/* ---------- The story pages: /about/spurgeon/ and /sermons/scholar/ (2026-11-23, website/story.js) ----------
   A hero stage pinned under the header with the page's sheet rising over it (as the quotes wall), headings that rise
   as they arrive, figures that count up, and a rail: a row of cards that scrolls sideways while the page is pinned,
   the ground a gradient that shifts with each chapter. With Reduce Motion, or no script, the stage sits still, the
   rail is a plain list on its first colours, and everything reads in order. */

:root {
  /* The header's height (styles.css .site-header), which the stage sits under */
  --story-top: 85px;
  /* How far the page scrolls before the sheet covers the stage: the pictures, portrait and words sink at three depths meanwhile */
  --story-travel: 48vh;
  /* The words' distance from the stage's corner on a wide window (owner, 2026-11-23: the very corner of the page; bottom left since later that day) */
  --stage-inset: clamp(24px, 3.333vw, 48px);
  /* The level cards' filled stars (owner, 2026-11-23: "yellow"): the design system's utility-amber-400, the same in both themes, as the rail's own colours are */
  --star: #fbbf24;
}
/* SplitText wraps each rising line in a mask that clips at the line box; a tight line height leaves the descenders
   outside it (owner, 2026-11-23: "the bottom part of G and P are clipping"), so each mask reaches under its line, the
   next line is pulled back up over the room, and the title itself keeps the last line's room at its foot. */
.m-line-mask {
  padding-bottom: 0.15em;
  margin-bottom: -0.15em;
}
html.story-motion .story-title,
html.story-motion .story-h2[data-rise] {
  padding-bottom: 0.15em;
}

/* ----- The hero ----- */

/* The stage starts at the top of the page, behind the header, which is a blurred glass over it (owner, 2026-11-23: "the
   nav over top of everything should have some opacity so as to show what's in the background"), and fills the window */
.story-hero-wrap {
  position: relative;
  margin-top: calc(-1 * var(--story-top));
  background: var(--hero);
}
html.story-motion .story-hero-wrap {
  height: calc(100vh + var(--story-travel));
  height: calc(100lvh + var(--story-travel));
}
.story-hero {
  position: relative;
  height: 100vh;
  height: 100lvh;
  min-height: 640px;
  overflow: hidden;
  background: var(--hero);
  color: var(--on-dark);
}
html.story-motion .story-hero {
  position: sticky;
  top: 0;
}
/* The portrait fills the stage, from behind the header to its foot (owner, 2026-11-23, after a day of other ideas:
   "just use spurgeon's image"), kept to his face and shoulders; a little larger than the stage, so it can sink as the
   sheet rises without showing an edge. (The rankings page had a stage of its own for a day; its top is the picture
   top again, library.css .top.) */
.story-hero-picture {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.story-hero-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  transform: scale(1.1);
  will-change: transform;
}
/* Over the portrait's lower part, the ink deepening to the ground, so the words read (owner: "a dark gradient so the
   text is readable"; the site's ink, as the quotes wall's wash) */
.story-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(12, 10, 9, 0) 36%, rgba(12, 10, 9, 0.56) 66%, rgba(12, 10, 9, 0.94) 100%);
}
/* The words: in the stage's bottom-left corner on a wide window (owner, 2026-11-23: the corner, then "left-align the
   hero text"), bottom left in the frame on a phone as the wall's */
.story-hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  justify-items: start;
  gap: 20px;
  padding: 0 var(--edge) clamp(40px, 9vh, 96px);
}
@media (min-width: 810px) {
  .story-hero-copy {
    padding: 0 var(--stage-inset) var(--stage-inset);
  }
}
.story-eyebrow {
  margin: 0;
  font-weight: var(--semibold);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  color: var(--on-dark-muted);
}
.story-title {
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: clamp(48px, 7.5vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  color: var(--on-dark);
}
.story-lead {
  max-width: 44ch;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--on-dark-muted);
}
/* Only while the script is about to run: the title, portrait and lines wait so they don't flash before their entrance */
html.js.motion .story-title,
html.js.motion .story-hero-picture,
html.js.motion .story-hero-copy > :not(.story-title) {
  visibility: hidden;
}

/* ----- The sheet ----- */

.story-body {
  position: relative;
  z-index: 1;
  background: var(--page);
}
/* The sheet starts at the stage's foot and rises over it for --story-travel of scroll, while the stage holds still */
html.story-motion .story-body {
  margin-top: calc(-1 * var(--story-travel));
  padding-top: 24px;
  border-radius: 32px 32px 0 0;
}
/* A section's label over its title: small, like a top's eyebrow */
.story-label {
  margin-bottom: 12px;
  font-weight: var(--semibold);
  font-size: var(--fs-meta);
  line-height: var(--lh-meta);
  color: var(--text-muted);
}
/* A big title, bigger than a section's, with clear room over what follows it (owner, 2026-11-23: "too tight") */
.story-h2 {
  max-width: 16ch;
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: var(--h2);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.story-h2 + .prose {
  margin-top: 32px;
}
/* His own words, large, in the reading face */
.story-quote {
  max-width: 22ch;
  margin: 56px 0 0;
  font-family: var(--reading);
  font-weight: 400;
  font-size: var(--karma-md);
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.story-quote cite {
  display: block;
  margin-top: 16px;
  font-family: var(--text);
  font-style: normal;
  font-weight: var(--medium);
  font-size: var(--fs-meta);
  line-height: var(--lh-meta);
  color: var(--text-muted);
}
.story-quote p {
  margin: 0;
}
.story-quote + .prose {
  margin-top: 48px;
}
/* Someone else's words (the Piper line that starts the scholar's story): the interface face, a little smaller */
.story-quote-plain {
  max-width: 30ch;
  margin-top: 20px;
  font-family: var(--text);
  font-weight: var(--medium);
  font-size: var(--karma-sm);
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.story-quote-plain cite i {
  font-style: italic;
}
/* Short tips in two columns, each under a hairline */
.story-tips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 40px;
  margin-top: 40px;
}
.story-tips li {
  padding-top: 20px;
  border-top: 1px solid var(--divider);
}
.story-tips h3 {
  font-weight: var(--bold);
  font-size: var(--fs-body);
  line-height: var(--lh-label);
}
.story-tips p {
  margin-top: 8px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-body);
}
.story-h2 + .story-tips {
  margin-top: 40px;
}
/* The figures, as the rankings' six, that count up as they arrive */
.story-figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 48px 0 0;
  overflow: hidden;
  border: 1px solid var(--stone-300);
  border-radius: 24px;
  background: var(--stone-300);
}
.story-figures div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  padding: 24px 28px;
  background: var(--stone-100);
}
.story-figures dd {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: clamp(36px, 3.5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.story-figures dt {
  margin-top: 4px;
  font-weight: var(--medium);
  font-size: var(--fs-meta);
  line-height: var(--lh-meta);
  color: var(--text-muted);
}

/* ----- The rail ----- */

/* The window's height under the header; its ground is a gradient from the stop in charge's colour at the top down to a
   blend of it with the next stop's (owner, 2026-11-23: "a gradient of colors that change a bit with each section"),
   which story.js shifts as the stops pass; the first stop's at rest. The top is one colour, so the header, which takes
   the colour of what's under it, meets it without a seam. */
.rail {
  position: relative;
  margin-top: 96px;
  background: var(--rail-color) linear-gradient(to bottom, var(--rail-color), var(--rail-color-2));
  color: var(--on-dark);
  overflow: hidden;
  /* The text, the panes and the line turn with the scheme halfway through the ground's shift, over half a second
     (owner, 2026-11-23: "all transitions need to be much smoother") */
  transition: color 0.5s ease;
}
.rail[data-scheme='light'] {
  color: var(--ink);
}
/* On the rail the head, the cards and the line sit together from the top, the cards 36 under the words (owner,
   2026-11-23: "tighten the space between the one to four stars text and the horizontal boxes"; they were centred in
   the window's height, which left an empty slab above the words as the rail arrived: "looks buggy"). The rail is
   pinned behind the header, the window's full height, as the stage is, with the header's height of room at the top. */
.rail.is-rail {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100lvh;
  padding-top: var(--story-top);
}
.rail-head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 40px var(--edge) 0;
}
/* The rail's title at the big heading's size (owner, 2026-11-23: "increase the size of 'His life' text") */
.rail-title {
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: var(--h2);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.rail-note {
  max-width: 60ch;
  margin-top: 16px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  opacity: 0.84;
}
.rail-track {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 32px var(--edge) 48px;
}
.is-rail .rail-track {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 20px;
  width: max-content;
  margin-top: 36px;
  padding: 0 var(--edge);
  will-change: transform;
}
/* The thin line under the cards that fills as the rail passes */
.rail-progress {
  display: none;
  height: 2px;
  margin: 40px var(--edge) 0;
  border-radius: 999px;
  background: rgba(250, 250, 249, 0.18);
  transition: background-color 0.5s ease;
}
.rail[data-scheme='light'] .rail-progress {
  background: rgba(12, 10, 9, 0.14);
}
.is-rail .rail-progress {
  display: block;
}
.rail-progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
}

/* A year on Spurgeon's life: the year huge in the pane's top-left corner, so every year sits on one line along the
   rail (owner, 2026-11-23), the words under it, on a pane of the ground's own shade (a plain tint: a blur behind a
   pane that slides is what browsers draw unevenly) */
.era {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
  border-radius: 24px;
  background: rgba(250, 250, 249, 0.07);
  box-shadow: inset 0 0 0 1px rgba(250, 250, 249, 0.1);
  transition:
    background-color 0.5s ease,
    box-shadow 0.5s ease;
}
.rail[data-scheme='light'] .era {
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(12, 10, 9, 0.08);
}
.is-rail .era {
  width: clamp(300px, 26vw, 380px);
  min-height: min(40vh, 360px);
}
.era-year {
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: clamp(56px, 6vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.era p {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  opacity: 0.86;
}
/* A chapter's name before its years: a heading in the list; on the rail, a narrow column with the name and the years
   at its top, level with the years in the panes (it was written upwards on a pane; owner, 2026-11-23: "looks buggy") */
.era-chapter {
  margin: 24px 0 4px;
}
.era-chapter:first-child {
  margin-top: 0;
}
.era-chapter h3 {
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: var(--fs-title);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.era-chapter span {
  display: block;
  margin-top: 4px;
  font-weight: var(--medium);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  opacity: 0.72;
}
.is-rail .era-chapter {
  display: grid;
  align-content: start;
  width: clamp(180px, 15vw, 220px);
  margin: 0;
  padding: 28px 0;
}
.is-rail .era-chapter h3 {
  font-size: clamp(22px, 2vw, 28px);
}

/* A level of the rankings: its stars huge, the meaning, the words, the count, on the scale's own green */
.level-card {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 32px;
  border-radius: 28px;
  background: rgba(250, 250, 249, 0.08);
  box-shadow: inset 0 0 0 1px rgba(250, 250, 249, 0.12);
  transition:
    background-color 0.5s ease,
    box-shadow 0.5s ease;
}
.rail[data-scheme='light'] .level-card {
  background: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 0 1px rgba(12, 10, 9, 0.08);
}
.is-rail .level-card {
  width: clamp(420px, 46vw, 640px);
  min-height: min(56vh, 480px);
  padding: 40px;
}
.level-stars {
  display: flex;
  gap: 6px;
}
/* The stars: the filled ones gold (story.js pops them in one by one as the level takes charge), the empty ones the text's colour, faint */
.level-stars svg {
  width: clamp(36px, 3.6vw, 52px);
  height: clamp(36px, 3.6vw, 52px);
  fill: var(--star);
}
.level-stars svg.off {
  fill: currentColor;
  opacity: 0.16;
}
.level-card h3 {
  font-family: var(--display);
  font-variation-settings: 'opsz' 32;
  font-weight: 700;
  font-size: clamp(32px, 3.2vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.level-card p {
  margin: 0;
  max-width: 34ch;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  opacity: 0.88;
}
.level-card .level-count {
  margin-top: 8px;
  font-weight: var(--medium);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  opacity: 0.78;
}
.level-card .level-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px 10px 20px;
  border-radius: 999px;
  background: rgba(250, 250, 249, 0.14);
  color: inherit;
  font-weight: var(--bold);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  transition: background-color 0.5s ease;
}
.rail[data-scheme='light'] .level-card .level-link {
  background: rgba(12, 10, 9, 0.08);
}
.level-card .level-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The spread of the rated sermons under the cards: a segment lights as its level takes charge */
.rail-spread {
  display: none;
  gap: 3px;
  height: 10px;
  margin: 40px var(--edge) 0;
  overflow: hidden;
  border-radius: 999px;
}
.is-rail .rail-spread {
  display: flex;
}
.rail-spread span {
  display: block;
  height: 100%;
  background: currentColor;
  opacity: 0.22;
  transition: opacity 0.6s ease;
}
.rail-spread span.is-on {
  opacity: 1;
}

/* Narrow windows: the rail's cards stack, the chapters become headings (story.js changes the ground as they pass) */
@media (max-width: 809px) {
  :root {
    --story-top: 81px;
    --story-travel: 36vh;
  }
  .story-hero {
    min-height: 0;
  }
  .story-hero-copy {
    gap: 16px;
    padding-bottom: max(72px, 10vh);
  }
  .story-title {
    font-size: clamp(44px, 12vw, 64px);
  }
  html.story-motion .story-body {
    border-radius: 24px 24px 0 0;
  }
  .story-figures {
    grid-template-columns: repeat(2, 1fr);
  }
  .story-tips {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .rail {
    margin-top: 64px;
  }
  .rail-head {
    display: grid;
    gap: 6px;
    padding-top: 32px;
  }
  .rail-track {
    gap: 12px;
    padding: 24px var(--edge) 40px;
  }
  .era,
  .level-card {
    min-height: 0;
    padding: 24px;
  }
  .era-year {
    font-size: clamp(44px, 14vw, 64px);
  }
}
