/* Protótipo de rolagem — convite bordado.
 * Cada .cena é alta (--h em vh); o .palco fica preso na tela enquanto ela rola,
 * e o JS transforma o conteúdo de acordo com o progresso (0 → 1) da cena.
 * Só transform/opacity/clip-path/stroke-dashoffset mudam durante a rolagem. */

:root {
  --creme: #F6F2E9;
  --oliva: #4A4826;
  --musgo: #858248;
  --linha: #8a7440;      /* cor do fio dourado-oliva */
  --tinta: #4a4238;
  --serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --script: "Pinyon Script", "Brush Script MT", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--tinta);
  font-family: var(--serif);
  background-color: var(--creme);
  background-image: url("img/algodao.webp");
  background-size: 600px 600px;
  background-blend-mode: multiply;
  overflow-x: clip;
}
img { display: block; max-width: none; user-select: none; -webkit-user-drag: none; }

/* ---------- estrutura das cenas ---------- */
.cena { position: relative; height: calc(var(--h, 250) * 1vh); }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 100%;   /* a grade tem sempre o tamanho da tela: */
  grid-template-rows: 100%;      /* imagens maiores transbordam sem deslocar o resto */
  place-items: center;
}
.palco > * { grid-area: 1 / 1; }
[data-anim] { will-change: transform, opacity; }

/* ---------- tipografia ---------- */
.sobre {
  margin: 0 0 .6em;
  font-size: clamp(.72rem, 1.6vmin, .95rem);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--musgo);
}
.sobre.claro { color: #d9d4b4; }
.script {
  margin: 0 0 .35em;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(2.2rem, 7vmin, 4.2rem);
  line-height: 1.1;
  color: var(--oliva);
}
.botao {
  display: inline-block;
  margin-top: 1.2em;
  padding: .7em 1.6em;
  border: 1px dashed var(--linha);
  border-radius: 999px;
  color: var(--oliva);
  text-decoration: none;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: .78rem;
  background: rgba(246, 242, 233, .6);
}
.botao.inativo { opacity: .6; }

/* ---------- traços "bordados" (SVG) ----------
   .ponto = pesponto visível (tracejado como pontos de linha);
   .revela = traço branco dentro de uma <mask>, desenhado pelo JS
   (stroke-dashoffset) para o pesponto ir aparecendo. */
.ponto {
  fill: none;
  stroke: var(--linha);
  stroke-width: 3;
  stroke-dasharray: 11 7;
  stroke-linecap: round;
}
mask .revela { fill: none; stroke: #fff; stroke-width: 26; }
mask text.revela, mask .revela text { fill: #fff; fill-opacity: 0; stroke-width: 18; }
.bordado text {
  font-family: var(--script);
  text-anchor: middle;
}
.bordado .linha text {
  fill: var(--linha);
  fill-opacity: 0;
  stroke: var(--linha);
  stroke-width: 2.4;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
}
/* relevo do fio: luz de cima, sombra embaixo */
.bordado, .c-fio, .ce-pesponto, .d-fio {
  overflow: visible;
  filter: drop-shadow(0 -0.5px 0 rgba(255, 255, 255, .55)) drop-shadow(0 1.5px 1px rgba(60, 48, 25, .35));
}

/* ---------- fio condutor (progresso da página) ---------- */
.fio-condutor {
  position: fixed;
  z-index: 50;
  left: clamp(8px, 2vw, 22px);
  top: 12vh;
  bottom: 12vh;
  width: 2px;
  background: repeating-linear-gradient(to bottom, rgba(138, 116, 64, .22) 0 8px, transparent 8px 14px);
  pointer-events: none;
}
.fio-condutor span {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, var(--linha) 0 8px, transparent 8px 14px);
  transform-origin: top;
  transform: scaleY(0);
}

/* ---------- 1. palco ---------- */
.p-cortina { height: min(94svh, 150vw); width: auto; z-index: 3; transform-origin: 50% 50%; }
.p-miolo {
  z-index: 2;
  width: min(62vw, 46svh);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6svh;
}
.p-palmeiras { width: 72%; height: auto; }
.p-nomes { width: 100%; height: auto; margin-top: -2%; }
.p-nomes text { font-size: 190px; }
.p-nomes .p-amp { font-family: var(--serif); font-style: italic; font-size: 64px; fill: var(--musgo); opacity: 0; }
.p-data {
  margin: .4em 0 0;
  letter-spacing: .34em;
  font-size: clamp(.7rem, 1.7vmin, .95rem);
  color: var(--musgo);
  opacity: 0;
}
/* convite para rolar: aro bordado com a seta costurada descendo */
.dica-rolar {
  align-self: end;
  z-index: 6;
  margin-bottom: calc(3svh + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .7rem;
  opacity: 0;
  pointer-events: none;
}
.dica-rolar.mostrar { animation: dica-entra 1s .35s cubic-bezier(.2, .8, .2, 1) both; }
.dica-texto {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .55rem 1.3rem;
  border-radius: 999px;
  background: rgba(246, 242, 233, .88);
  box-shadow: 0 4px 18px rgba(74, 72, 38, .16);
}
.dica-acao {
  font-size: clamp(.82rem, 2.1vmin, 1rem);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--oliva);
  font-weight: 500;
}
.dica-sub { font-family: var(--script); font-size: clamp(1.25rem, 3.4vmin, 1.7rem); color: var(--linha); line-height: 1.1; }
.dica-aro {
  width: clamp(54px, 8vmin, 72px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(246, 242, 233, .92);
  box-shadow: 0 6px 20px rgba(74, 72, 38, .22);
  animation: dica-pulso 2.2s ease-in-out infinite;
}
.dica-aro svg { width: 100%; height: 100%; overflow: visible; }
.dica-circulo {
  fill: none;
  stroke: var(--linha);
  stroke-width: 2.2;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  transform-origin: 32px 32px;
  animation: dica-gira 9s linear infinite;
}
.dica-seta {
  fill: none;
  stroke: var(--oliva);
  stroke-width: 3;
  stroke-dasharray: 4.5 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: dica-desce 1.6s cubic-bezier(.45, 0, .25, 1) infinite;
}
@keyframes dica-entra { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes dica-pulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes dica-gira { to { transform: rotate(360deg); } }
@keyframes dica-desce { 0% { transform: translateY(-7px); opacity: 0; } 25% { opacity: 1; } 75% { opacity: 1; } 100% { transform: translateY(9px); opacity: 0; } }

/* ---------- 2. contagem ---------- */
.c-fio { width: 110vw; height: 70svh; z-index: 1; }
.c-aneis { width: min(46vmin, 360px); height: auto; z-index: 2; place-self: start end; margin: 8svh 6vw 0 0; }
.c-texto { z-index: 3; text-align: center; padding: 0 6vw; place-self: start center; margin-top: 65svh; }
.c-relogio { display: flex; gap: clamp(.8rem, 4vw, 3rem); justify-content: center; }
.c-relogio > div { display: flex; flex-direction: column; align-items: center; }
.c-relogio span {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 9vmin, 5.5rem);
  line-height: 1;
  color: var(--oliva);
  font-variant-numeric: tabular-nums;
}
.c-relogio small { letter-spacing: .25em; text-transform: uppercase; font-size: .68rem; color: var(--musgo); }

/* ---------- 3. famílias (gota de tinta) ----------
   A mancha é o verde-oliva com a mesma trama de algodão por cima
   (versão neutra do tecido em soft-light), recortada pela forma img/mancha.webp; o JS aumenta
   o mask-size conforme a rolagem, a partir do ponto onde a gota cai. */
.f-mancha {
  width: 100%;
  height: 100%;
  background-color: #4A4826;
  background-image: url("img/tecido-neutro.webp");   /* trama neutra: clareia fios, escurece frestas */
  background-size: 600px 600px;
  background-blend-mode: soft-light;
  -webkit-mask-image: url("img/mancha.webp");
          mask-image: url("img/mancha.webp");
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 50% 50%;
          mask-position: 50% 50%;
  -webkit-mask-size: 0 0;
          mask-size: 0 0;
}
.f-gota { width: clamp(22px, 3.2vmin, 34px); height: auto; z-index: 3; opacity: 0;
  filter: drop-shadow(0 4px 4px rgba(40, 35, 10, .3)); }
.f-respingos { width: 0; height: 0; z-index: 2; }
.f-respingos i {
  position: absolute;
  left: 0; top: 0;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #4A4826;
  opacity: 0;
}
.f-flor { width: min(58vmin, 520px); height: auto; place-self: start start; transform-origin: 0 0; z-index: 4; opacity: 0; }
.f-texto { text-align: center; padding: 0 8vw; color: #efe9d6; max-width: 900px; z-index: 4; }
.f-texto .script { color: #f3eedd; }
.f-pais { margin: .3em 0; font-size: clamp(1rem, 2.6vmin, 1.35rem); }

/* ---------- 4. cerimônia ---------- */
.ce-casa { width: min(92vw, 120svh); height: auto; place-self: end center; margin-bottom: -2svh; z-index: 1; clip-path: inset(100% 0 0 0); }
.ce-cartao {
  position: relative;
  z-index: 2;
  width: min(86vw, 400px);
  padding: 2.4rem 2rem 2rem;
  text-align: center;
  background: rgba(246, 242, 233, .9);
  border-radius: 16px;
  place-self: start center;
  margin-top: 7svh;
}
.ce-pesponto { position: absolute; inset: 0; width: 100%; height: 100%; }
.ce-local { font-size: 1.08rem; line-height: 1.45; }
.ce-horas { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; justify-content: center; gap: 1.2rem; flex-wrap: wrap; }
.ce-horas b { display: block; font-size: 1.3rem; color: var(--oliva); }

/* ---------- 5. o dia (lateral) ---------- */
.d-trilho {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6vw;
  padding: 0 10vw;
  height: 100%;
  place-self: stretch start;
  width: max-content;
}
.d-fio { position: absolute; left: 0; top: 50%; width: 100%; height: 12svh; transform: translateY(-50%); z-index: 0; }
.d-painel {
  position: relative;
  z-index: 1;
  width: min(78vw, 440px);
  text-align: center;
  font-size: 1.15rem;
}
.d-painel img { width: 100%; height: auto; margin: 0 auto .6rem; }
.d-painel p { margin: .2em 0; }
.d-hora { font-size: clamp(2rem, 6vmin, 3.2rem); color: var(--oliva); letter-spacing: .05em; }
.d-intro { text-align: left; }
.d-seta { font-size: 2rem; color: var(--musgo); }

/* ---------- 6. traje / presentes ---------- */
.t-copo { height: 100svh; width: auto; place-self: end end; margin-right: 0; clip-path: inset(100% 0 0 0); z-index: 1; }
.t-textos { z-index: 2; width: min(84vw, 560px); display: grid; place-self: center start; margin-left: 10vw; }
.t-bloco { grid-area: 1 / 1; }
.t-traje .script { font-size: clamp(2.8rem, 10vmin, 5.6rem); }
.t-presentes { opacity: 0; }
.t-copos { width: min(42vmin, 300px); height: auto; margin-bottom: .6rem; }
.t-par { font-size: clamp(1.05rem, 2.5vmin, 1.3rem); line-height: 1.5; }

/* ---------- 7. perguntas (rolagem normal) ---------- */
.faq { max-width: 720px; margin: 0 auto; padding: 22vh 8vw; text-align: center; }
.faq details {
  text-align: left;
  border-bottom: 1px dashed var(--linha);
  padding: 1.1rem .2rem;
  font-size: 1.15rem;
}
.faq summary { cursor: pointer; color: var(--oliva); }
.surge { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.surge.visivel { opacity: 1; transform: none; }

/* ---------- 8. confirmação ---------- */
.r-envelope { position: relative; width: min(70vmin, 520px); z-index: 1; place-self: center; margin-top: -18svh; }
.r-flores { width: 100%; height: auto; }
.r-selo { position: absolute; width: 34%; height: auto; left: 50%; top: 50%; opacity: 0;
  filter: drop-shadow(0 6px 10px rgba(40, 30, 10, .35)); }
.r-texto { z-index: 2; place-self: end center; margin-bottom: 7svh; text-align: center; max-width: min(88vw, 560px); font-size: 1.12rem; line-height: 1.5; }

/* ---------- 9. final: imagem em cima, texto embaixo ---------- */
.palco--coluna { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2svh; }
.fi-pedido { height: min(54svh, 112vw); width: auto; clip-path: circle(0% at 50% 55%); }
.fi-texto { text-align: center; width: min(92vw, 760px); }
.fi-assinatura { width: 100%; height: auto; }
.fi-assinatura text { font-size: 118px; }
.fi-data { letter-spacing: .4em; color: var(--musgo); opacity: 0; margin: .4em 0 0; }

/* ---------- celular: rearranjos ---------- */
@media (max-width: 700px) {
  .c-aneis { place-self: start center; margin: 6svh 0 0; width: 44vmin; }
  .t-textos { place-self: start center; margin: 12svh 0 0; }
  .t-copo { height: 78svh; margin-right: -8vw; }
  .t-traje .script { font-size: 2.6rem; }
  .ce-cartao { margin-top: 4svh; padding: 1.8rem 1.4rem 1.6rem; }
  .ce-casa { width: 150vw; }
  .r-envelope { margin-top: -26svh; }
}

/* ---------- movimento reduzido: tudo parado, no estado final ---------- */
html.estatico .cena { height: auto; }
html.estatico .palco { position: relative; height: auto; min-height: 100svh; padding: 8svh 0; }
html.estatico .d-trilho { width: 100%; flex-direction: column; padding: 0 8vw; }
html.estatico .surge { opacity: 1; transform: none; transition: none; }
html.estatico .t-bloco { grid-area: auto; margin-bottom: 2rem; }

@media (prefers-reduced-motion: reduce) {
  .dica-aro, .dica-circulo, .dica-seta { animation: none; }
}

/* ---------- botão de som (aparece quando o convite abre) ---------- */
.musica-botao {
  position: fixed;
  z-index: 60;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(74, 72, 38, .18);
  border-radius: 50%;
  background: #fff;
  color: var(--oliva);
  box-shadow: 0 2px 10px rgba(45, 32, 17, .18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.musica-botao[hidden] { display: none; }
.musica-botao:focus-visible { outline: 2px solid var(--musgo); outline-offset: 3px; }
.musica-botao svg { width: 22px; height: 22px; }
.musica-botao .icone-mudo,
.musica-botao.mudo .icone-som { display: none; }
.musica-botao.mudo .icone-mudo { display: block; }
