/*
 * this stylesheet holds the tokens, layout, panel, hud and controls.
 * the site has a single dark theme, and every color lives on :root.
 */

:root {
  color-scheme: dark;

  /* the ground tokens run from the darkest blue-black upward. */

  --ink-0: #04060b;
  --ink-1: #080c15;
  --ink-2: #0e1420;
  --ink-3: #172033;
  --ink-4: #2a3550;

  /* the text tokens use a warm phosphor tone. */

  --text-1: #f2e8d2;
  --text-2: #c9bea7;
  --text-3: #958b77;

  /* amber marks ui emphasis, and cyan marks data and blueshift. */

  --amber: #ffb547;
  --amber-hi: #ffd08a;
  --amber-lo: #9c6219;
  --amber-ink: #1c1103;
  --cyan: #6fe3ea;
  --cyan-lo: #2a7d84;

  /* status colors stay apart from the accent. */

  --warn: #ff6b57;
  --hypo: #c6a6ff;

  --scrim: rgba(4, 6, 11, 0.9);
  --scrim-soft: rgba(4, 6, 11, 0.6);
  --shadow: rgba(0, 0, 0, 0.55);
  --focus: var(--amber-hi);

  --font-display: 'Pixelify Sans', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.875rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  --panel-w: 400px;
  --tab-w: 48px;
  --peek-h: 64px;
  --rule: 2px;

  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms;
  --t-med: 260ms;
  --t-slow: 600ms;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --t-fast: 0ms;
    --t-med: 0ms;
    --t-slow: 0ms;
  }
}

/* these base rules reset the page and style focus, icons and keys. */

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--ink-0);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--amber);
  color: var(--amber-ink);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.i {
  display: block;
  flex: none;
  width: 16px;
  height: 14px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

.i-flip {
  transform: scaleX(-1);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.4em;
  font-family: var(--font-mono);
  font-size: 0.8125em;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
  color: var(--text-1);
  background: var(--ink-2);
  border: 1px solid var(--ink-4);
  border-bottom-width: 3px;
}

/* the app frame puts the stage on the left and docks the guide on the right. */

.kerr {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  background: var(--ink-0);
}

.kerr[data-panel='collapsed'] {
  grid-template-columns: minmax(0, 1fr) var(--tab-w);
}

.main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  container-type: inline-size;
  container-name: main;
}

/* --bar-h is a share of the stage's height, so every rule that uses it must sit on an element positioned in the stage. */

.stage {
  --bar-h: clamp(28px, 10%, 88px);
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--ink-0);
}

.stage:focus {
  outline: none;
}

.view {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.view:active {
  cursor: grabbing;
}

.kerr[data-locked] .view {
  cursor: none;
}

.veil {
  position: absolute;
  inset: 0;
  background: var(--ink-0);
  opacity: 0;
  pointer-events: none;
}

/* ergo's canvas holds one art pixel per canvas pixel, and its css size scales it up. app.js moves it with a transform. */

.ergo {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
  image-rendering: pixelated;
  will-change: transform;
}

/*
 * the letterbox bars slide in over the scene and ergo during trips, title cards and captions.
 * the hud, compass, marker, chip, caption and card all sit above them.
 * .corners and BAR_IN_MS and BAR_OUT_MS in app.js share the bars' timing, so keep them in step.
 */

.bar {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--bar-h);
  background: var(--ink-0);
  pointer-events: none;
  transform: translateY(-101%);
  transition: transform 520ms var(--ease-out);
}

.bar-top {
  top: 0;
}

.bar-bottom {
  bottom: 0;
  transform: translateY(101%);
}

.kerr[data-letterbox] .bar {
  transform: none;
  transition-duration: 700ms;
}

@media (prefers-reduced-motion: reduce) {
  .bar,
  .bar-bottom {
    transform: none;
    opacity: 0;
    transition: opacity 200ms linear;
  }

  .kerr[data-letterbox] .bar {
    opacity: 1;
    transition-duration: 200ms;
  }
}

/*
 * the ergo marker is 40 px square, as MARK_SIZE in app.js. app.js moves it along the edge with a transform.
 * it stacks above the chip, caption and card, which ignore the pointer, so nothing hides it.
 */

.ergo-mark {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: block;
  width: 40px;
  height: 40px;
  padding: 2px;
  background: var(--scrim);
  border: 1px solid var(--amber-lo);
  cursor: pointer;
  will-change: transform;
  transition: border-color var(--t-fast);
}

.ergo-mark[hidden] {
  display: none;
}

@media (hover: hover) {
  .ergo-mark:hover {
    border-color: var(--amber);
  }
}

.ergo-mark:focus-visible {
  outline-offset: -4px;
}

.ergo-mark canvas {
  display: block;
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  pointer-events: none;
  background:
    linear-gradient(var(--text-1), var(--text-1)) center / 2px 14px no-repeat,
    linear-gradient(var(--text-1), var(--text-1)) center / 14px 2px no-repeat;
  opacity: 0.7;
  mix-blend-mode: difference;
}

.kerr[data-locked] .crosshair {
  display: block;
}

/*
 * the corners hold the hud and the compass, and they fill the stage.
 * while the bars show, the corners drop by --bar-h on the bars' timing, so the hud and the compass clear the top bar.
 * a translate percentage reads the corners' own height, which is the stage's, so the drop equals the bar's height.
 * app.js mirrors this slide in BAR_IN_MS, BAR_OUT_MS and barEase, so ergo's marker keeps clear of both.
 */

.corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: transform 520ms var(--ease-out);
}

.kerr[data-letterbox] .corners {
  transform: translateY(var(--bar-h));
  transition-duration: 700ms;
}

/* under reduced motion the corners jump without sliding. they jump down at once and jump back up once the bars have faded out. */

@media (prefers-reduced-motion: reduce) {
  .corners {
    transition: transform 0s linear 200ms;
  }

  .kerr[data-letterbox] .corners {
    transition: none;
  }
}

/*
 * the hud sits over the top-left corner of the view.
 * it takes the pointer so its tooltips show on hover, and look.js passes a drag or click on it through to the view.
 */

.hud {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  min-width: 232px;
  padding: var(--space-3) var(--space-4) var(--space-3);
  background: var(--scrim);
  border: 1px solid var(--ink-3);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.hud p {
  margin: 0;
}

.hud-kicker {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.hud-transit {
  color: var(--cyan);
}

.hud-name {
  margin: 2px 0 var(--space-2) !important;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-1);
}

.hud-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-4);
  row-gap: 2px;
  margin: 0;
}

.hud-grid > div {
  display: contents;
}

.hud-grid dt {
  color: var(--text-3);
}

.hud-grid dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  white-space: nowrap;
}

.hud-grid dd[data-hud='observer'] {
  font-family: var(--font-body);
  color: var(--text-1);
}

/* past the outer horizon, r and r in km turn red and stay red. */

.hud-grid dd[data-inside] {
  color: var(--warn);
}

/* at stages 5 and 6 the countdown to the inner horizon takes the clock row, and its zero note wraps inside the hud's width. */

.hud-grid > div[hidden] {
  display: none;
}

.hud-grid dd[data-hud='left'] {
  color: var(--warn);
}

.hud-note {
  margin-top: var(--space-2) !important;
  contain: inline-size;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--warn);
}

/*
 * the hud, the compass and the tool buttons step aside while a title card or the departure shows.
 * the card button stays while a card shows, so the same button closes it.
 */

.hud,
.compass,
.tool-btn {
  transition: opacity 300ms ease, visibility 0s linear 0s, border-color var(--t-fast), color var(--t-fast);
}

.kerr[data-card] .hud,
.kerr[data-card] .compass,
.kerr[data-card] .tool-btn:not(.card-btn),
.kerr[data-departure] .hud,
.kerr[data-departure] .compass,
.kerr[data-departure] .tool-btn {
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 0s linear 300ms, border-color var(--t-fast);
}

/* the hud lets go of the pointer as the card appears, so a press there during the fade only dismisses the card, as on the view. */

.kerr[data-card] .hud {
  pointer-events: none;
}

/* the tools column holds the compass, the speaker button, the ergo button and the card button over the top-right corner of the view. */

.tools {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: grid;
  justify-items: end;
  gap: var(--space-2);
  pointer-events: none;
}

.compass {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-2) 6px;
  background: var(--scrim);
  border: 1px solid var(--ink-3);
  cursor: pointer;
  pointer-events: auto;
}

@media (hover: hover) {
  .compass:hover {
    border-color: var(--amber-lo);
  }
}

/* the focus ring sits inside the compass, so it shows against any sky. */

.compass:focus-visible {
  outline-offset: -4px;
}

.compass canvas {
  display: block;
  width: 75px;
  height: 75px;
  image-rendering: pixelated;
}

.compass-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-2xs);
  color: var(--text-3);
}

.lg {
  display: inline-block;
  width: 6px;
  height: 6px;
}

.lg-hole {
  background: var(--ink-0);
  box-shadow: 0 0 0 1px var(--amber);
}

.lg-spin {
  margin-left: 4px;
  background: var(--cyan);
}

/*
 * the tool buttons share one style. each shows its icon in amber while on, and a struck icon in grey while off.
 * the speaker button shows a dim speaker while it waits for a click or key press.
 */

.tool-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 36px;
  padding: 0;
  background: var(--scrim);
  border: 1px solid var(--ink-3);
  color: var(--text-3);
  cursor: pointer;
  pointer-events: auto;
}

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

.tool-btn .i {
  width: 24px;
  height: 20px;
}

/* the ergo icon is 13 by 12 art pixels at 2 css px each. */

.ergo-btn .i {
  width: 26px;
  height: 24px;
}

/* the info icon is 12 by 12 art pixels. it shows a ring at rest and a filled disc while a card is open. */

.card-btn .i {
  width: 24px;
  height: 24px;
}

.tool-btn[aria-pressed='true'] {
  color: var(--amber);
}

.card-btn[aria-pressed='true'] {
  border-color: var(--amber-lo);
}

.sound-btn[data-waiting] {
  color: var(--amber-lo);
}

/* the card button rests during a trip, because the trip ends on a card. */

.tool-btn[aria-disabled='true'] {
  color: var(--ink-4);
  cursor: default;
}

@media (hover: hover) {
  .tool-btn:hover {
    border-color: var(--amber-lo);
    color: var(--text-1);
  }

  .tool-btn[aria-pressed='true']:hover {
    color: var(--amber-hi);
  }

  .tool-btn[aria-disabled='true']:hover {
    border-color: var(--ink-3);
    color: var(--ink-4);
  }
}

.tool-btn:focus-visible {
  outline-offset: -4px;
}

/* the status chip floats above the bottom edge of the view. */

.chip {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  max-width: calc(100% - 2 * var(--space-4));
  margin: 0;
  padding: var(--space-2) var(--space-4);
  transform: translateX(-50%);
  background: var(--scrim);
  border: 1px solid var(--ink-4);
  color: var(--text-1);
  font-size: var(--text-sm);
  line-height: 1.6;
  text-align: center;
  pointer-events: none;
  transition: opacity var(--t-slow) ease;
}

.chip[data-hidden] {
  opacity: 0;
}

.chip:empty {
  display: none;
}

.kerr[data-letterbox] .chip {
  bottom: calc(var(--bar-h) + var(--space-3));
}

/* a caption runs in the bottom letterbox bar, centred in it, and grows upward when it needs more lines. */

.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--bar-h);
  margin: 0;
  padding: var(--space-2) var(--space-6);
  color: var(--text-1);
  font-size: var(--text-md);
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.caption[data-tone='warn'] {
  color: var(--warn);
}

.caption[data-hidden] {
  opacity: 0;
}

.caption:empty {
  display: none;
}

/*
 * the ghost box names the scale ghost at stages 1 to 3 and holds its switch, in the view's bottom-left corner.
 * it rises clear of the look hint while the hint shows, and it fades out while the bars show.
 * GHOST_BOX_LIFT in app.js matches its raised bottom, so ergo's marker keeps clear of it.
 */

.ghost {
  position: absolute;
  left: var(--space-4);
  bottom: var(--space-4);
  width: min(420px, calc(100% - 2 * var(--space-4)));
  padding: 10px var(--space-4) var(--space-3);
  background: var(--scrim);
  border: 1px solid var(--ink-4);
  pointer-events: none;
  transition: opacity 300ms ease, bottom 300ms var(--ease-out), visibility 0s linear 0s;
}

.ghost[hidden] {
  display: none;
}

.chip:not([data-hidden]):not(:empty) ~ .ghost {
  bottom: 76px;
}

.kerr[data-letterbox] .ghost {
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, bottom 300ms var(--ease-out), visibility 0s linear 300ms;
}

.ghost[data-off] {
  width: auto;
}

.ghost-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}

.ghost[data-off] .ghost-name {
  color: var(--text-3);
}

.ghost-switch {
  flex: none;
  min-width: 44px;
  padding: 2px var(--space-2);
  font: inherit;
  letter-spacing: 0.08em;
  color: var(--ink-0);
  background: var(--cyan);
  border: 1px solid var(--cyan);
  cursor: pointer;
  pointer-events: auto;
}

.ghost-switch[aria-checked='false'] {
  color: var(--text-2);
  background: transparent;
  border-color: var(--ink-4);
}

@media (hover: hover) {
  .ghost-switch:hover {
    border-color: var(--text-1);
  }
}

.ghost-text {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-2);
}

.ghost[data-off] .ghost-text {
  display: none;
}

/* phones show the short caption, which keeps the size and the scale sentence. */

.ghost-short {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .ghost {
    transition: opacity 300ms ease, visibility 0s linear 0s;
  }

  .kerr[data-letterbox] .ghost {
    transition: opacity 300ms ease, visibility 0s linear 300ms;
  }
}

/*
 * the title card sits right of centre below the top bar, clear of ergo at the view's centre.
 * it fades in with a short rise and fades out, and under reduced motion it only fades.
 * its scrim reaches past the text and fades out before its own edges, so it darkens bright scenes without a visible box.
 */

.card {
  position: absolute;
  top: calc(var(--bar-h) + 40px);
  right: 48px;
  width: min(480px, calc(100% - 96px));
  padding: 20px 24px 24px;
  color: var(--text-1);
  pointer-events: none;
  isolation: isolate;
  transition: opacity 350ms ease, transform 350ms var(--ease-out), visibility 0s linear 0s;
}

.card::before {
  content: '';
  position: absolute;
  inset: -56px -96px;
  z-index: -1;
  background: radial-gradient(closest-side, var(--scrim) 0%, var(--scrim) 45%, var(--scrim-soft) 72%, transparent 100%);
}

.card[data-hidden] {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 450ms ease, transform 450ms ease, visibility 0s linear 450ms;
}

.card-kicker {
  display: flex;
  margin: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.card-kicker-part {
  white-space: nowrap;
}

.card-kicker .badge {
  margin: 0;
  letter-spacing: 0.1em;
}

.card-kicker .badge[hidden] {
  display: none;
}

.card-title {
  margin: 10px 0 12px;
  font-family: var(--font-display);
  font-size: 3.25rem;
  font-weight: 600;
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 2px 0 var(--ink-0);
}

.card-r {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  text-shadow: 0 1px 0 var(--ink-0);
}

.card-r-label {
  color: var(--text-3);
}

.card-r-value[data-inside] {
  color: var(--warn);
}

.card-line {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text-2);
  text-shadow: 0 1px 0 var(--ink-0);
}

/* the gap keeps the card's text clear of the card button on phones, where the card spans the view. */

.card-gap {
  display: none;
}

/* the extra-line slot stays empty until a later feature writes into it. */

.card-extra {
  margin-top: 18px;
}

.card-extra:empty {
  display: none;
}

.card-ghost {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--cyan);
  text-shadow: 0 1px 0 var(--ink-0);
}

/* the countdown sits in a red box, and its zero note explains why the view still holds. */

.card-clock {
  display: inline-block;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--warn);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--warn);
  background: var(--scrim-soft);
}

.card-clock-time {
  font-weight: 500;
  color: var(--text-1);
}

.card-clock[data-zero] {
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--text-1);
}

.card-clock-note {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-2);
  text-shadow: 0 1px 0 var(--ink-0);
}

/* a stage's line under the countdown is cyan, the colour of blueshift. a dark halo keeps it legible over the glare at stage 7. */

.card-clock-line {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--cyan);
  text-shadow: 0 1px 0 var(--ink-0), 0 0 3px var(--ink-0), 0 0 8px var(--ink-0);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card[data-hidden] {
    transform: none;
  }
}

/*
 * the departure covers the view with its plates on the trip from earth, under the letterbox bars and above ergo.
 * its canvas holds one art pixel per canvas pixel, and js/departure.js sizes it from the stage's bottom-left corner, as the renderer's grid runs.
 * a press anywhere on it skips the trip, so it takes the pointer while it shows.
 * its hud sits above the bars, with the kicker and skip hint in the top bar and the strip of rungs in the bottom bar.
 */

.departure {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.departure[hidden],
.departure-hud[hidden] {
  display: none;
}

.departure-plate {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  image-rendering: pixelated;
}

.departure-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* js/departure.js moves each label to its place with a transform, beside its point and clear of the ticker and the other labels. */

.dep-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.35;
  white-space: nowrap;
  color: var(--text-1);
  background: rgba(4, 6, 11, 0.85);
  border: 1px solid var(--ink-4);
}

.dep-label[hidden] {
  display: none;
}

.dep-sun {
  color: var(--amber-hi);
}

.dep-end {
  color: var(--amber);
}

.dep-rung,
.dep-ghost {
  color: var(--cyan);
}

.dep-dim {
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
  text-shadow: 0 1px 0 var(--ink-0), 0 0 4px var(--ink-0);
}

.departure-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dep-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--bar-h);
  margin: 0;
  padding: 0 var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.dep-skip {
  padding: 5px 12px;
  border: 1px solid var(--ink-4);
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-2);
  white-space: nowrap;
}

.dep-ticker {
  position: absolute;
  top: calc(var(--bar-h) + var(--space-4));
  left: var(--space-6);
  width: min(420px, calc(100% - 2 * var(--space-6)));
  padding: 14px 18px 12px;
  background: rgba(4, 6, 11, 0.84);
  border: 1px solid var(--ink-4);
}

.dep-ticker p {
  margin: 0;
}

.dep-big {
  font-family: var(--font-mono);
  font-size: 1.625rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--cyan);
}

.dep-of {
  margin-top: 2px !important;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-3);
}

.dep-age {
  margin-top: 10px !important;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text-1);
}

.dep-note {
  margin-top: 6px !important;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text-2);
}

.dep-note:empty {
  display: none;
}

.dep-light {
  margin-top: 10px !important;
  padding-top: 8px;
  border-top: 1px solid var(--ink-3);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-2);
}

.dep-scale {
  margin-top: 6px !important;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--text-3);
}

.dep-strip {
  position: absolute;
  left: var(--space-6);
  right: var(--space-6);
  bottom: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  height: var(--bar-h);
  margin: 0;
  padding: min(14px, calc(var(--bar-h) * 0.16)) 0 0;
  list-style: none;
}

.dep-cell {
  flex: 1 1 0;
  min-width: 0;
  padding-top: 7px;
  border-top: 3px solid var(--ink-4);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dep-cell-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* a value may wrap onto a second line, such as the horizon's length in the last cell. */

.dep-cell-value {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.dep-nowrap {
  white-space: nowrap;
}

.dep-cell[data-state='done'] {
  border-color: var(--amber-lo);
  color: var(--text-2);
}

.dep-cell[data-state='now'] {
  border-color: var(--amber);
  color: var(--amber);
}

/* while the departure shows, ergo's marker and the look hint wait, since ergo rides on the plates. */

.kerr[data-departure] .ergo-mark {
  visibility: hidden;
}

.kerr[data-departure] .chip {
  opacity: 0;
}

/* on small screens the ticker keeps the distance, the age of the light and the scale line, and the strip keeps the names. */

@container main (max-width: 640px) {
  .dep-top {
    padding: 0 var(--space-3);
  }

  .dep-kicker {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dep-ticker {
    left: var(--space-3);
    width: calc(100% - 2 * var(--space-3));
    padding: 10px 12px;
  }

  .dep-big {
    font-size: 1.375rem;
  }

  .dep-note {
    display: none;
  }

  .dep-light,
  .dep-age {
    font-size: 0.8125rem;
  }

  .dep-strip {
    left: var(--space-3);
    right: var(--space-3);
  }

  .dep-cell-value {
    display: none;
  }
}

/* the fallback plate explains a missing webgl2 context. */

.fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(26rem, calc(100% - 2 * var(--space-6)));
  padding: var(--space-4) var(--space-5);
  transform: translate(-50%, -50%);
  background: var(--scrim);
  border: 2px solid var(--warn);
}

.fallback[hidden] {
  display: none;
}

.fallback-title {
  margin: 0 0 var(--space-1);
  font-weight: 700;
  color: var(--warn);
}

.fallback-text {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm);
}

/* buttons share a pixel bevel, and the primary button is amber. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 2px solid var(--ink-4);
  border-radius: 0;
  background: var(--ink-2);
  color: var(--text-1);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.4);
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

@media (hover: hover) {
  .btn:hover {
    border-color: var(--text-3);
  }
}

.btn:active {
  box-shadow: none;
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.38;
  cursor: default;
  transform: none;
}

@media (hover: hover) {
  .btn:disabled:hover {
    border-color: var(--ink-4);
  }
}

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
  box-shadow: inset 0 -3px 0 var(--amber-lo);
}

@media (hover: hover) {
  .btn-primary:hover {
    background: var(--amber-hi);
    border-color: var(--amber-hi);
  }
}

.btn-lg {
  min-height: 52px;
  padding: 0 var(--space-7);
  font-size: var(--text-lg);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 2px solid var(--ink-4);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}

@media (hover: hover) {
  .icon-btn:hover {
    border-color: var(--text-3);
    color: var(--text-1);
  }
}

.icon-btn .i {
  width: 10px;
  height: 16px;
}

/* the journey nav holds ascend, the rail and descend. */

.nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'asc rail desc';
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-3) var(--space-5) var(--space-3);
  background: var(--ink-1);
  border-top: var(--rule) solid var(--ink-3);
}

.nav-ascend {
  grid-area: asc;
}

.nav-descend {
  grid-area: desc;
  min-width: 136px;
}

/* the descend arrow nudges 2 px right every 4 s, one pixel per step, to invite another press. */

.nav-descend .i {
  animation: descend-nudge 4s steps(1, end) infinite;
}

.kerr[data-travelling] .nav-descend .i,
.nav-descend[data-end] .i {
  animation: none;
}

@keyframes descend-nudge {
  0%,
  88% {
    transform: none;
  }

  91% {
    transform: translateX(1px);
  }

  94% {
    transform: translateX(2px);
  }

  97% {
    transform: translateX(1px);
  }

  100% {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-descend .i {
    animation: none;
  }
}

.rail {
  --progress: 0;
  --dot: 12px;
  grid-area: rail;
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail::before,
.rail::after {
  content: '';
  position: absolute;
  top: calc(var(--space-1) + var(--dot) / 2 - 1px);
  left: calc(100% / 18);
  right: calc(100% / 18);
  height: 2px;
  pointer-events: none;
}

/* the rail line is solid up to the horizon at stage 5 and dotted beyond it. */

.rail::before {
  background:
    linear-gradient(90deg, var(--ink-4) 62.5%, transparent 62.5%),
    repeating-linear-gradient(90deg, var(--ink-4) 0 4px, transparent 4px 8px);
}

.rail::after {
  background:
    linear-gradient(90deg, var(--amber) 62.5%, transparent 62.5%),
    repeating-linear-gradient(90deg, var(--amber) 0 4px, transparent 4px 8px);
  clip-path: inset(0 calc((1 - var(--progress)) * 100%) 0 0);
}

.rail li {
  display: flex;
  min-width: 0;
}

.stop {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: var(--space-1) 2px 2px;
  background: none;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
}

.stop:focus-visible {
  outline-offset: 0;
}

.stop-dot {
  width: var(--dot);
  height: var(--dot);
  background: var(--ink-1);
  border: 2px solid var(--ink-4);
  transition: background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

.stop-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  transition: color var(--t-fast);
}

.stop-r {
  margin-top: -3px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  white-space: nowrap;
  color: var(--text-3);
}

.stop-num {
  display: none;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}

@media (hover: hover) {
  .stop:hover .stop-name,
  .stop:hover .stop-num {
    color: var(--text-1);
  }

  .stop:hover .stop-dot {
    border-color: var(--text-3);
  }
}

.stop[data-state='past'] .stop-dot {
  background: var(--amber-lo);
  border-color: var(--amber-lo);
}

.stop[aria-current] .stop-dot {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--ink-1), 0 0 0 5px var(--amber);
}

.stop[aria-current] .stop-name,
.stop[aria-current] .stop-num {
  color: var(--text-1);
}

.stop[data-speculative] .stop-dot {
  transform: rotate(45deg) scale(0.85);
  border-color: var(--hypo);
}

.stop[data-speculative] .stop-name {
  color: var(--hypo);
}

.stop[data-speculative][aria-current] .stop-dot {
  background: var(--hypo);
  box-shadow: 0 0 0 3px var(--ink-1), 0 0 0 5px var(--hypo);
}

/* a red mark between the ergosphere and the horizon stops shows where return becomes impossible. its label sits in the nav's top padding. */

.rail li {
  position: relative;
}

.rail-mark {
  position: absolute;
  top: 0;
  left: -1px;
  z-index: 2;
  width: 2px;
  height: 26px;
  background: var(--warn);
  pointer-events: none;
}

.rail-mark span {
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--warn);
}

/* the nav stacks into two rows when the stage column is narrow. */

@container main (max-width: 860px) {
  .nav {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'rail rail'
      'asc desc';
    row-gap: var(--space-2);
    padding-top: 15px;
  }

  .stop-name,
  .stop-r {
    display: none;
  }

  .stop-num {
    display: block;
  }

  .stop {
    min-height: 40px;
  }

  .nav-descend {
    min-width: 0;
  }
}

/* the guide panel docks on the right on desktop. */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ink-1);
  border-left: var(--rule) solid var(--ink-3);
}

.sheet-grip,
.panel-tab {
  display: none;
}

.panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4) var(--space-6) var(--space-4);
  border-bottom: var(--rule) solid var(--ink-3);
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--amber);
}

.mass {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.mass-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* the options share one row, smallest mass on the left, however many presets there are. */

.mass-options {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border: 2px solid var(--ink-4);
}

/* each option is a label around a native radio, which covers it invisibly. */

.mass-opt {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 46px;
  padding: var(--space-1) 2px;
  background: transparent;
  border: 0;
  border-left: 2px solid var(--ink-4);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.mass-name {
  max-width: 100%;
  overflow: hidden;
}

.mass-opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mass-opt:first-child {
  border-left: 0;
}

@media (hover: hover) {
  .mass-opt:hover {
    color: var(--text-1);
    background: var(--ink-2);
  }
}

.mass-opt small {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 400;
  letter-spacing: -0.02em;
  opacity: 0.8;
}

/* the line under the options names the chosen preset in full and says what it stands for. */

.mass-note {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--text-3);
}

.mass-note b {
  color: var(--text-1);
}

.mass-note-text {
  display: block;
}

.mass-opt[data-checked] {
  background: var(--amber);
  color: var(--amber-ink);
}

.mass-opt:has(input:focus-visible) {
  outline: 2px solid var(--text-1);
  outline-offset: -4px;
}

.mass-opt[data-checked]:has(input:focus-visible) {
  outline-color: var(--amber-ink);
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6) var(--space-6) var(--space-8);
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) transparent;
}

.panel-body:focus-visible {
  outline-offset: -3px;
}

.kerr[data-panel='collapsed'] .panel-head,
.kerr[data-panel='collapsed'] .panel-body {
  display: none;
}

.kerr[data-panel='collapsed'] .panel-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: 100%;
  padding: var(--space-5) 0;
  background: none;
  border: 0;
  color: var(--text-2);
  cursor: pointer;
}

@media (hover: hover) {
  .panel-tab:hover {
    color: var(--text-1);
    background: var(--ink-2);
  }
}

.panel-tab .i {
  width: 10px;
  height: 16px;
}

.panel-tab span {
  writing-mode: vertical-rl;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* these rules style the guide content. */

.p-kicker {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.panel[data-speculative] .p-kicker {
  color: var(--hypo);
}

.p-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.12;
  color: var(--text-1);
  text-wrap: balance;
}

.badge {
  display: inline-block;
  margin: 0 0 var(--space-3);
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.badge-hypo {
  color: var(--hypo);
  border: 2px dashed var(--hypo);
}

.p-summary {
  margin: 0 0 var(--space-6);
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--text-1);
}

/* the ergo line reports ergo's state under the summary. */

.p-ergo {
  margin: 0 0 var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--ink-2);
  border-left: var(--rule) solid var(--amber);
}

.p-ergo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-2);
  margin: 0 0 var(--space-1);
  font-size: var(--text-xs);
}

.p-ergo-name {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.p-ergo-state {
  font-weight: 700;
  color: var(--amber);
}

.p-ergo-g {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

.p-ergo-why {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-2);
}

.p-section {
  margin: 0 0 var(--space-6);
  padding-top: var(--space-4);
  background-image: linear-gradient(90deg, var(--ink-4) 50%, transparent 50%);
  background-size: 6px 2px;
  background-repeat: repeat-x;
  background-position: top left;
}

.p-section > h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.p-section > h3 em {
  font-style: normal;
  color: var(--cyan);
}

.p-section p {
  margin: 0 0 var(--space-3);
  color: var(--text-2);
}

.p-section .p-sub {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-1);
}

.p-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-2);
}

.p-list li::before {
  content: '';
  position: absolute;
  top: 0.6em;
  left: 0;
  width: 6px;
  height: 6px;
  background: var(--amber-lo);
}

.p-list li[data-speculative]::before {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--hypo);
}

.p-flag {
  margin-left: 0.4em;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hypo);
  white-space: nowrap;
}

/* each number takes two rows, with the label on the left and the value below it on the right. */

.p-numbers {
  margin: 0;
}

.p-numbers dt {
  margin-top: var(--space-3);
  color: var(--text-2);
}

.p-numbers dt:first-child {
  margin-top: 0;
}

.p-numbers dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--cyan);
}

.p-numbers dd.is-text {
  font-family: var(--font-body);
  color: var(--text-1);
}

.p-numbers dd small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-3);
}

.p-note {
  margin: 0 0 var(--space-6);
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--ink-4);
  color: var(--text-3);
  font-size: var(--text-sm);
}

.p-note code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--text-2);
}

.p-glossary summary {
  cursor: pointer;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

@media (hover: hover) {
  .p-glossary summary:hover {
    color: var(--text-1);
  }
}

.p-glossary dl {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
}

.p-glossary dt {
  font-weight: 700;
  color: var(--text-1);
}

.p-glossary dd {
  margin: 0 0 var(--space-2);
  color: var(--text-2);
  font-size: var(--text-sm);
}

/* infographic slots show a labelled frame until the infographics script fills them. */

.ig {
  margin: 0 0 var(--space-4);
}

.ig-placeholder {
  display: grid;
  align-content: center;
  gap: var(--space-1);
  min-height: 120px;
  padding: var(--space-4);
  border: 1px dashed var(--ink-4);
  background-image:
    linear-gradient(var(--ink-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--ink-2) 1px, transparent 1px);
  background-size: 12px 12px;
  color: var(--text-3);
  font-size: var(--text-sm);
}

.ig-type {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}

/* the intro overlay covers the page on the first visit. */

.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: center;
  padding: clamp(24px, 7vw, 112px);
  overflow-y: auto;
  background:
    linear-gradient(90deg, rgba(4, 6, 11, 0.95) 0%, rgba(4, 6, 11, 0.88) 40%, rgba(4, 6, 11, 0.5) 78%, rgba(4, 6, 11, 0.35) 100%);
  opacity: 1;
  transition: opacity var(--t-slow) ease, visibility 0s linear 0s;
}

.intro[hidden] {
  display: none;
}

/* the loader covers the page from first paint and fades out after the first frame. */

.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: var(--ink-0);
  opacity: 1;
  transition: opacity var(--t-slow) ease, visibility 0s linear 0s;
}

.loader[hidden] {
  display: none;
}

.kerr[data-loading='done'] .loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--t-slow) ease, visibility 0s linear var(--t-slow);
}

.loader-inner {
  width: min(22rem, 100%);
}

.loader-title {
  margin: 0 0 var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1;
  color: var(--text-1);
  text-shadow: 0.06em 0.06em 0 var(--amber-lo);
}

.loader-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  height: 24px;
  padding: 4px;
  border: 2px solid var(--ink-4);
}

.loader-bar i {
  background: var(--ink-2);
}

/* finished steps are solid amber, and the active step marches in pixel stripes. */

.loader[data-step='2'] i:nth-child(-n+1),
.loader[data-step='3'] i:nth-child(-n+2),
.loader[data-step='4'] i:nth-child(-n+3) {
  background: var(--amber);
}

.loader[data-step='2'] i:nth-child(2),
.loader[data-step='3'] i:nth-child(3),
.loader[data-step='4'] i:nth-child(4) {
  background: repeating-linear-gradient(90deg, var(--amber-lo) 0 4px, var(--ink-2) 4px 8px);
  background-size: 8px 100%;
  animation: loader-march 0.4s steps(2) infinite;
}

@keyframes loader-march {
  to {
    background-position: 8px 0;
  }
}

.loader-status {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-1);
}

.loader-count {
  color: var(--amber);
}

.loader-time:empty {
  display: none;
}

.loader-status::after {
  content: '';
  width: 0.6em;
  height: 1.1em;
  margin-left: calc(var(--space-1) - var(--space-3));
  background: var(--amber);
  animation: loader-blink 1s steps(1) infinite;
}

@keyframes loader-blink {
  50% {
    opacity: 0;
  }
}

.loader-note {
  display: none;
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-3);
}

.loader[data-step='3'] .loader-note {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .loader-bar i,
  .loader-status::after {
    animation: none !important;
  }
}

.kerr[data-intro='closing'] .intro {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-slow) ease, visibility 0s linear var(--t-slow);
}

.intro-inner {
  max-width: 35rem;
}

.intro-kicker {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.intro-title {
  margin: 0 0 var(--space-5);
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 7.5vw, 5.5rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--text-1);
  text-shadow: 0.06em 0.06em 0 var(--amber-lo);
}

.intro-lede {
  max-width: 31rem;
  margin: 0 0 var(--space-6);
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--text-2);
}

.intro-controls {
  margin: 0 0 var(--space-3);
  color: var(--text-1);
}

.intro-keys {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0 0 var(--space-7);
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--text-3);
}

/* the two ways in sit side by side, and they stack on phones. */

.intro-begin {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.intro-start {
  min-height: 1.5em;
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--text-3);
}

.only-coarse {
  display: none;
}

@media (pointer: coarse) {
  .only-fine {
    display: none;
  }

  .only-coarse {
    display: inline;
  }

  .intro-controls {
    margin-bottom: var(--space-7);
  }
}

/* on phones the guide becomes a bottom sheet. */

@media (max-width: 720px) {
  .kerr,
  .kerr[data-panel='collapsed'] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) var(--peek-h);
  }

  .main {
    grid-row: 1;
  }

  .panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: 80%;
    border-left: 0;
    border-top: var(--rule) solid var(--ink-4);
    box-shadow: 0 -16px 40px var(--shadow);
    transform: translateY(calc(100% - var(--peek-h)));
    transition: transform var(--t-med) var(--ease-out);
  }

  .kerr[data-sheet='open'] .panel {
    transform: translateY(0);
  }

  .kerr[data-sheet='drag'] .panel {
    transition: none;
  }

  .sheet-grip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    align-items: center;
    column-gap: var(--space-3);
    flex: none;
    width: 100%;
    height: var(--peek-h);
    padding: 6px var(--space-4) var(--space-2);
    background: var(--ink-1);
    border: 0;
    text-align: left;
    cursor: grab;
    touch-action: none;
  }

  .sheet-grip:focus-visible {
    outline-offset: -3px;
  }

  .grip-bar {
    grid-column: 1 / -1;
    justify-self: center;
    width: 40px;
    height: 4px;
    margin-bottom: var(--space-2);
    background: var(--ink-4);
  }

  .grip-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: var(--text-lg);
  }

  .kerr[data-sheet='open'] .grip-title {
    visibility: hidden;
  }

  .grip-title b {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--amber);
    margin-right: 0.5em;
  }

  .grip-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--amber);
  }

  .i-up {
    width: 8px;
    height: 12px;
    transform: rotate(-90deg);
  }

  .kerr[data-sheet='open'] .i-up {
    transform: rotate(90deg);
  }

  .kerr[data-panel] .panel-tab,
  .icon-btn#kerr-collapse {
    display: none;
  }

  .kerr[data-panel='collapsed'] .panel-head {
    display: grid;
  }

  .kerr[data-panel='collapsed'] .panel-body {
    display: block;
  }

  .panel-head {
    padding: var(--space-2) var(--space-4) var(--space-3);
    border-top: 1px solid var(--ink-3);
  }

  .panel-head .wordmark {
    display: none;
  }

  .panel-body {
    padding: var(--space-5) var(--space-4) var(--space-8);
  }

  .kerr[data-sheet='peek'] .panel-head,
  .kerr[data-sheet='peek'] .panel-body {
    visibility: hidden;
    transition: visibility 0s linear var(--t-med);
  }

  .p-title {
    font-size: 1.625rem;
  }

  .p-summary {
    font-size: var(--text-md);
  }

  .hud {
    top: var(--space-3);
    left: var(--space-3);
    min-width: 0;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }

  .hud-name {
    font-size: var(--text-lg);
    margin-bottom: 6px !important;
  }

  .hud-grid {
    column-gap: var(--space-3);
  }

  .tools {
    top: var(--space-3);
    right: var(--space-3);
  }

  .compass {
    padding: 6px;
  }

  .tool-btn {
    width: 64px;
    height: 40px;
  }

  /* the card spans the view on phones, so the card button heads the tools column and sits in the card's top-right corner. */

  .card-btn {
    order: -1;
  }

  .compass canvas {
    width: 50px;
    height: 50px;
  }

  .compass-legend {
    display: none;
  }

  .nav {
    padding: 15px var(--space-3) var(--space-3);
    gap: var(--space-2) var(--space-3);
  }

  .nav .btn {
    min-height: 44px;
    padding: 0 var(--space-3);
  }

  .chip {
    bottom: var(--space-3);
    font-size: var(--text-xs);
  }

  .caption {
    padding: 6px var(--space-4);
    font-size: var(--text-sm);
    line-height: 1.4;
  }

  .ghost {
    left: var(--space-3);
    bottom: var(--space-3);
    width: calc(100% - 2 * var(--space-3));
    padding: var(--space-2) var(--space-3);
  }

  .chip:not([data-hidden]):not(:empty) ~ .ghost {
    bottom: 60px;
  }

  .ghost-text {
    font-size: var(--text-xs);
  }

  .ghost-long {
    display: none;
  }

  .ghost-short {
    display: inline;
  }

  .card {
    top: calc(var(--bar-h) + var(--space-2));
    left: var(--space-2);
    right: var(--space-2);
    width: auto;
    padding: var(--space-3) var(--space-3) var(--space-4);
  }

  /*
   * the gap floats in the card's top-right corner. it reaches 8 px left of the card button and 4 px below it.
   * the kicker runs beside it, and the title starts below it at full width.
   */

  .card-gap {
    display: block;
    float: right;
    width: 64px;
    height: 36px;
  }

  .card-kicker {
    font-size: var(--text-2xs);
  }

  .card-title {
    clear: right;
    margin: 6px 0 8px;
    font-size: 2.125rem;
  }

  .card-r {
    font-size: var(--text-xs);
  }

  .card-line {
    font-size: var(--text-md);
  }

  .card-extra {
    margin-top: var(--space-3);
  }

  .card-clock {
    padding: 5px 10px;
    font-size: var(--text-xs);
  }

  .card-clock[data-zero] {
    font-size: var(--text-sm);
  }

  .intro {
    align-items: end;
    padding: var(--space-6) var(--space-5) var(--space-7);
    background: linear-gradient(180deg, rgba(4, 6, 11, 0.35) 0%, rgba(4, 6, 11, 0.85) 38%, rgba(4, 6, 11, 0.96) 100%);
  }

  .intro-title {
    font-size: 3rem;
  }

  .intro-begin {
    display: grid;
  }

  .intro .btn-lg {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .nav-ascend span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}
