/* =========================================================
   TOKENS
   ========================================================= */
:root {
  --wine: #4a0620;
  --cherry: #d81e4a;
  --rose: #ff7e9d;
  --blush: #ffd7e2;
  --cream: #fff4ee;
  --ink: #2a0712;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --pad: clamp(1.25rem, 5vw, 3rem);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =========================================================
   BASE
   ========================================================= */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--cream);
  background: var(--wine);
  background-image:
    radial-gradient(120% 85% at 50% 0%, var(--cherry) 0%, transparent 62%),
    radial-gradient(90% 70% at 15% 100%, #8c0f36 0%, transparent 60%),
    linear-gradient(160deg, #5c0827 0%, var(--wine) 100%);
  -webkit-font-smoothing: antialiased;
}

/* Textura de grão: tira o aspecto "gradiente de template" */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

:focus-visible {
  outline: 3px solid var(--blush);
  outline-offset: 4px;
}

/* =========================================================
   CORAÇÕES DE FUNDO
   ========================================================= */
.hearts-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.heart {
  position: absolute;
  bottom: -8vh;
  left: var(--x);
  width: var(--size);
  color: var(--blush);
  opacity: 0;
  filter: blur(var(--blur, 0px));
  will-change: transform, opacity;
  animation: drift var(--dur) linear forwards;
}

.heart svg {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: var(--o);
  }
  50% {
    transform: translate3d(calc(var(--dx) * -0.55), -55vh, 0)
      rotate(calc(var(--rot) * 0.4));
  }
  82% {
    opacity: var(--o);
  }
  100% {
    transform: translate3d(var(--dx), -118vh, 0) rotate(var(--rot));
    opacity: 0;
  }
}

/* =========================================================
   PALCO E TELAS
   ========================================================= */
.stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: calc(var(--pad) + env(safe-area-inset-top)) var(--pad)
    calc(var(--pad) + env(safe-area-inset-bottom));
  text-align: center;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.25rem, 4vw, 2rem);
  max-width: 34rem;
}

.screen[hidden] {
  display: none;
}

.screen--ask.is-leaving {
  animation: leave 0.45s ease forwards;
}

.screen--yes {
  animation: enter 0.5s var(--spring) both;
}

@keyframes leave {
  to {
    opacity: 0;
    transform: scale(0.94);
    filter: blur(6px);
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* =========================================================
   TIPOGRAFIA
   ========================================================= */
.eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 244, 238, 0.65);
}

.question {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.7rem, 12vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  text-wrap: balance;
  text-shadow: 0 18px 40px rgba(42, 7, 18, 0.45);
}

.question em {
  color: var(--blush);
  font-weight: 700;
}

.hint {
  min-height: 1.4em;
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(255, 244, 238, 0.72);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hint.is-visible {
  opacity: 1;
}

.answer {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  line-height: 1;
}

.answer-note {
  font-size: 0.95rem;
  color: rgba(255, 244, 238, 0.7);
}

/* =========================================================
   BOTÕES
   ========================================================= */
.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

.btn {
  display: inline-block;
  padding: 1rem 2.4rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s var(--spring), box-shadow 0.25s ease,
    background-color 0.25s ease;
}

.btn-label {
  display: inline-block;
}

.btn-yes {
  background: var(--cream);
  color: var(--cherry);
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.65);
}

.btn-yes:hover,
.btn-yes:focus-visible {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 20px 44px -12px rgba(0, 0, 0, 0.7);
}

.btn-yes:active {
  transform: translateY(0) scale(0.97);
}

/* Quando o "No" desiste, o "Yes" assume o palco */
.btn-yes.is-champion {
  transform: scale(1.14);
  animation: heartbeat 1.6s ease-in-out infinite 0.4s;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1.14);
  }
  35% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1.15);
  }
}

.btn-no {
  background: rgba(255, 244, 238, 0.06);
  border-color: rgba(255, 244, 238, 0.42);
  color: var(--cream);
  backdrop-filter: blur(4px);
}

/* Estado "solto": sai do fluxo e passa a ser movido por transform */
.btn-no.is-loose {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  margin: 0;
  will-change: transform;
  transition: transform 0.42s var(--spring), opacity 0.3s ease;
}

.btn-no.is-gone {
  opacity: 0;
  pointer-events: none;
}

/* Reserva o espaço que o "No" deixou, para o "Yes" não pular */
.btn-spacer {
  display: inline-block;
}

/* Reações do rótulo (não mexem no transform do botão) */
.btn-no .btn-label.wobble {
  animation: wobble 0.5s ease;
}
.btn-no .btn-label.jitter {
  animation: jitter 0.4s ease;
}
.btn-no .btn-label.flip {
  animation: flip 0.5s ease;
}

@keyframes wobble {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translateX(-6px) rotate(-6deg);
  }
  50% {
    transform: translateX(5px) rotate(5deg);
  }
  75% {
    transform: translateX(-3px) rotate(-3deg);
  }
}

@keyframes jitter {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateY(-4px) scale(1.08);
  }
  60% {
    transform: translateY(2px) scale(0.96);
  }
}

@keyframes flip {
  0% {
    transform: none;
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: none;
  }
}

@keyframes poof {
  to {
    transform: translate3d(var(--px), var(--py), 0) scale(0.2) rotate(200deg);
    opacity: 0;
  }
}

/* =========================================================
   A MARCA DE BEIJO (elemento-assinatura)
   ========================================================= */
.stamp {
  width: clamp(9rem, 42vw, 14rem);
  height: auto;
  transform-origin: center;
  animation: stamp-in 0.6s var(--spring) both;
  filter: drop-shadow(0 16px 30px rgba(42, 7, 18, 0.55));
}

.stamp-lips path {
  fill: var(--blush);
}

.stamp-creases path {
  fill: none;
  stroke: var(--wine);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.35;
}

@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: scale(2.6) rotate(-22deg);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-8deg);
  }
}

/* =========================================================
   RESPONSIVO
   ========================================================= */
@media (max-width: 480px) {
  .btn {
    padding: 0.9rem 1.9rem;
    font-size: 1rem;
  }
  .button-row {
    gap: 0.7rem;
  }
}

/* =========================================================
   MOVIMENTO REDUZIDO
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-no.is-loose {
    transition-duration: 0.01ms;
  }
  .btn-yes.is-champion {
    animation: none;
  }
  .stamp,
  .screen--yes {
    animation-duration: 0.01ms;
  }
  .btn-no .btn-label.wobble,
  .btn-no .btn-label.jitter,
  .btn-no .btn-label.flip {
    animation: none;
  }
  .heart {
    animation-timing-function: linear;
  }
}
