/* Nossa História — design system v2 "Atelier"
   Direção: diário de viagem de luxo. Papel quente com textura sutil, serifa
   expressiva (Playfair), vinho profundo + dourado como fio condutor,
   materiais em camadas (hairline + sombra dupla), movimento suave.
   Claro e escuro. */

:root {
  --wine: #6E2039;
  --wine-deep: #501428;
  --rose: #B0476A;
  --blush: #E8B4BF;
  --blush-soft: #F3D9DF;
  --gold: #C29A55;
  --gold-deep: #8C5A2B;

  --bg: #FAF4EC;
  --bg-tint: #F4E7E9;
  --card: #FFFFFF;
  --text: #2B161F;
  --text-soft: #8E7280;
  --line: #EFDFE3;
  --hairline: rgba(110, 32, 57, 0.10);

  --hero: linear-gradient(135deg, #6E2039 0%, #A8405F 58%, #C2738B 100%);
  --hero-deep: linear-gradient(150deg, #44101F 0%, #6E2039 70%, #8A3551 100%);
  --grad-warm: linear-gradient(120deg, var(--wine), var(--rose));

  --radius: 22px;
  --radius-sm: 14px;
  --radius-lg: 28px;

  /* Sombra em duas camadas: contato + ambiente (acabamento de produto). */
  --shadow-soft: 0 1px 2px rgba(80, 20, 40, 0.05), 0 10px 28px rgba(110, 32, 57, 0.07);
  --shadow: 0 2px 4px rgba(80, 20, 40, 0.07), 0 18px 44px rgba(110, 32, 57, 0.13);

  --sp-xs: 4px;
  --sp-s: 8px;
  --sp-m: 16px;
  --sp-l: 24px;
  --sp-xl: 32px;

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --tabbar-h: 64px;
  --ease-spring: cubic-bezier(0.22, 0.9, 0.28, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --wine: #DA92AA;
    --wine-deep: #C06384;
    --rose: #C98592;
    --blush: #8A4A5C;
    --blush-soft: #38202A;
    --gold: #D6B97E;
    --gold-deep: #D6B97E;
    --bg: #170D12;
    --bg-tint: #221219;
    --card: #271720;
    --text: #F6EBEF;
    --text-soft: #B294A1;
    --line: #3A2630;
    --hairline: rgba(218, 146, 170, 0.12);
    --hero: linear-gradient(135deg, #4A1828 0%, #7A2742 60%, #94405C 100%);
    --hero-deep: linear-gradient(150deg, #260A14 0%, #44101F 70%, #5C1F33 100%);
    --grad-warm: linear-gradient(120deg, #DA92AA, #C98592);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.35);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

/* Papel: lavagens de cor + grão fino (textura de produto impresso). */
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  background:
    radial-gradient(110% 52% at 50% -4%, var(--bg-tint) 0%, transparent 60%),
    radial-gradient(90% 40% at 100% 100%, color-mix(in srgb, var(--blush-soft) 55%, transparent) 0%, transparent 55%),
    var(--bg);
}
#app::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.028'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  #app::before { mix-blend-mode: screen; opacity: 0.25; }
}
#screen, .tabbar { position: relative; z-index: 2; }

/* Telas com rolagem + espaço para a tab bar e safe-area do iPhone */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  animation: fade 0.18s ease;
}
/* Entrada em cascata dos blocos (aplicada pelo router). */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* Feedback tátil de toque */
.tap { cursor: pointer; transition: transform 0.14s var(--ease-spring), opacity 0.14s ease, box-shadow 0.14s ease; }
.tap:active { transform: scale(0.975); opacity: 0.92; }

.screen-pad { padding: 0 var(--sp-m); }
.screen-top { padding-top: calc(env(safe-area-inset-top) + 10px); }

/* ── Tipografia ─────────────────────────────────────────────────────── */
.display { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; }
.serif-title { font-family: var(--serif); font-weight: 600; letter-spacing: -0.005em; }
.quote { font-family: var(--serif); font-style: italic; line-height: 1.55; letter-spacing: 0.002em; }
.muted { color: var(--text-soft); }
.center { text-align: center; }

/* Rótulo-joia: pequena legenda em caixa alta com respiro (marca da casa). */
.kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-deep); display: inline-flex; align-items: center; gap: 7px;
}
.kicker::before { content: ""; width: 18px; height: 1px; background: var(--gold); opacity: 0.8; }
.kicker.bare::before { display: none; }

/* Número/texto com gradiente da casa. */
.grad-text {
  background: var(--grad-warm);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; color: var(--text); }

/* ── Cabeçalho de tela ──────────────────────────────────────────────── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-s);
  padding: 8px var(--sp-m) 12px;
}
.nav-title { font-family: var(--serif); font-size: 27px; font-weight: 700; letter-spacing: -0.01em; }

/* ── Cartões: papel sobre papel ─────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: var(--sp-m);
  position: relative;
}
.card + .card { margin-top: var(--sp-m); }

/* Material de vidro (overlays sobre foto/mapa). */
.glass {
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: saturate(170%) blur(18px);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
  border: 1px solid color-mix(in srgb, var(--card) 55%, var(--hairline));
  box-shadow: var(--shadow-soft);
}

/* ── Botões ─────────────────────────────────────────────────────────── */
.btn {
  font: inherit; border: none; cursor: pointer; border-radius: 16px;
  padding: 14px 18px; font-weight: 600; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px;
  transition: transform 0.14s var(--ease-spring), opacity 0.14s ease, box-shadow 0.14s ease;
  color: var(--text); background: var(--bg-tint);
  min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--hero); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 26px rgba(110, 32, 57, 0.35);
  letter-spacing: 0.01em;
}
.btn-ghost { background: transparent; color: var(--wine); }
.btn-block { width: 100%; }
.btn-icon {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  background: var(--card); color: var(--wine);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-soft);
  min-height: 42px;
}
.btn-danger { color: #fff; background: linear-gradient(135deg, #A8333F, #C2554D); box-shadow: 0 8px 20px rgba(168, 51, 63, 0.3); }

/* ── Pílulas, chips e selos ─────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--wine) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--wine) 14%, transparent);
  color: var(--wine);
}
.pill-gold {
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border-color: color-mix(in srgb, var(--gold) 32%, transparent);
  color: var(--gold-deep);
}

/* Chips de filtro/abas internas. */
.chip {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--card); color: var(--text-soft);
  transition: all 0.16s var(--ease-spring);
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px;
}
.chip.on {
  background: var(--hero); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(110, 32, 57, 0.3);
}

/* Azulejo de ícone (ações, listas) — cada um pode levar a sua cor. */
.icon-tile {
  width: 42px; height: 42px; border-radius: 14px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--wine) 9%, transparent);
  color: var(--wine);
}

.stat { text-align: center; }
.stat-value {
  font-family: var(--serif); font-size: 24px; font-weight: 700;
  background: var(--grad-warm);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-soft); margin-top: 1px; }

/* ── Divisor com coração ────────────────────────────────────────────── */
.heart-divider { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--gold); }
.heart-divider::before, .heart-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 55%, transparent));
}
.heart-divider::after { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 55%, transparent), transparent); }

/* ── Adesivo de scrapbook (ilustrações do casal) ────────────────────── */
.art-sticker {
  background: #fff; padding: 10px; border-radius: 18px;
  box-shadow: var(--shadow); transform: rotate(-2.5deg);
  display: inline-block; line-height: 0;
}
.art-sticker img { width: 100%; border-radius: 10px; display: block; }
.art-sticker.tilt-r { transform: rotate(2deg); }

/* ── Estado vazio (composição em camadas) ───────────────────────────── */
.empty {
  text-align: center; padding: var(--sp-xl) var(--sp-l);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-art { position: relative; width: 120px; height: 120px; margin-bottom: 2px; }
.empty-art .ea-sq {
  position: absolute; inset: 12px; border-radius: 30px;
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  transform: rotate(-9deg);
}
.empty-art .ea-sq2 {
  position: absolute; inset: 12px; border-radius: 30px;
  background: color-mix(in srgb, var(--rose) 13%, transparent);
  transform: rotate(7deg);
}
.empty-art .empty-icon {
  position: absolute; inset: 16px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--hairline); box-shadow: var(--shadow-soft);
  display: grid; place-items: center; color: var(--wine);
}
/* compat: empty-icon antigo usado sozinho */
.empty > .empty-icon {
  width: 88px; height: 88px; border-radius: 50%;
  background: color-mix(in srgb, var(--blush) 35%, transparent);
  display: grid; place-items: center; color: var(--wine);
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  background: var(--hero); color: #fff; border-radius: var(--radius-lg);
  padding: var(--sp-l); box-shadow: var(--shadow);
  position: relative; overflow: hidden; isolation: isolate;
}
/* Aurora viva dentro do hero (luz que respira). */
.hero.aurora::before {
  content: ""; position: absolute; inset: -40%; z-index: -1;
  background:
    radial-gradient(42% 38% at 22% 28%, rgba(255, 214, 224, 0.32) 0%, transparent 70%),
    radial-gradient(46% 42% at 82% 16%, rgba(194, 154, 85, 0.36) 0%, transparent 70%),
    radial-gradient(50% 46% at 68% 88%, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
  animation: aurora 9s ease-in-out infinite alternate;
}
@keyframes aurora {
  from { transform: translate3d(-3%, -2%, 0) rotate(0deg); }
  to { transform: translate3d(3%, 3%, 0) rotate(4deg); }
}
.hero::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ── Avatar ─────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-family: var(--serif); font-weight: 600; overflow: hidden;
  background-size: cover; background-position: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gold) 65%, transparent), 0 4px 10px rgba(80, 20, 40, 0.18);
}

/* ── Grid de mídia ──────────────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-cell {
  aspect-ratio: 1; border-radius: 12px; overflow: hidden; position: relative;
  background: var(--bg-tint); cursor: pointer;
}
.media-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Esqueleto com brilho (carregamento de fotos). */
.skeleton {
  background: linear-gradient(100deg,
    var(--bg-tint) 38%,
    color-mix(in srgb, var(--card) 65%, var(--bg-tint)) 50%,
    var(--bg-tint) 62%);
  background-size: 220% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 130% 0 } to { background-position: -90% 0 } }
img.fade-img { opacity: 0; transition: opacity 0.4s ease; }
img.fade-img.in { opacity: 1; }

/* ── FAB ────────────────────────────────────────────────────────────── */
.fab {
  position: fixed; right: max(16px, calc(50% - 260px + 16px));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  width: 58px; height: 58px; border-radius: 50%; border: none;
  background: var(--hero); color: #fff; font-size: 24px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 28px rgba(110, 32, 57, 0.42);
  z-index: 40; display: grid; place-items: center;
}

/* ── Tab bar (vidro + pílula ativa) ─────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 520px; margin: 0 auto;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--hairline);
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer; color: var(--text-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 600; font-family: var(--sans);
  transition: color 0.18s ease;
}
.tab .ico {
  font-size: 22px; line-height: 1;
  display: grid; place-items: center;
  padding: 4px 16px; border-radius: 999px;
  transition: background 0.22s var(--ease-spring), transform 0.22s var(--ease-spring);
}
.tab.active { color: var(--wine); }
.tab.active .ico {
  background: color-mix(in srgb, var(--wine) 11%, transparent);
  transform: translateY(-1px);
}

/* ── Inputs ─────────────────────────────────────────────────────────── */
input[type=text], input[type=date], input[type=search], textarea, select {
  font: inherit; width: 100%; padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  outline: none; transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: color-mix(in srgb, var(--wine) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wine) 12%, transparent);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-soft); margin-bottom: 7px;
}

/* ── Sheets / modais ────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(26, 8, 16, 0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.2s ease;
}
.sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 28px 28px 0 0;
  padding: 10px var(--sp-m) calc(env(safe-area-inset-bottom) + 24px);
  animation: rise 0.32s var(--ease-spring);
  box-shadow: 0 -12px 40px rgba(26, 8, 16, 0.25);
}
.sheet-grip {
  width: 42px; height: 5px; border-radius: 3px;
  background: color-mix(in srgb, var(--text-soft) 35%, transparent);
  margin: 6px auto 14px;
}
.sheet-fs {
  position: fixed; inset: 0; z-index: 100; background: #000;
  animation: fade 0.2s ease; overflow: hidden;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(48px); opacity: 0.5 } to { transform: translateY(0); opacity: 1 } }
@keyframes pop { from { transform: scale(0.85); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes floatUp { to { transform: translateY(-120px); opacity: 0 } }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--wine) 22%, transparent);
  border-top-color: var(--wine); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Utilitários de layout ──────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--sp-m); }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-s { gap: var(--sp-s); }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: var(--sp-m); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Leaflet / mapa ─────────────────────────────────────────────────── */
.leaflet-container { background: var(--bg) !important; font-family: var(--sans); }
.place-pin {
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gold) 70%, transparent), 0 4px 12px rgba(0, 0, 0, 0.35);
  background: var(--hero);
  display: grid; place-items: center; color: #fff;
}
.place-pin img { width: 100%; height: 100%; object-fit: cover; }
