/* ============================================================
   Rail Narrator — Folio-extended styles (after RailReader2's site)
   Extends system.css (Folio design system).
   Page-specific layout and component overrides only.
   All tokens, typography, and base styles come from system.css.
   ============================================================ */

/* ------------------------------------------------------------------
   Colour scheme — warm amber on ivory paper.
   Overrides Folio primitives with the original Reading Room palette.
   Folio structure (hairlines, pills, cards, layout) is preserved;
   only the colours change.
   ------------------------------------------------------------------ */

:root {
  --folio-bone: #f4eee2;
  --folio-snow: #fbf7ee;
  --folio-ink: #211c15;
  --folio-stone: #655c4d;
  --folio-mist: #e3dac8;
  --folio-whisper: #efe7d7;

  --color-accent: #c8772e;
  /* Accent as text: at least 4.5:1 on bone, snow and whisper (WCAG AA). */
  --color-accent-strong: #9a5317;
  --color-highlight: rgba(200, 119, 46, 0.22);
  --color-on-accent: #fff8ee;
  /* Text on an amber fill, in either theme: ink, 4.9:1 on the light amber and 7.3:1 on the dark. */
  --color-on-amber: #211c15;
  --color-lightbox-bg: rgba(33, 28, 21, 0.86);
  --font-mono: 'IBM Plex Mono', 'Fira Mono', 'Consolas', monospace;
}

[data-theme="dark"] {
  --folio-bone: #1a1611;
  --folio-snow: #221d16;
  --folio-ink: #efe7d6;
  --folio-stone: #b3a893;
  --folio-mist: #352d20;
  --folio-whisper: #211c15;

  --color-accent: #e0954a;
  --color-accent-strong: #f0a960;
  --color-highlight: rgba(224, 149, 74, 0.24);
  --color-on-accent: #fff8ee;
  --color-lightbox-bg: rgba(12, 9, 6, 0.9);
}

/* ------------------------------------------------------------------
   Accent overrides for system.css base styles
   ------------------------------------------------------------------ */

::selection {
  background: var(--color-highlight);
  color: var(--color-text);
}

a {
  color: var(--color-accent-strong);
  text-decoration-color: color-mix(in srgb, var(--color-accent) 45%, transparent);
}

a:hover {
  border-bottom-color: var(--color-accent);
}

.feature-list li::before {
  background-color: var(--color-accent);
}

/* Primary pill button — amber fill instead of ink, with ink text: light text on the amber was
   3.2:1 (light) and 2.3:1 (dark). */
.btn--primary {
  --btn-bg: var(--color-accent);
  --btn-fg: var(--color-on-amber);
  --btn-border: var(--color-accent);
}

.btn--primary:hover {
  --btn-bg: var(--color-accent-strong);
  --btn-fg: var(--color-on-accent);
  --btn-border: var(--color-accent-strong);
}

[data-theme="dark"] .btn--primary:hover {
  --btn-fg: var(--color-on-amber);
}

/* ------------------------------------------------------------------
   Skip link
   ------------------------------------------------------------------ */

.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--space-sm);
  background: var(--color-action);
  color: var(--color-on-action);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  z-index: 9999;
  transition: top var(--dur-base) var(--ease-quiet);
  text-decoration: none;
  border: none;
}

.skip-link:focus {
  top: var(--space-sm);
}

/* ------------------------------------------------------------------
   Theme toggle
   ------------------------------------------------------------------ */

.theme-toggle {
  background: var(--color-surface);
  border: var(--border-hairline);
  color: var(--color-text);
  font-size: 1.05rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--dur-base) var(--ease-quiet),
    transform var(--dur-base) var(--ease-quiet);
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  transform: rotate(-18deg);
}

/* ------------------------------------------------------------------
   Header / masthead
   ------------------------------------------------------------------ */

.header {
  padding: var(--space-lg) var(--container-pad) var(--space-md);
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

/* The menu wraps inside its own column, so the theme toggle stays at the top right on a phone. */
.header__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  flex: 1;
  min-width: 0;
}

/* .header__logo inherits from .brand (system.css) — only img overrides here */
.header__logo img {
  height: 44px;
  width: auto;
  flex-shrink: 0;
}

[data-theme="dark"] .header__logo img {
  filter: invert(89%) sepia(13%) saturate(190%) brightness(97%);
}

.header nav {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-md);
}

.header nav a {
  color: var(--color-text-muted);
  border-bottom: none;
  padding-bottom: 2px;
  position: relative;
}

.header nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-quiet);
}

.header nav a:hover {
  color: var(--color-accent);
}

.header nav a:hover::after {
  transform: scaleX(1);
}

/* ------------------------------------------------------------------
   Frame — screenshot wrapper (extends .media-frame concept)
   ------------------------------------------------------------------ */

.frame {
  background: var(--color-surface);
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.frame > img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.frame figcaption {
  padding: var(--space-2xs) var(--space-sm);
  border-top: var(--border-hairline);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
  text-align: center;
}

/* ------------------------------------------------------------------
   Hero — Folio split-card
   A single Snow card on Bone, text left, media right.
   ------------------------------------------------------------------ */

.hero {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--container-pad) var(--space-2xl);
}

.hero .card {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  overflow: hidden;
  padding: 0;
}

@media (min-width: 880px) {
  .hero .card {
    grid-template-columns: 1fr 1fr;
  }
}

.hero__text {
  padding: clamp(var(--space-lg), 4vw, var(--space-xl));
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.hero__lede {
  color: var(--color-text-muted);
  font-size: var(--text-body-md);
  line-height: var(--leading-body);
  max-width: 48ch;
}

.hero__buttons {
  display: flex;
  gap: var(--space-2xs);
  flex-wrap: wrap;
  align-items: center;
}

.hero__media {
  min-width: 0;
}

.hero__media .frame {
  height: 100%;
  box-shadow: none;
  border-radius: 0;
  border: none;
}

/* ------------------------------------------------------------------
   Sections — Folio editorial rhythm
   ------------------------------------------------------------------ */

.section {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-block: var(--section-rhythm);
  padding-inline: var(--container-pad);
}

.section__head {
  position: relative;
  padding-top: var(--space-md);
  margin-bottom: var(--space-xl);
  border-top: var(--border-hairline);
}

.section__head .folio {
  position: absolute;
  top: var(--space-md);
  right: 0;
  color: var(--color-accent-strong);
}

/* Conflict: current design uses serif italic kickers above headings.
   Folio says "no kicker, no chip, no 'Features' label sitting above
   the headline." Kept as a quiet uppercase label (label-sm) to
   preserve section categorisation without visual dominance. */
.section__head .kicker {
  color: var(--color-text-muted);
  margin-bottom: var(--space-2xs);
  display: block;
}

.section__head p {
  color: var(--color-text-muted);
  max-width: 64ch;
  margin-top: var(--space-2xs);
}

/* ------------------------------------------------------------------
   Overview
   ------------------------------------------------------------------ */

.overview__lead {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  max-width: 56ch;
  margin-bottom: var(--space-xl);
}

.overview__points {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.overview__points li {
  padding-top: var(--space-2xs);
  border-top: 2px solid var(--color-accent);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body);
  color: var(--color-text-muted);
}

.overview__points strong {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3xs);
}

/* ------------------------------------------------------------------
   Note callout
   ------------------------------------------------------------------ */

.note {
  background: var(--color-surface);
  border: var(--border-hairline);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-top: var(--space-lg);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body);
  color: var(--color-text-muted);
  max-width: 64ch;
}

.note strong {
  color: var(--color-text);
}

/* ------------------------------------------------------------------
   Feature rows — screenshot-led, alternating layout
   ------------------------------------------------------------------ */

.feature-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  align-items: center;
}

@media (min-width: 880px) {
  .feature-row {
    grid-template-columns: 1fr 1.1fr;
    gap: var(--space-xl);
  }
  .feature-row:nth-child(even) .feature-row__media {
    order: -1;
  }
}

.feature-row__text {
  max-width: 48ch;
}

.feature-row__eyebrow {
  color: var(--color-accent-strong);
  margin-bottom: var(--space-2xs);
}

.feature-row__text h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-headline-md);
  line-height: var(--leading-headline);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-2xs);
}

.feature-row__text p {
  color: var(--color-text-muted);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body);
  margin-bottom: var(--space-2xs);
}

.feature-row__text p:last-child {
  margin-bottom: 0;
}

.feature-row__media .frame {
  box-shadow: var(--elev-paper);
}

.feature-row__media img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

/* ------------------------------------------------------------------
   More label
   ------------------------------------------------------------------ */

.more-label {
  color: var(--color-accent-strong);
  margin-bottom: var(--space-md);
  padding-top: var(--space-2xs);
  border-top: var(--border-hairline);
}

/* ------------------------------------------------------------------
   Feature grid — smaller feature cells
   Folio: hairline borders separate cells, no gaps.
   ------------------------------------------------------------------ */

.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  counter-reset: feat;
}

@media (min-width: 680px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 920px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature {
  background: var(--color-surface);
  border: var(--border-hairline);
  padding: var(--space-md);
  position: relative;
  transition: background-color var(--dur-base) var(--ease-quiet);
}

.feature:hover {
  background-color: var(--color-surface-subtle);
}

.feature h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.125rem;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-2xs);
  color: var(--color-text);
}

.feature p {
  color: var(--color-text-muted);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body);
}

/* ------------------------------------------------------------------
   Story hook — teaser linking to About page
   ------------------------------------------------------------------ */

.story-hook {
  max-width: 52ch;
  margin: 0 auto;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.42;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.story-hook a {
  white-space: nowrap;
}

/* ------------------------------------------------------------------
   Getting Started — numbered steps
   ------------------------------------------------------------------ */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 64ch;
}

.steps li {
  counter-increment: step;
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
  position: relative;
  color: var(--color-text-muted);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-accent);
  width: var(--space-lg);
  text-align: center;
}

.steps strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ------------------------------------------------------------------
   Code — Folio permits Inter only, but code needs monospace.
   IBM Plex Mono for <code>/<pre> only; not used for UI labels.
   ------------------------------------------------------------------ */

code {
  font-family: var(--font-mono);
  background: var(--color-surface-subtle);
  padding: 0.1em 0.35em;
  font-size: 0.85em;
  border-radius: var(--radius-sm);
  border: var(--border-hairline);
}

pre {
  background: var(--color-surface);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-body-sm);
  margin-bottom: var(--space-md);
  line-height: var(--leading-body);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* ------------------------------------------------------------------
   Shortcuts table
   ------------------------------------------------------------------ */

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-sm);
}

.shortcuts-table th[scope="rowgroup"],
.shortcuts-table th[colspan] {
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-label-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent-strong);
  padding: var(--space-md) var(--space-2xs) var(--space-2xs);
  border-bottom: var(--border-hairline);
}

.shortcuts-table th {
  text-align: left;
  font-family: var(--font-body);
  color: var(--color-text);
  padding: var(--space-3xs) var(--space-2xs);
}

.shortcuts-table td {
  padding: var(--space-3xs) var(--space-2xs);
  border-bottom: var(--border-hairline);
}

.shortcuts-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: nowrap;
  width: 220px;
  color: var(--color-text);
}

.shortcuts-table td:last-child {
  color: var(--color-text-muted);
}

/* On a phone each shortcut is its key above its action, instead of two squeezed columns. */
@media (max-width: 600px) {
  .shortcuts-table tr { display: block; border-bottom: var(--border-hairline); padding: var(--space-3xs) 0; }
  .shortcuts-table tr:has(th[scope="rowgroup"]) { border-bottom: none; padding: 0; }
  .shortcuts-table th[scope="rowgroup"] { display: block; }
  .shortcuts-table td { display: block; border-bottom: none; padding: 0 var(--space-2xs); }
  .shortcuts-table td:first-child { width: auto; white-space: normal; }
}

/* ------------------------------------------------------------------
   Lightbox
   ------------------------------------------------------------------ */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--color-lightbox-bg);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 3vmin;
}

.lightbox.active {
  display: flex;
  animation: fade-in 0.25s ease;
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-paper);
}

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */

.footer {
  max-width: var(--container-max);
  margin: var(--space-lg) auto 0;
  padding: var(--space-lg) var(--container-pad) var(--space-2xl);
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
  border-top: var(--border-hairline);
}

.footer a {
  color: var(--color-text-muted);
  border-bottom: none;
}

.footer a:hover {
  color: var(--color-accent);
}

/* ------------------------------------------------------------------
   Animations + scroll reveal
   ------------------------------------------------------------------ */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero load choreography */
.hero [data-rise] {
  opacity: 0;
  animation: rise 0.7s var(--ease-quiet) forwards;
}

.hero [data-rise="1"] { animation-delay: 0.05s; }
.hero [data-rise="2"] { animation-delay: 0.16s; }
.hero [data-rise="3"] { animation-delay: 0.27s; }
.hero [data-rise="4"] { animation-delay: 0.38s; }

/* Scroll reveal — progressive enhancement */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-quiet),
    transform 0.6s var(--ease-quiet);
}

[data-reveal].reveal-in {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */

@media (max-width: 920px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero .card {
    grid-template-columns: 1fr;
  }

  .feature-row {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .feature-row__media {
    order: 0 !important;
  }

  .feature-row__text {
    max-width: none;
  }

  .feature-rows {
    gap: var(--space-xl);
  }
}

@media (max-width: 680px) {
  .overview__points {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .features {
    grid-template-columns: 1fr;
  }

  .hero__buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__buttons .btn {
    text-align: center;
  }

}

/* ------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .hero [data-rise],
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

.header nav a[aria-current="page"] {
  border-bottom-color: var(--color-accent);
}

/* ==================================================================
   Rail Narrator additions
   ================================================================== */

:root {
  /* The app's own highlight colours (NarrationHighlightStyle): amber for words read as printed,
     violet for a passage spoken in other words than the page's. */
  --hl-fill: rgba(255, 176, 32, 0.282);
  --hl-stroke: rgba(255, 140, 0, 0.863);
  --hl-para-fill: rgba(150, 100, 255, 0.282);
  --hl-para-stroke: rgba(110, 60, 230, 0.863);
  --color-violet: #6e3ce6;
  --page-canvas: #8a8378;
}

[data-theme="dark"] {
  --color-violet: #b195ff;
  --page-canvas: #2b2620;
}

.header__logo img {
  height: 40px;
}

/* The mark is black on white; in dark mode it is inverted like RailReader2's. */
[data-theme="dark"] .header__logo img {
  filter: invert(92%) sepia(8%) saturate(260%);
}

.badge-early {
  display: inline-block;
  font-size: var(--text-label-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent-strong);
  border: 1px solid color-mix(in srgb, var(--color-accent) 50%, transparent);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  width: fit-content;
}

/* ------------------------------------------------------------------
   Listen — the page player
   ------------------------------------------------------------------ */

.player {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

@media (min-width: 960px) {
  .player {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.player__viewport {
  position: relative;
  background: var(--page-canvas);
  height: clamp(420px, 72vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.player__sheet {
  position: relative;
  margin: 18px auto;
  background: #fff;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
  transform-origin: top left;
}

.player__sheet img,
.player__sheet svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.player__sheet svg {
  cursor: pointer;
}

.player__sheet rect.hl {
  fill: var(--hl-fill);
  stroke: var(--hl-stroke);
  stroke-width: 0.75;
}

.player__sheet rect.hl--para {
  fill: var(--hl-para-fill);
  stroke: var(--hl-para-stroke);
}

.player__sheet rect.hover {
  fill: rgba(0, 0, 0, 0.04);
  stroke: rgba(0, 0, 0, 0.25);
  stroke-width: 0.5;
  stroke-dasharray: 2 2;
}

.player__side {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: clamp(var(--space-md), 3vw, var(--space-lg));
  border-left: var(--border-hairline);
  min-width: 0;
}

@media (max-width: 959px) {
  .player__side { border-left: none; border-top: var(--border-hairline); }
}

.transport {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.play-btn {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-accent);
  color: var(--color-on-accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-quiet), transform var(--dur-base) var(--ease-quiet);
}

.play-btn:hover { background: var(--color-accent-strong); }
.play-btn:active { transform: scale(0.96); }
.play-btn:focus-visible,
.chip:focus-visible,
.mini-play:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 3px;
}

.play-btn svg { width: 1.4rem; height: 1.4rem; }

.transport__track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  min-width: 0;
}

.transport__time {
  font-family: var(--font-mono);
  font-size: var(--text-label-sm);
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
}

.transport input[type="range"] {
  width: 100%;
  accent-color: var(--color-accent);
}

.choice {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  border: none;
  padding: 0;
  margin: 0;
}

.choice legend {
  font-size: var(--text-label-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2xs);
  padding: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs) var(--space-2xs);
}

.chip {
  font: inherit;
  font-size: var(--text-body-sm);
  border: var(--border-hairline);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-quiet), background-color var(--dur-base) var(--ease-quiet);
}

.chip small {
  color: var(--color-text-muted);
  font-size: 0.78em;
  margin-left: 0.25em;
}

.chip:hover { border-color: var(--color-accent); }

.chip[aria-pressed="true"] {
  background: var(--color-highlight);
  border-color: var(--color-accent);
}

.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice__hint {
  font-size: var(--text-label-sm);
  color: var(--color-text-muted);
  min-height: 1.2em;
}

.now {
  background: var(--color-surface-subtle);
  border: var(--border-hairline);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  min-height: 9rem;
}

.now--para { border-left-color: var(--color-violet); }

.now__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  margin-bottom: var(--space-2xs);
}

.tag-sm {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: var(--border-hairline);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.5rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

.tag-sm--para {
  color: var(--color-violet);
  border-color: color-mix(in srgb, var(--color-violet) 45%, transparent);
}

.now__text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--color-text);
}

.now__text mark {
  background: var(--hl-fill);
  box-shadow: 0 0 0 1px var(--hl-stroke);
  border-radius: 2px;
  color: inherit;
}

.now__why {
  margin-top: var(--space-2xs);
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
}

.player__foot {
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
  margin-top: auto;
}

.script {
  margin-top: var(--space-md);
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.script summary {
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  font-weight: 500;
}

.script ol {
  margin: 0;
  padding: 0 var(--space-md) var(--space-md) calc(var(--space-md) + 1.5rem);
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
  columns: 2 22rem;
  column-gap: var(--space-xl);
}

.script li {
  margin-bottom: var(--space-2xs);
  break-inside: avoid;
}

.script li button {
  all: unset;
  cursor: pointer;
  color: var(--color-text);
}

.script li button:hover { color: var(--color-accent-strong); }
.script li button:focus-visible { outline: 2px solid var(--color-accent-strong); }

.script li.is-current button {
  background: var(--color-highlight);
  border-radius: 3px;
}

.script li .script__kind {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ------------------------------------------------------------------
   One equation, three ways
   ------------------------------------------------------------------ */

.equation-crop {
  background: #fff;
  border: var(--border-hairline);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  margin-bottom: var(--space-lg);
  box-shadow: var(--elev-paper);
}

.equation-crop img {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin: 0 auto;
}

.readings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 900px) {
  .readings { grid-template-columns: repeat(3, 1fr); }
}

.reading {
  background: var(--color-surface);
  border: var(--border-hairline);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

/* Wide screens: title, description, button and words on rows shared by the three cards, so the
   Play buttons line up whatever the length of the description above them. */
@media (min-width: 900px) {
  .reading { display: grid; grid-row: span 4; grid-template-rows: subgrid; align-items: start; row-gap: var(--space-2xs); }
}

.reading--para { border-top: 3px solid var(--color-violet); }
.reading--plain { border-top: 3px solid var(--color-accent); }

.reading h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.35rem;
  line-height: var(--leading-tight);
}

.reading__what {
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
}

.reading blockquote {
  margin: var(--space-2xs) 0 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.45;
  color: var(--color-text);
}

.reading blockquote .lead-in {
  color: var(--color-text-muted);
}

.mini-play {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font: inherit;
  font-size: var(--text-body-sm);
  font-weight: 500;
  border: 1px solid var(--color-accent);
  color: var(--color-accent-strong);
  background: transparent;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.9rem 0.35rem 0.7rem;
  cursor: pointer;
  width: fit-content;
}

.mini-play:hover { background: var(--color-highlight); }
.mini-play svg { width: 0.95rem; height: 0.95rem; }
.mini-play .mini-play__time { font-family: var(--font-mono); font-size: 0.78rem; color: var(--color-text-muted); }

.honest {
  font-size: var(--text-body-sm);
  color: var(--color-text-muted);
  max-width: 72ch;
  margin-top: var(--space-md);
}

/* The hero screenshot fills its half of the card, anchored at the window's top left. */
/* The hero screenshot is a crop of the app reading (zoomed in, so the word being read can be
   seen), set in the card as a framed window rather than bled to its edge. */
.hero__media {
  align-self: center;
  padding: 0 clamp(var(--space-lg), 4vw, var(--space-xl)) clamp(var(--space-lg), 4vw, var(--space-xl));
}
@media (min-width: 880px) {
  .hero__media { padding: clamp(var(--space-lg), 4vw, var(--space-xl)) clamp(var(--space-lg), 4vw, var(--space-xl)) clamp(var(--space-lg), 4vw, var(--space-xl)) 0; }
}
.hero__media .frame {
  display: flex;
  height: auto;
  border: var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(33, 28, 21, 0.16);
  overflow: hidden;
}
.hero__media .frame img { width: 100%; height: auto; cursor: zoom-in; }
