/* ==========================================================================
   Layout: LoveFlix — streaming-app title card hero, horizontal poster-row
   gallery, vertical "episode list" story with outlined episode numbers,
   left-accented letter card. Built for the dark/crimson loveflix theme.
   ========================================================================== */

/* ---------- Hero ---------- */
.hero-loveflix {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding: 0 7vw 110px;
  background-color: var(--choco-light);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.hero-loveflix .hero-chip {
  position: absolute;
  top: 28px; right: 28px;
  z-index: 3;
  width: 60px; height: 60px;
}
.hero-loveflix .hero-chip .chip-heart { font-size: 24px; }

.hero-loveflix-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--choco-overlay) 12%, transparent 68%),
    linear-gradient(0deg, var(--cream) 8%, transparent 48%);
  z-index: 1;
}

.hero-loveflix-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
  text-align: left;
}

.flix-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rose-bright);
  background: var(--rose-tint);
  border: 1px solid var(--rose-shadow);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
  animation: fadeUp 1s var(--ease) 0.1s both;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 1rem;
  color: var(--choco-soft);
  margin-bottom: 10px;
  animation: fadeUp 1s var(--ease) 0.2s both;
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  line-height: 1.02;
  color: var(--choco);
  animation: fadeUp 1s var(--ease) 0.35s both;
}
.hero-title .accent {
  color: var(--rose);
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: initial;
}

.flix-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--choco-soft);
  animation: fadeUp 1s var(--ease) 0.45s both;
}
.flix-meta-match { color: #4ADE80; font-weight: 700; }
.flix-tag {
  border: 1px solid var(--gold-line-strong);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: var(--gold-bright);
}

.hero-greet {
  margin-top: 20px;
  min-height: 2.6em;
  max-width: 560px;
  white-space: pre-line;
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-style: normal;
  color: var(--choco-soft);
  line-height: 1.6;
}
.hero-greet::after { content: "▌"; color: var(--rose); animation: blink 1s step-end infinite; }

.hero-ornament {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 0.85rem;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
  animation: floaty 3s ease-in-out infinite;
}

/* ---------- Section common: left-aligned "row" headers ---------- */
section, footer { padding: 96px 7vw; }

.section-title {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  text-align: left;
  color: var(--choco);
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 18px;
  position: relative;
}
.section-title::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 5px;
  border-radius: 3px;
  background: var(--rose);
}
.section-title::after { content: none; }
.section-sub {
  text-align: left;
  font-style: normal;
  font-family: var(--font-body);
  color: var(--choco-soft);
  margin: 8px auto 40px;
  max-width: 1100px;
  padding-left: 18px;
  font-size: 0.95rem;
}

/* ---------- Gallery: horizontal poster row ---------- */
.gallery-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 4px 20px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.g-item {
  position: relative;
  flex: 0 0 200px;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-paper);
  cursor: pointer;
  scroll-snap-align: start;
  animation: fadeUp 0.8s var(--ease) both;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.g-item:hover { transform: translateY(-6px) scale(1.035); box-shadow: 0 20px 40px var(--rose-shadow); }
.g-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.g-item:hover img { transform: scale(1.06); }

.g-item::before {
  content: "\f004";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  color: var(--rose-bright);
  background: rgba(0, 0, 0, 0.55);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.85rem;
}

.g-item figcaption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 30px 12px 10px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--choco);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.g-item:hover figcaption { opacity: 1; transform: none; }

/* ---------- Story: vertical episode list ---------- */
.story-chapters {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.story-chapter {
  counter-increment: ep;
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 20px;
  align-items: start;
  padding: 24px 12px;
  border-bottom: 1px solid var(--gold-line);
  transition: background 0.3s var(--ease);
}
.story-chapters { counter-reset: ep; }
.story-chapter:hover { background: rgba(255, 255, 255, 0.03); }
.story-chapter.reveal { transform: translateY(20px); }
.story-chapter::before {
  grid-column: 1;
  content: counter(ep, decimal-leading-zero);
  font-family: var(--font-heading);
  font-size: 2.2rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--gold-line-strong);
}

.ch-body { grid-column: 2; }

.ch-year {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose-bright);
  background: var(--rose-tint);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.ch-title {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 1.15rem;
  color: var(--choco);
  margin-bottom: 8px;
}
.ch-text { color: var(--choco-soft); font-size: 0.98rem; font-family: var(--font-body); }
.ch-ornament { display: none; }

/* ---------- Letter: left-accented card ---------- */
.letter-card {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  background: var(--white);
  border-left: 4px solid var(--rose);
  border-radius: 4px;
  padding: 50px 42px 46px;
  box-shadow: var(--shadow-paper);
}
.letter-card::before { display: none; }

.letter-wax {
  position: absolute;
  top: -24px; left: 40px;
  width: 54px; height: 54px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--rose-bright), var(--rose-deep));
  color: var(--choco);
  font-size: 22px;
  box-shadow: 0 10px 24px var(--rose-shadow);
}

.letter-content {
  font-family: var(--font-body);
  font-size: clamp(1.02rem, 2vw, 1.18rem);
  color: var(--choco);
  white-space: pre-line;
  min-height: 6em;
  line-height: 1.75;
}
.letter-sign {
  margin-top: 32px;
  text-align: right;
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 1.05rem;
  color: var(--rose-bright);
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  border-top: 1px solid var(--gold-line);
  padding-bottom: 120px;
}
.footer-main {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  color: var(--choco);
  margin-bottom: 10px;
}
.footer-sub { font-family: var(--font-body); color: var(--choco-soft); }
.footer-branding { margin-top: 22px; font-size: 0.78rem; color: var(--choco-soft); opacity: 0.7; font-family: var(--font-body); }
.footer-branding a { color: var(--rose-bright); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  section { padding: 68px 20px; }
  /* Keep extra bottom clearance so the fixed music-toggle button (bottom:22px,
     54px tall) never overlaps the centered branding line. */
  footer { padding: 68px 20px 100px; }
  /* Extra bottom room + a capped ornament width so the fixed music-toggle
     button (bottom-right) never sits on top of the hero's bottom-aligned text. */
  .hero-loveflix { padding: 110px 6vw 100px; }
  .hero-loveflix-content { max-width: 100%; }
  .hero-ornament { max-width: calc(100% - 70px); }
  .flix-meta { font-size: 0.85rem; }
  .story-chapter { grid-template-columns: 50px 1fr; padding: 20px 8px; gap: 14px; }
  .story-chapter::before { font-size: 1.6rem; }
}
@media (max-width: 560px) {
  .g-item { flex-basis: 150px; }
  .letter-card { padding: 44px 24px 38px; }
  .letter-wax { left: 24px; }
}

/* ==========================================================================
   STORIES MODE — mobile-only fullscreen slide deck (built by
   moment-stories.js). Sits above the normal page; that page's own boot
   never runs while this is active, so there's no double-init to worry about.
   ========================================================================== */
#stories-mode {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--cream);
}
#stories-mode.visible { display: block; }

.stories-progress {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 12px; right: 12px;
  z-index: 3;
  display: flex;
  gap: 5px;
}
.stories-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.stories-seg-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--choco);
}
@keyframes storiesFillAnim { from { width: 0%; } to { width: 100%; } }

.stories-viewport { position: absolute; inset: 0; }

.stories-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: var(--choco-light);
  background-size: cover;
  background-position: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.stories-slide.active { opacity: 1; pointer-events: auto; z-index: 1; }

.stories-slide-chapter,
.stories-slide-letter,
.stories-slide-outro {
  justify-content: center;
  background:
    radial-gradient(600px 500px at 50% 20%, var(--bg-glow-1), transparent 60%),
    var(--cream);
}

.stories-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--choco-overlay) 20%, transparent 60%);
}

.stories-content {
  position: relative;
  z-index: 2;
  padding: 24px 24px calc(env(safe-area-inset-bottom, 0px) + 40px);
  text-align: left;
}
.stories-content-chapter,
.stories-content-letter,
.stories-content-outro {
  text-align: center;
  padding: 24px 28px;
}

.stories-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose-bright);
  background: var(--rose-tint);
  border: 1px solid var(--rose-shadow);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.stories-eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--choco-soft);
  margin-bottom: 8px;
}
.stories-title {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(2.1rem, 10vw, 2.8rem);
  line-height: 1.05;
  color: var(--choco);
}
.stories-title .accent { color: var(--rose); }
.stories-sub {
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--choco-soft);
}

.stories-pill {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rose-bright);
  background: var(--rose-tint);
  border: 1px solid var(--rose-shadow);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.stories-caption {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--choco);
}

.stories-ep {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: transparent;
  -webkit-text-stroke: 1.2px var(--gold-line-strong);
  margin-bottom: 10px;
}
.stories-chapter-title {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 7vw, 2rem);
  color: var(--choco);
  margin: 6px 0 16px;
}
.stories-chapter-text {
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--choco-soft);
  max-height: 42vh;
  overflow-y: auto;
}

.stories-letter-badge {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--rose-bright), var(--rose-deep));
  color: var(--choco);
  font-size: 22px;
  box-shadow: 0 10px 24px var(--rose-shadow);
}
.stories-letter-text {
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--choco);
  white-space: pre-line;
  max-height: 44vh;
  overflow-y: auto;
  margin: 4px 0 16px;
}
.stories-letter-sign {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--rose-bright);
}

.stories-outro-main {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(1.3rem, 6vw, 1.7rem);
  color: var(--choco);
  margin-bottom: 10px;
}
.stories-outro-sub { font-family: var(--font-body); color: var(--choco-soft); margin-bottom: 26px; }
.stories-replay {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--choco);
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  padding: 12px 30px;
  border-radius: 999px;
  box-shadow: 0 12px 26px var(--rose-shadow);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.stories-outro-branding {
  margin-top: 26px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--choco-soft);
  opacity: 0.7;
}
