@import url("lesson-colors.css");
/* Transport bar docked under each film card. Page-owned presentation only:
   /jsfilm/lib/scrollfilm.css and scrollfilm.js are untouched. Injected into the lesson
   document by the reader's embed adapter (src/components/blocks/LessonFrame.jsx).

   Docked rather than overlaid: the board writes all the way to the bottom edge of the
   frame, so a hover-reveal overlay would sit on top of the mathematics at exactly the
   moment it is being written, and a hover affordance is invisible on a touch screen.
   A bar attached flush under the card is always visible, never occludes the lesson, and
   still reads as one object with the video. */

.film:has(+ .filmbar) { margin-bottom: 0; border-radius: 12px 12px 0 0; }

/* The film itself is a chalkboard in either theme, but the bar is page furniture, so it
   follows the page: a light control surface under a dark picture in light mode, the way a
   video player's controls sit outside the picture. The lesson document's own tokens supply
   the colours where they exist, and the fallbacks keep the bar legible if it is ever injected
   into a document that has none. */
.filmbar {
  /* every colour from lesson-colors.css (2026-10-04): the light bar is the accent's tints on the bar's ground */
  --fb-bg: var(--lc-fb-bg-light);
  --fb-edge: var(--rule, var(--lc-fb-edge-light));
  --fb-ink: var(--ink, var(--lc-ink-light));
  --fb-dim: var(--mute, var(--lc-fb-dim-light));
  --fb-accent: var(--accent, var(--lc-accent-light));
  --fb-btn: color-mix(in srgb, var(--lc-accent-light) 12%, var(--lc-white));
  --fb-btn-ink: color-mix(in srgb, var(--lc-accent-light) 88%, var(--lc-black));
  --fb-btn-hover: color-mix(in srgb, var(--lc-accent-light) 19%, var(--lc-white));
  --fb-hover: color-mix(in srgb, var(--lc-accent-light) 9%, var(--lc-fb-bg-light));
  --fb-track: color-mix(in srgb, var(--lc-accent-light) 14%, var(--lc-fb-edge-light));
  --fb-knob: var(--lc-white);
  --fb-focus: var(--accent, var(--lc-accent-light));
  --fb-muted-ink: var(--lc-off-light);
  --fb-forced: color-mix(in srgb, var(--lc-fb-dim-light) 75%, var(--lc-white));
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto auto minmax(40px, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;              /* JS matches this to the card, which film-layout.mjs sizes */
  margin: 0 auto 26px;
  padding: 7px 12px;
  background: var(--fb-bg);
  border: 1px solid var(--fb-edge);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  color: var(--fb-ink);
  font: 500 12px/1 Inter, -apple-system, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
:root[data-theme="dark"] .filmbar {
  --fb-bg: var(--lc-fb-bg-dark);
  --fb-edge: var(--lc-fb-edge-dark);
  --fb-ink: var(--lc-film-ink);
  --fb-dim: var(--lc-film-dim);
  --fb-accent: var(--lc-film-accent);
  --fb-btn: var(--lc-fb-btn-dark);
  --fb-btn-ink: var(--lc-fb-btn-ink-dark);
  --fb-btn-hover: var(--lc-fb-btn-hover-dark);
  --fb-hover: var(--lc-fb-hover-dark);
  --fb-track: var(--lc-fb-track-dark);
  --fb-knob: var(--lc-fb-btn-ink-dark);
  --fb-focus: var(--lc-fb-focus-dark);
  --fb-muted-ink: var(--lc-off-dark);
  --fb-forced: var(--lc-fb-forced-dark);
}
.filmbar[data-state="loading"] { opacity: .45; pointer-events: none; }

/* play / pause, at the left end */
.fb-play {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fb-btn);
  color: var(--fb-btn-ink);
  cursor: pointer;
  transition: background .15s ease;
}
.fb-play:hover { background: var(--fb-btn-hover); }
.fb-play svg { display: block; }
.fb-play .fb-pause-icon { display: none; }
.filmbar[data-playing="1"] .fb-play .fb-pause-icon { display: block; }
.filmbar[data-playing="1"] .fb-play .fb-play-icon { display: none; }

/* Mute sits after the progress bar, not beside play. In a player that gives progress its own
   row (YouTube), the bottom row is all transport and mute belongs there with it. Here progress
   shares the row, so putting mute at the left would bury it in the middle of that run; on the
   right it reads as its own control. Wide gaps on both sides keep transport, sound and speed
   legible as three separate groups. */
.fb-mute {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--fb-dim);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.fb-mute:hover { background: var(--fb-hover); color: var(--fb-ink); }
.fb-mute:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: 1px; }
.fb-mute svg { display: block; }
.fb-mute .fb-muted-icon { display: none; }
.filmbar[data-muted="1"] .fb-mute .fb-muted-icon { display: block; }
.filmbar[data-muted="1"] .fb-mute .fb-sound-icon { display: none; }
.filmbar[data-muted="1"] .fb-mute { color: var(--fb-muted-ink); }
/* silenced by the speed rather than by choice: dim, and the title says why */
.filmbar[data-forcedmute="1"] .fb-mute { color: var(--fb-forced); }
.filmbar[data-forcedmute="1"] .fb-mute .fb-muted-icon { display: block; }
.filmbar[data-forcedmute="1"] .fb-mute .fb-sound-icon { display: none; }
.filmbar[data-forcedmute="1"] .fb-rl { color: var(--fb-forced); }

/* ── volume ──────────────────────────────────────────────────────────────────────────────
   A small vertical slider that slides up out of the speaker: the speaker's own extension,
   so it is drawn in the bar's material (its ground, its edge, its rail and accent fill) and
   centred on the speaker. It has to stand above the bar, which is shorter than any usable
   slider, so for the moment it is open it covers a sliver of the picture's bottom edge.
   Hidden with visibility as well as opacity, so a closed slider is neither hit by the pointer
   nor reached by Tab; it becomes visible at once on opening (so focus can move into it) and
   only after its fade on closing. */
.fb-vol {
  flex: none;
  position: relative;
  display: flex;
}
.fb-vol-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 13px);
  z-index: 6;
  box-sizing: border-box;
  width: 34px;
  padding: 10px 0;
  margin-left: -17px;
  background: var(--fb-bg);
  border: 1px solid var(--fb-edge);
  border-radius: 11px;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--lc-shadow, var(--lc-black)) 45%, transparent);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s;
}
/* The gap between the slider and the speaker is part of the slider, so the pointer crossing
   it on the way up is never "outside both". */
.fb-vol-pop::after {
  content: "";
  position: absolute;
  left: -4px; right: -4px;
  top: 100%;
  height: 15px;
}
.filmbar[data-vol="1"] .fb-vol-pop {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .14s ease, transform .14s ease, visibility 0s;
}
/* The track is the whole column, a full pointer target around a thin rail. */
.fb-vol-track {
  --vol: 1;
  position: relative;
  height: 84px;
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.fb-vol-track::before {
  content: "";
  position: absolute;
  left: 50%; top: 6px; bottom: 6px;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--fb-track);
}
.fb-vol-fill {
  position: absolute;
  left: 50%; bottom: 6px;
  width: 6px;
  margin-left: -3px;
  height: calc((100% - 12px) * var(--vol));
  border-radius: 3px;
  background: var(--fb-accent);
}
.fb-vol-knob {
  position: absolute;
  left: 50%; top: 0;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--fb-knob);
  box-shadow: 0 0 0 2px var(--fb-accent);
}
/* muted: the empty rail and the knob at its foot, in the muted speaker's red */
.filmbar[data-muted="1"] .fb-vol-knob { box-shadow: 0 0 0 2px var(--fb-muted-ink); }
.fb-vol-track:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: -1px; border-radius: 8px; }
.filmbar[data-vol="1"] .fb-mute { background: var(--fb-hover); color: var(--fb-ink); }
.filmbar[data-vol="1"][data-muted="1"] .fb-mute { color: var(--fb-muted-ink); }
/* A touch screen gets the speaker alone: tap is mute, and iOS does not let a page set volume. */
@media (hover: none) { .fb-vol-pop { display: none; } }

/* Captions sit with the sound control, behind the same kind of rule: both answer "what am I
   hearing", and a reader who wants one usually wants the other. */
.fb-cc {
  flex: none;
  width: 30px; height: 26px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--fb-dim);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.fb-cc:hover { background: var(--fb-hover); color: var(--fb-ink); }
.fb-cc:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: 1px; }
.fb-cc svg { display: block; }
/* On is a state, not a hover: filled, in the same violet the progress fill uses. */
.fb-cc[aria-pressed="true"] { background: var(--fb-btn); color: var(--fb-btn-ink); }
/* Turned off, as opposed to never asked for: the muted speaker's red, and the same kind of
   cross through the glyph, so the state does not rest on colour alone. */
.fb-cc .fb-ccoff-icon { display: none; }
.filmbar[data-ccoff="1"] .fb-cc { color: var(--fb-muted-ink); }
.filmbar[data-ccoff="1"] .fb-cc .fb-ccoff-icon { display: block; }
.filmbar[data-ccoff="1"] .fb-cc .fb-cc-icon { display: none; }

/* Full screen closes the row, where a player's does. */
.fb-full {
  flex: none;
  width: 28px; height: 26px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--fb-dim);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.fb-full:hover { background: var(--fb-hover); color: var(--fb-ink); }
.fb-full:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: 1px; }
.fb-full svg { display: block; }
.fb-full .fb-exit-icon { display: none; }
.filmbar[data-full="1"] .fb-full .fb-exit-icon { display: block; }
.filmbar[data-full="1"] .fb-full .fb-full-icon { display: none; }

/* ── full screen ─────────────────────────────────────────────────────────────────────────
   The stage is the container the card and its bar already sit in; it is a stage only while
   full screen, and everything else it holds (the card's label, its transcript) is hidden for
   the duration. The two tagged children are the film and its bar.

   Sizing is in percentages of the stage, never vh: this document is an iframe that the reader
   has sized to its whole content height, so vh here is thousands of pixels and means nothing.
   The UA sizes the full-screen element itself to the screen, and everything inside is measured
   from that. Height is the definite dimension and the aspect ratio derives the width, capped
   so a wide screen letterboxes at the sides rather than overflowing. */
.film-stage:fullscreen,
.film-stage:-webkit-full-screen,
.film-stage[data-fallback-fullscreen="1"] {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  margin: 0; padding: 0;
  background: var(--bg, var(--lc-board-bg));
}
.film-stage[data-fallback-fullscreen="1"] {
  position: fixed; inset: 0; z-index: 2147483647;
  box-sizing: border-box;
}
.film-stage:fullscreen > *:not([data-fs="1"]),
.film-stage:-webkit-full-screen > *:not([data-fs="1"]),
.film-stage[data-fallback-fullscreen="1"] > *:not([data-fs="1"]) { display: none !important; }
.film-stage:fullscreen > .film[data-fs="1"],
.film-stage:-webkit-full-screen > .film[data-fs="1"],
.film-stage[data-fallback-fullscreen="1"] > .film[data-fs="1"] {
  /* --fs-h is measured in film-transport.js, from the bar's real height and both limits on
     the picture; the calc is the fallback if that has not been computed yet. */
  height: var(--fs-h, calc(100% - var(--fs-chrome, 70px))) !important;
  width: auto !important;
  max-width: 100%;
  aspect-ratio: 16 / 9 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none;
}
/* the caption band is part of the chrome the film has to leave room for */
.film-stage:fullscreen:has(.filmbar[data-cc="1"]) > .film[data-fs="1"],
.film-stage:-webkit-full-screen:has(.filmbar[data-cc="1"]) > .film[data-fs="1"],
.film-stage[data-fallback-fullscreen="1"]:has(.filmbar[data-cc="1"]) > .film[data-fs="1"] { --fs-chrome: 150px; }
.film-stage:fullscreen > .filmbar,
.film-stage:-webkit-full-screen > .filmbar,
.film-stage[data-fallback-fullscreen="1"] > .filmbar { margin: 0; border-radius: 0; }

/* A portrait screen has ample space above and below a 16:9 picture, but too little width for
   a docked desktop transport. Keep the viewing surface clean and leave one explicit way out
   of the expanded WebKit fallback. Native full screen benefits from the same affordance.
   Native players opting into film-stage-docked retain their bar, as in current Calculus. */
@media (orientation: portrait) {
  .film-stage:not(.film-stage-docked):fullscreen > .filmbar,
  .film-stage:not(.film-stage-docked):-webkit-full-screen > .filmbar,
  .film-stage:not(.film-stage-docked)[data-fallback-fullscreen="1"] > .filmbar {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    display: block;
    overflow: visible;
  }
  .film-stage:not(.film-stage-docked):fullscreen > .filmbar > *:not(.fb-group),
  .film-stage:not(.film-stage-docked):-webkit-full-screen > .filmbar > *:not(.fb-group),
  .film-stage:not(.film-stage-docked)[data-fallback-fullscreen="1"] > .filmbar > *:not(.fb-group),
  .film-stage:not(.film-stage-docked):fullscreen > .filmbar .fb-group > *:not(.fb-full),
  .film-stage:not(.film-stage-docked):-webkit-full-screen > .filmbar .fb-group > *:not(.fb-full),
  .film-stage:not(.film-stage-docked)[data-fallback-fullscreen="1"] > .filmbar .fb-group > *:not(.fb-full) {
    display: none !important;
  }
  .film-stage:not(.film-stage-docked):fullscreen > .filmbar .fb-group,
  .film-stage:not(.film-stage-docked):-webkit-full-screen > .filmbar .fb-group,
  .film-stage:not(.film-stage-docked)[data-fallback-fullscreen="1"] > .filmbar .fb-group {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    display: block;
  }
  .film-stage:not(.film-stage-docked):fullscreen > .filmbar .fb-full,
  .film-stage:not(.film-stage-docked):-webkit-full-screen > .filmbar .fb-full,
  .film-stage:not(.film-stage-docked)[data-fallback-fullscreen="1"] > .filmbar .fb-full {
    display: grid;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--lc-film-ink);
    background: color-mix(in srgb, var(--lc-fb-bg-dark) 78%, transparent);
  }
}

/* Directly under the picture, above the transport, because that is where a caption belongs:
   the reader's eye leaves the film and lands on the words it is still hearing, without
   crossing the controls to get there. Overlaying the picture instead was measured and
   rejected - these films write in the bottom sixth of the frame, most often in the closing
   beats, so an overlay would cover the line the film is making its point with.

   The row keeps its height while captions are on, so a two-line cue following a one-line cue
   never moves the film or the page under the reader. Off, it takes no space at all rather
   than leaving a gap under a bar nobody asked to grow. */
.fb-caption {
  /* content-box on purpose: the lesson pages set border-box globally, which would fold the
     padding into the two-line reservation below and let a two-line cue grow the row anyway. */
  box-sizing: content-box;
  grid-column: 1 / -1;
  margin: 0;
  display: none;
  /* The lesson's own prose face and size (page.css .p): a caption is read the way the lesson
     is read, and a caption set smaller than the text around it is the thing people squint at. */
  font: 400 17.5px/1.6 var(--lf-text, 'STIX Two Text', Georgia, serif);   /* the lesson's own face (2026-10-04) */
  color: var(--fb-ink);
  text-wrap: pretty;
}
/* The words sit in a centred column one caption line wide, left-aligned inside it, the way a
   player's caption area is narrower than its frame. The cap is on the text, not on the band:
   capping the band would leave room beside it and let the transport wrap up onto this row.
   The column's width is set from the measured font in film-transport.js. */
.fb-caption > span { display: block; margin-inline: auto; }
.filmbar[data-cc="1"] .fb-caption {
  display: block;
  min-height: 58.8px;        /* two prose lines, so one- and two-line cues share one height */
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--fb-edge);
  margin-bottom: 1px;
}

/* Sound, captions, speed and full screen, spaced tighter than the row: four controls at the
   row's own gap left the progress rail a stub, and the rail is what a pointer aims at. */
.fb-group {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fb-time { flex: none; color: var(--fb-dim); letter-spacing: .2px; }
.fb-time .fb-now { color: var(--fb-ink); }
.fb-time .fb-sep { margin: 0 3px; opacity: .5; }

/* the progress track: the thick one. 8px of hit area at rest, 10px while scrubbing. */
.fb-track {
  flex: 1 1 auto;
  min-width: 60px;
  position: relative;
  height: 16px;               /* a comfortable pointer target around an 8px rail */
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.fb-track::before {
  content: "";
  position: absolute; left: 0; right: 0;
  height: 8px;
  border-radius: 4px;
  background: var(--fb-track);
  transition: height .12s ease;
}
.fb-fill {
  position: absolute; left: 0;
  width: 0;
  height: 8px;
  border-radius: 4px;
  background: var(--fb-accent);
  transition: height .12s ease;
}
.fb-knob {
  position: absolute; right: -6px; top: 50%;
  width: 12px; height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--fb-knob);
  opacity: 0;
  transition: opacity .12s ease;
}
.fb-track:hover .fb-knob, .fb-track:focus-visible .fb-knob, .filmbar[data-scrub="1"] .fb-knob { opacity: 1; }
.filmbar[data-scrub="1"] .fb-track::before, .filmbar[data-scrub="1"] .fb-fill { height: 10px; }
.fb-track:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: 3px; border-radius: 4px; }

/* The same faint rule on both sides of the sound control, so transport, sound and speed read
   as three groups with one visual grammar. The flex gap carries the air; the rule only marks
   the boundary, so the total space either side of it is what it was without one. */
.fb-div {
  flex: none;
  width: 1px;
  height: 16px;
  background: var(--fb-edge);
}

/* speed: a separate group behind its divider, so it never reads as a second progress bar */
.fb-rate {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fb-rate .fb-cap { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fb-dim); }
.fb-speed {
  width: 74px;
  height: 14px;
  margin: 0;
  accent-color: var(--fb-accent);
  cursor: pointer;
}
.fb-speed:focus-visible { outline: 2px solid var(--fb-focus); outline-offset: 3px; }
.fb-rl { min-width: 30px; text-align: right; color: var(--fb-ink); font-weight: 600; }
/* a rate the wheel set that the slider cannot represent is still reported honestly */
.filmbar[data-paced="1"] .fb-rl { color: var(--fb-accent); }

/* one speed readout on the page: the bar's. The floating pill would disagree with it
   at 0.75x and 2.5x, which it rounds to one decimal. */
.film .speed { display: none !important; }
/* and one progress indicator: the thin 4px rail inside the card is now the bar's job */
.film .prog { display: none !important; }
/* The "click to pause, then scroll on" tip taught the click-and-wheel affordance back when
   it was the only transport. The bar states all of it permanently, so the tip is now a
   popup over the board that says what the controls under it already show. */
.film .hint { display: none !important; }

@media (max-width: 560px) {
  .filmbar { gap: 5px; padding: 7px 6px; }
  .fb-group { gap: 1px; }
  .fb-rate { gap: 2px; }
  .fb-div { height: 14px; }
  .fb-rate .fb-cap { display: none; }
  .fb-track { min-width: 40px; }
  .fb-speed { width: 44px; }
  .fb-rl { min-width: 23px; }
  .fb-time { font-size: 11px; }
  .fb-play { width: 28px; height: 28px; }
  .fb-mute { width: 22px; height: 24px; }
  .fb-cc { width: 24px; height: 24px; }
  .fb-cc svg { width: 18px; height: 14px; }
  .fb-full { width: 24px; height: 24px; }
  .fb-caption { font-size: 16px; }
  .filmbar[data-cc="1"] .fb-caption { min-height: 51.2px; }
}
