/*
  Freeport — the station market's front door.

  The world is ../docs/visual-direction-roadstead.md: a customs docket, ink on paper, colour
  only on leaves, and shape riding with colour so the status spine survives greyscale. The
  palette, the spacing unit and the [data-state] vocabulary are that document's, unchanged.
  Its §9 records every departure, including the three self-hosted faces.

  The layout is deliberately ordinary: one centred column, and cards where there is something
  to hold. An earlier build tried a "docket spine" — a sticky mono field-name in a 13rem left
  rail beside every section — and it failed twice over. It spent a quarter of a wide screen on
  two words, and with no surfaces under the content the page read as though the stylesheet had
  not loaded. Structure has to be visible to count.

  So: two grounds (canary paper, cream card), one accent that means one thing (customs red for
  settled), and headings that announce themselves. Nothing clever.
*/

/* ------------------------------------------------------------------- fonts */

@font-face {
  font-family: "Anton";
  src: url("assets/fonts/anton-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("assets/fonts/archivo-400-600-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Courier Prime";
  src: url("assets/fonts/courier-prime-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Courier Prime";
  src: url("assets/fonts/courier-prime-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */

:root {
  --color-canary: #f6e6a8; /* the page: the shipper's second ply */
  --color-original: #fdfaf0; /* the card: the top sheet, where settled facts live */
  --color-rose: #f6d4c8; /* the third ply: asides */

  --color-ink: #241c33;
  --color-ink-soft: #4a3f63;
  --color-label: #5a4e75;

  --color-stamp: #a82712; /* customs red. SETTLED. Nothing else. */
  --color-chalk: #44566e; /* chalk blue. A claim. Deliberately dull. */
  --color-tallow: #8a5100; /* ochre. The market's own business: fixed readings. */

  --color-canary-reversed: #f6e6a8; /* 13.04:1 on ink */
  --color-stamp-reversed: #f0a08c; /*  7.85:1 on ink */
  --color-tallow-reversed: #efc873; /* 10.23:1 on ink */

  --rule-hair: rgba(36, 28, 51, 0.18);
  --rule-strong: rgba(36, 28, 51, 0.5);
  --rule-perf: rgba(36, 28, 51, 0.38);
  --ply-lift: 2px 2px 0 rgba(36, 28, 51, 0.1);

  --font-display: "Anton", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Archivo", ui-sans-serif, system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-ui: "Courier Prime", "Courier New", Courier, monospace;

  --step-00: 0.8125rem; /* 13px, the hard floor for mono */
  --step-01: 0.9375rem;
  --step-0: 1.05rem;
  --step-1: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
  --step-2: clamp(1.25rem, 1.15rem + 0.5vw, 1.55rem);
  --step-3: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem);
  --step-hero: clamp(2.6rem, 6.4vw, 4.8rem);

  --space-unit: 4px;
  --radius: 6px;
  --radius-stamp: 999px;
  --wrap: 1120px;
  --measure: 68ch;
  --tap: 44px;
  --gutter: max(4vw, 20px);

  --motion-press: 90ms cubic-bezier(0.2, 0.9, 0.3, 1);
  --motion-system: 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Presentation only: no engine field, config key or protocol name is renamed by any of it. */
[data-state="claim"],
[data-state="proposed"] {
  color: var(--color-chalk);
}
[data-state="settled"] {
  color: var(--color-stamp);
}
[data-state="amended"] {
  color: var(--color-tallow);
}

/* ------------------------------------------------------------------- reset */

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

/* `.btn` sets display, and an author rule outranks the UA's [hidden]. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 6rem; /* the masthead is sticky */
  caret-color: var(--color-stamp);
  scrollbar-color: var(--color-label) var(--color-canary);
  scrollbar-width: thin;
}

body {
  margin: 0;
  background: var(--color-canary);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--color-stamp);
  color: var(--color-canary);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--color-canary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-label);
  border: 3px solid var(--color-canary);
  border-radius: var(--radius-stamp);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-ink);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 0.98;
  margin: 0;
  text-wrap: balance;
}

p,
ul,
ol,
dl {
  margin: 0;
}

a {
  color: var(--color-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--color-tallow);
  transition: color var(--motion-system);
}

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

code,
pre {
  font-family: var(--font-ui);
  font-size: var(--step-00);
}

strong {
  font-weight: 600;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-ink);
  color: var(--color-canary-reversed);
  padding: calc(var(--space-unit) * 3);
  z-index: 10;
}

.skip-link:focus {
  left: calc(var(--space-unit) * 2);
}

html:not(.js) .js-only {
  display: none;
}

/* --------------------------------------------------------------- masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-ink);
  color: var(--color-canary-reversed);
}

.masthead__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: calc(var(--space-unit) * 3) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--space-unit) * 3) calc(var(--space-unit) * 6);
}

.brand {
  font-family: var(--font-display);
  font-size: var(--step-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-canary-reversed);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-tallow-reversed);
}

.masthead__nav {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-unit) * 5);
  margin-right: auto;
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.masthead__nav a {
  color: var(--color-canary-reversed);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.masthead__nav a:hover {
  color: var(--color-tallow-reversed);
}

.masthead__nav a[aria-current="page"] {
  border-bottom-color: var(--color-stamp-reversed);
}

.masthead__auth {
  display: flex;
  align-items: center;
  gap: calc(var(--space-unit) * 3);
}

.auth-chip {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* On ink, the dull states need the reversed tokens or they fail contrast. */
.masthead .auth-chip[data-state="claim"],
.masthead .auth-chip[data-state="proposed"] {
  color: var(--color-tallow-reversed);
}

.masthead .auth-chip[data-state="settled"] {
  color: var(--color-stamp-reversed);
}

@media (max-width: 48rem) {
  .masthead__nav {
    order: 3;
    width: 100%;
    margin-right: 0;
    gap: calc(var(--space-unit) * 4);
    padding-top: calc(var(--space-unit) * 3);
    border-top: 1px solid rgba(246, 230, 168, 0.25);
  }

  .masthead__auth {
    margin-left: auto;
  }
}

/* 6px of customs tape under the station sign. */
.customs-tape {
  height: 6px;
  background-image: repeating-linear-gradient(
    -45deg,
    var(--color-stamp) 0 6px,
    var(--color-tallow) 6px 12px
  );
}

/* ----------------------------------------------------------------- layout */

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* A grid child defaults to min-width:auto, so one wide table would scroll the whole page. */
.wrap > *,
.grid-2 > *,
.grid-3 > *,
.card > * {
  min-width: 0;
}

.band {
  padding-block: calc(var(--space-unit) * 13);
}

/* Bands are full-bleed and cardless, so the seam between two of them is ruled, not guessed. */
.band + .band {
  border-top: 1px solid var(--rule-hair);
}

/* A section that belongs to the one above it, so it does not restate the full gap. */
.band--tight {
  padding-block: calc(var(--space-unit) * 10) calc(var(--space-unit) * 12);
}

.band--rose {
  background: var(--color-rose);
}

.view[hidden] {
  display: none;
}

/* A heading announces its section: display type over a red rule, at text width. */
.band h2 {
  font-size: var(--step-3);
  max-width: 26ch;
  padding-bottom: calc(var(--space-unit) * 3);
  border-bottom: 3px solid var(--color-stamp);
  display: inline-block;
}

/*
  A stamp above a heading. `.stamp` is inline-block and so is the h2, so the mark needs its
  own block wrapper or the two sit side by side on one line.
*/
.band__mark {
  margin-bottom: calc(var(--space-unit) * 5);
}

.stack {
  margin-top: calc(var(--space-unit) * 6);
}

.stack-lg {
  margin-top: calc(var(--space-unit) * 8);
}

.fineprint--lead {
  margin-top: calc(var(--space-unit) * 4);
}

.lede {
  font-size: var(--step-1);
  color: var(--color-ink-soft);
  max-width: var(--measure);
  margin-top: calc(var(--space-unit) * 6);
}

.fineprint {
  font-size: var(--step-00);
  color: var(--color-ink-soft);
  max-width: var(--measure);
  margin-top: calc(var(--space-unit) * 5);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-unit) * 3);
  margin-top: calc(var(--space-unit) * 8);
}

.label {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-label);
}

/* A path is not a label to be shouted: uppercasing it makes it wrong on disk. */
.label--path {
  text-transform: none;
  letter-spacing: 0.01em;
  word-break: break-all;
}

.grid-2 {
  display: grid;
  gap: calc(var(--space-unit) * 6);
  grid-template-columns: 1fr;
  margin-top: calc(var(--space-unit) * 8);
}

@media (min-width: 58rem) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.grid-3 {
  display: grid;
  gap: calc(var(--space-unit) * 6);
  grid-template-columns: 1fr;
  margin-top: calc(var(--space-unit) * 8);
}

@media (min-width: 52rem) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------ cards */

/*
  The one container. Cream over canary, a keyline, and a hard offset lift, because this world
  is paper on paper and the direction names that shadow explicitly.
*/
.card {
  background: var(--color-original);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--ply-lift);
  padding: calc(var(--space-unit) * 7);
}

.card > h3,
.card > h2 {
  font-size: var(--step-2);
  padding-bottom: calc(var(--space-unit) * 3);
  border-bottom: 1px solid var(--rule-hair);
}

/* A tear-off: designed, not settled. No surface, no lift, perforated edge. */
.card--torn {
  background: transparent;
  border-style: dashed;
  border-color: var(--rule-perf);
  box-shadow: none;
}

.card__stamp {
  margin-top: calc(var(--space-unit) * 5);
}

/* ------------------------------------------------------------------- hero */

/*
  The one reversed panel: ink ground under canary type, one centred column, and a red rule
  closing it. It reads as the cover sheet of the docket, and everything after it is paper.
*/
.hero {
  background: var(--color-ink);
  color: var(--color-canary-reversed);
  padding-block: calc(var(--space-unit) * 22) calc(var(--space-unit) * 18);
  border-bottom: 3px solid var(--color-stamp);
  text-align: center;
}

.hero__inner {
  max-width: 62rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/*
  The pill is a reading, not decoration: the state word says whether the figures beside it are
  the committed snapshot or a live read, and app.js fills both.
*/
.hero__pill {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space-unit) * 3);
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);
  border: 1px solid rgba(246, 230, 168, 0.38);
  border-radius: var(--radius-stamp);
  margin-bottom: calc(var(--space-unit) * 8);
}

.hero__pill-state {
  font-weight: 700;
  color: var(--color-tallow-reversed);
}

.hero__pill[data-stamp="live"] .hero__pill-state {
  color: var(--color-stamp-reversed);
}

.hero__pill-state::after {
  content: " ·";
  color: rgba(246, 230, 168, 0.5);
}

.hero__pill-figures {
  color: var(--color-canary-reversed);
}

.hero h1 {
  font-size: var(--step-hero);
  letter-spacing: -0.015em;
  line-height: 0.92;
  max-width: 24ch;
  text-wrap: balance;
}

.hero p.lede {
  color: rgba(246, 230, 168, 0.86);
  max-width: 46ch;
  text-wrap: pretty;
}

.hero__note {
  margin-top: calc(var(--space-unit) * 9);
  max-width: 62ch;
  color: rgba(246, 230, 168, 0.66);
  font-size: var(--step-00);
  font-family: var(--font-ui);
  border-top: 1px solid rgba(246, 230, 168, 0.22);
  padding-top: calc(var(--space-unit) * 4);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-unit) * 3);
  margin-top: calc(var(--space-unit) * 8);
  justify-content: center;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 calc(var(--space-unit) * 6);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--color-original);
  color: var(--color-ink);
  font-family: var(--font-ui);
  font-size: var(--step-01);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--ply-lift);
  transition:
    transform var(--motion-press),
    box-shadow var(--motion-press),
    background var(--motion-system);
}

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

/* A press, not a hover lift: the control goes down onto the paper. */
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.btn--primary {
  background: var(--color-stamp);
  border-color: var(--color-stamp);
  color: var(--color-original);
  font-weight: 700;
}

.btn--primary:hover {
  background: #8e2010;
  color: var(--color-canary);
}

.btn--reversed {
  background: transparent;
  border-color: rgba(246, 230, 168, 0.5);
  color: var(--color-canary-reversed);
  box-shadow: none;
  min-height: calc(var(--space-unit) * 8);
  font-size: var(--step-00);
}

.btn--reversed:hover {
  color: var(--color-ink);
  background: var(--color-tallow-reversed);
  border-color: var(--color-tallow-reversed);
}

.btn--small {
  min-height: calc(var(--space-unit) * 8);
  padding: 0 calc(var(--space-unit) * 3);
  font-size: var(--step-00);
}

/* Hero scale. These two are the only buttons on the site that each carry a whole view. */
.btn--large {
  min-height: calc(var(--space-unit) * 13);
  padding: 0 calc(var(--space-unit) * 7);
  font-size: var(--step-01);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------------------------------------------------------------- stamps */

/*
  Two shapes, and the shape is the meaning:
    round + red   it settled, or it is a live read of something that did
    rectangle     the market's note about itself: a fixed reading, or a concept
*/
.stamp {
  display: inline-block;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 4);
  border: 2px solid currentColor;
  border-radius: var(--radius-stamp);
  transform: rotate(-1.2deg);
}

.stamp--rect {
  border-radius: 3px;
  transform: rotate(-0.6deg);
}

.stamp--concept {
  border-style: dashed;
}

/*
  The one authored moment. A live read is the page's only real event, so the stamp lands on it:
  down from above the paper, over-rotated, resolving into its resting off-register. Set by
  app.js, and never for a fixed reading, which was already on the paper when you arrived.
*/
@keyframes stamp-land {
  0% {
    transform: rotate(-9deg) scale(1.5);
    opacity: 0;
    filter: blur(3px);
  }
  55% {
    opacity: 1;
    filter: blur(0);
  }
  70% {
    transform: rotate(0.6deg) scale(0.97);
  }
  100% {
    transform: rotate(-1.2deg) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

.stamp[data-landed] {
  animation: stamp-land 520ms var(--ease-out-expo) both;
}

/* ------------------------------------------------------------ the plates */

/* A photograph is a document pinned to the page, never a backdrop behind text. */
.plate {
  margin: 0;
  background: var(--color-original);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--ply-lift);
  padding: calc(var(--space-unit) * 2);
}

.plate img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
}

.plate figcaption {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  color: var(--color-tallow);
  padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 2) calc(var(--space-unit) * 1);
  max-width: 60ch;
}

.plate--strip {
  margin-bottom: calc(var(--space-unit) * 9);
}

/*
  The pinned plate. The hero ends on ink and the paper starts under it, so the photograph is
  tacked across that seam, off-square, the way a docket gets stapled to a folder. It stays a
  document on the page rather than a backdrop behind type.
*/
.seam {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.plate--pinned {
  margin-top: calc(var(--space-unit) * -16);
  transform: rotate(-0.55deg);
  box-shadow: 6px 6px 0 rgba(36, 28, 51, 0.16);
  position: relative;
  z-index: 1;
}

.plate--pinned img {
  aspect-ratio: 21 / 8;
  object-fit: cover;
  object-position: 50% 62%;
}

.plate--strip img {
  /*
    The docket photograph is mostly empty table on the left and blank paper through the middle.
    This crop is aimed at what carries the argument: the fanned canary and rose plies under a
    red stamp.
  */
  aspect-ratio: 3.4 / 1;
  object-fit: cover;
  object-position: 56% 72%;
}

@media (max-width: 48rem) {
  .plate--strip img {
    aspect-ratio: 2 / 1;
  }
}

/* ------------------------------------------------------------- the steps */

/* Three numbered cards, because the loop has three parts and the order is the point. */
.step__number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--color-stamp);
}

.step h3 {
  font-size: var(--step-2);
  margin-top: calc(var(--space-unit) * 2);
}

.step p {
  margin-top: calc(var(--space-unit) * 3);
  color: var(--color-ink-soft);
}

/* ---------------------------------------------------------------- tables */

.table-scroll {
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
  margin-top: calc(var(--space-unit) * 4);
}

.table-scroll .table {
  min-width: 26rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-original);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.table caption {
  text-align: left;
}

/* The header is the docket's printed band: mono, reversed out of the ink. */
.table thead th {
  background: var(--color-ink);
  color: var(--color-canary-reversed);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  padding: calc(var(--space-unit) * 2.5) calc(var(--space-unit) * 3);
}

.table td {
  text-align: left;
  padding: calc(var(--space-unit) * 3);
  border-bottom: 1px solid var(--rule-hair);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: var(--color-canary);
}

.table .num {
  text-align: right;
}

.table td.num,
.table td.mono {
  font-family: var(--font-ui);
}

/* A figure is struck, not set. */
.table td.num {
  font-weight: 700;
}

/*
  An agent name is one unbroken underscore-joined token, so it offers no break opportunity and
  would push the page sideways on a phone. The only place this page breaks inside a word.
*/
.table td.mono {
  overflow-wrap: anywhere;
}

.table__empty {
  color: var(--color-ink-soft);
  font-style: italic;
}

/* The signed-in visitor's own row, marked on the rank cell rather than with a colour bar. */
.table tr[data-mine="true"] td:first-child {
  color: var(--color-stamp);
  font-weight: 700;
}

.table tr[data-mine="true"] td:first-child::after {
  content: " you";
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-tallow);
}

/*
  On a narrow screen a table stops being a table and becomes what a docket is: one record per
  row, every field printed beside its own name from data-label (set in app.js). Sideways
  scrolling was the alternative and it is worse — the reader has to find the scroll, and the
  first column hides the value they came for.
*/
@media (max-width: 45rem) {
  .table-scroll {
    overflow-x: visible;
  }

  .table-scroll .table {
    min-width: 0;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    padding: calc(var(--space-unit) * 3);
    border-bottom: 1px solid var(--rule-strong);
  }

  .table tbody tr:last-child {
    border-bottom: 0;
  }

  .table td {
    display: grid;
    grid-template-columns: 12ch minmax(0, 1fr);
    gap: calc(var(--space-unit) * 3);
    align-items: baseline;
    padding: calc(var(--space-unit) * 1) 0;
    border-bottom: 0;
    text-align: left;
  }

  .table td::before {
    content: attr(data-label);
    font-family: var(--font-ui);
    font-size: var(--step-00);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-tallow);
  }

  .table td.num {
    text-align: left;
  }

  .table__empty {
    display: block;
  }

  .table__empty::before {
    content: none;
  }
}

/* ----------------------------------------------------------------- board */

.board__stamp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--space-unit) * 4);
  margin-bottom: calc(var(--space-unit) * 5);
}

.board__stamp-detail {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  color: var(--color-label);
  max-width: 56ch;
}

.board__prices {
  margin-top: calc(var(--space-unit) * 4);
  font-family: var(--font-ui);
  font-size: var(--step-00);
  color: var(--color-ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-unit) * 3);
}

/* ------------------------------------------------------- status ledgers */

.ledger-list h3 {
  font-size: var(--step-2);
  padding-bottom: calc(var(--space-unit) * 3);
  border-bottom: 2px solid currentColor;
}

.ledger-list ul {
  list-style: none;
  padding: 0;
}

.ledger-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: calc(var(--space-unit) * 1) calc(var(--space-unit) * 4);
  padding-block: calc(var(--space-unit) * 3);
  border-bottom: 1px solid var(--rule-hair);
}

@media (min-width: 34rem) {
  .ledger-list li {
    grid-template-columns: minmax(0, 1fr) minmax(15ch, 21ch);
    align-items: baseline;
  }

  .ledger-list li span {
    text-align: right;
  }
}

.ledger-list li:last-child {
  border-bottom: 0;
}

.ledger-list li span {
  font-family: var(--font-ui);
  font-size: var(--step-00);
}

.ledger-list--unstamped li {
  border-bottom-style: dashed;
  border-bottom-color: var(--rule-perf);
}

/* --------------------------------------------------------------- concept */

.concept-card h3 {
  font-size: var(--step-2);
}

.concept-card p {
  margin-top: calc(var(--space-unit) * 3);
  color: var(--color-ink-soft);
}

.concept-card__needs {
  font-size: var(--step-00);
}

.concept-card__needs .label {
  color: var(--color-chalk);
}

/* ----------------------------------------------------------------- forms */

.field {
  display: block;
  margin-top: calc(var(--space-unit) * 6);
  border: 0;
  padding: 0;
}

.field > label,
.field > legend {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-tallow);
  padding: 0;
}

.field__hint {
  display: block;
  font-size: var(--step-00);
  color: var(--color-ink-soft);
  margin-top: calc(var(--space-unit) * 1);
  max-width: 52ch;
}

.field input[type="text"],
.field textarea {
  display: block;
  width: 100%;
  margin-top: calc(var(--space-unit) * 2);
  padding: calc(var(--space-unit) * 3);
  min-height: var(--tap);
  font-family: var(--font-ui);
  font-size: var(--step-01);
  color: var(--color-ink);
  background: var(--color-canary);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-label);
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.field__problem {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--step-00);
  color: var(--color-stamp);
  margin-top: calc(var(--space-unit) * 2);
  min-height: 1.2em;
}

.chooser {
  display: grid;
  gap: calc(var(--space-unit) * 3);
  margin-top: calc(var(--space-unit) * 3);
  grid-template-columns: 1fr;
}

@media (min-width: 34rem) {
  .chooser {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A tick box on a form. Three children in two columns, so both text lines are pinned right. */
.choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: calc(var(--space-unit) * 3);
  align-items: start;
  border: 1px solid var(--rule-hair);
  border-radius: var(--radius);
  padding: calc(var(--space-unit) * 3);
  cursor: pointer;
  background: var(--color-canary);
  transition:
    border-color var(--motion-system),
    background var(--motion-system);
}

.choice input {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 4px 0 0;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--color-original);
}

.choice input:checked {
  border-color: var(--color-stamp);
  background: var(--color-stamp);
  box-shadow: inset 0 0 0 2px var(--color-original);
}

.choice__name {
  display: block;
  grid-column: 2;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: var(--step-01);
}

.choice__blurb {
  display: block;
  grid-column: 2;
  font-size: var(--step-00);
  color: var(--color-ink-soft);
  margin-top: calc(var(--space-unit) * 1);
}

.choice:has(input:checked) {
  border-color: var(--color-stamp);
  background: var(--color-original);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--color-stamp);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- output */

.output__block {
  margin-top: calc(var(--space-unit) * 6);
}

.output__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--space-unit) * 3);
  margin-bottom: calc(var(--space-unit) * 2);
}

.output__head .btn {
  margin-left: auto;
}

/*
  The typed docket, reversed. A generated artifact is not page copy the reader wrote, and making
  it obviously another surface makes copying obviously another act.
*/
.code {
  margin: 0;
  padding: calc(var(--space-unit) * 4);
  background: var(--color-ink);
  color: var(--color-canary-reversed);
  border-radius: var(--radius);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 24rem;
  line-height: 1.55;
}

.code::selection,
.code *::selection {
  background: var(--color-tallow-reversed);
  color: var(--color-ink);
}

/* ------------------------------------------------------------ hold panels */

.pairs {
  margin-top: calc(var(--space-unit) * 5);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);
}

.pairs dt {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-tallow);
}

.pairs dd {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--step-00);
  word-break: break-all;
}

/* The market's own line: a console strip, mono, one sentence at a time. */
.console {
  margin-top: calc(var(--space-unit) * 6);
  border-radius: var(--radius);
  background: var(--color-ink);
  padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 4);
}

.console__bar {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-unit) * 3);
  font-family: var(--font-ui);
  font-size: var(--step-00);
  color: var(--color-canary-reversed);
}

.console .label {
  color: var(--color-tallow-reversed);
}

.console[data-state="settled"] #console-line {
  color: var(--color-stamp-reversed);
}

.console[data-state="failed"] #console-line {
  color: var(--color-stamp-reversed);
  text-decoration: underline wavy;
  text-underline-offset: 0.25em;
}

.movements {
  list-style: none;
  padding: 0;
  margin-top: calc(var(--space-unit) * 5);
  border-top: 1px solid var(--rule-hair);
}

.movements li {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-unit) * 2) calc(var(--space-unit) * 4);
  padding-block: calc(var(--space-unit) * 3);
  border-bottom: 1px solid var(--rule-hair);
  font-family: var(--font-ui);
  font-size: var(--step-00);
}

.movements li:last-child {
  border-bottom: 0;
}

.movements__when {
  color: var(--color-label);
}

.movements__amount {
  margin-left: auto;
  font-weight: 700;
}

.movements__empty {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--color-ink-soft);
}

/* ---------------------------------------------------------------- footer */

.footer {
  background: var(--color-ink);
  color: var(--color-canary-reversed);
  padding-block: calc(var(--space-unit) * 12);
}

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

.footer a {
  color: var(--color-canary-reversed);
  text-decoration-color: var(--color-tallow-reversed);
}

.footer a:hover {
  color: var(--color-tallow-reversed);
}

.footer__line--fine {
  margin-top: calc(var(--space-unit) * 4);
  font-size: var(--step-00);
  font-family: var(--font-ui);
  color: var(--color-tallow-reversed);
}

/* ---------------------------------------------------------------- motion */

/* -------------------------------------------------------------- the trade */

/*
  One deal in three beats, stacked the way a docket sequence stacks: numeral, what happened, and
  the figures on the right. Rows rather than columns, because the third beat carries a result the
  other two do not, and three equal columns would just pad the first two with dead space.

  app.js lights them one after another when the section arrives; with no JavaScript they are
  simply lit, which is why the hidden state is scoped to `html.js`.
*/
.beats {
  list-style: none;
  display: grid;
  gap: calc(var(--space-unit) * 7);
  margin-top: calc(var(--space-unit) * 9);
}

.beat {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: calc(var(--space-unit) * 3) calc(var(--space-unit) * 6);
  align-items: center;
}

@media (min-width: 58rem) {
  .beat {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 21rem);
    gap: calc(var(--space-unit) * 8);
  }
}

.beat__num {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  line-height: 0.9;
  color: var(--color-stamp);
  align-self: start;
}

.beat__body h3 {
  font-size: var(--step-1);
  margin-top: calc(var(--space-unit) * 1);
}

.beat__note {
  font-size: var(--step-01);
  color: var(--color-ink-soft);
  margin-top: calc(var(--space-unit) * 3);
  max-width: 52ch;
}

/* The beat spans both text columns on a narrow screen, so the figures sit under the prose. */
.beat > .manifest,
.beat__result {
  grid-column: 1 / -1;
}

@media (min-width: 58rem) {
  .beat > .manifest,
  .beat__result {
    grid-column: auto;
  }
}

/* The hand-off between beats: a dashed drop under the numeral, drawn in the gutter. */
.beat:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(var(--space-unit) * 7);
  bottom: calc(var(--space-unit) * -7);
  height: calc(var(--space-unit) * 7);
  border-left: 2px dashed var(--rule-perf);
}

/*
  The manifest: the figures are the loudest thing in the section, because the quantities are what
  a reader is actually being shown. Display face, ink, with the good named underneath in mono.
*/
.manifest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space-unit) * 5);
  padding: calc(var(--space-unit) * 4);
  border: 1px solid var(--rule-hair);
  border-radius: var(--radius);
  background: rgba(246, 230, 168, 0.5);
}

.manifest__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--space-unit) * 1);
}

.manifest__figure {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.4vw, 2.9rem);
  line-height: 0.9;
  color: var(--color-ink);
}

.manifest__good {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-label);
}

.manifest__swap {
  font-size: 1.5rem;
  color: var(--color-stamp);
  line-height: 1;
}

.beat__stamp {
  display: flex;
  justify-content: center;
  margin-bottom: calc(var(--space-unit) * 3);
}

/* The settled beat is the one that happened, so it is the only row carrying the accent edge. */
.beat--settled {
  border-color: var(--color-stamp);
  box-shadow: 2px 2px 0 rgba(168, 39, 18, 0.16);
}

.movements--sample {
  margin-top: 0;
}

.movements--sample li:first-child {
  border-top: 1px solid var(--rule-hair);
}

.beat__flag {
  font-family: var(--font-ui);
  font-size: var(--step-00);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-stamp);
  border: 1px dashed currentColor;
  border-radius: 3px;
  padding: 0 calc(var(--space-unit) * 1.5);
  margin-left: calc(var(--space-unit) * 2);
}

/* The reveal. Hidden only when scripting is on, and only until app.js lights the beat. */
html.js .beat {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 420ms var(--ease-out-expo),
    transform 420ms var(--ease-out-expo);
}

html.js .beat[data-lit] {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------- the rules of play */

/* The goal, said once, in the display face, under the same red rule a heading gets. */
.goal {
  margin-top: calc(var(--space-unit) * 8);
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.15;
  max-width: 44ch;
  border-top: 2px solid var(--color-stamp);
  padding-top: calc(var(--space-unit) * 3);
}

.goal .label {
  display: block;
  margin-bottom: calc(var(--space-unit) * 2);
}

.rules {
  list-style: none;
  display: grid;
  gap: calc(var(--space-unit) * 4);
  margin-top: calc(var(--space-unit) * 8);
  max-width: 80ch;
}

.rules li {
  position: relative;
  padding-left: calc(var(--space-unit) * 8);
  font-size: var(--step-1);
  color: var(--color-ink);
  text-wrap: pretty;
}

/* A short red rule, not a bullet glyph: the accent already means "the market did this". */
.rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: calc(var(--space-unit) * 5);
  height: 2px;
  background: var(--color-stamp);
}

/* The loop sits under the four lines as supporting detail, so it steps down a size. */
.loop .step p {
  font-size: var(--step-01);
}

/* ------------------------------------------------------------- board tiles */

/*
  Three figures off the same response the table below prints, so the board answers "who is ahead"
  before anyone reads a row. They inherit the board's stamp: no tile ever carries a figure the
  table does not.
*/
.tiles {
  display: grid;
  gap: calc(var(--space-unit) * 5);
  margin-top: calc(var(--space-unit) * 8);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.tile {
  background: var(--color-original);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--ply-lift);
  padding: calc(var(--space-unit) * 6);
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-unit) * 2);
}

.tile__figure {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 0.9;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

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

  /* No transition means no reveal, so the beats must not be left invisible. */
  html.js .beat {
    opacity: 1;
    transform: none;
  }
}
