/* The faces are declared in template.html, where the generator gives each
   file its content hash. */

/* One committed look. Under the grass, where no light reaches, Burrow draws
   pure black, and every capture from the surface fades into it; so the page
   is that black, and a capture's lower half has no edge. The one colour is the
   Lantern Crystal (#6fe3ff), the light the game puts out of reach to show what
   is possible. On the page it means one thing: look here. */
:root {
  color-scheme: dark;
  --ground: #000;
  --ink: #ebe7df;
  --ink-2: #bab4a9;
  --muted: #858077;
  --faint: #1a1917;
  --faint-2: #2f2d29;
  --accent: #6fe3ff;
  --accent-dim: rgba(111, 227, 255, 0.32);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "OpenTUI Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pixel: "m5x7", var(--mono);
  --gutter: clamp(20px, 5vw, 72px);
  --measure: 40rem;
  --plate: 60rem;
  --wide: 100rem;
  --dpr: 1;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* The page's vertical rhythm, four steps, so that like joins get like
     gaps: s1 between paragraphs; s2 between text and what it speaks of (a
     heading and its text, text and a figure, a band, a stage, the promo); s3
     between sections; s4 the pause around a plate, and before the credits. */
  --s1: 1.3rem;
  --s2: 2.5rem;
  --s3: clamp(5.5rem, 13vh, 8rem);
  --s4: clamp(7rem, 17vh, 10rem);
  /* from the opening picture's ground line to the title */
  --hgap: 1.5rem;
}

/* on a phone the steps are smaller: no gap passes a fifth of the screen but
   the pause around a plate */
@media (max-width: 40rem) {
  :root {
    --s2: 2rem;
    --s3: 4.5rem;
    --s4: 6rem;
    --hgap: 1.25rem;
  }
}

/* the size at which a picture has one device pixel to each of its own */
@media (min-resolution: 1.25dppx) { :root { --dpr: 1.25; } }
@media (min-resolution: 1.5dppx) { :root { --dpr: 1.5; } }
@media (min-resolution: 2dppx) { :root { --dpr: 2; } }
@media (min-resolution: 2.5dppx) { :root { --dpr: 2.5; } }
@media (min-resolution: 3dppx) { :root { --dpr: 3; } }

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--ground);
}

html {
  scroll-padding-top: 3rem;
  -webkit-text-size-adjust: 100%;
}

body {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.62;
  font-variation-settings: "opsz" 16;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.viewing {
  overflow: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 4px;
}

::selection {
  background: var(--accent);
  color: var(--ground);
}

h1,
h2,
h3 {
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  font-feature-settings: normal;
}

/* -------------------------------------------------------------- opening */

/* The opening picture at a whole number of device pixels to each of its
   pixels: the smallest that spans nine tenths of the screen and fills most
   of its height (half of it on a tall screen, so a wide picture keeps its
   width), so no pixel is smeared; what does not fit is cut, and a picture a
   little narrower than the screen is centred on the dark. The picture is
   placed so that the line where its ground turns black (--fy) lands at
   --line of the screen's height, and the title starts there. From just above
   that line the picture fades to black, so whatever the game draws under its
   ground (a lit basement) never stands behind the words. */
.opening {
  --W: 100vw;
  --H: clamp(34rem, 100svh, 72rem);
  --fill: 0.8;
  --base: calc(var(--w) * 1px / var(--dpr));
  --cover: max(calc(0.9 * var(--W)), calc(var(--fill) * var(--H) * var(--w) / var(--h)));
  --iw: var(--cover);
  --ih: calc(var(--iw) * var(--h) / var(--w));
  --top: min(0px, max(calc(var(--H) - var(--ih)), calc(var(--line) * var(--H) - var(--fy) * var(--ih))));
  position: relative;
  overflow: clip;
  padding-top: calc(max(12rem, calc(var(--top) + var(--fy) * var(--ih))) + var(--hgap));
}

@supports (width: round(up, 10px, 3px)) {
  .opening {
    --iw: round(up, var(--cover), var(--base));
  }
}

@media (orientation: portrait) {
  .opening {
    --H: clamp(24rem, 72svh, 60rem);
    --fill: 0.5;
  }
}

/* a phone on its side: the title still starts two thirds down its screen */
@media (orientation: landscape) and (max-height: 34rem) {
  .opening {
    --H: max(20rem, 100svh);
  }
}

/* the link covers the picture above the title, so its focus ring frames
   what it opens and stays clear of the words */
.hero {
  position: absolute;
  inset: 0 0 auto 0;
  height: max(12rem, calc(var(--top) + var(--fy) * var(--ih)));
  cursor: zoom-in;
}

.hero img,
.hero video {
  position: absolute;
  width: var(--iw);
  height: var(--ih);
  max-width: none;
  left: clamp(min(var(--W) - var(--iw), (var(--W) - var(--iw)) / 2), var(--W) / 2 - var(--fx) * var(--iw), max(0px, (var(--W) - var(--iw)) / 2));
  top: var(--top);
  image-rendering: pixelated;
  user-select: none;
  /* to black under the ground line, and soft at the sides when the picture
     is narrower than the screen (off screen otherwise) */
  -webkit-mask-image: linear-gradient(#000 calc(var(--fy) * 100% - 1.25rem), transparent calc(var(--fy) * 100% + 0.5rem)), linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(#000 calc(var(--fy) * 100% - 1.25rem), transparent calc(var(--fy) * 100% + 0.5rem)), linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-composite: intersect;
}

/* the picture paints over its link's own outline, so the ring is drawn above it */
.hero::after,
.band::after {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
}

.hero:focus-visible,
.band:focus-visible {
  outline: none;
}

.hero:focus-visible::after,
.band:focus-visible::after {
  outline: 1.5px solid var(--accent);
}

.opening > .clip-play.corner,
.opening > .clip-sound.corner {
  top: 0.6rem;
  bottom: auto;
}

.masthead {
  position: relative;
  padding-inline: var(--gutter);
  display: grid;
  gap: 2rem;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
}

h1 {
  font-size: clamp(3rem, 7.4vw, 7rem);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 60;
  max-width: 10em;
}

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

.lede p {
  font-size: clamp(1.25rem, 1.1vw + 0.85rem, 1.5rem);
  line-height: 1.5;
  font-weight: 350;
  font-variation-settings: "opsz" 24;
  color: var(--ink);
}

/* ------------------------------------------------------------- sections */

main {
  padding-block: var(--s2) 0;
}

/* Text in one column; figures leave it, wider, on the same left edge. */
.sect {
  display: grid;
  grid-template-columns: [full-start] var(--gutter) [text-start] minmax(0, var(--measure)) [text-end] minmax(0, 1fr) [wide-end] var(--gutter) [full-end];
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
  row-gap: var(--s1);
  align-content: start;
}

.sect > * {
  grid-column: text;
  min-width: 0;
}

/* the first and last thing in a section add nothing to the gaps between
   sections */
.sect > :first-child {
  margin-top: 0;
}

.sect > :last-child {
  margin-bottom: 0;
}

.sect + .sect {
  margin-top: var(--s3);
}

h2 {
  font-size: clamp(2rem, 3.2vw, 2.875rem);
  line-height: 1.1;
  letter-spacing: -0.012em;
  font-variation-settings: "opsz" 48;
  margin-bottom: calc(var(--s2) - var(--s1));
  color: var(--ink);
}

.sect > p,
.sect li {
  color: var(--ink-2);
}

.sect p strong,
.sect li strong,
.sect p em,
.sect li em {
  color: var(--ink);
}

.sect strong {
  font-weight: 600;
}

/* a line set on its own in the draft */
.sect > p.said {
  font-size: clamp(1.5rem, 1.6vw + 0.9rem, 2rem);
  line-height: 1.3;
  font-variation-settings: "opsz" 36;
  color: var(--ink);
  margin-block: 1.4rem;
  text-wrap: balance;
}

.sect > p.said em {
  font-style: italic;
}

.sect ul,
.sect ol {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.55rem;
}

.sect li::marker {
  color: var(--muted);
}

/* a list whose items open with a bold lead: no bullets, the leads carry it */
.sect ul.leads {
  list-style: none;
  padding-left: 0;
  gap: 1rem;
}

.sect blockquote {
  margin: 0.6rem 0;
  padding-left: 1.4rem;
  border-left: 1px solid var(--faint-2);
  color: var(--ink);
}

/* the game's own words, in its own face */
.sect blockquote.voice {
  border: 0;
  padding: 0;
  margin-block: 1.2rem 1.6rem;
  font-family: var(--pixel);
  font-size: 32px;
  line-height: 36px;
  color: var(--ink);
  -webkit-font-smoothing: none;
}

.sect blockquote.voice p {
  text-wrap: balance;
}

/* the game's own words quoted in a sentence: its face at 32 px, whose
   capitals stand as tall as the text's, and without growing the line */
.sect p .voice {
  font-family: var(--pixel);
  font-size: 32px;
  line-height: 0;
  color: var(--ink);
  -webkit-font-smoothing: none;
  white-space: nowrap;
}

/* the short version: questions and answers */
.qa {
  grid-column: text-start / wide-end;
  max-width: 58rem;
  margin: 1.2rem 0 0;
  display: grid;
  gap: 0;
}

.qa > div {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 0.25rem 2.5rem;
  padding-block: 1.15rem 1.25rem;
  border-top: 1px solid var(--faint);
}

.qa > div:last-child {
  border-bottom: 1px solid var(--faint);
}

.qa dt {
  font-size: 1.3125rem;
  line-height: 1.35;
  font-variation-settings: "opsz" 24;
  color: var(--ink);
}

.qa dt strong {
  font-weight: 400;
}

.qa dd {
  margin: 0;
  color: var(--ink-2);
}

/* ------------------------------------------------------------- figures */

/* A figure is as wide as its column allows, never taller than most of the
   screen, and never larger than one device pixel to each of its pixels, so
   the page never enlarges a picture; the viewer does, by whole steps. A
   picture of the game may use the whole width; one that was enlarged before
   it came here (--b) is shown at a whole number of its own pixels. */
.fig {
  --cap: var(--plate);
  --fw: min(100%, var(--cap), calc(var(--w) * 1px / var(--dpr)), calc(82svh * var(--w) / var(--h)));
  grid-column: text-start / wide-end;
  display: grid;
  grid-template-columns: var(--fw);
  justify-content: start;
  gap: 0.85rem;
  margin: calc(var(--s2) - var(--s1)) 0;
}

.fig.px,
.fig.wide {
  --cap: var(--wide);
}

@supports (width: round(down, 10px, 3px)) {
  .fig[style*="--b"] {
    --fw: max(calc(var(--w) / var(--b) * 1px / var(--dpr)), round(down, min(100%, var(--cap), calc(var(--w) * 1px / var(--dpr)), calc(82svh * var(--w) / var(--h))), calc(var(--w) / var(--b) * 1px / var(--dpr))));
  }
}

/* a sheet (of icons, of frames) is read, not glanced at: as wide as the
   column allows up to one device pixel to each of its pixels, however tall,
   and the reader scrolls past it */
.fig.sheet {
  --fw: min(100%, var(--cap), calc(var(--w) * 1px / var(--dpr)));
}

.fig > * {
  min-width: 0;
}

.frame {
  display: block;
  position: relative;
  cursor: zoom-in;
  text-decoration: none;
}

.frame img {
  width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

/* a figure that shows part of a picture: the box has the part's shape, and
   the whole picture sits behind it; the viewer shows it whole */
.frame.crop {
  overflow: hidden;
  aspect-ratio: var(--w) / var(--h);
}

.frame.crop img {
  width: calc(100% * var(--ciw));
  max-width: none;
  margin-left: calc(100% * var(--cml));
  margin-top: calc(100% * var(--cmt));
}

figcaption,
.sect > p.caption {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 64ch;
}

figcaption .fn {
  color: var(--ink-2);
  font-weight: 500;
  margin-right: 0.15em;
}

.fig-label {
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  color: var(--ink-2);
  -webkit-font-smoothing: none;
  margin-bottom: -0.1rem;
}

/* a small figure beside the paragraph it belongs to, on a wide screen */
.with-aside {
  grid-column: text-start / wide-end;
  display: grid;
  grid-template-columns: var(--measure) auto;
  justify-content: start;
  gap: 1.3rem 4.5rem;
  align-items: start;
}

.with-aside > p {
  color: var(--ink-2);
}

.with-aside > .fig {
  --cap: 30rem;
  grid-column: auto;
  margin: 0.4rem 0 0;
}

@media (max-width: 64rem) {
  .with-aside {
    grid-template-columns: minmax(0, var(--measure));
  }

  .with-aside > .fig {
    --cap: var(--measure);
  }

  .with-aside > .fig {
    margin-block: 1.2rem 0;
  }
}

/* --------------------------------------------- one place at several times */

.series .stage {
  position: relative;
  aspect-ratio: var(--w) / var(--h);
}

/* a moment not shown is not laid out, so its picture waits to be fetched */
.series .step {
  position: absolute;
  inset: 0;
  display: none;
  cursor: zoom-in;
}

.series .step.on {
  display: block;
}

/* a moment of another shape than the first is cut to the first's shape
   around its middle, never stretched; the viewer shows it whole */
.series .step img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.series.maps .stage {
  display: grid;
  place-items: center;
}

.series.maps .step {
  inset: auto;
  position: absolute;
  left: calc((1 - var(--sw)) * 50%);
  top: calc((1 - var(--sh)) * 50%);
  width: calc(var(--sw) * 100%);
  height: calc(var(--sh) * 100%);
}

/* The stepper: a hairline with a mark for each moment and its name under
   it, the one shown lit. On a stage it is the only way to the other clips,
   so it reads as something to press: the names in the game's face at 32 px
   where there is room, the others plain but dimmer, the one shown in the
   accent with a heavier mark, a hit area of a whole line, and a ring for the
   keyboard round the name. */
.steps {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  position: relative;
  margin-top: 0.1rem;
  touch-action: pan-y;
}

.steps::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0.6rem;
  height: 1px;
  background: var(--faint-2);
}

.steps button {
  position: relative;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0.25rem 0 0.5rem;
  text-align: left;
  color: var(--ink-2);
  opacity: 0.72;
  transition: opacity 0.15s, color 0.15s;
}

.steps button:last-child {
  justify-items: end;
  text-align: right;
}

.steps button i {
  width: 1px;
  height: 0.7rem;
  background: currentColor;
}

.steps button span {
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  -webkit-font-smoothing: none;
  white-space: nowrap;
  padding: 0.15rem 0.1rem;
}

@media (min-width: 60rem) {
  .steps button span {
    font-size: 32px;
  }
}

/* five names or more need a wider screen before they take the larger size */
@media (max-width: 72rem) {
  .steps:is([style*="--n:5"], [style*="--n:6"], [style*="--n:7"]) button span {
    font-size: 16px;
  }
}

.steps button:hover {
  color: var(--ink);
  opacity: 1;
}

.steps button:focus-visible {
  outline: none;
  opacity: 1;
}

.steps button:focus-visible span {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
}

.steps button[aria-pressed="true"] {
  color: var(--accent);
  opacity: 1;
}

.steps button[aria-pressed="true"] i {
  width: 3px;
  height: 0.9rem;
  margin-top: -0.1rem;
  margin-left: -1px;
}

.steps button:last-child[aria-pressed="true"] i {
  margin-left: 0;
  margin-right: -1px;
}

/* a clip on its own is a picture of the game that moves */
.clipfig .clip {
  max-width: none;
}

/* the film's round play button, in the middle of its poster */
.film-icon {
  display: grid;
  place-items: center;
}

.film-icon svg {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.65rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  box-shadow: inset 0 0 0 1px var(--ink-2);
  fill: currentColor;
  overflow: visible;
}

/* ------------------------------------------------------------- the film */

/* The film the reader plays. It starts on the text's left edge, as every
   figure does, and may run past the wide column to the screen's gutter, up
   to one device pixel to each of its pixels (1920 on a 2560 screen), and
   never taller than most of the screen; below that it is shrunk smoothly,
   and full screen shows it large. */
.fig.film {
  --fw: min(calc(var(--w) * 1px / var(--dpr)), calc(100vw - 2 * var(--gutter) - max(0px, (100vw - var(--wide) - 2 * var(--gutter)) / 2)), calc(78svh * var(--w) / var(--h)));
  gap: 0.6rem;
}

.film-box {
  position: relative;
  aspect-ratio: var(--w) / var(--h);
  background: var(--ground);
}

.film-box video,
.film-box .still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.film-box video {
  cursor: pointer;
}

.film-box .still {
  pointer-events: none;
  transition: opacity 0.4s var(--ease), visibility 0s 0.4s;
}

.film.started .still {
  opacity: 0;
  visibility: hidden;
}

/* before the first press: the poster, and in its middle the play button
   and how long the film is, set as the game sets its own words */
.film-go {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: radial-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45));
  color: var(--ink);
}

.film-go:hover .film-icon svg,
.film-go:focus-visible .film-icon svg {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.film-go .film-icon svg {
  width: 3.5rem;
  height: 3.5rem;
  padding: 1.1rem;
}

.film-sub {
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  color: var(--ink);
  -webkit-font-smoothing: none;
  text-shadow: 1px 1px 0 #000;
}

.film.started .film-go {
  display: none;
}

/* under it, as the players are set: play or pause, a line of how far it
   has played that scrubs, the time, and full screen */
.film-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  height: 2.75rem;
}

.film-key,
.film-fs {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--faint-2);
  color: var(--ink);
  display: grid;
  place-items: center;
}

.film-key:hover,
.film-fs:hover {
  box-shadow: inset 0 0 0 1px var(--ink-2);
}

.film-key svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.film-key.is-playing {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

.film-key.is-playing .go,
.film-key.is-again .go {
  display: none;
}

.film-key.is-playing .stop,
.film-key.is-again .again,
.film-key.is-again .again-head {
  display: inline;
}

.film-key .again {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.film-fs svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.film-bar {
  position: relative;
  flex: 1 1 auto;
  height: 1.75rem;
  cursor: pointer;
  touch-action: none;
}

.film-bar::before,
.film-bar i {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 1px;
}

.film-bar::before {
  right: 0;
  background: var(--faint-2);
}

.film-bar i {
  width: 0;
  height: 2px;
  margin-top: -0.5px;
  background: var(--accent);
}

.film-bar:focus-visible {
  outline-offset: 0;
}

.film-time {
  flex: none;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.film.playing .film-now {
  color: var(--accent);
}

/* full screen: the film as large as the screen allows, its controls under it */
.fig.film:fullscreen {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  margin: 0;
  padding: 1rem var(--gutter);
  background: var(--ground);
}

.fig.film:fullscreen .film-box {
  aspect-ratio: auto;
}

.fig.film:fullscreen .film-box video {
  object-fit: contain;
}

/* A stage: several clips, one shown at a time as a band across the screen,
   the labels under it as a series' steps. The band is the largest whole step
   of the clip that cuts no more than a sixth of its width, centred on the
   dark when the screen is wider; never taller than four fifths of the
   screen, its rows cut around the focus. Only the step shown is laid out, so
   only its clip streams, plays, and is heard. Each step carries its own
   corner controls. */
.fig.stage-strip .stage {
  aspect-ratio: auto;
}

.fig.stage-strip .step {
  position: relative;
  inset: auto;
  cursor: auto;
}

.fig.stage-strip .band img,
.fig.stage-strip .band video {
  width: var(--iw);
  height: var(--ih);
  object-fit: fill;
}

.band.stage-band {
  --iw: max(var(--base), 100vw);
}

@supports (width: round(down, 10px, 3px)) {
  .band.stage-band {
    --iw: max(var(--base), round(down, 1.2 * 100vw, var(--base)));
  }
}

.fig.stage-strip > .steps,
.fig.stage-strip > figcaption {
  width: min(100% - 2 * var(--gutter), calc(var(--w) * 1px / var(--dpr)));
  margin-inline: auto;
}

/* ------------------------------------------------- a picture beside a clip */

.fig.pair {
  --fw: min(100%, var(--wide));
}

.pair-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
}

.pair-cell {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.clip {
  position: relative;
  aspect-ratio: var(--w) / var(--h);
  max-width: calc(var(--w) * 1px / var(--dpr));
}

.clip video,
.clip .still {
  width: 100%;
  height: 100%;
}

/* the first frame, fetched only near the screen; the clip covers it once it plays */
.clip .still {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* once the clip has drawn its own first frame, the poster fades out; they
   are the same frame, so the fade only hides the step between a picture's
   colours and a video's */
.clip .still {
  transition: opacity 0.4s var(--ease), visibility 0s 0.4s;
}

.clip.shown .still {
  opacity: 0;
  visibility: hidden;
}

/* the opening and a band: the clip lies over the still, at the same place
   and size, and fades in */
[data-clip] video {
  opacity: 0;
  transition: opacity 0.9s var(--ease);
  pointer-events: none;
}

[data-clip].shown video {
  opacity: 1;
}

/* A clip's controls sit together in its corner: the play button in the
   corner, the speaker beside it, one size and one style, so the picture
   stays clear. Faint while the clip plays by itself; plain under the pointer
   or the keyboard, and while the clip waits for a press. The play button
   shows play, pause, or, once a clip has played out, play again. */
.clip-play,
.clip-sound {
  position: absolute;
  bottom: 0.5rem;
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  color: var(--ink);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.clip-play {
  right: 0.5rem;
}

.clip-sound {
  right: 3.5rem;
}

.clip-play svg,
.clip-sound svg,
.sound-switch svg,
.np-key svg {
  width: 2rem;
  height: 2rem;
  padding: 0.55rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 0 0 1px var(--ink-2);
  overflow: visible;
}

.clip-play svg,
.np-key svg {
  padding: 0.62rem;
  fill: currentColor;
}

.clip-play:hover,
.clip-play:focus,
.clip-play.idle,
.clip-sound:hover,
.clip-sound:focus,
.clip-sound.on {
  opacity: 1;
}

/* focused, a control shows at once */
.clip-play:focus,
.clip-sound:focus {
  transition: none;
}

.clip-play:focus-visible,
.clip-sound:focus-visible,
.sound-switch:focus-visible,
.np-key:focus-visible,
.np-title:focus-visible {
  outline-offset: -2px;
}

/* which of the play button's shapes shows */
svg .stop,
svg .again,
svg .again-head,
.clip-play.is-playing .go,
.clip-play.is-again .go,
.np-key.is-paused .stop {
  display: none;
}

.clip-play.is-playing .stop,
.np-key .stop,
.np-key.is-paused .go {
  display: inline;
}

.np-key .go {
  display: none;
}

.clip-play.is-again .again,
.clip-play.is-again .again-head {
  display: inline;
}

.clip-play .again {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

/* a clip that fills a band of the screen: the same pair, a size larger, in
   the band's corner by the text's edge, so the band stays a link to the
   viewer */
.clip-play.corner,
.clip-sound.corner {
  bottom: 0.6rem;
  width: 3rem;
  height: 3rem;
  opacity: 0.55;
}

.clip-play.corner {
  right: max(0.6rem, calc(var(--gutter) - 0.6rem));
}

.clip-sound.corner {
  right: calc(max(0.6rem, calc(var(--gutter) - 0.6rem)) + 3.25rem);
}

.clip-play.corner svg,
.clip-sound.corner svg {
  width: 2.25rem;
  height: 2.25rem;
}

.clip-play.corner:hover,
.clip-play.corner:focus,
.clip-play.corner.idle,
.clip-sound.corner:hover,
.clip-sound.corner:focus,
.clip-sound.corner.on {
  opacity: 1;
}

.band-wrap {
  position: relative;
}

/* ------------------------------------------------------------ clip sound */

/* A clip's speaker: crossed out while sound is off; plain while sound is
   on and another clip is heard; lit, with its waves, while this clip is
   heard. The accent means what it means in the players: sound, now. */
.clip-sound svg,
.sound-switch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clip-sound .body,
.sound-switch .body {
  fill: currentColor;
  stroke: none;
}

.clip-sound .waves,
.clip-sound.ready .slash,
.clip-sound.on .slash,
.sound-switch .waves,
.sound-switch.on .slash {
  display: none;
}

.clip-sound.on .waves,
.sound-switch.on .waves {
  display: inline;
}

.clip-sound.on,
.sound-switch.live {
  color: var(--accent);
}

.clip-sound.on svg,
.sound-switch.live svg {
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

/* The dock, in the corner of the screen: what is playing from the score,
   when its player is off screen, and the page's sound switch. It moves up
   out of the way of a band's own corner controls. */
.dock {
  position: fixed;
  right: max(0.6rem, calc(var(--gutter) - 1rem));
  bottom: 0.75rem;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  pointer-events: none;
}

.viewing .dock {
  visibility: hidden;
}

/* What plays from the score while its player is off screen: its name and
   how far it has played, which lead back to its player, and its pause. */
.now-playing {
  display: none;
  align-items: center;
  gap: 0.55rem;
  pointer-events: auto;
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1;
  color: var(--ink);
}

.now-playing.shown {
  display: flex;
  animation: np-in 0.3s var(--ease);
}

@keyframes np-in {
  from {
    opacity: 0;
  }
}

.np-title {
  display: grid;
  gap: 0.4rem;
  max-width: min(16rem, 42vw);
  padding: 0.25rem 0;
  text-align: right;
  /* legible over a picture, without a box */
  text-shadow: 0 0 3px #000, 0 0 10px rgba(0, 0, 0, 0.8);
}

.np-what {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.np-title:hover .np-what {
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.2em;
}

.np-bar {
  position: relative;
  height: 1px;
  background: var(--faint-2);
}

.np-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
}

.np-key {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.np-key svg {
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

.np-key {
  position: relative;
}

/* how far the piece has played, as a ring round its button, where the
   name and its line give way to the text */
.np-key::before {
  content: "";
  position: absolute;
  inset: calc(50% - 1rem);
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--np, 0) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  display: none;
}

@media (max-width: 60rem) {
  .np-title {
    display: none;
  }

  .np-key::before {
    display: block;
  }
}

.np-key.is-paused {
  color: var(--ink);
}

.np-key.is-paused svg {
  box-shadow: inset 0 0 0 1px var(--ink-2);
}

/* The page's sound switch: once the opening has gone by, while a clip with
   sound is on screen or sound is on. */
.sound-switch {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1;
  color: var(--ink-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* hidden, it stays in the order of the keys, and shows when it has them */
.sound-switch.shown,
.sound-switch:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

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

.sound-switch.on {
  color: var(--ink);
}

.sound-switch .ss-text {
  order: -1;
  font-variant-numeric: tabular-nums;
}

.sound-switch .ss-on,
.sound-switch.on .ss-off {
  display: none;
}

.sound-switch.on .ss-on {
  display: inline;
}

/* on a phone, the word goes and the speaker stays */
@media (max-width: 40rem) {
  .sound-switch .ss-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 52rem) {
  .pair-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pair-cell {
    flex: none !important;
  }
}

/* -------------------------------------------------------------- sound */

.players {
  display: grid;
  gap: 0.35rem;
}

.player {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  height: 2.75rem;
  min-width: 0;
}

.player audio {
  flex: 1;
  height: 2.5rem;
  min-width: 0;
}

.js .player audio {
  display: none;
}

.player .play,
.player .wave,
.player .time {
  display: none;
}

.js .player .play,
.js .player .wave {
  display: block;
}

.js .player .time {
  display: block;
}

.player .play {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--faint-2);
  color: var(--ink);
  display: grid;
  place-items: center;
}

.js .player .play {
  display: grid;
}

.player .play:hover {
  box-shadow: inset 0 0 0 1px var(--ink-2);
}

.player .play svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.player .play .stop,
.player.playing .play .go {
  display: none;
}

.player.playing .play .stop {
  display: inline;
}

.player.playing .play {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}

.wave {
  position: relative;
  flex: 1 1 auto;
  min-width: 4rem;
  max-width: 28rem;
  height: 1.75rem;
  cursor: pointer;
}

.wave svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--faint-2);
}

.wave:hover svg:not(.played) {
  fill: #45423c;
}

.wave svg.played {
  fill: var(--accent);
  clip-path: inset(0 100% 0 0);
}

.wave .head {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 0;
  width: 1px;
  background: var(--ink);
  opacity: 0;
}

.player.started .wave .head {
  opacity: 1;
}

.player .time,
.player .what {
  flex: none;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.player .what {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.player.playing .now {
  color: var(--accent);
}

/* ----------------------------------------------------------- the score */

/* The listening room, as a player, across the wide column and one screen
   tall at most, whatever is chosen: on the left the place shown, its picture
   as large as the room allows at the picture's own pixels, its name and when
   its music plays, and under them the one player; on the right the whole
   score as one list, scrolled inside the room, a group's name staying at the
   top while its places pass. No boxes, no counts: the list is set as the
   page's labels are, a little larger, with room between its lines. */
.fig.score {
  --fw: min(100%, var(--wide));
}

.room {
  --rh: min(80svh, 56rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 21rem);
  column-gap: var(--s2);
  height: var(--rh);
}

.stagebox {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.sights {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sight {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sight[hidden] {
  display: none;
}

.sight .place {
  flex: 1 1 0;
  height: auto;
  min-height: 6rem;
  max-height: var(--ph);
  margin-bottom: var(--s1);
}

.sight .pt {
  font-size: clamp(1.375rem, 0.8vw + 1rem, 1.75rem);
}

.sight .when {
  margin-top: 0.3rem;
  max-width: 40rem;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.stagebox .players {
  margin-top: var(--s1);
}

/* the piece in the player, where a reader looks: its title by the play
   button, in the text's face at the size of the sentence above it; then the
   outline and the time. Where, when, what, read downward. */
.stagebox .player {
  gap: 0.9rem;
}

.stagebox .player .what {
  order: 1;
  display: block;
  flex: 0 1 auto;
  max-width: 45%;
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink);
}

.stagebox .player .wave {
  order: 2;
  max-width: none;
}

.stagebox .player .time {
  order: 3;
}

/* on a phone the title takes the line by the button, and the outline and
   the time the line under it */
@media (max-width: 40rem) {
  .stagebox .player {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    grid-template-areas: "key what what" "wave wave time";
    gap: 0.5rem 0.9rem;
    height: auto;
  }

  .stagebox .player .play {
    grid-area: key;
  }

  .stagebox .player .what {
    grid-area: what;
    max-width: none;
  }

  .stagebox .player .wave {
    grid-area: wave;
  }

  .stagebox .player .time {
    grid-area: time;
  }
}

.list {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--faint-2) transparent;
  min-height: 0;
}

.list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lg + .lg {
  margin-top: var(--s1);
}

/* a group's name, the size of the page's labels, staying at the top of the
   list while its places pass */
.lgh {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 0.7rem 0 0.45rem;
  background: var(--ground);
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  color: var(--muted);
  -webkit-font-smoothing: none;
}

.lp {
  padding-bottom: 0.6rem;
}

.lpc {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  line-height: 1.35;
}

/* a place: a plain sub-heading over its pieces */
.lpn {
  margin: 0;
  padding: 0.45rem 0 0.2rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink-2);
}

/* a piece: a title and a length; the one playing in the accent, marked */
.lpc {
  position: relative;
  padding: 0.28rem 0 0.28rem 0.9rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.lpc .d {
  flex: none;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

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

.lpc.playing {
  color: var(--accent);
}

.lpc.playing::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(50% - 2.5px);
  width: 5px;
  height: 5px;
  background: var(--accent);
}

.lpc:focus-visible,
.lgt:focus-visible {
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .lpc {
    min-height: 2.75rem;
    align-items: center;
  }
}

/* On a phone: the picture across the top, the place and the player under
   it, then the score's groups as rows that open one at a time. */
@media (max-width: 40rem) {
  .room {
    display: block;
    height: auto;
  }

  .sight .place {
    flex: none;
    height: min(var(--ph), 38svh);
    margin-inline: calc(-1 * var(--gutter));
  }

  .list {
    overflow: visible;
    margin-top: var(--s2);
  }

  .lg + .lg {
    margin-top: 0;
  }

  .lgh {
    position: static;
    padding: 0;
    box-shadow: inset 0 -1px 0 var(--faint);
  }

  .lgt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 2.75rem;
    text-align: left;
    color: var(--ink-2);
  }

  .lgt::after {
    content: "+";
    color: var(--muted);
  }

  .lg.open .lgt {
    color: var(--ink);
  }

  .lg.open .lgt::after {
    content: "\2212";
  }

  .fold .lg:not(.open) .lgb {
    display: none;
  }

  .lgb {
    padding: 0.4rem 0 var(--s1);
  }
}

/* the place a pool plays in, a band of it across the room at the picture's
   own pixels, cut around its point */
.place {
  --pw: calc(var(--w) * 1px / var(--dpr));
  --ph: calc(var(--h) * 1px / var(--dpr));
  position: relative;
  overflow: hidden;
  height: min(var(--ph), 26rem, 50svh);
  margin-bottom: 1.75rem;
}

.place img,
.place video {
  position: absolute;
  width: var(--pw);
  height: var(--ph);
  max-width: none;
  left: clamp(min(100% - var(--pw), (100% - var(--pw)) / 2), 50% - var(--fx) * var(--pw), max(0px, (100% - var(--pw)) / 2));
  top: clamp(calc(100% - var(--ph)), calc(50% - var(--fy) * var(--ph)), 0px);
  image-rendering: pixelated;
}

.pt {
  font-size: clamp(1.5rem, 1.2vw + 1rem, 1.875rem);
  line-height: 1.15;
  font-variation-settings: "opsz" 32;
  color: var(--ink);
}

.when {
  margin-top: 0.45rem;
  color: var(--ink-2);
  max-width: 34rem;
}

/* the agent's picture of a sound, with the passage marked */
.marked {
  position: relative;
}

.marked .span {
  position: absolute;
  top: 6%;
  bottom: 9%;
  box-shadow: inset 1px 0 0 var(--accent), inset -1px 0 0 var(--accent), inset 0 2px 0 var(--accent);
  pointer-events: none;
}

/* the whole piece: the playhead alone */
.marked .span.whole {
  box-shadow: none;
}

.marked .span .head {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--ink);
  opacity: 0;
}

.marked.started .span .head {
  opacity: 1;
}

/* ------------------------------------------------ the request and its brief */

.fig.brief {
  --fw: min(100%, 66rem);
}

.brief-row {
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: 1.25rem 3.5rem;
  align-items: start;
}

.ask,
.spec {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.request {
  font-size: 1.3125rem;
  line-height: 1.45;
  font-variation-settings: "opsz" 24;
  color: var(--ink);
}

/* the brief, its parts named in its margin */
.brief-text {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.62;
  color: var(--muted);
  max-height: min(40rem, 72svh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--faint-2) transparent;
  padding: 0.1rem 1rem 3rem 0;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 4rem), transparent);
  mask-image: linear-gradient(#000 calc(100% - 4rem), transparent);
  display: grid;
  gap: 0.9rem;
}

.bp {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 1.1rem;
}

.bl {
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1.2;
  color: var(--ink-2);
  -webkit-font-smoothing: none;
  padding-top: 0.05rem;
}

.bt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding-left: 0.9rem;
  box-shadow: inset 1px 0 0 var(--faint-2);
  color: var(--ink-2);
  transition: color 0.15s, box-shadow 0.15s;
}

.bp:hover .bl {
  color: var(--accent);
}

.bp:hover .bt {
  color: var(--ink);
  box-shadow: inset 1px 0 0 var(--accent);
}

@media (max-width: 68rem) {
  .brief-row {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 36rem) {
  .bp {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
  }
}

/* ------------------------------------------------- a picture across the screen */

/* across the screen, not only the section: the section stops at the wide
   column, and a band wider than that would be cut instead of centred */
.fig.bleed {
  grid-column: full;
  grid-template-columns: minmax(0, 1fr);
  width: 100vw;
  justify-self: center;
}

/* A plate: a band between two sections, in neither, with a small label in
   the game's face and no caption. It has the same air above and below as
   lies between two sections, so it reads as a pause. */
.fig.plate {
  margin-block: var(--s4) 0;
}

.plate + .sect {
  margin-top: var(--s4);
}

.fig.bleed > .fig-label {
  margin: 0;
}

.fig.bleed figcaption,
.fig.bleed > .fig-label {
  padding-inline: var(--gutter);
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
}

.fig.bleed figcaption {
  max-width: none;
}

/* A picture across the screen at a whole number of device pixels to each of
   its pixels, the one nearest the screen's width; it is cut around the point
   the figure names, and centred on the dark when it is narrower than the
   screen. It is never taller than four fifths of the screen (the small
   viewport, so a phone's collapsing bars don't move it): rows are cut around
   the point, so the whole band and its caption fit on a laptop. A window
   (--y0, --y1) keeps only those rows of it. */
.band {
  --base: calc(var(--w) * 1px / var(--dpr));
  --iw: max(var(--base), 100vw);
  --ih: calc(var(--iw) * var(--h) / var(--w));
  --y0: 0;
  --y1: 1;
  display: block;
  position: relative;
  overflow: hidden;
  height: min(calc((var(--y1) - var(--y0)) * var(--ih)), 80svh);
  container-type: size;
  cursor: zoom-in;
}

@supports (width: round(nearest, 10px, 3px)) {
  .band {
    --iw: max(var(--base), round(nearest, 100vw, var(--base)));
  }
}

/* a band that must never leave dark at its sides takes the next whole size up */
@supports (width: round(up, 10px, 3px)) {
  .band.fill {
    --iw: max(var(--base), round(up, 100vw, var(--base)));
  }
}

.band img,
.band video {
  position: absolute;
  width: var(--iw);
  height: var(--ih);
  max-width: none;
  left: clamp(min(100cqw - var(--iw), (100cqw - var(--iw)) / 2), 50cqw - var(--fx) * var(--iw), max(0px, (100cqw - var(--iw)) / 2));
  top: clamp(min(0px, 100cqh - var(--y1) * var(--ih)), 50cqh - var(--fy) * var(--ih), -1 * var(--y0) * var(--ih));
  image-rendering: pixelated;
}

/* -------------------------------------------------------------- draft notes */

.draft-note {
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--accent);
  border-left: 1px solid var(--accent-dim);
  padding-left: 0.75rem;
}

@media (min-width: 80rem) {
  .sect > .draft-note {
    grid-column: text-end / wide-end;
    margin-left: 3rem;
    max-width: 18rem;
    grid-row: span 1;
    margin-top: -4rem;
  }
}

/* --------------------------------------------------------------- credits */

.credits {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: var(--s4) auto 0;
  padding: 0 var(--gutter) 5rem;
  display: grid;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}

.credits p {
  max-width: 72ch;
}

.credits .home {
  margin-top: 1.4rem;
}

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

.rail {
  position: fixed;
  left: max(0.9rem, calc((100vw - var(--wide)) / 2 - var(--gutter) - 1.5rem));
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: none;
  font-family: var(--sans);
  font-size: 0.6875rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
  pointer-events: none;
}

/* only the marks take the pointer, until one is under it; then the names
   show, and the whole rail does */
.rail.on:hover,
.rail.on:focus-within {
  pointer-events: auto;
}

@media (min-width: 80rem) {
  .rail {
    display: block;
  }
}

.rail.on {
  opacity: 1;
  visibility: visible;
}

.rail ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}

.rail a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  height: 1.35rem;
  color: var(--muted);
  text-decoration: none;
}

.rail a i {
  width: 5px;
  height: 5px;
  background: var(--faint-2);
  flex: none;
  transition: background 0.2s;
  position: relative;
  pointer-events: auto;
}

.rail a i::before {
  content: "";
  position: absolute;
  inset: -0.5rem;
}

.rail a span {
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  background: var(--ground);
  padding-right: 0.4rem;
}

.rail:hover a span,
.rail:focus-within a span {
  opacity: 1;
  transform: none;
}

.rail a.on {
  color: var(--ink-2);
}

.rail a.on i {
  background: var(--accent);
}

.rail a:hover {
  color: var(--ink);
}

/* ----------------------------------------------------------------- viewer */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--ground);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  opacity: 0;
  transition: opacity 0.22s;
}

.viewer[hidden] {
  display: none;
}

.viewer.on {
  opacity: 1;
}

.v-stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}

.v-stage.zoomed {
  cursor: grab;
}

.v-stage.dragging {
  cursor: grabbing;
}

.v-img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.v-img.px {
  image-rendering: pixelated;
}

.v-img.px.down {
  image-rendering: auto;
}

.v-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2.5rem;
  padding: 0.9rem var(--gutter) 1.1rem;
  min-height: 4.5rem;
}

.v-cap {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 70ch;
}

.v-cap b {
  color: var(--ink-2);
  font-weight: 500;
}

.v-cap .v-step {
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--accent);
  -webkit-font-smoothing: none;
  margin-right: 0.6rem;
}

.v-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: none;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.v-tools button {
  height: 2.25rem;
  min-width: 2.25rem;
  padding: 0 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--ink-2);
}

.v-tools button:hover {
  color: var(--ink);
}

.v-tools button:disabled {
  opacity: 0.25;
  cursor: default;
}

.v-tools svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-zoom {
  font-family: var(--pixel);
  font-size: 16px;
  min-width: 2.5rem;
  text-align: center;
  color: var(--muted);
  -webkit-font-smoothing: none;
}

.v-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-right: 0.6rem;
}

@media (max-width: 40rem) {
  .player .what {
    display: none;
  }

  .v-bar {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .v-tools {
    justify-content: space-between;
  }
}

/* ------------------------------------------------------------- small screens */

/* On a phone the stepper is a row of names that wraps, every one shown, each
   a whole line tall to press; the one shown underlined in the accent, as the
   score's places are. */
@media (max-width: 40rem) {
  .steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.4rem;
  }

  .steps::before,
  .steps button i {
    display: none;
  }

  .steps button,
  .steps button:last-child {
    justify-items: start;
    align-content: center;
    padding: 0;
    text-align: left;
  }

  .steps button[aria-pressed="true"] {
    box-shadow: inset 0 -2px 0 var(--accent);
  }
}

@media (max-width: 40rem) {
  body {
    font-size: 1.0625rem;
  }

  .qa > div {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
