:root {
  --bg: #180f1f;
  --card-bg: #241533;
  --card-bg-hover: #2e1c40;
  --text: #f5ece0;
  --muted: #c3b3d6;
  --accent: #e8c988;
  --accent-2: #e0a98f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

h1, h2 {
  font-family: "Playfair Display", "Poppins", serif;
}

/* ---------- animated background blobs ---------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.3;
  z-index: 0;
  pointer-events: none;
}

.blob-a {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -100px;
  background: #d9a25c;
  animation: drift-a 18s ease-in-out infinite;
}

.blob-b {
  width: 380px;
  height: 380px;
  bottom: -140px;
  right: -100px;
  background: #e0a98f;
  animation: drift-b 22s ease-in-out infinite;
}

.blob-c {
  width: 300px;
  height: 300px;
  top: 40%;
  left: 60%;
  background: #7c4a8a;
  animation: drift-c 26s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 80px) scale(1.15); }
}

@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -70px) scale(1.1); }
}

@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 50px) scale(0.9); }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-text {
  flex: 1 1 380px;
  max-width: 520px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(232, 201, 136, 0.1);
  border: 1px solid rgba(232, 201, 136, 0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin: 0 0 1rem;
  line-height: 1.15;
}

.gradient-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shine 6s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.hero-text p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
}

.hero-art {
  flex: 1 1 320px;
  display: flex;
  justify-content: center;
}

.orbit-svg {
  width: 100%;
  max-width: 380px;
}

.orbit-group {
  transform-origin: 200px 200px;
  animation: spin 10s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.heart-pulse {
  transform-origin: 200px 178px;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.twinkle {
  animation: twinkle 2.4s ease-in-out infinite;
}
.t2 { animation-delay: 0.6s; }
.t3 { animation-delay: 1.2s; }
.t4 { animation-delay: 1.8s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* ---------- main / cards ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid rgba(232, 201, 136, 0.08);
  border-radius: 14px;
  padding: 2rem;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.card.wide {
  width: 100%;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 700;
}

.section-hint {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- envelope ---------- */
.envelope-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.envelope {
  position: relative;
  width: 220px;
  height: 140px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #3a2650, #241533);
  border: 1px solid rgba(232, 201, 136, 0.35);
  border-radius: 8px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  border-left: 110px solid transparent;
  border-right: 110px solid transparent;
  border-top: 70px solid #3f2a58;
  transform-origin: top;
  transition: transform 0.5s ease;
  z-index: 2;
}

.envelope-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -30%);
  color: var(--accent-2);
  font-size: 1.6rem;
  z-index: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.envelope.is-open .envelope-flap {
  transform: rotateX(180deg);
}

.envelope.is-open .envelope-heart {
  opacity: 0;
  transform: translate(-50%, -60%) scale(0.6);
}

.letter {
  max-width: 520px;
  width: 100%;
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: rgba(232, 201, 136, 0.06);
  border: 1px solid rgba(232, 201, 136, 0.2);
  border-radius: 10px;
  padding: 0 1.5rem;
  transition: max-height 0.6s ease, opacity 0.6s ease, padding 0.6s ease;
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  color: var(--text);
}

.letter.is-visible {
  max-height: 400px;
  opacity: 1;
  padding: 1.5rem;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: caret-blink 0.9s steps(1) infinite;
}

.caret.done {
  display: none;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

/* ---------- flip cards ---------- */
.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.flip-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  perspective: 1000px;
  height: 150px;
}

.flip-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.flip-card.is-flipped .flip-inner {
  transform: rotateY(180deg);
}

.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 12px;
  backface-visibility: hidden;
  padding: 1rem;
}

.flip-front {
  background: rgba(232, 201, 136, 0.08);
  border: 1px solid rgba(232, 201, 136, 0.25);
  color: var(--accent-2);
  font-size: 2.2rem;
}

.flip-back {
  background: linear-gradient(160deg, #3a2650, #241533);
  border: 1px solid rgba(224, 169, 143, 0.35);
  color: var(--text);
  font-size: 0.92rem;
  transform: rotateY(180deg);
}

/* ---------- love meter ---------- */
.love-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.meter-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.meter-svg {
  width: 140px;
  height: 126px;
}

.meter-outline {
  fill: none;
  stroke: rgba(232, 201, 136, 0.4);
  stroke-width: 2;
}

.meter-fill {
  fill: url(#sparkGrad);
  fill: var(--accent-2);
  transition: y 0.4s ease, height 0.4s ease;
}

.meter-heart {
  animation: none;
}

.meter-heart.is-full {
  animation: pulse 1s ease-in-out infinite;
}

.meter-button {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #241533;
  border: none;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.meter-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -8px rgba(232, 201, 136, 0.5);
}

.meter-button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.meter-percent {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.final-message {
  max-width: 420px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.7s ease, opacity 0.7s ease;
}

.final-message.is-visible {
  max-height: 200px;
  opacity: 1;
  margin-top: 0.5rem;
}

.final-message p {
  color: var(--text);
  margin: 0.3rem 0;
}

.final-message .signature {
  color: var(--accent);
  font-family: "Playfair Display", serif;
  font-style: italic;
}

/* ---------- falling hearts celebration ---------- */
.falling-heart {
  position: fixed;
  top: -40px;
  font-size: 1.4rem;
  color: var(--accent-2);
  pointer-events: none;
  z-index: 50;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.wave {
  display: block;
  width: 100%;
  height: 50px;
  margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .orbit-group, .heart-pulse, .twinkle, .blob, .gradient-text, .meter-heart.is-full {
    animation: none !important;
  }
}
