/* ==========================================================================
   ROOT / THEME TOKENS
   Edit these variables to quickly reskin the whole site (colors, fonts).
   ========================================================================== */
:root {
  --bg-black: #08050c;
  --bg-deep: #0f0817;
  --purple-900: #1a0f2e;
  --purple-700: #3a1f5c;
  --pink-500: #ff5fa2;
  --pink-glow: #ff7ec2;
  --violet-glow: #9b6bff;
  --text-main: #f4eef9;
  --text-soft: #cbb9dd;
  --text-faint: #8a7699;
  --serif: 'Georgia', 'Iowan Old Style', 'Palatino Linotype', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-black);
  color: var(--text-main);
  font-family: var(--sans);
  overflow-x: hidden;
  line-height: 1.5;
}

/* Respect users who don't want motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   SHARED SECTION LAYOUT
   ========================================================================== */
.section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem;
  text-align: center;
  overflow: hidden;
}

.eyebrow-soft {
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  font-size: 1.05rem;
  margin: 0 0 1.5rem;
}

/* Background wash: subtle purple-to-black radial glow behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 60% 40% at 20% 15%, rgba(155, 107, 255, 0.14), transparent 60%),
    radial-gradient(ellipse 55% 45% at 85% 70%, rgba(255, 95, 162, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-black) 0%, var(--bg-deep) 50%, var(--bg-black) 100%);
}

/* ==========================================================================
   SCROLL PROGRESS BAR
   ========================================================================== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--violet-glow), var(--pink-500));
  z-index: 999;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--pink-glow);
}

/* ==========================================================================
   FLOATING HEARTS (JS-generated, drift upward slowly)
   ========================================================================== */
.hearts-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  bottom: -5%;
  color: rgba(255, 95, 162, 0.35);
  font-size: 1.2rem;
  animation: floatUp linear forwards;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 20px)) rotate(20deg); opacity: 0; }
}

/* ==========================================================================
   REVEAL-ON-SCROLL (toggled by IntersectionObserver in script.js)
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.from-left { transform: translateX(-40px) translateY(0); }
.reveal.from-right { transform: translateX(40px) translateY(0); }

.reveal.in-view {
  opacity: 1;
  transform: translate(0, 0);
}

/* ==========================================================================
   1. HERO
   ========================================================================== */
.hero { position: relative; z-index: 2; }

.hero-inner { max-width: 720px; z-index: 3; position: relative; }

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.08;
  margin: 0 0 1.75rem;
  letter-spacing: -0.01em;
}

.accent-word {
  background: linear-gradient(100deg, var(--pink-glow), var(--violet-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 460px;
  margin: 0 auto 2.5rem;
}

.hero-tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--pink-glow);
}

.heart-mark { display: inline-block; }

.scroll-hint {
  margin-top: 4rem;
  width: 24px;
  height: 40px;
  border: 1.5px solid rgba(244, 238, 249, 0.25);
  border-radius: 14px;
  position: relative;
  margin-left: auto;
  margin-right: auto;
}
.scroll-hint span {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 8px;
  background: var(--pink-glow);
  border-radius: 3px;
  transform: translateX(-50%);
  animation: scrollDot 1.8s ease-in-out infinite;
}
@keyframes scrollDot {
  0% { top: 6px; opacity: 1; }
  70% { top: 20px; opacity: 0; }
  100% { top: 20px; opacity: 0; }
}

.floating-words {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.floating-words span {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  color: rgba(203, 185, 221, 0.28);
  font-size: 1.1rem;
  white-space: nowrap;
  animation: driftWord 14s ease-in-out infinite;
}
/* Scatter each floating word to a distinct starting position */
.floating-words span:nth-child(1) { top: 12%; left: 8%; animation-duration: 16s; }
.floating-words span:nth-child(2) { top: 22%; right: 10%; animation-duration: 13s; }
.floating-words span:nth-child(3) { top: 65%; left: 12%; animation-duration: 18s; }
.floating-words span:nth-child(4) { top: 78%; right: 14%; animation-duration: 15s; }
.floating-words span:nth-child(5) { top: 40%; left: 4%; animation-duration: 12s; }
.floating-words span:nth-child(6) { top: 50%; right: 6%; animation-duration: 17s; }
.floating-words span:nth-child(7) { top: 85%; left: 45%; animation-duration: 11s; font-size: 1.6rem; color: rgba(255, 95, 162, 0.3); }

@keyframes driftWord {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.5; }
  50% { transform: translateY(-18px) translateX(8px); opacity: 0.9; }
}

.floating-words-small span { font-size: 0.95rem; }
.floating-words-finale span {
  font-size: 2rem;
  color: rgba(255, 95, 162, 0.25);
}

/* ==========================================================================
   2 & 4. CHAPTER SECTIONS (HIM / HER)
   ========================================================================== */
.chapter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: 1000px;
  width: 100%;
}
.chapter-grid.reverse { direction: rtl; }
.chapter-grid.reverse > * { direction: ltr; }

.chapter-photo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

.chapter-photo {
  display: block; /* img default is inline; block avoids a stray baseline gap */
  width: 100%;
  max-width: 340px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
  transform: rotate(-2deg);
  transition: transform 0.5s var(--ease);
}
.chapter-photo-wrap:hover .chapter-photo { transform: rotate(0deg) scale(1.02); }

.photo-glow {
  position: absolute;
  inset: -20px;
  z-index: -1;
  background: radial-gradient(circle, rgba(255, 95, 162, 0.25), transparent 70%);
  filter: blur(30px);
  opacity: 0;
  transition: opacity 1s var(--ease);
}
.reveal.in-view .photo-glow { opacity: 1; }

.chapter-text { text-align: left; }
.chapter-number {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0 0 0.5rem;
}
.chapter-title {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin: 0 0 0.25rem;
  font-style: italic;
}
.chapter-sub {
  color: var(--pink-glow);
  font-size: 1.1rem;
  margin: 0 0 1.5rem;
}
.chapter-narration {
  color: var(--text-soft);
  font-size: 1.05rem;
  max-width: 380px;
}

/* ==========================================================================
   3. TRANSITION
   ========================================================================== */
.transition { background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(26, 15, 46, 0.6), transparent); }
.transition-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6rem;
  color: var(--text-soft);
  margin: 0.5rem 0;
}
.transition-big {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  color: var(--pink-glow);
}
.tiny-glow {
  width: 60px;
  height: 60px;
  margin: 2rem auto 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 95, 162, 0.5), transparent 70%);
  filter: blur(10px);
  animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* ==========================================================================
   5. SUSPICION
   ========================================================================== */
.suspicion-inner { max-width: 640px; position: relative; z-index: 2; }
.suspicion-line {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.25;
  margin: 0;
}
.suspicion-question {
  color: var(--pink-glow);
  font-style: italic;
  margin-top: 1.5rem;
}
.suspicion-pause { height: 2rem; }

/* ==========================================================================
   6. TWO PHOTOS MEET
   ========================================================================== */
.meet-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 3rem;
}
.meet-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  margin-bottom: 3rem;
}
.meet-photo {
  display: block; /* img default is inline; block avoids a stray baseline gap */
  width: 38vw;
  max-width: 260px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.1s linear;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
}
.meet-photo-a { transform: translateX(0); }
.meet-photo-b { transform: translateX(0); }
.meet-heart {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 2.5rem;
  color: var(--pink-glow);
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 3;
}
.meet-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(255, 95, 162, 0.3), transparent 65%);
  filter: blur(40px);
  opacity: 0;
  transition: opacity 0.8s ease;
}
.meet-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(2rem, 5vw, 3rem);
}

/* ==========================================================================
   7. CLASS REACTION
   ========================================================================== */
.reaction-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  margin-bottom: 3rem;
}
.reaction-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  max-width: 800px;
}
.reaction-card {
  padding: 1rem 1.5rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 1rem;
  color: var(--text-soft);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reaction-card.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.reaction-card-big {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--pink-glow);
  background: rgba(255, 95, 162, 0.08);
  border-color: rgba(255, 95, 162, 0.25);
}

/* ==========================================================================
   8. GALLERY / POLAROIDS
   ========================================================================== */
.gallery-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--text-soft);
  margin-bottom: 3rem;
}
.polaroid-row {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.polaroid {
  background: #f4eef9;
  padding: 1rem 1rem 1.5rem;
  border-radius: 3px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.4s var(--ease);
  width: 220px;
}
.polaroid:hover { transform: rotate(0deg) translateY(-6px); }
.polaroid .chapter-photo {
  max-width: 100%;
  width: 100%;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  aspect-ratio: 1/1;
}
.polaroid-caption {
  font-family: var(--serif);
  font-style: italic;
  color: #1a0f2e;
  text-align: center;
  margin: 0.75rem 0 0;
  font-size: 1rem;
}

/* ==========================================================================
   9. THE WHOLE CLASS IS WAITING
   ========================================================================== */
.waiting-line {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  color: var(--text-soft);
  margin: 0.3rem 0;
}
.waiting-letters {
  display: flex;
  gap: 1rem;
  margin: 2.5rem 0;
}
.waiting-letters span {
  font-family: var(--serif);
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 700;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  background: linear-gradient(160deg, var(--pink-glow), var(--violet-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.waiting-letters span.in-view {
  opacity: 1;
  transform: translateY(0);
}
.waiting-final {
  font-family: var(--serif);
  font-style: italic;
  color: var(--pink-glow);
  font-size: 1.4rem;
}

/* ==========================================================================
   10. FINALE
   ========================================================================== */
.finale {
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(58, 31, 92, 0.4), var(--bg-black) 75%);
  min-height: 100vh;
}
.finale-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(3rem, 12vw, 7rem);
  line-height: 1;
  background: linear-gradient(120deg, var(--pink-glow), var(--violet-glow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 2.5rem;
  z-index: 2;
  position: relative;
}
.finale-btn {
  font-family: var(--sans);
  font-size: 1rem;
  padding: 1rem 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 95, 162, 0.4);
  background: rgba(255, 95, 162, 0.08);
  color: var(--text-main);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
  z-index: 2;
  position: relative;
}
.finale-btn:hover {
  background: rgba(255, 95, 162, 0.18);
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 95, 162, 0.35);
}
.finale-btn:focus-visible,
.replay-btn:focus-visible,
button:focus-visible {
  outline: 2px solid var(--pink-glow);
  outline-offset: 3px;
}

.finale-typing {
  margin-top: 2rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--text-soft);
  min-height: 3.5rem;
  max-width: 500px;
  z-index: 2;
  position: relative;
  white-space: pre-wrap;
}

.replay-btn {
  margin-top: 3rem;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  z-index: 2;
  position: relative;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.replay-btn.visible {
  opacity: 1;
  pointer-events: auto;
}
.replay-btn:hover { color: var(--pink-glow); }

/* ==========================================================================
   RESPONSIVE — MOBILE
   ========================================================================== */
@media (max-width: 760px) {
  .section { padding: 5rem 1.25rem; }

  .chapter-grid,
  .chapter-grid.reverse {
    grid-template-columns: 1fr;
    direction: ltr;
    gap: 2.5rem;
  }
  .chapter-text { text-align: center; }
  .chapter-narration { margin: 0 auto; }

  .meet-stage { gap: 0.75rem; }
  .meet-photo { width: 42vw; }

  .polaroid-row { gap: 1.5rem; }
  .polaroid { width: 44vw; min-width: 150px; }

  .waiting-letters { gap: 0.5rem; }

  .floating-words span { font-size: 0.85rem; }
}
