/* ============================================================================
   16.100 Interactive Aerodynamics Tools — base component layer
   ----------------------------------------------------------------------------
   Lean components built ONLY on tokens.css. Rules: docs/design-language.md.
   Layout is a single prose column with figures in-line beneath their prose.
   There are no sidebars and no control panels anywhere — controls always sit
   directly under the figure stage.
   ========================================================================== */

/* ---- Document ------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-ui);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---- Prose column -------------------------------------------------------- */
/* Each direct child is individually constrained to the measure so figures
   may opt out to --measure-wide without wrappers.                            */

.prose {
  padding-block: var(--space-6);
}

.prose > * {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.prose p,
.prose li {
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
}

.prose p {
  margin-block: 0.7em;
}

.prose ul,
.prose ol {
  padding-left: calc(var(--space-5) + 1.5em);
}

.prose li {
  margin-block: 0.3em;
}

/* A pipe table (docs/authoring/article-markdown.md): hairline rules only, set
   in the body size, starting on the text's left edge. The table is a BLOCK so
   it takes the same measure, margins and padding as a paragraph (review
   2026-09-30: as a table box it sat a gutter left of the text); the browser
   wraps its rows in an anonymous table inside it. The first column has no
   left padding, so its words line up with the paragraph's. */
.prose > table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin-block: 1em 1.2em;
  font-size: var(--fs-base);
  line-height: 1.45;
}

.prose th:first-child,
.prose td:first-child {
  padding-left: 0;
}

.prose th,
.prose td {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.prose th {
  font-weight: var(--fw-semibold);
  border-bottom: 1.5px solid var(--ink-muted);
}

h1,
h2,
h3,
h4 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--ink);
  margin-block: 1.4em 0.4em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-base); }

.tool-title {
  font-size: var(--fs-display);
  margin-block: 0.5em 0.25em;
}

/* Small label over a title (course, milestone). Letterspaced, never
   ALL-CAPS — rule T4. */
.eyebrow {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  margin-block: 0 0.2em;
}

/* The bar across the top of an Article Mode page, written by build/article.mjs:
   the way back to all tools on the left, the page's own actions (Lecture Mode,
   the theme, page motion) in the top right-hand corner (review 2026-09-29). */
.article-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) 0;
}

.article-bar-end {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* The theme menu (shared/js/theme-menu.js): an icon button showing the theme
   in use, and a small menu of System / Light / Dark under it. */
.theme-menu {
  position: relative;
}

.theme-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-1));
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 9rem;
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.15);
}

.theme-menu-list[hidden] {
  display: none;
}

.theme-menu-list button {
  appearance: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}

.theme-menu-list button:hover,
.theme-menu-list button:focus-visible {
  background: var(--band);
}

/* The check mark: a tick drawn before the chosen mode, a blank of the same
   width before the others so the names line up. */
.theme-menu-list button::before {
  content: '';
  width: 1em;
  text-align: center;
}

.theme-menu-list button[aria-checked='true']::before {
  content: '✓';
}

/* The lede paragraph under a tool title. */
.lede {
  font-size: var(--fs-h3);
  line-height: var(--lh-prose);
  color: var(--ink-muted);
}

/* The estimated reading time under an article's lede (build/article.mjs). */
.prose .reading-time {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  margin-top: calc(-1 * var(--space-2));
}

/* Page-level actions (theme, the other mode of the same tool). Not a control:
   these change how the page is read, not what the physics does, so they carry
   no semantic accent (rule C3). */
.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-block: var(--space-5);
}

b,
strong {
  font-weight: var(--fw-medium);
}

/* Links are neutral ink: saturated color is reserved for physics meaning. */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-muted);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 0.06em;
  transition: text-decoration-color var(--t-fast) var(--ease);
}

a:hover {
  text-decoration-color: var(--ink);
}

/* ---- Margin notes -------------------------------------------------------- */
/* The Tufte column. It holds what supports the argument without being the
   argument: the reason a step is exact, a disclosed number, a source. In the
   flow that material becomes a parenthesis, and a parenthesis makes the
   sentence long — which rule F5 does not allow. In the margin the sentence
   stays short and the detail stays available.

   Markup: a <span class="margin-note"> INSIDE the paragraph it belongs to. A
   block element inside <p> is not valid HTML, and the float has to begin on
   the paragraph's own first line for the note to sit beside it. Put the span
   first in the paragraph.

   A page opts in with `.prose--notes`. Below the breakpoint there is no margin
   to write in, so the note falls back into the flow as an indented block.     */

.margin-note {
  display: block;
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
  color: var(--ink-muted);
  /* The 2px ink rule over it is the landing page's section rule (review
     2026-09-29), so the notes read as part of the same page family. */
  border-top: 2px solid var(--ink);
  padding-top: var(--space-2);
  margin-block: var(--space-4);
}

/* A note beside a figure (`::: {.column-margin align=…}` before the figure).
   On a narrow page it falls in after the figure; the margin column places it
   level with the figure's top or bottom. Full screen has no margin. */
.figure-note {
  margin-block: var(--space-4) 0;
}

.figure.is-fullscreen .figure-note {
  display: none;
}

/* A note's bold lead-in is ink; a concept term keeps its hue (rule C1). The
   :not() matters: this selector outranks a bare .term-* class, and without it
   every coloured word in a note turned ink (review 2026-10-01). */
.margin-note strong:not([class*="term-"]) {
  color: var(--ink);
}

/* A table inside a margin note (docs/authoring/article-markdown.md): spans laid
   out as a table, because a <table> cannot sit inside the note's paragraph. */
.note-table {
  display: table;
  border-collapse: collapse;
  margin-top: var(--space-2);
  width: 100%;
}

.note-tr {
  display: table-row;
}

.note-th,
.note-td {
  display: table-cell;
  padding: var(--space-1) var(--space-2) var(--space-1) 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.note-th {
  font-weight: var(--fw-semibold);
  color: var(--ink);
  border-bottom-color: var(--ink-muted);
}

/* A section folded by default (`::: {.fold summary="…"}`, the article
   dialect): a <details> whose summary reads as the section heading. The
   details box spans the prose column, and its children are laid out as if they
   were children of .prose, so figures and margin notes inside behave the same. */
.prose > details.fold {
  position: relative;
  isolation: isolate;
  max-width: none;
  padding-inline: 0;
  padding-block: var(--space-1) var(--space-3);
  margin-block: var(--space-5);
}

/* The fold is a raised box behind the text column, open or closed, so a reader
   scrolling past sees where it starts and ends (review 2026-10-02). The box is
   drawn by ::before rather than by the details itself because the details
   spans the whole prose width: its children, not it, sit in the column. */
.prose > details.fold::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset-block: 0;
  left: max(0px, (100% - var(--measure)) / 2);
  right: max(0px, (100% - var(--measure)) / 2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.prose > details.fold > * {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.prose > details.fold > summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--ink);
  margin-block: 0.7em 0.4em;
}

.prose > details.fold > summary::-webkit-details-marker {
  display: none;
}

.prose > details.fold > summary::before {
  content: '';
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.5em;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: translateY(-0.12em) rotate(-45deg);
  transition: transform var(--t-fast) var(--ease);
}

.prose > details.fold[open] > summary::before {
  transform: translateY(-0.2em) rotate(45deg);
}

.prose > details.fold > summary::after {
  content: 'Click to open';
  margin-left: 0.75em;
  font-size: var(--fs-sm);
  font-weight: normal;
  color: var(--ink-muted);
}

.prose > details.fold[open] > summary::after {
  content: none;
}

/* A numbered equation and a reference to it (`$$…$$ {#eq:x}` and `@eq:x`,
   the article dialect). Following a reference lands the equation a third of
   the way down the window, not under the top edge, and flashes it once; a
   hover shows it in a preview (shared/js/eq-ref.js).                       */
.eq {
  display: block;
  scroll-margin-block: 30vh;
  border-radius: var(--radius-sm);
}

.eq:target {
  animation: eq-flash 1.6s var(--ease);
}

@keyframes eq-flash {
  from { background: var(--band); box-shadow: 0 0 0 var(--space-2) var(--band); }
  to { background: transparent; box-shadow: 0 0 0 var(--space-2) transparent; }
}

a.eq-ref {
  white-space: nowrap;
}

.eq-pop {
  position: fixed;
  z-index: 40;
  max-width: min(40rem, calc(100vw - 16px));
  padding: var(--space-1) var(--space-4);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.15);
  overflow-x: auto;
  pointer-events: none;
}

.eq-pop[hidden] {
  display: none;
}

.eq-pop .katex-display {
  margin: var(--space-2) 0;
}

/* A display equation wider than the column scrolls on its own, so a phone
   never scrolls the whole page sideways. The small vertical padding keeps
   tall integrals and underbraces from being clipped by the scroll box. */
.prose .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15em 0;
}
/* On a phone an equation and its number do not both fit on one centred line,
   and KaTeX sets the number over the equation's right end. There the number
   follows the equation instead, and the pair scrolls if it must. */
@media (max-width: 40rem) {
  .prose .katex-display > .katex > .katex-html > .katex-tag {
    position: static;
    display: inline-block;
    padding-left: 0.6em;
  }
}

/* KaTeX sets the \tag at the right edge of the line, which a preview sized to
   the equation would lay over it; the reference already shows the number. */
.eq-pop .katex-tag {
  display: none;
}

/* An acknowledgement at the foot of an article: small, muted, and set off from
   the article by a hairline (review 2026-10-01). */
.prose > .acknowledgement {
  margin-top: var(--space-7);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--ink-muted);
}
/* A run of end notes shares the one hairline above the first. */
.prose > .acknowledgement + .acknowledgement {
  margin-top: var(--space-3);
  padding-top: 0;
  border-top: 0;
}

@media (min-width: 68rem) {
  /* The text column and the figures are one width, --measure-wide, and the
     margin column sits to their right (instructor review, 2026-09-29: "the
     text should be the same width as the figure", with the notes given more
     room). Every child of .prose is laid out from one left edge:
       --text-w  the text and figure width, which gives way first on a
                 narrower window so the notes always fit;
       --pair    text + gap + notes;
       --left    the left edge. The spare width is split a third to the left
                 and two thirds to the right, so the pair sits left of centre
                 and the margin column has air beside it.
     Percentages resolve against .prose, the parent of every child using them. */
  .prose--notes {
    --note-w: 18rem;
    --note-gap: var(--space-7);
    --text-w: min(var(--measure-wide), 100% - var(--note-w) - var(--note-gap) - 2 * var(--space-5));
    --pair: calc(var(--text-w) + var(--note-gap) + var(--note-w));
    --left: max(var(--space-5), (100% - var(--pair)) / 3);
  }

  .prose--notes > * {
    max-width: var(--text-w);
    margin-left: var(--left);
    margin-right: auto;
  }

  .prose--notes .margin-note {
    float: right;
    clear: right;
    width: var(--note-w);
    /* Pull the margin box fully outside the text column: its own width then
       costs the lines beside it nothing, and they wrap at the column. The
       child's own right padding is part of the gap.                          */
    margin-right: calc(-1 * (var(--note-w) + var(--note-gap)));
    margin-block: 0.35em var(--space-4);
  }

  /* The figure's band lines up with the text on both sides, so this lands the
     note exactly where a paragraph's note sits. */
  .prose--notes .figure:not(.is-fullscreen) > .figure-note {
    position: absolute;
    left: calc(100% + var(--note-gap));
    width: var(--note-w);
    margin: 0;
  }

  .prose--notes .figure > .figure-note--top {
    top: var(--space-5);
  }

  .prose--notes .figure > .figure-note--bottom {
    bottom: var(--space-4);
  }

  /* A block box may overlap a float, so a tall note beside the paragraph above
     could land on a stage. Figures clear the margin column instead.          */
  .prose--notes .figure {
    clear: right;
  }

  /* A figure's band lines up with the text on both sides: the text sits a
     --space-5 gutter inside its column, and so does the band (review
     2026-10-01: the band used to start a gutter left of the text).
     `:not(.is-fullscreen)`: a figure that fills the screen has no column to
     line up with, and the two rules would otherwise both set width and margin
     on one element and be settled by source order. */
  .prose--notes .figure:not(.is-fullscreen) {
    width: calc(var(--text-w) - 2 * var(--space-5));
    max-width: none;
    margin-left: calc(var(--left) + var(--space-5));
    margin-right: 0;
  }

  /* A folded section spans the column; its children take the column's layout. */
  .prose--notes > details.fold {
    max-width: none;
    margin-left: 0;
  }

  .prose--notes > details.fold > * {
    max-width: var(--text-w);
    margin-left: var(--left);
    margin-right: auto;
  }

  .prose--notes > details.fold::before {
    left: var(--left);
    right: auto;
    width: var(--text-w);
  }
}

/* On a narrow window a figure would otherwise reach both edges of the window and
   the rounded corners of the band would be cut off. Keep a gutter. It is a
   margin and not a `max-width: calc(100% - …)`, because a real margin needs no
   percentage: the width of the band then follows from the window with no
   containing-block arithmetic at all. */
@media (max-width: 60rem) {
  .prose .figure:not(.is-fullscreen) {
    margin-inline: var(--space-4);
  }
}

/* Justified body copy. Opt-in per block: justification only reads well in a
   wide-enough measure, so it carries `hyphens: auto` to keep the rivers out. */
.prose--justify p {
  text-align: justify;
  hyphens: auto;
}

/* ---- Dev mode (landing page) --------------------------------------------- */
/* Sections for repo work, not for students. Hidden until the reader asks for
   them (Ctrl+D on the landing page), so the page a student opens lists tools
   only. */
[data-dev-mode='off'] .dev-only {
  display: none;
}

/* ---- Landing page (Instrument) -------------------------------------------- */
/* A sheet on the band: a header bar closed by a 2px ink rule, a display-serif
   hero, then the topics as bordered cards two up. Heavy rules are ink; every
   other border is a --line hairline. */

.landing {
  min-height: 100vh;
  background: var(--band);
}

.landing-sheet {
  /* Full width, edge to edge (review 2026-09-29). --page-pad is the one side
     gutter every band of the page uses, so their edges line up. */
  --page-pad: clamp(var(--space-5), 4vw, var(--space-8));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.landing-sheet > main {
  flex: 1;
}

.landing-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  min-height: 56px;
  padding: var(--space-2) var(--page-pad);
  border-bottom: 2px solid var(--ink);
}

.landing-brand {
  font-weight: 700;
  font-size: var(--fs-base);
}

/* System / Light / Dark. The pressed segment is outlined in ink on the band. */
.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
}

.theme-switch button {
  appearance: none;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--fs-sm);
  min-height: 32px;
  padding: 0 var(--space-3);
  cursor: pointer;
}

.theme-switch button:hover {
  color: var(--ink);
}

.theme-switch button[aria-pressed='true'] {
  color: var(--ink);
  background: var(--band);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.landing-hero {
  padding: var(--space-7) var(--page-pad) var(--space-6);
}

.landing-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-normal);
  font-size: clamp(2.75rem, 9vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.landing-lede {
  max-width: 36rem;
  margin: var(--space-5) 0 0;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.landing-how {
  margin: var(--space-5) 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}

.landing-how kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 6px;
}

.landing-rule {
  height: 2px;
  margin: 0 var(--page-pad);
  background: var(--ink);
}

.landing-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  margin: 0;
  padding: var(--space-5) var(--page-pad) var(--space-4);
  font-size: var(--fs-xs);
  font-weight: var(--fw-normal);
  color: var(--ink-muted);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  gap: var(--space-4);
  padding: 0 var(--page-pad) var(--space-7);
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
}

/* A planned topic has no pages yet: hairline border, muted title. */
.topic-card--planned {
  border-color: var(--line);
}

.topic-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.topic-card h2 {
  margin: var(--space-1) 0 0;
  font-family: var(--font-display);
  font-weight: var(--fw-normal);
  font-size: 2.125rem;
  line-height: 1;
  text-wrap: balance;
}

.topic-card--planned h2 {
  color: var(--ink-muted);
}

.topic-card p {
  flex: 1;
  margin: 0;
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--ink-muted);
}

.topic-foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  min-height: var(--hit-target);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}

.topic-foot a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--ink);
  text-decoration: none;
}

/* The reading time on a card, beside its status: a copy of the article
   build's estimate, which check/article-build.mjs holds it to. */
.topic-time {
  white-space: nowrap;
}

.topic-foot a:hover,
.topic-foot a.is-primary {
  border-color: var(--ink);
}

.landing-dev {
  padding: 0 var(--page-pad) var(--space-7);
}

/* Course and author, closing the page under a hairline. */
.landing-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-5) var(--page-pad);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}

.landing-dev h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-normal);
  color: var(--ink-muted);
}

.landing-dev ul {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}

@media (max-width: 40rem) {
  .landing-bar,
  .landing-hero,
  .landing-head,
  .landing-dev {
    padding-inline: var(--space-5);
  }
  .landing-rule {
    margin-inline: var(--space-5);
  }
  .topic-grid {
    grid-template-columns: 1fr;
    padding-inline: var(--space-5);
  }
  .topic-card h2 {
    font-size: 1.875rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .topic-foot a,
  .theme-switch button {
    transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
      background-color var(--t-fast) var(--ease);
  }
}

/* ---- Semantic term coloring ---------------------------------------------- */
/* The triple binding: the same class colors (a) the bolded prose word,
   (b) a KaTeX term via \htmlClass, (c) any DOM-side label. Canvas geometry
   uses the matching --canvas-* token from JS.                                */

.term-parcel    { color: var(--c-parcel); }
.term-probe     { color: var(--c-probe); }
.term-local     { color: var(--c-local); }
.term-advective { color: var(--c-advective); }
.term-influx    { color: var(--c-influx); }
.term-efflux    { color: var(--c-efflux); }
.term-vortex    { color: var(--c-vortex); }
.term-circulation { color: var(--c-circulation); }

/* ---- Figure container ---------------------------------------------------- */
/* A soft tinted band separates the figure from prose. Stage on top,
   controls directly beneath, caption last. Fixed aspect ratio so the page
   never shifts as scenes hydrate.                                            */

.figure {
  position: relative; /* the expand button anchors to the band's corner */
  background: var(--band);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4) var(--space-4);
  margin-block: var(--space-6);
  user-select: none;
  -webkit-user-select: none;
}

.figure--wide {
  max-width: var(--measure-wide);
}

.figure-stage {
  position: relative;
  aspect-ratio: var(--ratio, 100 / 60);
  max-width: 100%;
}

/* Scene canvases are sized by JS, in logical pixels, because the drawing and the
   backing store have to carry the same number — a CSS `width/height: 100%` here
   fights the inline size and the loser is silently rescaled, which slides every
   drawing off the KaTeX labels on top of it. See shared/js/canvas.js. */
.figure-stage > canvas,
.figure-canvas {
  position: absolute;
  inset: 0;
  display: block;
}

/* Stage aspect utilities: height as a percentage of width. */
.ratio-30  { --ratio: 100 / 30; }
.ratio-40  { --ratio: 100 / 40; }
.ratio-50  { --ratio: 100 / 50; }
.ratio-60  { --ratio: 100 / 60; }
.ratio-70  { --ratio: 100 / 70; }
.ratio-80  { --ratio: 100 / 80; }
.ratio-100 { --ratio: 100 / 100; }
.ratio-120 { --ratio: 100 / 120; }

/* Narrower stages for small scenes (gauges, 1D strips). */
.stage-medium { max-width: 600px; margin-inline: auto; }
.stage-small  { max-width: 400px; margin-inline: auto; }

/* ---- Expand a figure to full screen -------------------------------------- */
/* A stage sized for a prose column is small for an instrument. The reader can
   give any figure the whole screen and take it back. This is view chrome, not
   a control: it changes the size of the picture, not the physics, so it sits
   in the band's corner and rule F3 (controls under the stage) does not apply
   to it. It stays quiet until the pointer is over the figure.                */

.figure-expand {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  width: var(--hit-target);
  height: var(--hit-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.figure:hover .figure-expand,
.figure-expand:hover,
.figure-expand:focus-visible {
  opacity: 1;
  color: var(--ink);
}

/* A touch reader has no hover, so the button carries its own weight. */
@media (pointer: coarse) {
  .figure-expand { opacity: 0.8; }
}

/* The full-screen state. The shell sets this class rather than the page using
   `:fullscreen`, so one rule covers the prefixed API as well. The stage drops
   the article aspect ratio and takes the room the screen has, exactly as the
   stage does in Lecture Mode. The ratio arrives as --ratio (not as an inline
   `aspect-ratio`) precisely so this rule can override it.                     */
.figure.is-fullscreen {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  padding: var(--space-5) var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.figure.is-fullscreen .figure-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  aspect-ratio: auto;
}

/* Only an Article Mode figure takes this class, and an Article Mode figure is
   pinned to one step, so there are no stepper dots here to lay out. */
.figure.is-fullscreen .figure-controls,
.figure.is-fullscreen .figure-caption {
  flex: 0 0 auto;
}

/* Read from further away than a laptop, like the lecture caption. */
.figure.is-fullscreen .figure-caption {
  font-size: var(--fs-base);
  max-width: 46rem;
}

.figure.is-fullscreen::backdrop {
  background: var(--bg);
}

/* ---- Controls (always under the figure) ---------------------------------- */

.figure-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 380px;
  margin: var(--space-4) auto 0;
}

.figure-controls--wide {
  max-width: 600px;
}

/* An Article Mode figure may be presented before its instrument
   (`data-controls="none"`): the reader meets the picture, and the controls
   arrive with the figure that asks for them. The scene still builds them, so
   nothing in the scene contract changes — the box is only not shown. The rule
   exists because the bare `hidden` attribute loses to `display: flex` above. */
.figure-controls[hidden] {
  display: none;
}

/* Row layout, for scenes with two or more controls (and Lecture Mode, where
   the controls sit in one band under the stage). Every row of the band is
   centred, and the controls hang from a common top edge so that a label which
   takes two lines does not push its own instrument out of line with its
   neighbours'. */
.figure-controls--row {
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-5);
  max-width: min(1200px, 100%);
}

.figure-controls--row > * {
  flex: 0 0 auto;
}

/* A control is as wide as what it holds. This used to be one flex basis for
   every control — `flex: 1 1 200px; max-width: 300px` — which put a segmented
   control into a box narrower than its own buttons: .segmented is an
   inline-flex that does not wrap, so it overflowed the box to the right and
   drew over the next control in the row (AERO-29). Flex lays items out by
   their boxes, not by what spills out of them, and a box that lies about its
   width is the whole bug. Buttons, segmented controls and readouts therefore
   size to their content and cannot collide. */
.figure-controls--row > .control {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
}

/* The one control that has no intrinsic width is a slider: its track and knob
   are positioned children, so the box would collapse to the width of the
   label. It gets a track width instead — a basis it may grow from to share
   the row, and a cap so a lone slider is not a stage-wide ruler. The label
   wraps inside that width rather than widening the control. */
.figure-controls--row > .control:has(.slider) {
  flex: 1 1 240px;
  min-width: 180px;
  max-width: 320px;
}

/* One labeled control: name + live value above the slider. */
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}

/* A control's or readout's name typeset with KaTeX (the `tex` option of
   slider.js, segmented.js and the tools' readout rows). Only the math is set
   in KaTeX's face; the words of the name (\text{…}) stay in the interface
   face, as words beside inline math do in prose, so a typeset name reads
   like the plain names next to it. */
.control-label .katex { font-size: 1.1em; }
.control-label .katex .text { font-family: var(--font-sans); }

.control-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--ink);
}

/* A scene hides a control that drives nothing on the current beat. The bare
   attribute needs saying once, next to the flex rules that would outrank it. */
.control[hidden] {
  display: none;
}

/* ---- Slider -------------------------------------------------------------- */
/* Div-based slider skeleton. JS sets --value in [0,1] and handles pointer /
   keyboard events on .slider (role="slider", tabindex="0").
   Tint per variable by setting --accent, e.g.:
     <div class="slider" style="--accent: var(--c-local)">
   Time-scrub sliders take no accent and stay neutral: time is not a concept
   that owns a hue.                                                           */

.slider {
  --accent: var(--ink-muted);
  --value: 0.5;
  position: relative;
  height: var(--hit-target);
  touch-action: none;
  cursor: pointer;
}

.slider-track,
.slider-fill {
  position: absolute;
  top: 50%;
  left: 0;
  height: var(--slider-track-h);
  margin-top: calc(var(--slider-track-h) / -2);
  border-radius: calc(var(--slider-track-h) / 2);
  background: var(--accent);
  pointer-events: none;
}

.slider-track {
  right: 0;
  opacity: 0.25;
}

.slider-fill {
  width: calc(var(--value) * 100%);
}

.slider-knob {
  position: absolute;
  top: 50%;
  left: calc(var(--value) * 100%);
  width: var(--slider-knob);
  height: var(--slider-knob);
  transform: translate(-50%, -50%);
  border-radius: var(--radius-full);
  background: var(--accent);
  cursor: grab;
  touch-action: none;
}

/* Pad the knob's hit area to the full touch target. */
.slider-knob::before {
  content: "";
  position: absolute;
  inset: calc((var(--slider-knob) - var(--hit-target)) / 2);
}

.slider:active .slider-knob {
  cursor: grabbing;
}

.slider:focus-visible {
  outline: none;
}

.slider:focus-visible .slider-knob {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Opt-in: keep the knob inside its control. A knob is centred on the end of
   the track, so at either end it sticks out by half its width (18 px for the
   36 px knob of a coarse pointer) past the track and the control's box; in a
   row of sliders the 24 px gap is then narrower than two such halves and the
   knobs of neighbours at their ends overlap. A control that takes this class
   insets the track by that much on both sides, so its knob never leaves the
   control's own box. The name and value above the slider keep the full width. */
.control--knob-inset > .slider {
  margin-inline: 18px;
}

/* ---- Buttons & toggles --------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  min-height: var(--hit-target);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.btn:hover {
  border-color: var(--ink-muted);
}

/* A link styled as a button is a button: its text sits in the middle of the
   pill and is not underlined. Without this, an <a class="btn"> drew its text
   at the top of the pill beside a <button> that centred it. */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn:active {
  background: var(--band);
}

/* Square icon button (play/pause, restart, undo). Icon supplied inline. */
.btn-icon {
  width: var(--hit-target);
  min-width: var(--hit-target);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Segmented control (mode toggles, A/B frames). */
/* The group wraps and its buttons do not: where the band is narrower than the
   options, a second line of whole buttons inside the border reads better than
   four squeezed columns of broken words — and it keeps the control inside its
   own box, which is what a neighbour depends on. */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.segmented-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  min-height: calc(var(--hit-target) - 8px);
  padding: 0 var(--space-4);
  white-space: nowrap;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.segmented-btn:hover {
  color: var(--ink);
}

.segmented-btn.is-on,
.segmented-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---- Transition Scene ---------------------------------------------------- */
/* A scene that carries no physics and no instrument (CONTEXT.md): it states the
   question the next scene answers. It fills the stage and centers one short
   block of prose, one line per step. Deliberately undecorated — no rule, no
   frame, no icon: there is nothing here to read but the sentence, and the
   emptiness is what tells a lecture hall that the argument has turned.        */

.transition {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-6);
  text-align: center;
}

.transition p {
  margin: 0;
  max-width: 34rem;
  font-size: var(--fs-h3);
  line-height: var(--lh-prose);
  color: var(--ink-muted);
}

/* The turn itself: the one sentence that names the question. */
.transition p:first-child {
  font-size: var(--fs-h2);
  font-weight: var(--fw-medium);
  color: var(--ink);
}

/* Not revealed yet. Hidden rather than removed, so revealing a line never
   re-flows the ones already on screen (rule M6: motion only for continuity). */
.transition p[data-pending] {
  visibility: hidden;
}

/* ---- Equations slide ----------------------------------------------------- */
/* The deck's last turn: the equations of motion, one per step, with the
   material rate split once underneath the first of them. Like a Transition
   Scene it fills the stage and centers its content, and like a Transition
   Scene it is undecorated — the equations are the only thing on the wall.   */

.equations {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Tight enough that the whole stack clears a 16:9 article figure without a
     scrollbar; a lecture stage has room to spare. */
  gap: var(--space-4);
  padding: var(--space-4);
  text-align: center;
  overflow-y: auto;
}

.equation-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

/* The name of the law, not a concept term: it says which equation this is, so
   it is set as quiet furniture and never in a physics accent. */
.equation-name {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  opacity: 0.7;
}

.equation-math .katex-display,
.equation-split .katex-display { margin: 0; }

/* The split is a reading of the line above it, so it is set smaller and
   quieter — subordinate to the equation, not a second equation. */
.equation-split {
  font-size: 0.82em;
  color: var(--ink-muted);
}

.equation-close {
  margin: 0;
  max-width: 34rem;
  font-size: var(--fs-h3);
  line-height: var(--lh-prose);
  color: var(--ink);
}

/* Not revealed yet. Hidden rather than removed, so revealing an equation never
   re-flows the ones already on the wall (rule M6). */
.equations [data-pending] { visibility: hidden; }

@media (max-width: 700px) {
  .equations { gap: var(--space-3); padding: var(--space-3); }
  .equation-close { font-size: var(--fs-body); }
}

/* ---- Caption strip ------------------------------------------------------- */

.figure-caption {
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
  color: var(--ink-muted);
  text-align: center;
  max-width: 34rem;
  margin: var(--space-4) auto 0;
  user-select: text;
  -webkit-user-select: text;
}

/* Numeric readout (instrument value in DOM chrome). */
.readout {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--ink);
}

/* ---- Scene chrome (counters & steppers) ---------------------------------- */

/* ---- Lecture Mode layout ------------------------------------------------- */
/* A flex column owned by shared/js/lecture-shell.js. Nothing is positioned by
   hand-tuned offsets, so a scene with tall controls cannot overlap the stage.
   Scenes fill .lecture-stage absolutely; exactly one scene root and one
   controls block are displayed at a time.

   TWO BANDS, AND THE SPLIT MATTERS. .lecture-controls holds the SCENE's
   instruments and is always visible — a control the lecturer reaches for
   mid-sentence cannot live behind a toggle. .lecture-dock holds the chevron
   and the drawer, and the drawer holds what is about the deck rather than the
   physics: the speaking notes, and under a hairline the legend (slide number,
   stepper, key hints). Windowed, the dock is in flow. Full screen
   (.is-fullscreen, set from the fullscreenchange event) floats it over the
   bottom of the stage and closes it, so the projector shows the image and the
   scene's own controls and nothing else.                                     */

.lecture {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--band);
  /* A palm on an iPad must not select the page (shared/js/lecture-shell.js). */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* The positioning context for the floating dock: it covers the stage and stops
   above the controls row, without either knowing the other's height. */
.lecture-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lecture-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0; /* let the stage shrink instead of pushing chrome off-screen */
}

.lecture-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.lecture-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-2);
}

/* The bare attribute would lose to the display above. */
.lecture-drawer[hidden] {
  display: none;
}

/* The demarcation: notes above, the deck's own legend below. */
.lecture-drawer-rule {
  height: 1px;
  background: var(--line);
  margin-inline: auto;
  width: min(46rem, 100%);
}

.lecture-drawer-rule[hidden] {
  display: none;
}

/* Slide number, stepper and key hints — the legend, not the physics. Faint by
   default, legible on hover, and gone with the notes in full screen. */
.lecture-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  opacity: 0.6;
  transition: opacity var(--t-fast) var(--ease);
}

.lecture-legend:hover,
.lecture-legend:focus-within {
  opacity: 1;
}

.lecture-controls[hidden] {
  display: none;
}

/* The hairline is the same rule, and the same rhythm, as the one inside the
   drawer: it says that what is under it is a different kind of thing from what
   is over it — there, the deck's legend under the notes; here, the scene's
   instruments under the picture. It runs the width of the band because it
   divides the whole stage from the whole band, and it is drawn once, by the
   band itself, so no scene can add a second one. */
.lecture-controls {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
}

/* In Lecture Mode the controls sit in their own row, so drop the article
   margin that would double the gap under the stage. */
.lecture-controls > .figure-controls {
  margin-top: 0;
}

/* The notes are read from a lectern, not from the back of the hall — but the
   same measure as the article keeps them scannable mid-sentence. */
.lecture .figure-caption {
  margin: 0 auto;
  font-size: var(--fs-base);
  max-width: 46rem;
}

/* The chevron: the only affordance that says the drawer exists. It flips when
   the drawer is open, so its direction always points at what a click does. */
.lecture-bar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: var(--space-1);
}

.notes-chevron {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-muted);
  opacity: 0.45;
  padding: var(--space-2);
  cursor: pointer;
  line-height: 0;
  transition: opacity var(--t-fast) var(--ease);
}

.notes-chevron svg {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform var(--t-fast) var(--ease);
}

.notes-chevron:hover,
.notes-chevron:focus-visible {
  opacity: 1;
}

.lecture.notes-open .notes-chevron svg {
  transform: rotate(180deg);
}

.lecture-hint {
  opacity: 0.8;
}

@media (max-width: 700px) {
  .lecture-hint { display: none; }
}

/* ---- Lecture buttons for touch ------------------------------------------- */
/* A lecturer on an iPad has no f or p key: full screen is a corner button over
   the stage, and pause/play sits at the right of the bar, opposite the ink
   tools. Both are faint, like the chevron, until touched or hovered.        */

.lecture-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-muted);
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity var(--t-fast) var(--ease);
}

.lecture-btn[hidden] {
  display: none;
}

.lecture-btn svg {
  width: 20px;
  height: 20px;
}

.lecture-btn:hover,
.lecture-btn:focus-visible {
  opacity: 1;
}

.lecture-fullscreen {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 3;
}

.lecture-pause {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
}

/* Paused is a state worth seeing from across the room: the play triangle
   stays at full strength until motion resumes. */
.lecture-pause[aria-pressed="true"] {
  opacity: 0.85;
}

.lecture.is-fullscreen .lecture-btn {
  opacity: 0.3;
}

.lecture.is-fullscreen .lecture-btn:hover,
.lecture.is-fullscreen .lecture-pause[aria-pressed="true"] {
  opacity: 0.8;
}

@media (pointer: coarse) {
  .lecture-btn {
    width: 44px;
    height: 44px;
  }
}

/* ---- Lecturer's ink ------------------------------------------------------ */
/* shared/js/ink.js. The layer sits over every scene on the stage and takes no
   pointer events of its own: the stage listens, so a pencil writes and a
   finger passes through to the scene. The stage isolates its stacking, so
   the ink covers the scene's math labels but never the floating dock.      */

.lecture-stage {
  isolation: isolate;
}

.ink-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.lecture-stage.is-inking {
  cursor: crosshair;
}

/* The tools: a pen button at the left of the bar, opening a row of pens. */
.ink-tools {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.ink-palette {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
}

.ink-palette[hidden] {
  display: none;
}

.ink-toggle,
.ink-pen,
.ink-action {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-muted);
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.ink-toggle svg,
.ink-pen svg,
.ink-action svg {
  width: 20px;
  height: 20px;
}

.ink-toggle {
  opacity: 0.45;
}

.ink-toggle:hover,
.ink-toggle:focus-visible,
.ink-tools.is-open .ink-toggle {
  opacity: 1;
}

.ink-pen:hover,
.ink-action:hover {
  background: var(--band);
  color: var(--ink);
}

.ink-pen[aria-pressed="true"] {
  background: var(--band);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink-muted);
}

.ink-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--canvas-ink);
}

.ink-swatch--red { background: var(--canvas-pen-red); }
.ink-swatch--blue { background: var(--canvas-pen-blue); }
.ink-swatch--highlight {
  width: 18px;
  height: 9px;
  border-radius: 2px;
  background: var(--canvas-pen-highlight);
  opacity: 0.75;
}

/* The pen button says which pen a pencil will write with, even when shut. */
.ink-toggle-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--canvas-ink);
}

.ink-tools[data-tool="red"] .ink-toggle-dot { background: var(--canvas-pen-red); }
.ink-tools[data-tool="blue"] .ink-toggle-dot { background: var(--canvas-pen-blue); }
.ink-tools[data-tool="highlight"] .ink-toggle-dot { background: var(--canvas-pen-highlight); }
.ink-tools[data-tool="eraser"] .ink-toggle-dot {
  background: none;
  box-shadow: inset 0 0 0 1.5px var(--ink-muted);
}

.ink-sep {
  width: 1px;
  height: 18px;
  margin-inline: 2px;
  background: var(--line);
}

@media (pointer: coarse) {
  .ink-toggle,
  .ink-pen,
  .ink-action {
    width: 40px;
    height: 40px;
  }
}

/* ---- Saving the ink as a PDF ------------------------------------------------ */
/* shared/js/lecture-shell.js makes the PDF (shared/js/ink-pdf.js) and offers
   it in this bar: Share on an iPad, Download elsewhere.                      */

.ink-save-bar {
  position: fixed;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
}

/* ---- Counter & stepper dots ---------------------------------------------- */

.scene-counter {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.stepper-dots {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stepper-dot {
  appearance: none;
  border: 0;
  padding: 0;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  background: var(--line);
  position: relative;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

/* Dots are secondary navigation (keyboard stepping is primary in Lecture
   Mode); pad their hit area without forcing 44px spacing.                    */
.stepper-dot::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.stepper-dot:hover {
  background: var(--ink-muted);
}

.stepper-dot.is-active {
  background: var(--ink);
}

/* ---- Lecture Mode, full screen ------------------------------------------- */

.lecture.is-fullscreen .lecture-dock {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;   /* the image keeps its taps on either side of these */
}

.lecture.is-fullscreen .notes-chevron,
.lecture.is-fullscreen .lecture-drawer,
.lecture.is-fullscreen .ink-tools,
.lecture.is-fullscreen .lecture-pause {
  pointer-events: auto;
}

/* Opaque, so notes read over whatever the scene is drawing underneath. */
.lecture.is-fullscreen .lecture-drawer {
  background: var(--band);
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
}

/* Over the image the chevron is a reminder, not chrome. */
.lecture.is-fullscreen .notes-chevron {
  opacity: 0.3;
}

/* ---- Input-modality & motion --------------------------------------------- */

@media (pointer: coarse) {
  .slider-knob {
    --slider-knob: 36px;
  }
}

/* Reduced motion: UI transitions collapse; JS must also start scenes paused
   (scrubbing stays live — it is user-driven, not autonomous motion).         */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
