/* Convite Mariana Borges · 15 anos — azul-noite e dourado
   Telas cheias empilhadas; cada troca de tela é uma transição, e cada
   elemento entra no seu tempo (--d). */
:root {
  color-scheme: dark;
  --navy: #06102a;
  --cream: #f1e8d8;
  --gold-1: #fbefd2;
  --gold-2: #e6c896;
  --gold-3: #c49c62;
  --gold: #dcbd8a;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--navy);
  color: var(--cream);
  font-family: 'Cormorant Garamond', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 1px dashed var(--gold); outline-offset: 4px; }

/* ---------- telas ---------- */
#convite { position: fixed; inset: 0; touch-action: none; }
.page {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  overflow: hidden;
  visibility: hidden;
}
.page.active { visibility: visible; z-index: 2; }
.page.leaving { visibility: visible; z-index: 1; }

/* entrada: abre em círculo a partir do centro, com um anel de luz */
.page.entering { animation: iris 1.25s var(--ease-io) both; }
.page.leaving .stage { animation: recede 1.25s var(--ease-io) both; }
.page.back.entering { animation-name: iris-back; }
@keyframes iris { from { clip-path: circle(0% at 50% 55%); } to { clip-path: circle(140% at 50% 55%); } }
@keyframes iris-back { from { clip-path: circle(0% at 50% 45%); } to { clip-path: circle(140% at 50% 45%); } }
@keyframes recede { to { transform: scale(.92); filter: brightness(.35) blur(3px); } }

.flash {
  position: fixed; left: 50%; top: 55%; z-index: 5; pointer-events: none;
  width: 10vmax; height: 10vmax; margin: -5vmax 0 0 -5vmax; border-radius: 50%;
  border: 2px solid rgba(251, 239, 210, .9);
  box-shadow: 0 0 40px 10px rgba(230, 200, 150, .55), inset 0 0 40px 6px rgba(230, 200, 150, .35);
  animation: ring 1.25s var(--ease-io) forwards;
}
@keyframes ring { 0% { transform: scale(0); opacity: 1; } 80% { opacity: .7; } 100% { transform: scale(16); opacity: 0; } }

/* fundo em tela cheia (sem bordas); o conteúdo fica numa coluna com a
   proporção da arte original (336 × 763), centralizada */
.stage { position: absolute; inset: 0; overflow: hidden; }
.col {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  height: min(100%, calc(100vw * 763 / 336));
  aspect-ratio: 336 / 763;
  transform: translate(-50%, -50%);
  container-type: size;
}
.bg {
  position: absolute; inset: -3%;
  background: var(--bg) center / cover no-repeat;
  transform: scale(1.18) translate(var(--px, 0), var(--py, 0));
  transition: transform 12s cubic-bezier(.2, .6, .2, 1);
}
.in .bg { transform: scale(1.02) translate(var(--px, 0), var(--py, 0)); }
.stage::after { /* vinheta */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 85% 70% at 50% 50%, transparent 55%, rgba(3, 8, 24, .55));
}

/* ---------- tipografia ---------- */
.at {
  position: absolute; left: 0; right: 0;
  transform: translateY(-50%);
  display: flex; justify-content: center;
  text-align: center;
  z-index: 3;
}
.caps {
  font-family: 'Cinzel', serif; font-weight: 400;
  text-transform: uppercase; letter-spacing: .24em;
  padding-left: .24em;
}
.serif { font-weight: 400; }
.serif-it { font-style: italic; }
.script { font-family: 'Pinyon Script', cursive; font-weight: 400; padding: .12em .35em; }
.cream { color: var(--cream); text-shadow: 0 1px 12px rgba(0, 0, 0, .6); }
.gold-solid { color: var(--gold-2); text-shadow: 0 1px 12px rgba(0, 0, 0, .6); }
.gold {
  background: linear-gradient(100deg, var(--gold-3) 0%, var(--gold-2) 30%, #fffaf0 47%, var(--gold-2) 62%, var(--gold-3) 100%);
  background-size: 300% 100%; background-position: 15% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.glow { filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .5)) drop-shadow(0 0 0 rgba(240, 210, 150, 0)); }
.big { font-weight: 400; letter-spacing: -.02em; }
.addr { text-decoration: none; }

/* divisória ── ✦ ── */
.divider { display: flex; align-items: center; gap: 2.4cqw; width: 46cqw; }
.divider span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.divider span:last-child { background: linear-gradient(270deg, transparent, var(--gold)); }
.divider i { width: 3.4cqw; height: 3.4cqw; background: var(--gold-1);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 4px #fff3d0); }
.divider.thin { width: 40cqw; }
.divider.thin i { width: 1.6cqw; height: 1.6cqw; border-radius: 50%; clip-path: none; }

/* ícones */
.heart svg, .pin svg, .icon svg {
  display: block; fill: none; stroke: var(--gold); stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round; overflow: visible;
}
.heart svg { width: 6.6cqw; }
.big-heart svg { width: 9cqw; }
.pin svg { width: 6.2cqw; }
.icon svg { width: 7.8cqw; }
.heart path { stroke-dasharray: 1; stroke-dashoffset: 1; }

/* QR code */
.qr {
  display: block; position: relative; width: 31cqw; aspect-ratio: 1;
  padding: 3cqw; background: #f8f4ec; border-radius: 1cqw;
  outline: 1px solid var(--gold); outline-offset: 1.6cqw;
  box-shadow: 0 1.4cqw 5cqw rgba(0, 0, 0, .5);
  overflow: visible;
}
.qr img { display: block; width: 100%; height: 100%; }
.qr .scan {
  position: absolute; left: 6%; right: 6%; top: 8%; height: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, #e6c896, transparent);
  box-shadow: 0 0 10px 2px rgba(230, 200, 150, .8);
}

/* botões */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 3cqw;
  border-radius: 999px; text-decoration: none; white-space: nowrap;
  position: relative; overflow: hidden;
}
.gold-pill {
  width: 59cqw; height: 10.6cqw;
  background: linear-gradient(180deg, #ecd6ae, #cfac77);
  color: #13203f; font-size: 5cqw; font-weight: 500;
  box-shadow: 0 1cqw 4cqw rgba(0, 0, 0, .45);
}
.gold-pill svg { width: 5cqw; fill: none; stroke: #13203f; stroke-width: 2; stroke-linecap: round; }
.ghost {
  padding: 2.4cqw 6cqw; border: 1px solid var(--gold);
  font-family: 'Cinzel', serif; font-size: 3.2cqw; letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold-1); background: rgba(6, 16, 42, .5);
  transition: background .3s, color .3s;
}
.ghost:hover { background: var(--gold-2); color: #13203f; }
.pill::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .6), transparent);
  transform: skewX(-20deg);
}

/* contagem regressiva */
.count { display: flex; gap: 2.4cqw; }
.count div {
  width: 14cqw; padding: 1.6cqw 0 1.2cqw;
  border: 1px solid rgba(220, 189, 138, .55); border-radius: 1.4cqw;
  background: rgba(6, 16, 42, .55); backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; gap: .4cqw;
}
.count b { font-family: 'Cinzel', serif; font-weight: 500; font-size: 6cqw; line-height: 1; color: var(--gold-1);
  font-variant-numeric: tabular-nums; }
.count span { font-family: 'Cinzel', serif; font-size: 2.2cqw; letter-spacing: .18em; text-transform: uppercase; color: var(--cream); }
.count b.tick { animation: tick .5s var(--ease); }
@keyframes tick { from { transform: translateY(-30%); opacity: .2; } to { transform: none; opacity: 1; } }

/* traços caligráficos do "15" */
.draw { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.swash { fill: none; stroke: var(--gold-2); stroke-width: 1.1; stroke-linecap: round;
  stroke-dasharray: 120; stroke-dashoffset: 120; filter: drop-shadow(0 0 2px rgba(255, 236, 190, .8)); }

/* brilhos pontuais (tiara, lustres, luzes) */
.twinkles { position: absolute; inset: 0; z-index: 2; pointer-events: none; container-type: size; }
.twinkles i {
  position: absolute; width: 5cqw; height: 5cqw; margin: -2.5cqw 0 0 -2.5cqw;
  background: radial-gradient(circle, #fff 0 8%, rgba(255, 244, 214, .9) 14%, transparent 60%);
  clip-path: polygon(50% 0, 56% 44%, 100% 50%, 56% 56%, 50% 100%, 44% 56%, 0 50%, 44% 44%);
  opacity: 0; transform: scale(.2) rotate(0deg);
}
.twinkles.warm i { background: radial-gradient(circle, #fff 0 8%, rgba(255, 210, 140, .9) 14%, transparent 60%); }

/* poeira dourada em canvas, sobre tudo */
#glitter { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }

/* barra de progresso no topo */
.progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 8; background: rgba(220, 189, 138, .15); }
.progress i { display: block; height: 100%; width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, var(--gold-3), var(--gold-1)); box-shadow: 0 0 8px var(--gold-2);
}

/* dica de rolagem */
.hint {
  position: fixed; left: 50%; bottom: max(2.2%, env(safe-area-inset-bottom, 0px)); z-index: 7;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--gold-1); opacity: 0; transition: opacity .6s;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .3em; text-transform: uppercase;
  pointer-events: none;
}
.hint svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; animation: bob 2s ease-in-out infinite; }
.hint.show { opacity: .85; pointer-events: auto; }
.hint.up svg { transform: rotate(180deg); animation: none; }
body[data-page="confirmacao"] .hint { bottom: 5.5%; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- ABERTURA (selo + portas) ---------- */
#intro { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; cursor: pointer; }
.door {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  background: url(img/bg1.jpg) center 70% / cover no-repeat, var(--navy);
  filter: brightness(.55) saturate(1.1);
  transition: transform 1.8s var(--ease-io), filter 1.8s;
}
.door.left { left: 0; background-position: 30% 70%; box-shadow: inset -30px 0 40px -20px rgba(0, 0, 0, .8); }
.door.right { right: 0; background-position: 70% 70%; transform-origin: right; box-shadow: inset 30px 0 40px -20px rgba(0, 0, 0, .8); }
.door::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: linear-gradient(transparent, var(--gold), transparent); }
.door.left::after { right: 0; }
.door.right::after { left: 0; }
.seal {
  position: relative; z-index: 2; width: min(46vw, 210px); aspect-ratio: 1;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1c3577, #0a1838 60%, #050c22);
  box-shadow: 0 0 0 1px rgba(220, 189, 138, .6), 0 20px 60px rgba(0, 0, 0, .7), 0 0 60px rgba(230, 200, 150, .25);
  animation: sealIn 1.4s var(--ease) both, breathe 3s ease-in-out 1.4s infinite;
  transition: transform 1s var(--ease-io), opacity .8s;
}
.ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin360 30s linear infinite; }
.ring .r1, .ring .r2 { fill: none; stroke: var(--gold); stroke-width: .8; }
.ring text { fill: var(--gold-2); font-family: 'Cinzel', serif; font-size: 10.5px; letter-spacing: 2.6px; }
.mono {
  font-family: 'Pinyon Script', cursive; font-size: min(17vw, 78px); line-height: 1; padding: .1em .2em 0;
  background: linear-gradient(120deg, var(--gold-3), var(--gold-1) 45%, var(--gold-2) 60%, var(--gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tap {
  position: absolute; bottom: 14%; z-index: 2;
  font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .4em; text-transform: uppercase; color: var(--gold-1);
  animation: fadeinout 2.4s ease-in-out 1.2s infinite both;
}
#intro.open { pointer-events: none; }
#intro.open .door.left { transform: translateX(-102%); filter: brightness(.25); }
#intro.open .door.right { transform: translateX(102%); filter: brightness(.25); }
#intro.open .seal { transform: scale(1.6); opacity: 0; animation: none; }
#intro.open .tap { opacity: 0; animation: none; transition: opacity .3s; }
#intro.gone { display: none; }
@keyframes sealIn { from { transform: scale(.3) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 1px rgba(220, 189, 138, .6), 0 20px 60px rgba(0, 0, 0, .7), 0 0 50px rgba(230, 200, 150, .2); }
  50% { box-shadow: 0 0 0 1px rgba(220, 189, 138, .9), 0 20px 60px rgba(0, 0, 0, .7), 0 0 90px rgba(230, 200, 150, .45); } }
@keyframes spin360 { to { transform: rotate(360deg); } }
@keyframes fadeinout { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ---------- animações elemento a elemento ---------- */
.a { opacity: 0; }
.chars { opacity: 1; }                 /* quem anima são as letras */
.chars .ch { display: inline-block; opacity: 0; white-space: pre; }
.lines { opacity: 1; }
.lines .ln { display: inline-block; opacity: 0; }

.in .up    { animation: up 1.1s var(--ease) var(--d) both; }
.in .zoom  { animation: zoom 1.5s var(--ease) var(--d) both; }
.in .pop   { animation: pop 1s var(--ease) var(--d) both; }
.in .write { animation: write 2s cubic-bezier(.5, .1, .3, 1) var(--d) both; }
.in .chars .ch { animation: letter .9s var(--ease) calc(var(--d) + var(--i) * 45ms) both; }
.in .lines .ln { animation: up 1.2s var(--ease) calc(var(--d) + var(--i) * 160ms) both; }
.in .divider { animation: show .2s linear var(--d) both; }
.in .divider span { animation: grow 1.2s var(--ease) var(--d) both; }
.in .divider span:first-child { transform-origin: right; }
.in .divider span:last-child { transform-origin: left; }
.in .divider i { animation: spinIn 1.2s var(--ease) var(--d) both, twinkle 2.6s ease-in-out calc(var(--d) + 1.4s) infinite; }
.in .heart, .in .pin, .in .icon { animation: pop .9s var(--ease) var(--d) both; }
.in .heart path { animation: stroke 1.6s ease var(--d) forwards; }
.in .heart svg { animation: beat 1.9s ease-in-out calc(var(--d) + 1.6s) infinite; }
.in .pin svg { animation: drop 1.1s cubic-bezier(.3, 1.6, .5, 1) var(--d) both; }
.in .swash { animation: drawline 1.6s var(--ease) var(--d) forwards; }
.in .gold.write { animation: write 2s cubic-bezier(.5, .1, .3, 1) var(--d) both, shimmer 4s ease-in-out calc(var(--d) + 1.6s) infinite; }
.in .gold.zoom  { animation: zoom 1.5s var(--ease) var(--d) both, shimmer 4s ease-in-out calc(var(--d) + 1.2s) infinite; }
.in .pill::after { animation: sweep 3.6s ease-in-out calc(var(--d) + 1.2s) infinite; }
.in .qr .scan { animation: scan 2.4s ease-in-out calc(var(--d) + 1s) infinite; }
.in .twinkles i { animation: star var(--t) ease-in-out var(--w) infinite; }

/* saída: os elementos sobem e somem um a um antes da troca de tela */
.page.out .at { animation: out .7s var(--ease-io) calc(var(--o, 0) * 55ms) forwards; }
@keyframes out { to { opacity: 0; transform: translateY(calc(-50% - 4cqw)); filter: blur(8px); } }

/* tela do local: a fachada fica embaixo, sem deslizar o enquadramento */
#local .bg { background-position: 50% 100%; transform-origin: 50% 80%; }
#local.in .bg { animation: none; }

/* fundo sempre em movimento lento */
.in .bg { animation: drift 16s ease-in-out 2s infinite alternate; }
@keyframes drift { from { background-position: 50% 50%; } to { background-position: 46% 54%; } }

@keyframes up     { from { opacity: 0; transform: translateY(5cqw); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes letter { from { opacity: 0; transform: translateY(.7em) rotate(8deg); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes zoom   { from { opacity: 0; transform: scale(.6); filter: blur(12px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes pop    { 0% { opacity: 0; transform: scale(.4); } 65% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes write  { from { opacity: 1; clip-path: inset(-30% 100% -30% 0); } to { opacity: 1; clip-path: inset(-30% -5% -30% 0); } }
@keyframes show   { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow   { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spinIn { from { transform: rotate(-270deg) scale(0); } to { transform: none; } }
@keyframes twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5) rotate(45deg); opacity: .7; } }
@keyframes stroke { to { stroke-dashoffset: 0; } }
@keyframes beat   { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.2); } 28% { transform: scale(1); } 42% { transform: scale(1.12); } }
@keyframes drop   { from { transform: translateY(-9cqw); } to { transform: none; } }
@keyframes drawline { to { stroke-dashoffset: 0; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0 0; } }
@keyframes sweep  { 0% { left: -60%; } 45%, 100% { left: 130%; } }
@keyframes scan   { 0% { top: 8%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 90%; opacity: 0; } }
@keyframes star   { 0%, 70%, 100% { opacity: 0; transform: scale(.2) rotate(0deg); } 82% { opacity: 1; transform: scale(1) rotate(45deg); } }

@media (prefers-reduced-motion: reduce) {
  .a, .chars .ch, .lines .ln { opacity: 1 !important; animation: none !important; clip-path: none !important; }
  .page.entering, .page.leaving .stage, .flash { animation: none !important; }
  .bg { transform: none !important; transition: none; }
  .swash { stroke-dashoffset: 0; }
  .heart path { stroke-dashoffset: 0; }
  #glitter, .twinkles { display: none; }
}
