/* ================================================================
   MY JOURNEY — a film played one chapter at a time
   The stage holds every scene stacked fullscreen; exactly one is
   on screen. main.js flips state classes; ALL motion lives here.
   Shared tokens keep every chapter part of the same film.
   ================================================================ */

/* ---------- design tokens ---------- */
:root {
  --bg: #000000;                       /* the dark of the theatre    */
  --ink: #f4f1ea;                      /* warm off-white titles      */
  --ink-dim: rgba(244, 241, 234, .55); /* supporting lines           */
  --accent: #f58220;                   /* the life-line (brand warm) */
  --accent-soft: rgba(245, 130, 32, .45);
  --font-display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --ease-cinema: cubic-bezier(.22, 1, .36, 1);  /* slow, confident settle */
  --scene-shift: 7vh;                  /* how far scenes drift when swapping */
}

/* ---------- base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;                    /* the film, not the page, moves */
  overscroll-behavior: none;
  height: 100vh;
  height: 100svh;
}

/* ================================================================
   THE STAGE — scene switching mechanics
   Every scene is fullscreen and stacked. State classes:
     .is-active  on screen
     .is-past    already lived (parked above)
     (neither)   still to come (parked below)
   ================================================================ */

/* the cosmos: one living particle field behind the whole film */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.stage { position: fixed; inset: 0; z-index: 1; }

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  /* waiting below: out of focus, slightly oversized — a lens racking in */
  opacity: 0;
  visibility: hidden;
  transform: translateY(var(--scene-shift)) scale(1.05);
  filter: blur(14px);
  transition:
    opacity 1.05s var(--ease-cinema),
    transform 1.05s var(--ease-cinema),
    filter 1.05s var(--ease-cinema),
    visibility 0s linear 1.05s;
}
.scene.is-past {                       /* already lived: shrinks away above */
  transform: translateY(calc(var(--scene-shift) * -1)) scale(.96);
}
.scene.is-active {                     /* on screen, in focus */
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition:
    opacity 1.05s var(--ease-cinema),
    transform 1.05s var(--ease-cinema),
    filter 1.05s var(--ease-cinema),
    visibility 0s;
}

/* ---------- the projector: grain + vignette over the whole film ---------- */
.film-grain {
  position: fixed;
  inset: -60px;
  z-index: 5;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainJump .9s steps(3) infinite;
}
@keyframes grainJump {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-22px, 14px); }
  66%  { transform: translate(16px, -20px); }
  100% { transform: translate(0, 0); }
}
.film-vignette {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse 88% 82% at 50% 48%, transparent 58%, rgba(0, 0, 0, .42));
}

/* ---------- the glows breathe: every scene wash slowly drifts ---------- */
.scene--childhood::before, .scene--school::before, .scene--move::before,
.scene--agarwal::before, .scene--drop::before, .scene--mits::before {
  animation: glowDrift 18s ease-in-out infinite alternate;
}
@keyframes glowDrift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 3%, 0) scale(1.18); }
}

/* ---------- parallax depth: layers drift with the cursor ---------- */
.chapter-body, .birth-stage {
  transform: translate3d(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -10px), 0);
  transition: transform .9s cubic-bezier(.2, .8, .2, 1);
}
.ambient {
  transform: translate3d(calc(var(--mx, 0) * 12px), calc(var(--my, 0) * 9px), 0);
  transition: transform 1.3s cubic-bezier(.2, .8, .2, 1);
}

/* ================================================================
   THE BACKBONE — journey rail (right edge)
   ================================================================ */

.rail {
  position: fixed;
  right: clamp(14px, 3vw, 34px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 10;
}
.rail-track, .rail-fill {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-.5px);
}
.rail-track { background: rgba(244, 241, 234, .12); }
.rail-fill {
  background: linear-gradient(180deg, var(--accent), #ffd9ad);
  box-shadow: 0 0 10px var(--accent-soft);
  transform-origin: top;
  transform: translateX(-.5px) scaleY(0);
  transition: transform 1s var(--ease-cinema);
}
.rail-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, .35);
  background: var(--bg);
  cursor: pointer;
  padding: 0;
  transition: border-color .5s, background .5s, box-shadow .5s, transform .5s;
}
.rail-dot:hover { border-color: var(--ink); transform: scale(1.25); }
.rail-dot.is-lit {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-soft);
}
/* "you are here": the current chapter's dot sends out rings */
.rail-dot.is-now::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: dotPing 2.4s ease-out infinite;
}
@keyframes dotPing {
  0%   { transform: scale(1);    opacity: .8; }
  70%  { transform: scale(2.6);  opacity: 0; }
  100% { transform: scale(2.6);  opacity: 0; }
}

/* ---------- the exit (top-left): back to the main site ---------- */
.exit {
  position: fixed;
  top: clamp(16px, 3vh, 28px);
  left: clamp(16px, 3vw, 34px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(244, 241, 234, .18);
  background: rgba(0, 0, 0, .35);
  color: rgba(244, 241, 234, .55);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 10.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  z-index: 10;
  transition: color .4s, border-color .4s, box-shadow .4s;
}
.exit:hover {
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-soft);
}

/* ---------- chapter caption (bottom-left) ---------- */
.caption {
  position: fixed;
  left: clamp(18px, 4vw, 44px);
  bottom: clamp(18px, 4vh, 36px);
  display: flex;
  align-items: baseline;
  gap: 14px;
  z-index: 10;
  opacity: 0;
  transition: opacity 1s var(--ease-cinema);
}
.caption.is-on { opacity: 1; }
.caption-number {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: .3em;
  color: var(--accent);
}
.caption-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 13px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .5);
}

/* ---------- interaction hint (bottom-center) ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: clamp(18px, 4vh, 36px);
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .35);
  z-index: 10;
  opacity: 0;
  transition: opacity 1.2s var(--ease-cinema);
  animation: hintBreathe 3.2s ease-in-out infinite;
}
.hint.is-on { opacity: 1; }
.hint.is-off { opacity: 0; animation: none; }
@keyframes hintBreathe { 50% { color: rgba(244, 241, 234, .6); } }

/* ================================================================
   SCENE 1 — BIRTH
   Atmosphere: a universe before a life — drifting stars, then
   a single point of warmth.
   ================================================================ */

/* two star layers, different depths, twinkling and drifting */
.stars, .stars--far {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  opacity: 0;
  animation: starsIn 3s ease-out .3s forwards, starsDrift 160s linear infinite;
}
.stars {
  background-image:
    radial-gradient(1.3px 1.3px at 22px 34px, rgba(244,241,234,.8), transparent),
    radial-gradient(1px 1px at 130px 90px, rgba(244,241,234,.55), transparent),
    radial-gradient(1.4px 1.4px at 200px 160px, rgba(255,217,173,.7), transparent),
    radial-gradient(1px 1px at 80px 200px, rgba(244,241,234,.45), transparent);
  background-size: 260px 260px;
}
.stars--far {
  background-image:
    radial-gradient(1px 1px at 60px 40px, rgba(244,241,234,.35), transparent),
    radial-gradient(.9px .9px at 170px 130px, rgba(244,241,234,.3), transparent),
    radial-gradient(1px 1px at 40px 180px, rgba(255,217,173,.28), transparent);
  background-size: 210px 210px;
  animation-duration: 3s, 240s;
}
@keyframes starsIn { to { opacity: 1; } }
@keyframes starsDrift { to { background-position: 520px 260px; } }

.birth-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* --- STEP 1 · the date --- */
.birth-date {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(34px, 6vw, 64px);
  letter-spacing: .14em;
  color: var(--ink);
  opacity: 0;
}
.scene--birth.play-date .birth-date {
  animation: birthFadeIn 1.2s var(--ease-cinema) forwards;
}
@keyframes birthFadeIn {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: 1; filter: blur(0); }
}

/* --- STEP 2 · the birthplace rises --- */
.birth-place {
  margin-top: 28px;
  font-weight: 300;
  font-size: clamp(15px, 2.2vw, 20px);
  line-height: 1.7;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  opacity: 0;
  transform: translateY(26px);
}
.scene--birth.play-place .birth-place {
  animation: birthRise 1.1s var(--ease-cinema) forwards;
}
@keyframes birthRise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- STEP 3 · the timeline is born --- */
.birth-line {
  margin-top: 44px;
  width: min(400px, 78vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 18%, #ffd9ad 50%, var(--accent) 82%, transparent);
  box-shadow: 0 0 14px var(--accent-soft), 0 0 42px rgba(245, 130, 32, .18);
  transform: scaleX(0);
  transform-origin: center;
}
.scene--birth.play-line .birth-line {
  animation: birthLineGrow 1.5s var(--ease-cinema) forwards;
}
@keyframes birthLineGrow {
  from { transform: scaleX(0); opacity: .4; }
  60%  { opacity: 1; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* --- STEP 4 · the whisper --- */
.birth-whisper {
  margin-top: 34px;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(14px, 1.8vw, 17px);
  letter-spacing: .08em;
  color: var(--ink-dim);
  min-height: 1.6em;
  opacity: 0;
}
.scene--birth.play-whisper .birth-whisper { opacity: 1; }

.caret {
  display: inline-block;
  width: 1px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--ink-dim);
  opacity: 0;
}
.scene--birth.play-whisper .caret {
  opacity: 1;
  animation: caretBlink 1.1s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }

/* ================================================================
   SHARED CHAPTER PIECES (Chapter 2 onward)
   ================================================================ */

/* ambient dust motes (transform + opacity only) */
.ambient { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.mote {
  position: absolute;
  bottom: -2vh;
  left: var(--x);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffd9ad;
  opacity: 0;
  animation: moteRise var(--dur) linear var(--delay) infinite;
}
.mote--chalk { background: #f4f1ea; }
@keyframes moteRise {
  0%   { transform: translate3d(0, 0, 0) scale(.7);       opacity: 0; }
  12%  { opacity: .28; }
  55%  { transform: translate3d(14px, -55vh, 0) scale(1);  opacity: .18; }
  100% { transform: translate3d(-10px, -110vh, 0) scale(.6); opacity: 0; }
}

/* chapter reveal: rises softly when its scene takes the stage */
.ch-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.1s var(--ease-cinema) var(--d, 0s),
              transform 1.1s var(--ease-cinema) var(--d, 0s);
}
.ch-reveal.in { opacity: 1; transform: translateY(0); }

/* titles land with a tracking-in: wide, blurred, contracting into place */
.chapter-title.ch-reveal {
  letter-spacing: .55em;
  filter: blur(8px);
  transition: opacity 1.5s var(--ease-cinema) var(--d, 0s),
              transform 1.5s var(--ease-cinema) var(--d, 0s),
              letter-spacing 1.5s var(--ease-cinema) var(--d, 0s),
              filter 1.5s var(--ease-cinema) var(--d, 0s);
}
.chapter-title.ch-reveal.in { letter-spacing: .26em; filter: blur(0); }

/* ghost years arrive from an oversized blur and rack into focus */
.chapter-year.ch-reveal {
  transform: translateY(30px) scale(1.18);
  filter: blur(12px);
  transition: opacity 1.6s var(--ease-cinema) var(--d, 0s),
              transform 1.6s var(--ease-cinema) var(--d, 0s),
              filter 1.6s var(--ease-cinema) var(--d, 0s);
}
.chapter-year.ch-reveal.in { transform: translateY(0) scale(1); filter: blur(0); }

.chapter-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
}

.chapter-circa {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: .5em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .35);
  margin-bottom: 6px;
}

/* the big words carry the website's living gradient */
.chapter-year {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(64px, 12vw, 130px);
  line-height: 1;
  letter-spacing: .04em;
  background: linear-gradient(90deg, var(--ink), var(--accent), var(--ink));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradientShift 4s ease-in-out infinite;
}

.chapter-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: .26em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--ink), var(--accent), var(--ink));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0 center; }
  50%      { background-position: 100% center; }
}

.chapter-text {
  margin-top: 20px;
  font-weight: 300;
  font-size: clamp(14.5px, 1.8vw, 17px);
  line-height: 1.85;
  color: var(--ink-dim);
  max-width: 52ch;
}

/* ================================================================
   SCENE 2 — CHILDHOOD
   ================================================================ */

.scene--childhood::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 45% at 50% 40%, rgba(245, 130, 32, .07), transparent 70%);
  pointer-events: none;
}

/* ================================================================
   SCENE 3 — MY FIRST SCHOOL
   ================================================================ */

.scene--school::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 65% 40% at 50% 42%, rgba(245, 130, 32, .06), transparent 70%);
  pointer-events: none;
}

/* photo + words sit side by side on wide screens, stacked on small */
.chapter-body--school {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  max-width: 980px;
}
.school-words {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 460px;
}

.school-meta {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.school-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(16px, 2.2vw, 20px);
  letter-spacing: .12em;
  color: var(--ink);
}
.school-facts {
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .45);
}

/* --- the memory card --- */
.memory-card {
  width: min(340px, 80vw);
  padding: 12px 12px 16px;
  background: rgba(244, 241, 234, .03);
  border: 1px solid rgba(244, 241, 234, .1);
  border-radius: 6px;
  rotate: 4deg;                          /* held mid-air… */
  transition: opacity 1.2s var(--ease-cinema) var(--d, 0s),
              transform 1.2s var(--ease-cinema) var(--d, 0s),
              rotate 1.2s var(--ease-cinema) var(--d, 0s);
}
.memory-card.in { rotate: 1.8deg; }      /* …then laid gently down */

.memory-photo { overflow: hidden; border-radius: 3px; }
.memory-card--photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 36vh;
  object-fit: cover;
  border-radius: 3px;
  /* undeveloped: soft and faded, like a memory not yet recalled */
  filter: blur(6px) saturate(.4) brightness(.8);
  transform: scale(1.08);
  transition: filter 1.8s var(--ease-cinema) .5s, transform 1.8s var(--ease-cinema) .5s;
}
.memory-card--photo.in img {
  filter: blur(0) saturate(.92) brightness(.96);
  transform: scale(1);
  animation: kenBurns 26s ease-in-out 2.6s infinite alternate;
}
@keyframes kenBurns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.06) translate(-1.5%, 1.2%); }
}

.memory-meta { margin-top: 12px; }
.memory-caption {
  font-style: italic;
  font-weight: 300;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: .04em;
}

/* ================================================================
   SCENE 4 — MOVING TO INDORE
   Atmosphere: open road at night; two cities, one travelling light.
   ================================================================ */

.scene--move::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 42% at 50% 55%, rgba(245, 130, 32, .06), transparent 70%);
  pointer-events: none;
}

.journey-road {
  margin-top: 46px;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.5vw, 24px);
  width: min(560px, 84vw);
}
.road-city {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(11px, 1.5vw, 13px);
  letter-spacing: .3em;
  text-transform: uppercase;
  white-space: nowrap;
}
.road-city--from { color: rgba(244, 241, 234, .4); }   /* the city left behind */
.road-city--to   { color: var(--ink); }                 /* the city ahead */

.road-line {
  position: relative;
  flex: 1;
  height: 1px;
  background: rgba(244, 241, 234, .12);
}
.road-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), #ffd9ad);
  box-shadow: 0 0 12px var(--accent-soft);
  transform: scaleX(0);
  transform-origin: left;
}
.road-traveller {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffd9ad;
  box-shadow: 0 0 14px var(--accent), 0 0 34px var(--accent-soft);
  transform: translate(-50%, -50%);
  opacity: 0;
}
/* the road is travelled once the element has revealed */
.journey-road.in .road-fill {
  animation: roadFill 2.4s var(--ease-cinema) .9s forwards;
}
.journey-road.in .road-traveller {
  animation: roadTravel 2.4s var(--ease-cinema) .9s forwards;
}
@keyframes roadFill { to { transform: scaleX(1); } }
@keyframes roadTravel {
  0%   { left: 0;    opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { left: 100%; opacity: 1; }
}
/* the destination wakes when the light arrives */
.journey-road.in .road-city--to {
  animation: cityArrive 1.2s var(--ease-cinema) 3.1s both;
}
@keyframes cityArrive {
  0%   { color: var(--ink); text-shadow: none; }
  40%  { color: #ffd9ad; text-shadow: 0 0 18px var(--accent), 0 0 40px var(--accent-soft); }
  100% { color: var(--ink); text-shadow: 0 0 10px var(--accent-soft); }
}

/* ================================================================
   SCENE 5 — AGARWAL PUBLIC SCHOOL
   Atmosphere: a bigger classroom; a scrapbook turning its own pages.
   ================================================================ */

.scene--agarwal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 65% 40% at 50% 42%, rgba(245, 130, 32, .06), transparent 70%);
  pointer-events: none;
}

/* --- scene layout: words + portrait above, filmstrip band below --- */
.agarwal-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4.5vh, 48px);
  width: 100%;
}
.agarwal-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(26px, 4.5vw, 60px);
  max-width: 980px;
}
.agarwal-top .chapter-body { max-width: 520px; }

/* the portrait: narrower card, tilted the other way */
.memory-card--portrait {
  width: min(220px, 60vw);
  rotate: -4.5deg;
}
.memory-card--portrait.in { rotate: -1.8deg; }
.memory-card--portrait img { max-height: 34vh; object-fit: cover; }

/* short screens: keep everything on one stage */
@media (max-height: 760px) {
  .memory-card--portrait img { max-height: 26vh; }
  .strip-item img { height: clamp(150px, 24vh, 220px); }
}

/* --- the filmstrip: memories drifting endlessly leftward --- */
.filmstrip {
  width: 100vw;
  overflow: hidden;
  /* the strip fades away at both edges, like film leaving the light */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.filmstrip-track {
  display: flex;
  width: max-content;
  animation: stripSlide 55s linear infinite;
  will-change: transform;
}
/* content is duplicated once, so -50% lands exactly on the seam */
@keyframes stripSlide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
/* a hand (or hover) on the strip stops time to read */
.filmstrip:hover .filmstrip-track { animation-play-state: paused; }
/* offstage chapters keep their film still */
.scene:not(.is-active) .filmstrip-track { animation-play-state: paused; }

.strip-item {
  margin-right: clamp(18px, 2.5vw, 30px);
  padding: 10px 10px 12px;
  background: rgba(244, 241, 234, .03);
  border: 1px solid rgba(244, 241, 234, .1);
  border-radius: 6px;
  flex-shrink: 0;
}
.strip-item img {
  display: block;
  height: clamp(170px, 28vh, 260px);
  width: auto;                 /* natural aspect — certificates stay readable */
  border-radius: 3px;
}
.strip-item figcaption {
  margin-top: 9px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .45);
}

/* ================================================================
   SCENE 6 — THE DROP YEAR
   Atmosphere: the coldest room in the film. The glow turns
   blue-grey and the dust falls instead of rising.
   ================================================================ */

.scene--drop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 45% at 50% 40%, rgba(140, 160, 200, .055), transparent 70%);
  pointer-events: none;
}

/* the days falling away — cold, slow, downward */
.mote--fall {
  top: -2vh;
  bottom: auto;
  background: #c9d4e8;
  animation: moteFall var(--dur) linear var(--delay) infinite;
}
@keyframes moteFall {
  0%   { transform: translate3d(0, 0, 0) scale(.7);        opacity: 0; }
  10%  { opacity: .22; }
  55%  { transform: translate3d(-10px, 55vh, 0) scale(1);  opacity: .15; }
  100% { transform: translate3d(8px, 110vh, 0) scale(.6);  opacity: 0; }
}

/* the antagonist gets wider spacing, same living gradient */
.chapter-year--dim { letter-spacing: .12em; }

/* the verdict — typed once the chapter takes the stage */
.drop-whisper {
  margin-top: 30px;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(13.5px, 1.7vw, 16px);
  letter-spacing: .08em;
  color: var(--ink-dim);
  min-height: 1.6em;
  opacity: 0;
  transition: opacity .8s var(--ease-cinema);
}
.scene--drop.play-whisper .drop-whisper { opacity: 1; }
.scene--drop.play-whisper .caret {
  opacity: 1;
  animation: caretBlink 1.1s steps(1) infinite;
}

/* ================================================================
   SCENE 7 — MITS GWALIOR
   Atmosphere: the warmth returns; the road runs home.
   ================================================================ */

.scene--mits::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 45% at 50% 42%, rgba(245, 130, 32, .07), transparent 70%);
  pointer-events: none;
}

.journey-road--home {
  width: min(380px, 78vw);
  margin-top: 26px;
}

/* certificate + rap stacked beside the words */
.mits-cards {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.mits-cards .memory-card { width: min(360px, 82vw); }
.mits-cards .memory-card--photo img { max-height: 30vh; object-fit: contain; }

/* --- the rap card: a quiet stage door --- */
.rap-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 22px 13px 15px;
  background: rgba(244, 241, 234, .03);
  border: 1px solid rgba(244, 241, 234, .14);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  transition: border-color .4s, box-shadow .4s, transform .4s,
              opacity 1.1s var(--ease-cinema) var(--d, 0s);
}
.rap-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-soft);
  transform: translateY(-2px);
}
.rap-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 16px var(--accent-soft);
}
.rap-words { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.rap-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .08em;
}
.rap-sub {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .45);
}

/* --- the overlay: the reel plays on our stage --- */
.rap-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .88);
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--ease-cinema), visibility 0s linear .5s;
}
.rap-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .5s var(--ease-cinema), visibility 0s;
}
.rap-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rap-frame-holder {
  width: min(400px, 92vw);
  height: min(690px, 78vh);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(244, 241, 234, .12);
}
.rap-frame-holder iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.rap-ig-link {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .5);
  text-decoration: none;
  transition: color .4s;
}
.rap-ig-link:hover { color: var(--accent); }
.rap-close {
  position: absolute;
  top: clamp(16px, 3vh, 30px);
  right: clamp(16px, 3vw, 30px);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, .3);
  background: rgba(0, 0, 0, .5);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .4s, color .4s, box-shadow .4s;
}
.rap-close:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px var(--accent-soft); }

/* ================================================================
   SCENE 8 — STILL WRITING (the living present)
   Atmosphere: the warmest room in the film; a page mid-sentence.
   ================================================================ */

.scene--finale::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 72% 46% at 50% 44%, rgba(245, 130, 32, .09), transparent 70%);
  pointer-events: none;
  animation: glowDrift 18s ease-in-out infinite alternate;
}

/* the pulse line: alive, working, typing */
.finale-live {
  margin-top: 26px;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(13px, 1.7vw, 15.5px);
  letter-spacing: .08em;
  color: var(--ink-dim);
  min-height: 1.6em;
}
.finale-type { color: var(--ink); }
.live-dot {
  width: 8px;
  height: 8px;
  margin-right: 11px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, .7);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 8px rgba(74, 222, 128, .6); }
  50%      { transform: scale(1.25); box-shadow: 0 0 16px rgba(74, 222, 128, .9); }
}
.finale-live.in .caret {
  opacity: 1;
  animation: caretBlink 1.1s steps(1) infinite;
}

/* the way home: same living gradient border as the site's CTA */
.finale-btn {
  margin-top: 36px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 15px 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  background:
    linear-gradient(rgba(20, 20, 20, .92), rgba(20, 20, 20, .92)) padding-box,
    linear-gradient(90deg, var(--accent), #ffd9ad, var(--accent)) border-box;
  background-size: 100% 100%, 250% 100%;
  animation: finaleBorder 4s linear infinite;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: .12em;
  transition: transform .4s var(--ease-cinema), box-shadow .4s,
              opacity 1.1s var(--ease-cinema) var(--d, 0s);
}
@keyframes finaleBorder { to { background-position: 0 0, 250% 0; } }
.finale-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px var(--accent-soft);
}
.finale-btn svg { transition: transform .4s var(--ease-cinema); }
.finale-btn:hover svg { transform: translateX(4px); }

.finale-note {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .35);
}


/* ================================================================
   REDUCED MOTION — instant scene cuts, everything visible
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  .scene, .scene.is-active { transition: none; filter: none; transform: none; }
  .film-grain { animation: none; }
  .cosmos { display: none; }
  .scene--childhood::before, .scene--school::before, .scene--move::before,
  .scene--agarwal::before, .scene--drop::before, .scene--mits::before { animation: none; }
  .stars, .stars--far { animation: starsIn 0s forwards; }
  .chapter-body, .birth-stage, .ambient { transform: none; transition: none; }
  .chapter-title.ch-reveal, .chapter-title.ch-reveal.in { letter-spacing: .26em; filter: none; transition: none; }
  .chapter-year.ch-reveal, .chapter-year.ch-reveal.in { transform: none; filter: none; transition: none; }
  .journey-road.in .road-city--to { animation: none; }
  .rail-dot.is-now::after { animation: none; opacity: 0; }
  .birth-date, .birth-place, .birth-whisper { opacity: 1; transform: none; animation: none; }
  .birth-line { transform: scaleX(1); animation: none; }
  .typewriter::after { content: attr(data-text); }
  .caret { display: none; }
  .ch-reveal { opacity: 1; transform: none; transition: none; }
  .mote, .hint { animation: none; }
  .memory-card--photo img { filter: none; transform: none; transition: none; animation: none; }
  .rail-fill { transition: none; }
  /* the road is already travelled; scrapbook pages cut instantly */
  .journey-road .road-fill { animation: none; transform: scaleX(1); }
  .journey-road .road-traveller { animation: none; opacity: 0; }
  /* the filmstrip stands still and scrolls by hand */
  .filmstrip-track { animation: none; }
  .filmstrip { overflow-x: auto; }
  /* the verdict stands written */
  .drop-whisper { opacity: 1; transition: none; }
  /* gradients stand still but stay colorful */
  .chapter-year, .chapter-title { animation: none; }
  /* the present stands still too, but stays warm */
  .live-dot, .finale-btn, .scene--finale::before { animation: none; }
}

/* small screens: tighter type so every chapter fits one screen */
@media (max-width: 640px) {
  .caption { display: none; }
}

/* ================================================================
   MOBILE — the film reflows for the small screen.
   A chapter taller than the screen scrolls inside itself;
   main.js only changes chapters from the top/bottom edge.
   ================================================================ */
@media (max-width: 760px) {
  .scene {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: flex-start;
    padding: 78px 18px 56px;
  }
  .scene::-webkit-scrollbar { display: none; }
  /* short chapters stay centered; tall ones start at the top */
  .scene > .birth-stage,
  .scene > .chapter-body,
  .scene > .agarwal-layout,

  /* type scale for narrow screens */
  .birth-date { font-size: clamp(26px, 8vw, 38px); letter-spacing: .1em; }
  .birth-place { font-size: 13px; letter-spacing: .16em; }
  .chapter-year { font-size: clamp(50px, 17vw, 76px); }
  .chapter-title { font-size: clamp(19px, 5.6vw, 26px); letter-spacing: .16em; }
  .chapter-title.ch-reveal { letter-spacing: .4em; }
  .chapter-title.ch-reveal.in { letter-spacing: .16em; }
  .chapter-text { font-size: 14px; line-height: 1.75; }
  .school-name { font-size: 15px; }

  /* media shrinks so stories still breathe */
  .chapter-body--school, .agarwal-top { gap: 26px; }
  .memory-card { width: min(260px, 74vw); }
  .memory-card--photo img { max-height: 24vh; }
  .memory-card--portrait { width: min(170px, 52vw); }
  .memory-card--portrait img { max-height: 19vh; }
  .mits-cards .memory-card { width: min(280px, 78vw); }
  .mits-cards .memory-card--photo img { max-height: 20vh; }
  .agarwal-layout { gap: 24px; }
  .filmstrip { width: 100%; }
  .strip-item { margin-right: 16px; padding: 8px 8px 10px; }
  .strip-item img { height: 128px; }
  .strip-item figcaption { font-size: 9px; letter-spacing: .14em; }
  .journey-road { width: 100%; }

  /* chrome tightens */
  .rail { right: 8px; gap: 14px; }
  .rail-dot { width: 8px; height: 8px; }
  .exit { padding: 8px 13px 8px 10px; font-size: 9.5px; letter-spacing: .18em; }
  .hint { font-size: 9.5px; white-space: nowrap; }
  .rap-card { padding: 11px 18px 11px 12px; }
}
