/* ============================================================
   OUR LITTLE STORY — Romantic Blush theme
   Single theme only. Mobile-first. No dark mode / theme switcher.
   ============================================================ */

:root {
  --bg: #FFF7F8;
  --primary: #E85D75;
  --secondary: #F4A6B8;
  --accent: #D94F70;
  --text: #4A2C35;
  --muted: #8B6871;
  --white: #FFFFFF;
  --soft-pink: #FFE4EA;

  --font-script: 'Great Vibes', 'Brush Script MT', cursive;
  --font-body: 'Poppins', 'Inter', Arial, sans-serif;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-soft: 0 10px 30px rgba(217, 79, 112, 0.14);
  --shadow-card: 0 6px 20px rgba(74, 44, 53, 0.08);
  --transition-soft: 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 8%, rgba(244, 166, 184, 0.25), transparent 45%),
                     radial-gradient(circle at 85% 92%, rgba(255, 228, 234, 0.6), transparent 50%);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

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

/* ---------------------------------------------------------------
   Typography
   --------------------------------------------------------------- */
.script-heading {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--accent);
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  line-height: 1.25;
  margin: 0.2em 0 0.5em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.6em;
}

.lead-text {
  font-size: clamp(1.05rem, 4.2vw, 1.3rem);
  color: var(--text);
  margin: 0 0 1.2em;
  white-space: pre-line;
}
.lead-text.small { font-size: 1rem; }

.muted-text {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  border: none;
  border-radius: 999px;
  padding: 0.9em 2em;
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--transition-soft), box-shadow var(--transition-soft), opacity var(--transition-soft);
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--white);
  box-shadow: var(--shadow-soft);
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--secondary);
}
.btn-secondary:active { transform: scale(0.97); background: var(--soft-pink); }

/* ---------------------------------------------------------------
   Layout shell
   --------------------------------------------------------------- */
.story-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 12vh 1.5rem 4rem;
  text-align: center;
}

.story-section {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 0;
  position: relative;
}
.story-section:nth-of-type(even) { background: linear-gradient(180deg, transparent, rgba(255, 228, 234, 0.35), transparent); }

/* Reveal-on-enter (loading/welcome/gate) */
.reveal { animation: revealIn 900ms var(--transition-soft) both; }
@keyframes revealIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scroll-triggered reveal (JS toggles .is-visible via IntersectionObserver) */
.scroll-reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  filter: blur(2px);
  transition: opacity 700ms var(--transition-soft), transform 700ms var(--transition-soft), filter 700ms var(--transition-soft);
}
.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* ---------------------------------------------------------------
   Loading screen
   --------------------------------------------------------------- */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
  transition: opacity 600ms ease;
}
.loading-screen.is-hiding { opacity: 0; pointer-events: none; }
.loading-heart {
  font-size: 2.6rem;
  animation: pulseHeart 1.1s ease-in-out infinite;
}
.loading-text {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
@keyframes pulseHeart {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* ---------------------------------------------------------------
   Welcome screen / Password gate (full-screen story-inner)
   --------------------------------------------------------------- */
.welcome-screen, .password-gate {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
}
.password-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 3rem 1.75rem;
  box-shadow: var(--shadow-card);
}
.password-icon { font-size: 2.4rem; margin-bottom: 0.6rem; }
.password-form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1.5rem; }
.password-form input {
  border: 1.5px solid var(--soft-pink);
  border-radius: 999px;
  padding: 0.85em 1.3em;
  font-size: 1rem;
  text-align: center;
  background: var(--bg);
  color: var(--text);
}
.password-form input:focus { border-color: var(--secondary); outline: none; }
.form-error { color: var(--accent); font-size: 0.85rem; margin: 0; }

/* ---------------------------------------------------------------
   Progress indicator
   --------------------------------------------------------------- */
.progress-indicator {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  padding: 0;
}
.progress-track {
  height: 3px;
  background: rgba(244, 166, 184, 0.25);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 150ms linear;
}

/* ---------------------------------------------------------------
   PWA install button
   --------------------------------------------------------------- */
.pwa-install-btn {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 55;
  background: var(--white);
  color: var(--accent);
  border: 1.5px solid var(--secondary);
  border-radius: 999px;
  padding: 0.7em 1.3em;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-card);
}
.pwa-install-btn[hidden] { display: none; }

/* ---------------------------------------------------------------
   Floating music button
   --------------------------------------------------------------- */
.music-fab {
  position: fixed;
  right: 1rem;
  bottom: 1.1rem;
  z-index: 55;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-card);
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--soft-pink);
}
.music-fab[hidden] { display: none; }
.music-fab.is-playing { animation: pulseHeart 1.6s ease-in-out infinite; }

/* ---------------------------------------------------------------
   Countdown
   --------------------------------------------------------------- */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 1.5rem 0 2rem;
}
.countdown-unit {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.3rem;
  box-shadow: var(--shadow-card);
}
.countdown-value {
  display: block;
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.countdown-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.2rem;
}
.countdown-complete { color: var(--accent); }

/* ---------------------------------------------------------------
   Envelope
   --------------------------------------------------------------- */
.envelope {
  width: 220px;
  height: 150px;
  margin: 1.5rem auto;
  position: relative;
  background: none;
  border: none;
  padding: 0;
}
.envelope-body {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.envelope-icon { font-size: 2.2rem; }
.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 700ms var(--transition-soft);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.envelope.is-open .envelope-flap { transform: rotateX(180deg); }
.envelope.is-open .envelope-body { animation: envelopeShake 500ms ease; }
@keyframes envelopeShake {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------------------------------------------------------------
   Letter
   --------------------------------------------------------------- */
.letter-paper {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-card);
  text-align: left;
  margin: 1.5rem 0 2rem;
}
.letter-line {
  margin: 0 0 1em;
  color: var(--text);
  white-space: pre-line;
}
.letter-line:last-child { margin-bottom: 0; }
.letter-paper[data-animation="typewriter"] .letter-line.is-typing::after {
  content: '|';
  animation: blinkCursor 800ms steps(1) infinite;
  color: var(--accent);
}
@keyframes blinkCursor { 50% { opacity: 0; } }

/* ---------------------------------------------------------------
   Memories
   --------------------------------------------------------------- */
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  margin: 1.5rem 0 2rem;
  text-align: left;
}
.memory-card {
  margin: 0;
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.memory-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.memory-placeholder {
  width: 100%; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--soft-pink), var(--secondary));
}
.memory-card figcaption { padding: 1rem 1.1rem; }
.memory-caption { margin: 0 0 0.35em; color: var(--text); font-style: italic; }
.memory-meta { margin: 0; font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------
   Timeline
   --------------------------------------------------------------- */
.timeline {
  list-style: none;
  margin: 1.5rem 0 2rem;
  padding: 0 0 0 1.6rem;
  border-left: 2px solid var(--soft-pink);
  text-align: left;
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -1.98rem;
  top: 0.3rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--soft-pink);
}
.timeline-image {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 0.6rem;
}
.timeline-title { font-weight: 700; color: var(--accent); margin: 0 0 0.3em; font-size: 1.15rem; }
.timeline-desc { margin: 0; color: var(--text); white-space: pre-line; }

/* ---------------------------------------------------------------
   Love counter
   --------------------------------------------------------------- */
.love-counter-number {
  font-size: clamp(3rem, 16vw, 4.5rem);
  font-weight: 700;
  color: var(--accent);
  margin: 0.1em 0;
  line-height: 1;
}
.love-counter-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.8rem; }

/* ---------------------------------------------------------------
   Love notes carousel
   --------------------------------------------------------------- */
.love-notes-carousel {
  position: relative;
  min-height: 190px;
  margin: 1.5rem 0 2rem;
}
.love-note {
  position: absolute; inset: 0;
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity 450ms var(--transition-soft), transform 450ms var(--transition-soft);
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 1.8rem 1.4rem;
  display: flex; flex-direction: column; justify-content: center;
}
.love-note.is-active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.love-note-number {
  font-family: var(--font-script);
  font-size: 2rem;
  color: var(--secondary);
  margin: 0 0 0.2em;
}
.love-note-title { font-size: 1.2rem; font-weight: 600; color: var(--accent); margin: 0 0 0.3em; }
.love-note-desc { color: var(--muted); margin: 0; font-size: 0.92rem; }

/* ---------------------------------------------------------------
   Gallery + Lightbox
   --------------------------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 1.5rem 0 2rem;
}
.gallery-item {
  border: none; padding: 0; background: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1/1;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms ease; }
.gallery-item:active img { transform: scale(0.96); }
.gallery-item-wide { grid-column: 1 / -1; aspect-ratio: 16/10; }

.lightbox {
  position: fixed; inset: 0;
  background: rgba(74, 44, 53, 0.92);
  z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.lightbox[hidden] { display: none; }
.lightbox-image { max-width: 100%; max-height: 72vh; border-radius: var(--radius-sm); }
.lightbox-caption { color: var(--white); margin-top: 1rem; text-align: center; font-size: 0.9rem; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 42px; height: 42px;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close { top: 1.2rem; right: 1.2rem; }
.lightbox-prev { left: 0.8rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 0.8rem; top: 50%; transform: translateY(-50%); }

/* ---------------------------------------------------------------
   Song player
   --------------------------------------------------------------- */
.song-player {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-card);
  margin: 1.5rem 0 2rem;
}
.song-note { font-size: 2rem; animation: pulseHeart 2s ease-in-out infinite; }
.song-title { font-weight: 600; color: var(--accent); margin: 0.4em 0 1em; }
.song-play-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.8em 1.6em;
  font-weight: 600;
}
.song-progress {
  height: 4px;
  background: var(--soft-pink);
  border-radius: 999px;
  margin-top: 1.4rem;
  overflow: hidden;
}
.song-progress-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  transition: width 200ms linear;
}

/* ---------------------------------------------------------------
   Question
   --------------------------------------------------------------- */
.question-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.5rem;
}

/* ---------------------------------------------------------------
   Final surprise
   --------------------------------------------------------------- */
.final-photo {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius-lg);
  margin: 0 auto 1.5rem;
  box-shadow: var(--shadow-soft);
}
.final-letter {
  text-align: left;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.8rem 1.4rem;
  box-shadow: var(--shadow-card);
  white-space: pre-line;
  margin-bottom: 1rem;
}
.final-signature { color: var(--muted); font-style: italic; }
.share-row { margin-top: 1.5rem; }

/* ---------------------------------------------------------------
   Floating background effects (hearts / sparkles / confetti)
   Injected as absolutely-positioned elements by animations.js
   --------------------------------------------------------------- */
.fx-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 90;
  overflow: hidden;
}
.fx-heart, .fx-sparkle, .fx-confetti {
  position: absolute;
  will-change: transform, opacity;
}
.fx-heart { font-size: 1.4rem; animation: floatUp linear forwards; opacity: 0.85; }
.fx-sparkle { font-size: 1rem; animation: floatUp linear forwards; opacity: 0.7; }
.fx-confetti {
  width: 8px; height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.9; }
  100% { transform: translateY(-100vh) rotate(20deg); opacity: 0; }
}
@keyframes confettiFall {
  0%   { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0.9; }
}

/* ---------------------------------------------------------------
   Error pages
   --------------------------------------------------------------- */
.error-screen {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 2rem;
}
.error-icon { font-size: 2.6rem; margin-bottom: 0.6rem; }

/* ---------------------------------------------------------------
   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;
  }
}

html { scroll-behavior: smooth; }

/* ---------------------------------------------------------------
   Responsive: tablet & desktop enhancements
   --------------------------------------------------------------- */
@media (min-width: 768px) {
  .story-inner { max-width: 620px; }
  .memory-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .story-inner { max-width: 900px; padding-top: 14vh; }
  .script-heading { font-size: clamp(3rem, 5vw, 4.2rem); }
  .letter-paper, .final-letter { padding: 2.6rem 3rem; }
}

@media (min-width: 1366px) {
  .story-inner { max-width: 1000px; }
}
