:root {
  --areia: #f5ece3;
  --areia-2: #efe1d4;
  --cartao: #fbf5ee;
  --noz: #4a3327;
  --caule: #93796c;
  --rosa: #b9827a;
  --rosa-fraca: rgba(185, 130, 122, 0.14);
  --ouro: #b8925a;
  --linha: #e3d1c3;
  --sombra: rgba(74, 51, 39, 0.14);

  --cor-texto: var(--noz);
  --cor-texto-secundario: var(--caule);
  --cor-texto-terciario: var(--caule);
  --cor-acento: var(--rosa);
  --cor-acento-fraco: var(--rosa-fraca);
  --cor-divisor: var(--linha);

  --espaco-xs: 6px;
  --espaco-sm: 12px;
  --espaco-md: 20px;
  --espaco-lg: 32px;
  --espaco-xl: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --areia: #241813;
    --areia-2: #2c1e18;
    --cartao: #2a1c16;
    --noz: #f3e6dc;
    --caule: #c9ab9c;
    --rosa: #dd9a8c;
    --rosa-fraca: rgba(221, 154, 140, 0.16);
    --ouro: #d3ac72;
    --linha: #4a362e;
    --sombra: rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--areia);
  color: var(--cor-texto);
  min-height: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  background: radial-gradient(ellipse 900px 700px at 50% 0%, var(--rosa-fraca) 0%, var(--areia) 65%);
  font-family: 'Raleway', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Ícones ---------- */
.icone {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.icone-cheio {
  fill: currentColor;
  stroke: none;
}

.icone-inline {
  width: 13px;
  height: 13px;
  margin: 0 1px -2px 0;
}

.ramo-caule { fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; }
.ramo-folha { fill: currentColor; stroke: none; }

.page {
  max-width: 430px;
  margin: 0 auto;
  padding: var(--espaco-md) 15px var(--espaco-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 100px var(--rosa-fraca);
  position: relative;
  isolation: isolate;
}

.page::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../content/texturas/grao-fundo.svg');
  pointer-events: none;
  z-index: -1;
}

.page[hidden] {
  display: none;
}

/* Portão de entrada */
.portao {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  position: relative;
  isolation: isolate;
}

.portao::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../content/texturas/grao-fundo.svg');
  pointer-events: none;
  z-index: -1;
}

.portao-cadeado {
  width: 22px;
  height: 22px;
  color: var(--rosa);
  margin-bottom: 14px;
}

.portao-coracao {
  position: relative;
  color: var(--rosa);
  margin: 0 0 var(--espaco-md);
}

.portao-coracao .icone {
  width: 48px;
  height: 48px;
}

.portao-coracao::before {
  content: '';
  position: absolute;
  inset: -30px -40px;
  background: radial-gradient(circle, var(--rosa-fraca) 0%, transparent 70%);
  filter: blur(2px);
  animation: pulsar 7s ease-in-out infinite;
  z-index: -1;
}

.portao-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 280px;
}

.portao-label {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 24px;
  margin-bottom: 18px;
  text-wrap: balance;
}

.portao-input {
  width: 100%;
  background: var(--cartao);
  border: 1px solid var(--linha);
  border-radius: 10px;
  color: var(--noz);
  font-family: 'Cormorant', serif;
  font-size: 20px;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 11px 18px;
  margin-bottom: 20px;
}

.portao-input:focus {
  outline: none;
  border-color: var(--rosa);
}

.portao-botao {
  background: var(--noz);
  color: var(--areia);
  border: none;
  border-radius: 20px;
  padding: 10px 32px;
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.portao-botao:hover {
  background: var(--rosa);
}

.portao-erro {
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  color: var(--rosa);
  margin: 16px 0 0;
  display: none;
}

.portao-erro.visivel {
  display: block;
}

.portao.escondido {
  display: none;
}

.carregando {
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  color: var(--cor-texto-terciario);
  letter-spacing: 1px;
  margin: 60px 0;
}

.carregando[hidden] {
  display: none;
}

.titulo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 22px);
  position: relative;
}

.titulo-wrap::before {
  content: '';
  position: absolute;
  inset: -40px -60px;
  background: radial-gradient(circle, var(--rosa-fraca) 0%, transparent 70%);
  filter: blur(2px);
  animation: pulsar 7s ease-in-out infinite;
  z-index: -1;
}

.ramo {
  width: clamp(18px, 3vw, 26px);
  height: auto;
  color: var(--rosa);
  opacity: 0.55;
  flex-shrink: 0;
}
.ramo.esq { transform: scaleX(-1) rotate(6deg); }
.ramo.dir { transform: rotate(-6deg); }

@media (max-width: 480px) {
  .ramo { display: none; }
}

.titulo {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 56px;
  margin: 0;
  text-align: center;
  color: var(--noz);
}

/* Carrossel */
.carousel {
  width: 100%;
  height: 320px;
  position: relative;
  overflow: hidden;
}

.carousel-track {
  position: absolute;
  inset: 0;
  cursor: grab;
  user-select: none;
}

.carousel-track:active {
  cursor: grabbing;
}

.carousel-track img {
  --tx: 0px;
  --escala: 1;
  --rot: 0deg;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 190px;
  height: 290px;
  object-fit: cover;
  border-radius: 8px;
  border: 4px solid var(--cartao);
  box-shadow: 0 14px 26px -16px var(--sombra);
  transform: translate(-50%, -50%) translateX(var(--tx)) scale(var(--escala)) rotate(var(--rot));
  transition: transform 0.8s ease, opacity 0.8s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}

.carousel-track img:hover {
  transform: translate(-50%, -50%) translateX(var(--tx)) translateY(-4px) scale(calc(var(--escala) * 1.04)) rotate(0deg);
  border-color: var(--rosa);
  box-shadow: 0 22px 34px -16px var(--sombra);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.carousel-dots button {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: var(--linha);
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-dots button.ativo {
  background: var(--rosa);
  transform: scale(1.3);
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cartao);
  border: 1px solid var(--linha);
  color: var(--noz);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px -10px var(--sombra);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.carousel-nav:hover {
  opacity: 1;
}

.carousel-nav .icone {
  width: 16px;
  height: 16px;
}

.carousel-nav-esquerda {
  left: 8px;
}

.carousel-nav-esquerda .icone {
  transform: scaleX(-1);
}

.carousel-nav-direita {
  right: 8px;
}

@media (max-width: 480px) {
  .carousel-nav {
    width: 32px;
    height: 32px;
  }
}

/* Divisores ornamentais */
.divisor {
  width: 360px;
  max-width: 90%;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: var(--espaco-lg) 0;
}

.divisor-linha {
  flex: 1;
  height: 1px;
  background: var(--linha);
}

.divisor .icone {
  width: 12px;
  height: 12px;
  color: var(--rosa);
  opacity: 0.85;
}

.divisor .divisor-estrela {
  color: var(--ouro);
}

/* Contadores */
.contadores {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.contador {
  text-align: center;
}

.contador-cabeca {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.contador-cabeca .icone {
  width: 16px;
  height: 16px;
  color: var(--rosa);
}

.contador-titulo {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 27px;
  margin: 0;
  color: var(--noz);
}

.contador-gif {
  width: 100px;
  height: 100px;
  margin-top: 8px;
}

.contador-numeros {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 3vw, 22px);
  flex-wrap: wrap;
  margin: 6px 0 4px;
}

.contador-bloco {
  min-width: 52px;
}

.contador-numero {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: clamp(28px, 6vw, 42px);
  color: var(--noz);
  font-variant-numeric: lining-nums tabular-nums;
  display: inline-block;
  transition: transform 0.25s ease, color 0.25s ease;
}

.contador-numero.bate {
  transform: scale(1.14);
  color: var(--rosa);
}

.contador-rotulo {
  font-family: 'Prata', serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--caule);
}

.contador-legenda {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 20px;
  color: var(--rosa);
  margin: 4px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .contador-numero { transition: none; }
}

/* Título de seção */
.secao-titulo {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: 30px;
  text-align: center;
  margin: 0 0 var(--espaco-lg);
  color: var(--noz);
}

.linha-tempo-dica {
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  font-style: italic;
  color: var(--cor-texto-terciario);
  text-align: center;
  margin: 0 0 var(--espaco-lg);
}

/* Linha do tempo */
.linha-tempo {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 26px;
}

.linha-tempo::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--linha);
}

.marco {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  background: var(--areia-2);
  border: 1px solid var(--linha);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.7s ease;
}

.marco-marca {
  position: absolute;
  left: 6.5px;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--areia);
  border: 1px solid var(--linha);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.marco-estrela {
  width: 11px;
  height: 11px;
  color: var(--rosa);
}

.marco:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 36px -18px var(--sombra);
  border-color: var(--rosa);
}

.marco:active {
  transform: translateY(-1px) scale(0.985);
  box-shadow: 0 8px 16px -12px var(--sombra);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.marco-foto {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  transition: transform 0.35s ease;
}

.marco:hover .marco-foto {
  transform: scale(1.07);
}

.marco:active .marco-foto {
  transform: scale(1.03);
}

.marco-textos {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.marco--sem-foto .marco-textos {
  grid-column: 1 / -1;
}

.marco-data {
  font-family: 'Prata', serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rosa);
  margin: 0 0 4px;
}

.marco-titulo {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 6px;
  color: var(--noz);
}

.marco-carta {
  background-color: var(--cartao);
  background-image: url('../content/texturas/grao-papel.svg');
  padding: 16px 16px 12px;
  margin-top: 6px;
  clip-path: polygon(
    0% 7px, 8% 1px, 16% 8px, 24% 2px, 32% 9px, 40% 1px, 48% 7px,
    56% 2px, 64% 9px, 72% 1px, 80% 8px, 88% 2px, 96% 7px, 100% 2px,
    100% 100%, 0% 100%
  );
}

.marco-trecho {
  font-family: 'Caveat', cursive;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.35;
  color: var(--noz);
  margin: 0;
}

/* Fechamento */
.fechamento {
  width: 100%;
  text-align: center;
}

.monograma {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--linha);
  background: var(--areia-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0 auto;
  font-family: 'Prata', serif;
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--noz);
}

.monograma .icone {
  width: 10px;
  height: 10px;
  color: var(--rosa);
}

.rodape {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 22px;
  color: var(--cor-texto-secundario);
  white-space: pre-line;
  margin: var(--espaco-md) 0 0;
  text-align: center;
}

.assinatura {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 19px;
  color: var(--rosa);
  margin: 10px 0 0;
}

.assinatura .icone {
  width: 13px;
  height: 13px;
  color: var(--ouro);
}

/* Popup de um momento (fotos + carta do dia) */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 8, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}

.popup.aberto {
  opacity: 1;
  pointer-events: auto;
}

.popup-cartao {
  background-color: var(--cartao);
  background-image: url('../content/texturas/grao-papel.svg');
  border: 1px solid var(--linha);
  border-radius: 0 0 12px 12px;
  max-width: 430px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 30px 20px 24px;
  text-align: center;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
  transform: scale(0.96);
  transition: transform 0.25s ease;
  clip-path: polygon(
    0% 1.6%, 3% 0.4%, 6% 2%, 10% 0.2%, 14% 1.6%, 18% 0.4%, 22% 1.8%,
    27% 0.2%, 31% 1.4%, 36% 0%, 40% 1.2%, 45% 0%, 49% 1%,
    54% 0%, 58% 1.2%, 63% 0.2%, 67% 1.4%, 72% 0.4%, 76% 1.6%, 81% 0.2%,
    85% 1.4%, 90% 0.4%, 94% 1.6%, 100% 0.6%,
    100% 100%, 0% 100%
  );
}

.popup.aberto .popup-cartao {
  transform: scale(1);
}

.popup-data {
  font-family: 'Prata', serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cor-texto-secundario);
  margin: 0 0 4px;
}

.popup-titulo {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 18px;
  color: var(--noz);
}

.popup-cartao::-webkit-scrollbar {
  display: none;
}

.popup-carrossel {
  height: 250px;
  margin: 0 0 6px;
}

.popup-cartao .popup-carrossel .carousel-track img {
  width: 180px;
  height: 235px;
}

.popup-cartao .popup-carrossel .carousel-nav {
  width: 30px;
  height: 30px;
}

.popup-cartao .popup-carrossel .carousel-nav .icone {
  width: 13px;
  height: 13px;
}

.popup-cartao .carousel-dots {
  margin: 10px 0 18px;
}

.popup-texto {
  font-family: 'Kalam', cursive;
  font-weight: 300;
  font-size: 19px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  text-align: left;
  white-space: pre-line;
  margin: 0;
  color: var(--noz);
}

.popup-fechar {
  position: sticky;
  top: 0;
  float: right;
  background: none;
  border: none;
  color: var(--cor-texto-terciario);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -14px -12px 0 0;
}

.popup-fechar:hover {
  color: var(--rosa);
}

/* Lightbox (foto em tela cheia) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 4, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}

.lightbox.aberto {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox-seta {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-seta .icone {
  width: 20px;
  height: 20px;
}

.lightbox-seta-esquerda .icone {
  transform: scaleX(-1);
}

.lightbox-seta[hidden] {
  display: none;
}

.lightbox-seta:hover {
  background: rgba(0, 0, 0, 0.65);
}

.lightbox-seta-esquerda {
  left: 12px;
}

.lightbox-seta-direita {
  right: 12px;
}

.lightbox-contador {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  color: #e8ddd6;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  margin: 0;
}

.lightbox-contador[hidden] {
  display: none;
}

@keyframes pulsar {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.08); }
}

/* ---------- Entrada e revelação ---------- */
.surge {
  opacity: 0;
  transform: translateY(14px);
  animation: surgir 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.surge.d1 { animation-delay: 0.12s; }
.surge.d2 { animation-delay: 0.24s; }
.surge.d3 { animation-delay: 0.36s; }

@keyframes surgir {
  to { opacity: 1; transform: translateY(0); }
}

.contador,
.marco {
  opacity: 0;
  transform: translateY(16px);
}

.contador {
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.contador.em-vista,
.marco.em-vista {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .portao-coracao::before { animation: none; }
  .titulo-wrap::before { animation: none; }
  .surge { animation: none; opacity: 1; transform: none; }
  .contador,
  .marco { transition: none; opacity: 1; transform: none; }
}

/* ===== Responsivo: tablet / desktop pequeno ===== */
@media (min-width: 600px) {
  .page {
    max-width: 600px;
    padding: var(--espaco-lg) 30px var(--espaco-xl);
  }

  .portao-coracao .icone {
    width: 60px;
    height: 60px;
  }

  .portao-form {
    max-width: 340px;
  }

  .portao-label {
    font-size: 28px;
  }

  .titulo {
    font-size: 72px;
  }

  .rodape {
    font-size: 27px;
  }

  .carousel {
    height: 420px;
  }

  .carousel-track img {
    width: 250px;
    height: 380px;
  }

  .divisor {
    width: 460px;
  }

  .contador-titulo {
    font-size: 30px;
  }

  .secao-titulo {
    font-size: 36px;
  }

  .marco {
    grid-template-columns: 112px 1fr;
    padding: 18px;
  }

  .marco-titulo {
    font-size: 23px;
  }

  .marco-trecho {
    font-size: 21px;
  }

  .monograma {
    width: 66px;
    height: 66px;
    font-size: 16px;
  }

  .popup-cartao {
    max-width: 520px;
    padding: 38px 28px 32px;
  }

  .popup-titulo {
    font-size: 30px;
  }

  .popup-carrossel {
    height: 290px;
  }

  .popup-cartao .popup-carrossel .carousel-track img {
    width: 205px;
    height: 270px;
  }

  .popup-texto {
    font-size: 20px;
  }
}

/* ===== Responsivo: desktop grande ===== */
@media (min-width: 1000px) {
  .page {
    max-width: 680px;
  }

  .titulo {
    font-size: 82px;
  }

  .carousel {
    height: 460px;
  }

  .carousel-track img {
    width: 275px;
    height: 415px;
  }

  .popup-cartao {
    max-width: 560px;
  }

  .popup-carrossel {
    height: 320px;
  }

  .popup-cartao .popup-carrossel .carousel-track img {
    width: 225px;
    height: 295px;
  }
}
