/* ==========================================================
   Victor & Anne — Convite digital (Etapa 2)
   Paleta: off-white predominante · verde oliva · manteiga e rosé em detalhes
   ========================================================== */
:root {
  --paper: #FAF7F0;
  --paper-2: #F1ECDF;
  --olive: #5B6341;
  --olive-deep: #3F4730;
  --butter: #F0E2A8;
  --butter-soft: #F7EFCF;
  --rose: #D9B3A9;
  --ink: #2E3424;
  --ink-soft: #5E6551;
  --line: rgba(91, 99, 65, .22);

  --serif: "Playfair Display", "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --nav-h: 48px; /* altura útil da barra inferior (sem safe-area) */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 1rem; line-height: 1.6;
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
body.is-locked { overflow: hidden; height: 100%; }
img { max-width: 100%; display: block; }
h1, h2, p, address { margin: 0; }
address { font-style: normal; }
[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--olive); outline-offset: 4px; border-radius: 2px; }

/* ================= MONOGRAMA ================= */
.mono { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.mono img { width: 100%; height: auto; object-fit: contain; }
.mono-ph { display: none; }
.mono.is-missing img { display: none; }
.mono.is-missing .mono-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1; border-radius: 50%; border: 1px solid currentColor;
  font-family: var(--serif); font-style: italic; letter-spacing: .04em;
}
.mono-ph small { font-family: var(--sans); font-style: normal; font-size: .5rem; letter-spacing: .08em; margin-top: .3rem; opacity: .7; }

/* ================= ENVELOPE FECHADO (tela inteira) ================= */
.stage {
  position: fixed; inset: 0; z-index: 50; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 38%, #FCFAF5 0%, var(--paper) 55%, #F3EEE2 100%);
  transition: opacity .7s var(--ease), visibility 0s linear .7s;
}
.stage.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; }
.stage[hidden] { display: none; }

.envelope { position: absolute; inset: 0; animation: fadeIn 1.2s var(--ease) both; transition: transform 1.1s var(--ease); }
.stage.is-opening .envelope { transform: scale(1.012); }
.envelope::before { /* filete interno de papelaria, respeitando as safe areas */
  content: ""; position: absolute; pointer-events: none;
  inset: calc(var(--safe-t) + 14px) calc(var(--safe-r) + 14px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 14px);
  border: 1px solid rgba(91, 99, 65, .15);
}
.env-paper { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .1; pointer-events: none; }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 47%; filter: drop-shadow(0 5px 7px rgba(46, 52, 36, .09)); pointer-events: none; }
.env-flap > span { position: absolute; inset: 0; background: linear-gradient(180deg, #F4F0E4, #FBF9F3); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.env-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.env-lines polyline, .env-lines line { fill: none; stroke: var(--olive); stroke-opacity: .34; stroke-width: 1; vector-effect: non-scaling-stroke; }
.env-lines line { stroke-opacity: .14; }

/* Selo de cera — único ponto de destaque e única ação */
.seal {
  position: absolute; left: 50%; top: 47%; translate: -50% -50%;
  width: clamp(104px, min(30vw, 20vh), 160px); aspect-ratio: 1;
  padding: 0; border: 0; background: none; cursor: pointer; color: var(--olive-deep);
  transition: scale .35s var(--ease);
}
.seal-half { position: absolute; inset: 0; }
.seal-wax {
  position: absolute; inset: 0; border-radius: 51% 49% 52% 48% / 49% 52% 48% 51%;
  background: radial-gradient(circle at 35% 30%, #7A8458 0%, var(--olive) 45%, var(--olive-deep) 100%);
  box-shadow: 0 3px 8px rgba(46, 52, 36, .28), inset 0 0 0 1px rgba(250, 247, 240, .1);
}
.seal-disc {
  position: absolute; inset: 15%; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--butter-soft); padding: 11%;
  box-shadow: inset 0 1px 3px rgba(46, 52, 36, .28), 0 0 0 1px rgba(250, 247, 240, .22);
}
.seal-disc .mono { width: 100%; height: 100%; }
.seal-disc .mono.is-missing .mono-ph, .seal-disc .mono-ph { border: 0; font-size: clamp(.9rem, 4.2vw, 1.3rem); }
.seal-disc .mono-ph small { display: none; }
.seal-half--l { clip-path: polygon(0 0, 54% 0, 46% 28%, 56% 52%, 48% 100%, 0 100%); }
.seal-half--r { clip-path: polygon(53% 0, 100% 0, 100% 100%, 47% 100%, 55% 52%, 45% 28%); }
.seal:not(.is-breaking) .seal-half--r { clip-path: none; }
@media (hover: hover) { .seal:hover { scale: 1.04; } }
.seal:focus-visible { outline-offset: 10px; border-radius: 50%; }

/* Instrução: só aparece após ~8 s sem interação */
.stage-hint {
  position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 3rem); margin: 0;
  font-size: .68rem; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; text-align: center;
  color: var(--ink-soft); opacity: 0; transition: opacity 1.4s var(--ease); pointer-events: none;
}
.stage-hint.is-shown { opacity: .85; }
.stage.is-opening .stage-hint { opacity: 0; transition-duration: .3s; }

/* Ruptura do selo (~0,9s); a tela inteira segue em fade (total ~1,2s) */
.seal.is-breaking { pointer-events: none; animation: sealPress .2s var(--ease) forwards; }
.seal.is-breaking .seal-half--l { animation: sealL .75s var(--ease) .15s forwards; }
.seal.is-breaking .seal-half--r { animation: sealR .75s var(--ease) .15s forwards; }
@keyframes sealPress { to { scale: .94; } }
@keyframes sealL { to { transform: translate(-16%, 7%) rotate(-9deg); opacity: 0; } }
@keyframes sealR { to { transform: translate(16%, 4%) rotate(8deg); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ================= NAVEGAÇÃO ================= */
.nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  padding: 0 calc(var(--safe-r) + .25rem) var(--safe-b) calc(var(--safe-l) + .25rem);
  background: rgba(250, 247, 240, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .8s var(--ease) .3s, transform .8s var(--ease) .3s, visibility 0s linear .3s;
}
.nav.is-on { opacity: 1; visibility: visible; transform: none; }
.nav a {
  position: relative; flex: 1; min-height: var(--nav-h);
  display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: var(--ink-soft); transition: color .35s var(--ease);
}
.nav a::after {
  content: ""; position: absolute; left: 50%; bottom: 9px; width: 1.1rem; height: 1px; translate: -50% 0;
  background: var(--rose); opacity: 0; transition: opacity .35s var(--ease);
}
.nav a[aria-current="true"] { color: var(--olive-deep); }
.nav a[aria-current="true"]::after { opacity: 1; }
@media (hover: hover) { .nav a:hover { color: var(--olive-deep); } }

/* ================= CONVITE ================= */
.invite { opacity: 0; visibility: hidden; }
.invite.is-visible { opacity: 1; visibility: visible; transition: opacity .8s var(--ease); }

/* Primeira tela: editorial, muito espaço negativo */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: clamp(2rem, 6.5vh, 3.5rem);
  padding: calc(var(--safe-t) + 3rem) calc(var(--safe-r) + 1.5rem) calc(var(--safe-b) + var(--nav-h) + 3rem) calc(var(--safe-l) + 1.5rem);
}
.mono--hero { width: clamp(92px, 25vw, 122px); color: var(--olive); }
.mono--hero .mono-ph { font-size: 1.6rem; }
.names {
  font-family: var(--serif); font-weight: 400; color: var(--olive-deep);
  font-size: clamp(2.2rem, 10.4vw, 4rem); white-space: nowrap; line-height: 1.08; letter-spacing: .005em;
}
.amp { font-style: italic; color: var(--olive); padding: 0 .06em; }
.date-short { font-size: .74rem; letter-spacing: .46em; padding-left: .46em; font-weight: 500; color: var(--ink-soft); }

.hero-in { opacity: 0; transform: translateY(12px); }
.invite.is-visible .hero-in { animation: heroIn 1.2s var(--ease) calc(var(--d, 0s) + .3s) forwards; }
@keyframes heroIn { to { opacity: 1; transform: none; } }

.section {
  padding: clamp(3rem, 9vw, 4.5rem) calc(var(--safe-r) + 1.5rem) clamp(3rem, 9vw, 4.5rem) calc(var(--safe-l) + 1.5rem);
  position: relative;
  text-align: center; display: flex; flex-direction: column; align-items: center;
}
.h2 { font-family: var(--serif); font-weight: 400; color: var(--olive-deep); font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.2; margin-bottom: 1.75rem; }
.rule { display: block; width: 2.5rem; height: 2px; background: var(--butter); margin: 1.4rem 0; }

/* Mensagem */
.text-section { padding-top: 0; }
.invite-text { max-width: 28rem; display: flex; flex-direction: column; gap: 1.5rem; }
.invite-text p { font-family: var(--serif); font-size: clamp(1.1rem, 4.5vw, 1.35rem); line-height: 1.8; color: var(--ink); }

/* Confirmação — importante, sem parecer banner */
.rsvp { padding-top: clamp(2.5rem, 8vw, 3.5rem); }
.rsvp::before { display: none; }
.rsvp-frame {
  width: 100%; max-width: 30rem; padding: 3rem 1.5rem;
  border: 1px solid var(--olive); outline: 1px solid var(--line); outline-offset: 6px;
  display: flex; flex-direction: column; align-items: center;
}
.rsvp-title {
  font-family: var(--serif); font-weight: 400; text-transform: uppercase; color: var(--olive-deep);
  font-size: clamp(1.25rem, 5.6vw, 1.65rem); letter-spacing: .14em; padding-left: .14em; line-height: 1.4; margin-bottom: 1.1rem;
}
.rsvp-text { font-size: .9rem; max-width: 19rem; color: var(--ink-soft); margin-bottom: 2rem; }

/* Local */
.venue-date { font-size: .78rem; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; color: var(--ink-soft); }
.venue-time { font-family: var(--serif); font-size: 2.3rem; line-height: 1.2; color: var(--olive-deep); margin-top: .5rem; }
.venue-name { font-family: var(--serif); font-weight: 400; text-transform: uppercase; letter-spacing: .16em; padding-left: .16em; font-size: clamp(1.2rem, 5.2vw, 1.5rem); color: var(--olive-deep); margin-bottom: 1.25rem; }
.venue-address { font-size: .92rem; line-height: 1.9; color: var(--ink-soft); margin-bottom: 2.25rem; }

/* Contagem regressiva — editorial, integrada */
.countdown-section { padding-top: 0; padding-bottom: clamp(3rem, 9vw, 4rem); }
.cd-title { font-family: var(--sans); font-weight: 500; font-size: .7rem; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 1.75rem; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 28rem; }
.cd-unit { display: flex; flex-direction: column; align-items: center; gap: .65rem; padding: .25rem 0; }
.cd-unit + .cd-unit { border-left: 1px solid var(--line); }
.cd-num { font-family: var(--serif); font-size: clamp(1.8rem, 8.8vw, 2.6rem); line-height: 1; color: var(--olive-deep); font-variant-numeric: tabular-nums; }
.cd-label { font-size: .58rem; letter-spacing: .2em; padding-left: .2em; text-transform: uppercase; color: var(--ink-soft); }
.cd-message { font-family: var(--serif); font-style: italic; font-size: clamp(1.8rem, 8vw, 2.6rem); color: var(--olive-deep); }
.cd-message[hidden], .countdown[hidden] { display: none; }

/* Presentes */
.gifts { background: transparent; }
.gift-list { width: 100%; max-width: 36rem; margin-bottom: 2.25rem; }
.gift-empty { font-family: var(--serif); font-size: 1.1rem; color: var(--ink-soft); line-height: 1.7; }

/* Fotografias — composição editorial compacta */
.photos { padding-top: clamp(3rem, 9vw, 4.5rem); padding-bottom: clamp(2.5rem, 8vw, 3.5rem); }
.photo-grid { width: 100%; max-width: 30rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.photo { position: relative; overflow: hidden; background: var(--paper-2); border: 1px solid var(--line); border-radius: 2px; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: .75rem; font-size: .62rem; letter-spacing: .16em; color: var(--ink-soft); }
.photo.has-img .photo-ph { display: none; }
.photo--1 { grid-column: 1 / -1; aspect-ratio: 3 / 2; }
.photo--2 { aspect-ratio: 1; }
.photo--3 { aspect-ratio: 1; margin-top: 1.5rem; }

/* Rodapé */
.footer {
  padding: 2.5rem 1.5rem calc(var(--safe-b) + var(--nav-h) + 2.5rem); margin: 0 1.5rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1rem; border-top: 1px solid var(--line);
}
.mono--small { width: 64px; color: var(--olive); }
.mono--small .mono-ph { font-size: .85rem; }
.footer p { font-size: .7rem; letter-spacing: .24em; color: var(--ink-soft); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; width: 100%; max-width: 20rem; padding: .9rem 1.75rem;
  font-family: var(--sans); font-size: .74rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border-radius: 2px; border: 1px solid transparent;
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease);
}
.btn:active { transform: scale(.985); }
.btn--primary { background: var(--olive-deep); color: var(--paper); border-color: var(--olive-deep); }
.btn--outline { background: transparent; color: var(--olive-deep); border-color: var(--olive); }
.btn--light { background: var(--paper); color: var(--olive-deep); }
.btn--ghost { background: transparent; color: var(--paper); border-color: rgba(250, 247, 240, .55); }
.btn-stack { display: flex; flex-direction: column; gap: 1rem; width: 100%; align-items: center; }
@media (hover: hover) {
  .btn--primary:hover { background: var(--olive); border-color: var(--olive); }
  .btn--outline:hover { background: var(--olive-deep); color: var(--paper); border-color: var(--olive-deep); }
  .btn--light:hover { background: var(--butter); }
  .btn--ghost:hover { background: rgba(250, 247, 240, .12); border-color: var(--paper); }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + var(--nav-h) + 1rem); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: min(90vw, 24rem); padding: .9rem 1.4rem; border-radius: 2px;
  background: var(--olive-deep); color: var(--paper); font-size: .85rem; text-align: center;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Revelar ao rolar */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ================= TABLET / DESKTOP ================= */
@media (min-width: 700px) {
  :root { --nav-h: 0px; }
  .btn-stack { flex-direction: row; justify-content: center; }
  .btn-stack .btn { width: auto; min-width: 16rem; }
  .rsvp-frame { max-width: 40rem; padding: 3.5rem 2.5rem; }

  /* mesma navegação, em linha no topo */
  .nav { top: 0; bottom: auto; justify-content: center; gap: 3rem; padding: var(--safe-t) 1rem 0; border-top: 0; border-bottom: 1px solid var(--line); transform: translateY(-12px); }
  .nav a { flex: none; min-height: 52px; padding: 0 .25rem; font-size: .68rem; letter-spacing: .22em; }
  .nav a::after { bottom: 12px; }
  .hero { padding-top: calc(var(--safe-t) + 5rem); }
  #presenca, #local, #presentes { scroll-margin-top: 3.25rem; }

  .photo-grid { max-width: 40rem; grid-template-columns: 1.3fr 1fr; gap: 1.25rem; }
  .photo--1 { grid-column: 1; grid-row: 1 / span 2; width: 100%; aspect-ratio: auto; align-self: stretch; min-height: 20rem; }
  .photo--2 { grid-column: 2; aspect-ratio: 4 / 3; }
  .photo--3 { grid-column: 2; margin-top: 0; aspect-ratio: 4 / 3; }
}
@media (min-width: 1000px) {
  body { background: var(--paper-2); }
  .invite { max-width: 880px; margin: 0 auto; background: var(--paper); box-shadow: 0 0 80px rgba(46, 52, 36, .08); }
  .names { font-size: 4.2rem; }
}

/* ================= MOVIMENTO REDUZIDO ================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .stage { transition-duration: .3s !important; }
  .invite.is-visible { transition-duration: .3s !important; }
  .seal.is-breaking .seal-half { animation: none; opacity: 0; }
  .stage-hint { transition-duration: .3s !important; }
  .js .reveal, .hero-in { opacity: 1; transform: none; }
  .stage.is-opening .envelope { transform: none; }
}

/* ===== Etapa 4: refinamento da página aberta ===== */
/* filete curto marcando o início de cada "página" */
.rsvp::before, .venue::before, .gifts::before, .photos::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 2.5rem; height: 1px; translate: -50% 0; background: rgba(91, 99, 65, .4);
}

/* Seção de fotos desativada (photos.enabled = false): sem espaço reservado */
.photos[hidden] { display: none; }

/* ===== Cenário do Midori integrado ao fundo do hero ===== */
.hero { position: relative; overflow: hidden; }
.hero > :not(.hero-scene) { position: relative; z-index: 1; }
.hero-scene {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 0; display: block;
  height: min(62vh, 150vw); height: min(62svh, 150vw); pointer-events: none;
  opacity: 0;
}
.invite.is-visible .hero-scene { animation: fadeIn 1.8s var(--ease) 1s forwards; }
.hero-scene img {
  width: 100%; height: 100%; object-fit: cover; object-position: center bottom;
  /* suaviza apenas a borda inferior para não formar um corte seco ao rolar */
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 90%, transparent 100%);
}
