/* ================================
   VARIABLES
================================ */
:root {
  --primary: #ff4f81;
  --secondary: #ff8fab;
  --accent: #ff2f68;
  --dark: #5a1833;
  --bg: #fff5f8;
  --bg-deep: #ffe4ec;
  --white: #ffffff;
  --ink: #3a1425;
  --ink-soft: #7a4a5c;
  --lavender: #efe6fb;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Poppins', 'Inter', sans-serif;

  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow-soft: 0 20px 50px rgba(90, 24, 51, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--dark);
  margin: 0;
}

p { margin: 0; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

.hidden { display: none !important; }

/* Visible focus states */
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ================================
   AMBIENT BACKGROUND
================================ */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: linear-gradient(180deg, #fff5f8 0%, #ffeef4 50%, #fdf2f8 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: drift 22s ease-in-out infinite;
}

.blob-a {
  width: 40vw; height: 40vw;
  background: var(--secondary);
  top: -10%; left: -10%;
}

.blob-b {
  width: 35vw; height: 35vw;
  background: var(--lavender);
  bottom: -5%; right: -10%;
  animation-delay: -7s;
}

.blob-c {
  width: 25vw; height: 25vw;
  background: #ffd6e5;
  top: 40%; left: 60%;
  animation-delay: -14s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, 6%) scale(1.08); }
}

#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* ================================
   FLOATING NAV / MUSIC
================================ */
.float-nav {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--white);
  color: var(--accent);
  font-size: 22px;
  box-shadow: var(--shadow-soft);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease);
  opacity: 0;
  pointer-events: none;
}

.float-nav.visible {
  opacity: 1;
  pointer-events: auto;
}

.float-nav:hover { transform: scale(1.1); }

.music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.music-icon { transition: transform 0.4s var(--ease); }
.music-toggle.playing .music-icon { animation: spin 4s linear infinite; }

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

/* ================================
   SCREENS (Opening / Envelope)
================================ */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  position: relative;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.opening-screen.fading-out,
.envelope-screen.fading-out {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.eyebrow-text {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 600;
  margin-bottom: 14px;
}

.hero-sub {
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 420px;
  margin-bottom: 36px;
}

.glow-heart {
  width: 120px;
  margin-bottom: 40px;
}

.heart-svg path {
  fill: var(--primary);
  filter: drop-shadow(0 0 24px rgba(255, 47, 104, 0.55));
  animation: heartbeat 1.8s ease-in-out infinite;
  transform-origin: center;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.08); }
  40% { transform: scale(0.97); }
  55% { transform: scale(1.05); }
}

/* Buttons */
.btn {
  padding: 16px 36px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 500;
  min-height: 52px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--white);
  box-shadow: 0 14px 34px rgba(255, 47, 104, 0.35);
}

.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(255, 47, 104, 0.45); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--dark);
}
.btn-ghost:hover { background: rgba(255, 79, 129, 0.08); }

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-hint span {
  display: block;
  width: 22px; height: 34px;
  border: 2px solid var(--secondary);
  border-radius: 20px;
  position: relative;
}

.scroll-hint span::before {
  content: '';
  position: absolute;
  top: 6px; left: 50%;
  width: 4px; height: 8px;
  background: var(--primary);
  border-radius: 4px;
  transform: translateX(-50%);
  animation: scrollDot 1.6s ease-in-out infinite;
}

@keyframes scrollDot {
  0% { opacity: 1; top: 6px; }
  100% { opacity: 0; top: 18px; }
}

/* ================================
   REVEAL-IN (opening sequence)
================================ */
.reveal-in {
  opacity: 0;
  transform: translateY(18px);
  animation: revealIn 0.9s var(--ease) forwards;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.35s; }
.delay-3 { animation-delay: 0.55s; }
.delay-4 { animation-delay: 0.8s; }

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

/* ================================
   ENVELOPE SCREEN
================================ */
.envelope-wrap {
  perspective: 1200px;
  margin-bottom: 44px;
}

.envelope {
  width: min(78vw, 300px);
  height: min(56vw, 210px);
  position: relative;
}

.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.envelope-front-left,
.envelope-front-right {
  position: absolute;
  bottom: 0;
  width: 50%;
  height: 100%;
  background: var(--white);
  opacity: 0.94;
}

.envelope-front-left {
  left: 0;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  border-radius: 0 0 0 12px;
}

.envelope-front-right {
  right: 0;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
  border-radius: 0 0 12px 0;
}

.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  background: var(--white);
  clip-path: polygon(0 0, 100% 0, 50% 90%);
  transform-origin: top;
  transition: transform 0.8s var(--ease);
  z-index: 3;
}

.envelope-heart {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 2.6rem;
  z-index: 2;
  transition: transform 0.6s var(--ease) 0.4s;
}

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

.envelope.open .envelope-heart {
  transform: translate(-50%, -120%) scale(1.2);
}

/* ================================
   SECTIONS
================================ */
.section {
  max-width: 720px;
  margin: 0 auto;
  padding: 90px 24px;
  text-align: center;
  position: relative;
}

.section-title {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-weight: 600;
  margin-bottom: 34px;
}

.reveal-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal-section.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Message section */
.name-line {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 28px;
}

.typing-block { min-height: 160px; }

.typing-text {
  font-size: 1.15rem;
  color: var(--ink-soft);
  white-space: pre-line;
  max-width: 60ch;
  margin: 0 auto;
}

.typing-text::after {
  content: '|';
  color: var(--primary);
  animation: blink 0.9s step-end infinite;
}

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

/* Love letter */
.letter-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 32px;
  box-shadow: var(--shadow-soft);
  position: relative;
  background-image:
    radial-gradient(circle at 90% 10%, rgba(255, 143, 171, 0.08), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(255, 143, 171, 0.08), transparent 40%);
  border: 1px solid rgba(255, 143, 171, 0.25);
}

.letter-hearts {
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  color: var(--secondary);
  font-size: 1.3rem;
}

.letter-body {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink);
  text-align: left;
  max-height: 4.8em;
  overflow: hidden;
  transition: max-height 0.6s var(--ease);
  position: relative;
}

.letter-body.expanded { max-height: 600px; }

.read-more-btn {
  margin-top: 18px;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.95rem;
}

.letter-signature {
  margin-top: 24px;
  font-family: var(--font-display);
  color: var(--ink-soft);
  text-align: right;
}

/* Moments grid */
.moments-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.moment-card {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: 26px 18px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  animation: floatCard 5s ease-in-out infinite;
}

.moment-card:nth-child(even) { animation-delay: -2.5s; }

.moment-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 32px rgba(90, 24, 51, 0.1);
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.moment-icon { font-size: 1.8rem; margin-bottom: 10px; }
.moment-card h3 { font-size: 1rem; margin-bottom: 6px; }
.moment-card p { font-size: 0.88rem; color: var(--ink-soft); }

/* Reasons grid */
.reasons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.reason-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 22px 14px;
  box-shadow: 0 10px 24px rgba(90, 24, 51, 0.07);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reason-card.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.reason-mark {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--dark);
}

/* Interactive heart */
.tap-heart {
  font-size: 4.5rem;
  background: none;
  transition: transform 0.15s var(--ease);
  filter: drop-shadow(0 8px 20px rgba(255, 47, 104, 0.35));
}

.tap-heart:active { transform: scale(1.3); }

.tap-message {
  margin-top: 20px;
  font-size: 1.05rem;
  color: var(--ink-soft);
  min-height: 1.6em;
}

.tap-counter {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* Love meter */
.meter-console { max-width: 380px; margin: 0 auto; }

.meter-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.meter-track {
  width: 100%;
  height: 14px;
  background: rgba(255, 143, 171, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  border-radius: 999px;
  transition: width 2.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.meter-result {
  margin-top: 20px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--accent);
}

/* Final message */
.final-message {
  font-size: 1.15rem;
  color: var(--ink-soft);
  line-height: 1.9;
  margin-bottom: 30px;
}

.signature-line {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--primary);
}

.signature-name {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--dark);
  margin-top: 6px;
}

.site-footer {
  text-align: center;
  padding: 40px 24px 60px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ================================
   MODAL
================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 20, 37, 0.55);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.4s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 32px;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  animation: modalPop 0.5s var(--ease);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-message {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--dark);
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 1.6rem;
  color: var(--ink-soft);
  width: 40px; height: 40px;
}

/* ================================
   CINEMATIC FINAL SURPRISE
================================ */
.cinematic {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(circle at 50% 30%, #2b0f1f, #150710 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  overflow: hidden;
  animation: fadeIn 0.6s var(--ease);
}

.stars {
  position: absolute;
  inset: 0;
}

.cinematic-text {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-style: italic;
  color: #ffe3ec;
  font-size: clamp(1.3rem, 4vw, 2rem);
  max-width: 640px;
  line-height: 1.7;
  margin-bottom: 34px;
}

.cinematic-close {
  position: relative;
  z-index: 2;
  border-color: #ffb6cf;
  color: #ffe3ec;
}

.cinematic-close:hover { background: rgba(255, 182, 207, 0.12); }

/* ================================
   RESPONSIVE
================================ */
@media (min-width: 640px) {
  .moments-grid { grid-template-columns: repeat(3, 1fr); }
  .reasons-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .section { padding: 130px 24px; }
  .letter-card { padding: 56px 64px; }
}

/* ================================
   ACCESSIBILITY: REDUCED MOTION
================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
