/* =========================================================
   PARA VOCÊ — Dia dos Namorados
   Experiência premium, mobile-first, sem frameworks.
   ========================================================= */

:root {
  /* Paleta */
  --bg-deep: #050505;
  --bg-purple: #1a0a2e;
  --bg-pink: #ff8fb1;
  --gold: #e8c98a;
  --gold-soft: #f4e3bd;

  /* Vidro */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-blur: 12px;

  /* Tipografia */
  --font-serif: "Playfair Display", "Georgia", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Timing */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: #f5f2f7;
  overflow-x: hidden;
  min-height: 100vh;
  /* Evita "bounce" estranho em iOS */
  overscroll-behavior: none;
}

/* =========================================================
   FUNDO CINEMATOGRÁFICO
   ========================================================= */

.background {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg-deep);
  overflow: hidden;
}

/* Manchas de luz suaves que respiram lentamente, criando profundidade */
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform, opacity;
}

.glow--purple {
  width: 80vmax;
  height: 80vmax;
  left: -30vmax;
  top: -20vmax;
  background: radial-gradient(circle at 30% 30%, var(--bg-purple), transparent 70%);
  animation: drift-glow 22s ease-in-out infinite alternate;
}

.glow--pink {
  width: 70vmax;
  height: 70vmax;
  right: -25vmax;
  bottom: -25vmax;
  background: radial-gradient(circle at 70% 70%, rgba(255, 143, 177, 0.35), transparent 70%);
  animation: drift-glow 26s ease-in-out infinite alternate-reverse;
}

@keyframes drift-glow {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.45;
  }
  50% {
    transform: translate(4%, 3%) scale(1.08);
    opacity: 0.6;
  }
  100% {
    transform: translate(-3%, -4%) scale(1);
    opacity: 0.5;
  }
}

/* Partículas brilhantes lentas geradas via JS */
.particles {
  position: absolute;
  inset: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
  will-change: transform, opacity;
  animation: particle-drift linear infinite;
}

@keyframes particle-drift {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: var(--p-opacity, 0.5);
  }
  90% {
    opacity: var(--p-opacity, 0.5);
  }
  100% {
    transform: translateY(-110vh) translateX(var(--p-drift, 20px));
    opacity: 0;
  }
}

/* =========================================================
   PALCO PRINCIPAL
   ========================================================= */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8vh 6vw;
  text-align: center;
  transition: filter 1.1s var(--ease-soft), transform 1.1s var(--ease-soft);
}

/* Quando a escolha é feita, o palco recua suavemente (efeito de câmera) */
.stage.is-zoomed {
  transform: scale(1.04);
  filter: brightness(0.7);
}

/* =========================================================
   TEXTO INTRODUTÓRIO
   ========================================================= */

.intro {
  margin-bottom: clamp(2.5rem, 8vh, 4rem);
  transition: opacity 0.8s var(--ease-soft), transform 0.8s var(--ease-soft);
  animation: fade-up 1.2s var(--ease-out) both;
}

.intro__title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  letter-spacing: 0.01em;
  line-height: 1.35;
  background: linear-gradient(135deg, #ffffff 0%, var(--bg-pink) 60%, var(--gold-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro__subtitle {
  margin-top: 0.75rem;
  font-size: clamp(0.78rem, 3vw, 0.95rem);
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 242, 247, 0.55);
}

.intro.is-hidden,
.hint.is-hidden {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   CORAÇÕES
   ========================================================= */

.hearts {
  position: relative;
  width: min(420px, 92vw);
  height: clamp(300px, 82vw, 380px);
  transition: opacity 0.7s var(--ease-soft);
}

.hearts.is-fading {
  opacity: 0;
  pointer-events: none;
}

.heart {
  position: absolute;
  width: clamp(64px, 20vw, 92px);
  height: clamp(64px, 20vw, 92px);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  will-change: transform;
}

.heart__shape {
  will-change: transform;
}

/* Posicionamento individual — disposição orgânica tipo "constelação" */
.heart[data-index="0"] { top: 2%;  left: 6%;  animation-delay: 0s, -1.2s; }
.heart[data-index="1"] { top: 0%;  right: 4%; animation-delay: 0.6s, -3.1s; }
.heart[data-index="2"] { top: 36%; left: 50%; transform: translateX(-50%); animation-delay: 1.1s, -0.4s; }
.heart[data-index="3"] { bottom: 4%; left: 4%;  animation-delay: 1.7s, -2.3s; }
.heart[data-index="4"] { bottom: 2%; right: 8%; animation-delay: 0.3s, -4.2s; }

/* Flutuação lenta + leve rotação para sensação orgânica */
.heart {
  animation:
    heart-float 7s ease-in-out infinite,
    heart-fade-in 0.9s var(--ease-out) both;
}

@keyframes heart-fade-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mantém o centro horizontal do coração central durante o fade-in */
@keyframes heart-fade-in-center {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(24px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes heart-float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-14px) rotate(6deg); }
}

/* O coração central usa o keyframe que preserva translateX(-50%) */
.heart[data-index="2"] {
  animation: heart-fade-in-center 0.9s var(--ease-out) both;
}

.heart[data-index="2"] .heart__shape {
  animation: heart-float 8s ease-in-out infinite;
}

.heart[data-index="0"] .heart__shape,
.heart[data-index="1"] .heart__shape,
.heart[data-index="3"] .heart__shape,
.heart[data-index="4"] .heart__shape {
  animation: heart-breathe 4.5s ease-in-out infinite;
}

.heart[data-index="0"] .heart__shape { animation-delay: -0.5s; }
.heart[data-index="1"] .heart__shape { animation-delay: -2.1s; }
.heart[data-index="3"] .heart__shape { animation-delay: -3.4s; }
.heart[data-index="4"] .heart__shape { animation-delay: -1.3s; }

/* "Respiração": leve pulsar de escala (sem animar filtros pesados, para manter 60fps) */
@keyframes heart-breathe {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Forma do coração — técnica clássica com elemento + 2 pseudo-elementos,
   com efeito glassmorphism aplicado às três partes */
.heart__shape {
  position: relative;
  width: 70%;
  height: 70%;
  transform: rotate(-45deg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 4px 0 0 0;
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    inset 0 -6px 16px rgba(0, 0, 0, 0.25),
    0 0 22px rgba(255, 143, 177, 0.3);
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out), background 0.45s var(--ease-out);
}

.heart__shape::before,
.heart__shape::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
  transition: background 0.45s var(--ease-out);
}

.heart__shape::before {
  top: -50%;
  left: 0;
}

.heart__shape::after {
  left: 50%;
  top: 0;
}

/* Brilho interno que se move suavemente — vida própria */
.heart__shine {
  position: absolute;
  top: 12%;
  left: 18%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 70%);
  filter: blur(2px);
  opacity: 0.8;
  z-index: 2;
}

/* Estado ao tocar: escala + glow intenso */
.heart:active .heart__shape,
.heart.is-pressed .heart__shape {
  transform: rotate(-45deg) scale(0.92);
}

.heart:hover .heart__shape,
.heart:focus-visible .heart__shape {
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.3),
    inset 0 -6px 16px rgba(0, 0, 0, 0.2),
    0 0 36px rgba(255, 143, 177, 0.35);
}

.heart:hover .heart__shape::before,
.heart:hover .heart__shape::after,
.heart:focus-visible .heart__shape::before,
.heart:focus-visible .heart__shape::after {
  background: rgba(255, 255, 255, 0.1);
}

/* =========================================================
   ESTADOS DE ESCOLHA
   ========================================================= */

/* O coração escolhido recebe glow intenso e some o "breathe" padrão */
.heart.is-chosen {
  z-index: 5;
  animation: none !important;
}

.heart.is-chosen .heart__shape {
  animation: none !important;
  transform: rotate(-45deg) scale(1.15);
  background: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.4),
    inset 0 -6px 16px rgba(0, 0, 0, 0.15),
    0 0 60px rgba(255, 143, 177, 0.65),
    0 0 120px rgba(232, 201, 138, 0.35);
}

.heart.is-chosen .heart__shape::before,
.heart.is-chosen .heart__shape::after {
  background: rgba(255, 255, 255, 0.14);
}

/* O coração escolhido viaja para o centro da tela (efeito "câmera aproxima") */
.heart.is-centered {
  position: fixed;
  top: 50%;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  transition: top 1s var(--ease-soft), left 1.1s var(--ease-soft), transform 1.1s var(--ease-soft);
  z-index: 20;
}

.heart.is-centered .heart__shape {
  transition: transform 1.1s var(--ease-soft), box-shadow 1.1s var(--ease-soft);
  transform: rotate(-45deg) scale(1.35);
}

/* Demais corações desaparecem suavemente */
.heart.is-leaving {
  opacity: 0;
  transform: scale(0.7) !important;
  transition: opacity 0.6s var(--ease-soft), transform 0.6s var(--ease-soft);
  pointer-events: none;
}

/* Dica de toque */
.hint {
  margin-top: clamp(2rem, 7vh, 3.5rem);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(245, 242, 247, 0.32);
  transition: opacity 0.6s var(--ease-soft), transform 0.6s var(--ease-soft);
  animation: fade-up 1.4s var(--ease-out) 0.4s both;
}

/* =========================================================
   OVERLAY — escurece o fundo quando a carta aparece
   ========================================================= */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: radial-gradient(circle at 50% 45%, rgba(10, 4, 16, 0.6), rgba(2, 1, 4, 0.94));
  backdrop-filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s var(--ease-soft), backdrop-filter 1.2s var(--ease-soft);
}

.overlay.is-active {
  opacity: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}

/* =========================================================
   CARTA FINAL
   ========================================================= */

.card {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 7vw;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.card.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.card__inner {
  position: relative;
  width: min(420px, 100%);
  padding: clamp(2.2rem, 7vw, 3rem) clamp(1.6rem, 6vw, 2.4rem);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.25);
  text-align: center;
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
  transition-delay: 0.25s;
}

.card.is-visible .card__inner {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card__ornament {
  display: block;
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 1rem;
  letter-spacing: 0.3em;
  text-shadow: 0 0 18px rgba(232, 201, 138, 0.6);
}

.card__eyebrow {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(245, 242, 247, 0.45);
  margin-bottom: 1.4rem;
}

.card__message {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.15rem, 5.2vw, 1.5rem);
  line-height: 1.65;
  background: linear-gradient(135deg, #ffffff 0%, #f6e3ee 50%, var(--gold-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card__signature {
  display: block;
  margin-top: 1.8rem;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(232, 201, 138, 0.65);
}

.card__credit {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 242, 247, 0.28);
}

/* Botão para reiniciar a experiência e escolher outro coração */
.card__reset {
  display: inline-block;
  margin-top: 1.6rem;
  padding: 0.6rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(245, 242, 247, 0.55);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.3s var(--ease-soft), background 0.3s var(--ease-soft), border-color 0.3s var(--ease-soft);
}

.card__reset:hover,
.card__reset:focus-visible {
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(232, 201, 138, 0.4);
}

/* =========================================================
   PARTÍCULAS DOURADAS (confete refinado)
   ========================================================= */

.sparkles {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 8px rgba(244, 227, 189, 0.9);
  opacity: 0;
  animation: sparkle-fall linear forwards;
}

@keyframes sparkle-fall {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6);
  }
  10% {
    opacity: 1;
  }
  85% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translate(var(--s-drift, 0px), 105vh) scale(1);
  }
}

/* =========================================================
   ACESSIBILIDADE — respeita preferência por menos movimento
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.2s !important;
  }
}

/* =========================================================
   AJUSTES FINOS PARA TELAS PEQUENAS (360px–430px)
   ========================================================= */

@media (max-width: 380px) {
  .intro__title {
    font-size: 1.45rem;
  }

  .hearts {
    height: 76vw;
  }
}

@media (min-width: 431px) {
  .stage {
    padding: 6vh 6vw;
  }
}
