/* The stage: what the reader plays or operates. The rules here set its parts; the block at the end of this sheet
   ("Round two") draws it as a window, with title and transport bands, a long soft shadow and pill controls. The
   slider is a thin track whose range fills in the accent, under a white thumb. */
:is(.walkthrough, .player, .stream-replay-card, .so-figure, .rq-workbench, .code-card) {
  color: var(--ink);
  background-color: var(--surface);
  box-shadow: 0 0 0 1px var(--stage-edge), var(--shadow-xs);
}

/* The title: set as a card's title; Round two puts it in a band. */
:is(.walkthrough > .tw-head, .player-head) { min-height: 0; padding: 18px 20px 6px; background: none; border: 0; }
:is(.flow, .lesson-diagram) > .tw-head.is-ruled { padding-bottom: 6px; }
:is(.flow, .lesson-diagram) > .tw-head.is-ruled::after { content: none; }
:is(.walkthrough > .tw-head, .player-title) h2 { font: 600 var(--text-body) / 1.35 var(--sans); letter-spacing: -0.01em; }
.player-head { align-items: center; }
.player-bars { padding-top: 10px; }

/* The footer: the transport under a hairline; Round two puts it in a band. */
:is(.walkthrough, :where(:is(.walkthrough, .so-figure) > .figure-foot), .player, .so-figure) > .tw-controls {
  padding: 12px 20px; background: none; border-top: 1px solid var(--line);
}
.lesson-diagram .flow-timeline { border-top-color: var(--line); }

/* Buttons. Play is the one filled button; the steps are ghost icons. Every figure has this one transport: a lesson
   diagram, a flow figure, a walkthrough, a film and the output figures. */
.tw-controls .flow-transport { gap: 4px; }
.flow-transport :is([data-tw="frame-back"], [data-tw="frame-next"]) {
  width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink);
}
.flow-transport :is([data-tw="frame-back"], [data-tw="frame-next"]):hover:not(:disabled) { background: var(--stage); }
.flow-transport [data-tw="play"] {
  min-width: 72px; height: 36px; min-height: 0; padding: 0 16px; border-radius: 8px; box-shadow: var(--shadow-xs);
  font: 500 var(--text-sm) / 1 var(--sans);
}
/* Play, Pause and Replay stand in one cell, the words not said unseen, so the button is as wide as the widest of
   them and the clock and the track beside it never move (timeline.mjs, playButton). */
.button.tw-play { display: inline-grid; place-items: center; }
.tw-play > span { grid-area: 1 / 1; visibility: hidden; }
.tw-play[data-state="play"] > [data-play="play"], .tw-play[data-state="pause"] > [data-play="pause"],
.tw-play[data-state="replay"] > [data-play="replay"] { visibility: visible; }
:is(.walkthrough, :where(:is(.walkthrough, .so-figure) > .figure-foot), .player, .so-figure) > .tw-controls .button {
  border-radius: 8px;
}

/* The slider: a 6px track on the muted fill, its range in the accent, a white thumb ringed in the accent. */
.flow-scrubber input { appearance: none; -webkit-appearance: none; background: transparent; }
.flow-scrubber input::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--stage) var(--fill, 0%));
}
.flow-scrubber input::-moz-range-track { height: 6px; border-radius: 3px; background: var(--stage); }
.flow-scrubber input::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.flow-scrubber input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border: 1.5px solid var(--accent);
  border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-xs);
}
.flow-scrubber input::-moz-range-thumb {
  width: 16px; height: 16px; border: 1.5px solid var(--accent); border-radius: 50%; background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.flow-scrubber input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}
.flow-time-mark { background: var(--surface); }
/* A plain track, with no stages marked on it, stands level with the transport beside it, and under it from the left
   where the row is too narrow for both. */
.flow-timeline.is-plain { flex-direction: row; flex-wrap: wrap; align-items: center; row-gap: 8px; padding-top: 12px; }
.flow-timeline.is-plain .flow-scrubber { flex: 1 1 160px; }

/* Tabs: a muted track, 3px round its tabs, the chosen tab raised on the surface. */
:is(.player-segmented, .code-card .code-tabs) {
  display: inline-flex; gap: 0; padding: 3px; border: 0; border-radius: 10px; background: var(--stage);
}
.player-segmented button, .code-card .code-tabs [role="tab"] {
  min-height: 28px; margin: 0; padding: 4px 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font: 500 var(--text-sm) / 1.2 var(--sans);
}
.player-segmented button:hover, .code-card .code-tabs [role="tab"]:hover { color: var(--ink); background: transparent; }
:is(.player-segmented button:is([aria-pressed="true"], [aria-checked="true"]),
  .code-card .code-tabs [aria-selected="true"]) {
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--stage-edge), var(--shadow-xs);
}
.code-card .code-tabs { margin: 14px 20px 0; width: max-content; }
.code-card .code-panel { padding-top: 14px; }
.tw-stages {
  gap: 0; margin: 6px 20px 14px; padding: 3px; border: 0; border-radius: 10px; background: var(--stage);
}
.tw-stages button {
  min-height: 34px; padding: 6px 12px; border: 0; border-radius: 7px; font: 500 var(--text-sm) / 1.3 var(--sans);
}
.tw-stages button:hover { background: transparent; color: var(--ink); }
.tw-stages button[aria-selected="true"] {
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--stage-edge), var(--shadow-xs);
}
.tw-stages button[aria-selected="true"] span { color: var(--accent-ink); }

/* What runs now: the bar the clock is in and a part in use are ringed in the accent; nothing glows. */
.schedule-bar[data-tone="active"] .schedule-elapsed { box-shadow: 0 0 0 1px color-mix(in srgb, var(--bar-ink) 55%, transparent); }
.flow-part.is-active:not(.is-store, .is-frame) { box-shadow: 0 0 0 1px var(--accent); }
/* A figure's motion (figure-motion.mjs): what changed is laid over the new, where and as it stood, while it fades out. */
.figure-ghost { position: absolute; z-index: 1; grid-area: auto; box-sizing: border-box; margin: 0; pointer-events: none; }
/* The film's inspector stands on the muted fill, a step over the surface in dark as in light. */
.player .player-panel { background: var(--stage); }

/* The clock: the frame the run stands on and the last, in mono, beside the transport. */
.flow-timecode {
  min-width: 4.5ch; padding: 0 4px 0 8px; color: var(--muted);
  font: 500 var(--text-xs) / 1 var(--mono); text-align: right;
}
.flow-timecode span { color: var(--faint); font-weight: 400; }

/* A planned bar is opaque, so the time grid does not run through it. */
.schedule-bar[data-reveal][aria-hidden="true"] .schedule-elapsed { background: var(--surface); }

/* Forced colours draw the stage's edge as a line, since its box-shadow is dropped. */
@media (forced-colors: active) {
  :is(.walkthrough, .player, .stream-replay-card, .so-figure, .rq-workbench, .code-card) { outline: 1px solid CanvasText; }
}

/* A figure's readouts are muted cells, a step over the surface in either theme. */
.flow-metric { background: var(--stage); }

/* Round two of the stage, after bencho.dev's controls and Docker's product cards: every control is a pill or a
   circle on a soft fill, and a card is a window. A card stands on the page with its hairline and a long soft shadow;
   its title stands in a band a shade over the surface with a hairline under it, as a window's title bar does, and its
   transport stands in a band of the same shade. Nothing in a band moves when a state changes: only fills change. */
:is(.walkthrough, .player, .stream-replay-card, .so-figure, .rq-workbench, .code-card) {
  box-shadow: 0 0 0 1px var(--stage-edge), var(--shadow-card);
}
:is(.walkthrough > .tw-head, .player-head) {
  padding: 14px 20px; background: var(--band); border-bottom: 1px solid var(--line);
}
:is(.flow, .lesson-diagram) > .tw-head.is-ruled { padding-bottom: 14px; }
:is(.walkthrough, :where(:is(.walkthrough, .so-figure) > .figure-foot), .player, .so-figure) > .tw-controls { background: var(--band); }
/* The code card's tabs stand in its title band: 12px over and under a 34px track, then the hairline. */
.code-card { background: linear-gradient(to bottom, var(--band) 0 58px, var(--line) 58px 59px, var(--surface) 59px); }
.code-card .code-tabs { margin: 12px 20px; }
.code-card .code-panel { padding-top: 16px; }

/* Controls: a pill for a button with words, a circle for one with an icon, on a soft fill or the accent. */
.button { border-radius: var(--radius-pill); }
.secondary { background: var(--stage); border-color: transparent; }
.secondary:hover:not(:disabled) { background: var(--stage-edge); }
.flow-transport :is([data-tw="frame-back"], [data-tw="frame-next"]), .flow-transport [data-tw="play"],
:is(.walkthrough, :where(:is(.walkthrough, .so-figure) > .figure-foot), .player, .so-figure) > .tw-controls .button {
  border-radius: var(--radius-pill);
}
.flow-transport :is([data-tw="frame-back"], [data-tw="frame-next"]):hover:not(:disabled) { background: var(--stage-edge); }
.icon-button, .lesson-step { border-radius: var(--radius-pill); }
.lesson-step { border-color: var(--line); }
/* A track of choices is a pill, and so is the choice raised on it. */
:is(.player-segmented, .code-card .code-tabs) { border-radius: var(--radius-pill); }
.player-segmented button, .code-card .code-tabs [role="tab"] { border-radius: var(--radius-pill); }
.tw-stages { border-radius: 14px; }
.tw-stages button { border-radius: 11px; }
.rq-plain-button { border-radius: var(--radius-pill); background: var(--stage); }
.rq-plain-button:hover { background: var(--stage-edge); }
/* A field takes focus with a soft ring in the accent, not the browser's outline. */
:is(.rq-config input:not([type=checkbox]), .rq-config select, .rq-config textarea):focus-visible {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* The icon set at its own stroke: a 16px glyph at 1.5 reads as a hairline beside a word. */
svg.icon { stroke-width: 1.9; }
/* The code card's own controls: Copy is a pill on the soft fill, and a snippet's box takes the card's rounder corner. */
.code-copy { border-color: transparent; border-radius: var(--radius-pill); background: var(--stage); }
.code-copy:hover { background: var(--stage-edge); }
.code-block { border-radius: 12px; }
