/*
 * Bu0y reads as a price current: the printed sheet a merchant scanned to
 * see which market was quoting cheapest. The name marks the channel —
 * cheapest path through the markets — the way a buoy marks safe water.
 *
 *   Day: sepia engravings on warm parchment, one cut of harbor green spent
 *   only on the price that just got beaten.
 *
 *   Night: the same subjects as celestial plates — silver line on deep
 *   harbor blue, sea-glass green where the day sheet ran the accent. Warm
 *   cream text (not cold gray) so night still feels like a printed sheet.
 *
 * Palette refs (kept as working notes): Vev warm-tones dark mode; Media.io
 * Night Harbor / nautical midnight blues. Tokens only — change once here.
 */
:root {
  color-scheme: light;

  /* Parchment sheet — cream with a hint of sand, not stark white. */
  --paper: #f3efe6;
  --leaf: #faf7f0;
  --tint: #e8e1d2;
  --ink: #1a1814;
  --ink-soft: #5a5448;
  --rule: #cfc6b4;
  --vermilion: #2c6840;
  --on-ink: #f7f4ec;
  --grain-op: 0.05;

  --display: "Bodoni Moda", Didot, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 62ch;
  --page: 1120px;
}

/* Night Harbor printing: deep navy ground, warm cream ink, sea-glass accent. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0b1320;
  --leaf: #111c2c;
  --tint: #1a2a40;
  --ink: #f2efe9;
  --ink-soft: #a8b8c9;
  --rule: #2a3d56;
  --vermilion: #7ec992;
  --on-ink: #0b1320;
  --grain-op: 0.06;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The printer's mark is positioned to bleed off the right edge of the page.
   Clip at the viewport so the bleed never becomes a horizontal scrollbar.
   `clip` rather than `hidden`: it does not make a scroll container, so the
   fixed grain layer and anchor scrolling are unaffected. */
html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Paper tooth. Sits behind the content, never over it, so nothing that has
   to stay legible is fighting a texture. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.75rem;
}

/* Short pages (Account): pin the imprint to the viewport foot. */
html:has(.wrap--fill),
body:has(.wrap--fill) {
  height: 100%;
}

body:has(.wrap--fill) {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.wrap--fill {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--page);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.wrap--fill > .colophon {
  margin-top: auto;
}

p {
  max-width: var(--measure);
}

a {
  color: var(--vermilion);
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}

::selection {
  background: var(--vermilion);
  color: var(--paper);
}

/* Author rules can override the UA [hidden] → display:none; keep it absolute. */
[hidden] {
  display: none !important;
}

a:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---- masthead ---- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.75rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
}

.nav a:hover {
  color: var(--vermilion);
}

.chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  line-height: 1;
}

.chip--solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}

.chip--trail {
  margin-left: auto;
}

.mast-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.85rem 1.05rem;
}

.mast-link {
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.mast-link:hover {
  color: var(--vermilion);
}

/* Signed-out home: Log in + Get started. Account page always shows Account.
   Signed-in (`data-signed` set before paint, same as theme): Account + Sign out. */
.mast-auth [data-mast-account],
.mast-auth [data-mast-signout] {
  display: none;
}

.page-account .mast-auth [data-mast-login] {
  display: none;
}

.page-account .mast-auth [data-mast-account] {
  display: inline;
}

html[data-signed="in"] .mast-auth [data-mast-login],
html[data-signed="in"] .mast-auth [data-mast-start] {
  display: none;
}

html[data-signed="in"] .mast-auth [data-mast-account] {
  display: inline;
}

html[data-signed="in"] .mast-auth [data-mast-signout] {
  display: inline-block;
}

/* The printing is flipped where a reader expects it: a sun on the day
   sheet, a moon on the night one. */
.themer {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}

.themer:hover {
  color: var(--vermilion);
  border-color: var(--vermilion);
}

.themer:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 3px;
}

.themer svg {
  width: 1.05rem;
  height: 1.05rem;
}

.themer .moon,
[data-theme="dark"] .themer .sun {
  display: none;
}

[data-theme="dark"] .themer .moon {
  display: block;
}

/* First viewport: masthead + hero + ticker. Ticker locks to the bottom
   of the screen on load; hero fills whatever space remains. */
.fold {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* ---- hero ---- */

/* A full first screen: the channel buoy sits in the right two-fifths and
   slips behind the type. No sun/moon disc — it fought the buoy plate. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Children keep their own width — a flex column would otherwise
     stretch the call-to-action into a full-width bar. */
  align-items: flex-start;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4rem 0;
  border-bottom: none;
}

/* The one spent colour: a vermilion sun by day, a gilt moon by night.
   The .art wrapper takes the parallax; the disc itself takes the dawn. */
.art--disc {
  z-index: -2;
  top: -2rem;
  right: -7rem;
  width: 34rem;
}

.disc {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--vermilion);
  opacity: 0.14;
}

/* By night the sun is an eclipsed moon: a faint gilt body, a bright
   rim, and a halo thrown onto the sky. */
[data-theme="dark"] .disc {
  opacity: 1;
  background: rgb(217 166 72 / 0.1);
  border: 1px solid rgb(217 166 72 / 0.45);
  box-shadow:
    0 0 140px 50px rgb(217 166 72 / 0.14),
    inset 0 0 90px 12px rgb(217 166 72 / 0.16);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  max-width: none;
}

.eyebrow--spaced {
  margin-top: 5rem;
}

/* Numbered column heads: the number in the spent colour, then a rule
   carrying the line out to the margin like a ledger's ruling. */
.eyebrow--ruled {
  margin-bottom: 2.25rem;
}

.eyebrow--ruled::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.eyebrow .no {
  color: var(--vermilion);
  font-weight: 500;
}

h1 {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: clamp(2.75rem, 7.6vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 1.75rem;
}

h1 em {
  font-weight: 400;
  font-style: italic;
}

.standfirst {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 2.25rem;
}

.button {
  display: inline-block;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.75rem;
}

.button:hover {
  background: var(--vermilion);
  color: var(--paper);
}

/* Mast CTAs — taller than chips so they read as primary actions. */
.button--mast {
  padding: 0.65rem 1.05rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.15;
  border: 1px solid var(--ink);
  font-family: inherit;
  cursor: pointer;
}

.button--ghost {
  display: inline-block;
  background: transparent;
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.65rem 1.05rem;
  line-height: 1.15;
  border: 1px solid var(--rule);
  cursor: pointer;
  font-family: inherit;
}

.button--ghost:hover {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

/* An usher at the foot of the first screen. */
.scrollcue {
  position: absolute;
  bottom: 1.1rem;
  left: 0;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  text-decoration: none;
}

.scrollcue:hover {
  color: var(--vermilion);
}

/* ---- the price current: the whole thesis in one ruled table ---- */

.section {
  position: relative;
  padding: 4.5rem 0;
  border-bottom: 1px solid var(--rule);
}

/* Keep the lighthouse inside its own sheet so it cannot cover the imprint. */
#rules.section {
  overflow: hidden;
  isolation: isolate;
}

#start.section {
  overflow: hidden;
}

.art--rules {
  top: 1rem;
  bottom: 1.5rem;
  right: -2rem;
  width: 18rem;
  height: auto;
  max-height: calc(100% - 2.5rem);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.art--rules img {
  width: 100%;
  height: 100%;
  max-height: inherit;
  object-fit: contain;
  object-position: top right;
}

.sheet {
  background: var(--leaf);
  border: 1px solid var(--rule);
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  align-items: baseline;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sheet-head .asof {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0.04em;
}

.scroller {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  text-align: right;
  padding: 0.7rem 1.25rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}

/* The double rule under the head is the broadsheet's own punctuation. */
thead th {
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 3px double var(--ink);
}

th[scope="row"],
thead th:first-child {
  text-align: left;
  font-weight: 400;
  color: var(--ink);
}

tbody tr:nth-child(even) td,
tbody tr:nth-child(even) th {
  background: color-mix(in srgb, var(--tint) 55%, transparent);
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

.retail {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--ink-soft) 55%, transparent);
  text-decoration-thickness: 1px;
}

.beaten {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--ink-soft) 55%, transparent);
  text-decoration-thickness: 1px;
}

.won {
  font-weight: 600;
}

.delta {
  color: var(--vermilion);
  font-weight: 500;
}

.harbor-loading {
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.rate-sep {
  color: var(--ink-soft);
  font-weight: 400;
}

.sheet-note {
  margin: 0;
  max-width: none;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* ---- headings and figures ---- */

h2 {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 1.5rem;
}

h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.35;
  margin: 0 0 0.4rem;
}

/* ---------------------------------------------------------------------------
   Account dashboard.

   Groups are separated by space, not by rules. An earlier pass ruled every
   group and the page turned into a stack of bands -- on a sheet this short,
   whitespace already reads as a break, and the small caps label already says
   where you are. Rules are kept only where they do work no gap can do: under
   a text field, and under a table head. The one thing that gets visual weight
   is the balance, because that is what the page is for.

   Class names beginning `account-` are load-bearing: account.js queries
   `.account-table-wrap` and constructs `.account-key*` / `.account-empty`
   nodes itself. Renaming them here silently breaks the page.
   --------------------------------------------------------------------------- */

.account.section {
  flex: 1 0 auto;
  padding: 1.15rem 0 2.25rem;
}

.page-account .masthead {
  padding: 1.15rem 0;
}

@media (min-width: 621px) {
  .page-account .masthead {
    flex-wrap: nowrap;
  }
}

/* Status is one line for both signed-in and signed-out, so it must not
   reserve a gap when empty or jump the layout when it fills. */
.acct-status {
  margin: 0 0 1.5rem;
  min-height: 1.4em;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

/* Nothing to report: collapse the line rather than reserve a gap for it.
   Not display:none -- that drops the live region out of the a11y tree. */
.acct-status:empty {
  margin: 0;
  min-height: 0;
}

.acct-fine {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.acct-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0;
}

/* --- signed out ----------------------------------------------------------- */

.acct-gate {
  max-width: 34rem;
}

.acct-gate__note {
  margin-top: 1rem;
}

.acct-gate__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* --- the desk ------------------------------------------------------------- */

.desk {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.desk-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.desk-bar__id {
  margin: 0;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.desk-gear {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--ink-soft);
}

.desk-gear svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* --- balance -------------------------------------------------------------- */

/* Labels share a row, amounts share the next. The lead figure is louder;
   the other two stay on the same value line instead of sinking under it. */
.balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
}

.balance .figures {
  flex: 1 1 16rem;
}

.balance #btn-usdc {
  flex: none;
  align-self: center;
}

.figures {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  column-gap: 2.5rem;
  row-gap: 0.35rem;
  align-items: baseline;
  margin: 0;
}

.figure {
  display: contents;
}

.figure dt {
  grid-row: 1;
  margin: 0;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.figure dd {
  grid-row: 2;
  margin: 0;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* The one figure allowed to shout. Bodoni at this size is the wordmark's
   voice, which is why the balance gets it and the smaller figures do not. */
.figure--lead dd {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: clamp(2.25rem, 6vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  /* Bodoni's dollar bar overshoots; a hair of pad keeps it off the label. */
  padding-top: 0.12rem;
}

/* --- cards (ruled groups, not boxes) -------------------------------------- */

/* One column until there is room for a rail. The rail is placed into column 2
   explicitly, so on a single column it keeps its DOM order and leads. */
.desk-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}

@media (min-width: 62rem) {
  .desk-main {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 19rem);
    gap: 3rem;
    align-items: start;
  }

  .rail {
    grid-column: 2;
    grid-row: 1;
  }

  .card--usage {
    grid-column: 1;
    grid-row: 1;
  }
}

/* The rail's own panels stack. */
.rail {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.card {
  min-width: 0;
}

.card__label {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.acct-address {
  margin: 0.85rem 0 0;
  max-width: none;
  font-size: 0.8125rem;
  line-height: 1.6;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

/* --- keys ----------------------------------------------------------------- */

.acct-row--form {
  align-items: flex-end;
  margin-top: 0;
}

.acct-field {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
}

.acct-field input {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 0;
  outline: none;
}

.acct-field input::placeholder {
  color: var(--ink-soft);
  opacity: 0.75;
}

.acct-field input:focus {
  border-bottom-color: var(--ink);
}

.key-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

/* Built by account.js — see the note at the top of this block. */
.account-key {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0;
}

.account-key .button {
  flex: none;
  padding: 0.4rem 0.75rem;
}

.account-key--revoked {
  opacity: 0.5;
}

/* Stacked, not inline: in the rail a long label plus its hash wraps for some
   keys and not others, and the list goes ragged. */
.account-key__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 auto;
}

.account-key__main strong {
  font-weight: 600;
  font-size: 0.875rem;
}

.account-key__meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* --- dialogs (key secret, USDC deposit) ---------------------------------- */

.sheet-dialog {
  width: min(32rem, calc(100vw - 2rem));
  margin: auto;
  padding: 1.75rem 1.75rem 1.5rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
}

.sheet-dialog::backdrop {
  background: rgb(26 24 20 / 0.42);
}

:root[data-theme="dark"] .sheet-dialog::backdrop {
  background: rgb(5 10 18 / 0.62);
}

.sheet-dialog__title {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.sheet-dialog__lede {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: none;
}

.sheet-dialog .acct-address {
  margin: 1rem 0 0;
}

.sheet-dialog .acct-status {
  margin: 0.85rem 0 0;
}

.sheet-dialog__secret {
  display: block;
  margin: 1.15rem 0 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

.sheet-dialog__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
}

/* --- usage ---------------------------------------------------------------- */

.card--usage .figures {
  margin-bottom: 1.75rem;
}

/* --- spend chart ---------------------------------------------------------

   Colour is set here, not in account.js, so the themes keep working without
   the drawing code knowing anything about them. Bars are solid ink: this is
   a printed sheet, so no gridlines, no fills, no legend -- a baseline and two
   dates carry it. */
.chart {
  margin: 0 0 2rem;
  color: var(--ink);
}

.chart svg {
  display: block;
  height: auto;
  overflow: visible;
}

.chart rect {
  fill: currentColor;
}

/* A day with no fills: a hairline on the baseline, so the gap reads as
   "nothing spent" rather than a hole in the chart. */
.chart__nil {
  fill: var(--rule);
}

.chart__base {
  stroke: var(--rule);
  stroke-width: 1;
}

.chart text {
  fill: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chart__peak {
  fill: var(--ink-soft);
}

.account-table-wrap {
  overflow-x: auto;
  margin: 0;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.account-table th,
.account-table td {
  text-align: left;
  padding: 0.5rem 1rem 0.5rem 0;
  border: none;
  white-space: nowrap;
  vertical-align: baseline;
}

.account-table th:nth-child(4),
.account-table td:nth-child(4),
.account-table th:nth-child(5),
.account-table td:nth-child(5) {
  text-align: right;
}

.account-table thead th {
  border-bottom: 1px solid var(--rule);
}

/* The site-wide `tbody tr:nth-child(even)` tint puts a coloured ground behind
   half the rows. Not here: this table is figures on paper, told apart by
   alignment and row spacing. */
.account-table tbody tr:nth-child(even) td,
.account-table tbody tr:nth-child(even) th {
  background: none;
}

.account-table th {
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.625rem;
  color: var(--ink-soft);
}

.account-table td:last-child,
.account-table th:last-child {
  padding-right: 0;
}

.account-empty {
  margin: 0.85rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

@media (max-width: 640px) {
  .desk {
    gap: 1.75rem;
  }

  .balance {
    align-items: stretch;
    gap: 1.25rem;
  }

  .balance #btn-usdc {
    align-self: start;
  }

  .figures {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 1.25rem;
    width: 100%;
  }

  .account-key {
    flex-wrap: wrap;
  }
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.75rem 2rem;
  margin: 0;
}

.facts-lede {
  max-width: var(--measure);
  margin: -0.5rem 0 1.75rem;
  color: var(--ink-soft);
}

.facts div {
  border-top: 1px solid var(--ink);
  padding-top: 0.85rem;
}

.facts dt {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.facts dd {
  margin: 0.55rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.35rem 1.25rem;
  }

  .facts dt {
    font-size: 2rem;
  }
}

/* ---- endpoints ---- */

.endpoints {
  display: grid;
  margin: 2.5rem 0 0;
  border-top: 1px solid var(--ink);
}

.endpoint {
  display: grid;
  grid-template-columns: minmax(0, 21rem) 1fr auto;
  gap: 0.4rem 1.5rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.endpoint code {
  font-size: 0.875rem;
}

.endpoint .verb {
  color: var(--ink-soft);
}

.endpoint p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.flag {
  justify-self: start;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  background: var(--ink);
  color: var(--on-ink);
}

.flag--pending {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-weight: 500;
}

@media (max-width: 680px) {
  .endpoint {
    grid-template-columns: 1fr;
  }
}

pre {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: var(--leaf);
  border: 1px solid var(--rule);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 2.5rem 0 0;
}

/* ---- start: agents / humans ---- */

.start-switch {
  position: relative;
}

.start-switch__radio {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.start-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.75rem 0 0;
}

.start-tab {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.start-tab:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}

#start-mode-agents:checked ~ .start-tablist label[for="start-mode-agents"],
#start-mode-humans:checked ~ .start-tablist label[for="start-mode-humans"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}

.start-panel--humans {
  display: none;
}

#start-mode-humans:checked ~ .start-panel--agents {
  display: none;
}

#start-mode-humans:checked ~ .start-panel--humans {
  display: block;
}

.start-panel > .eyebrow {
  margin-top: 0;
}

.start-panel > pre {
  margin-top: 1.75rem;
}

.start-steps {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  max-width: var(--measure);
  border-top: 1px solid var(--ink);
}

.start-steps li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.85rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}

.start-steps__n {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding-top: 0.15rem;
}

.start-steps strong {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.start-steps p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.start-cta {
  margin: 1.75rem 0 0;
}

/* ---- invariants ---- */

.rules-lede {
  max-width: var(--measure);
  margin: -0.5rem 0 1.75rem;
  color: var(--ink-soft);
}

.rules {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
  max-width: var(--measure);
  border-top: 1px solid var(--ink);
}

.rules li {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.75rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}

.rules__n {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding-top: 0.35rem;
}

.rules h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.rules p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---- plates ---- */

/*
 * The engraved plates are cut out to true transparency, so they sit
 * directly on the paper at any size. The <picture> in the markup swaps
 * which plate is printed; this file only decides how it sits.
 */
.art {
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.art picture {
  display: block;
}

.art img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.92;
}

.art--hero {
  top: -3rem;
  right: -3rem;
  width: 30rem;
}

/* One endpoint: no side plate — endpoints + code need the full measure.
   Lobster pots live on #start (traps you set, fills you pull). */
.art--start {
  top: 0.5rem;
  right: -4rem;
  width: 22rem;
  opacity: 0.88;
}

/* ---- ticker ---- */

/* The telegraph tape: the measured spread running past the fold, full
   bleed, the one element allowed to cross the page margins. */
.ticker {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  overflow: hidden;
  flex: none;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.8rem 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  gap: 3rem;
  padding-right: 3rem;
}

.ticker span {
  display: inline-flex;
  gap: 0.6rem;
  align-items: baseline;
}

.ticker b {
  font-weight: 600;
  color: var(--ink);
}

.ticker i {
  font-style: normal;
  color: var(--vermilion);
}

.ticker span::after {
  content: "◆";
  font-size: 0.5em;
  color: var(--vermilion);
  transform: translateY(-0.35em);
  margin-left: 3rem;
}

/* ---- night sky ---- */

/* Stars exist only in the night printing. Two layers of gilt points
   pulse out of phase, fixed to the sky rather than the sheet. */
.stars {
  display: none;
}

[data-theme="dark"] .stars {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

[data-theme="dark"] .stars::before,
[data-theme="dark"] .stars::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  opacity: 0.7;
}

[data-theme="dark"] .stars::before {
    box-shadow:
      7vw 12vh 0 0 #d9d2be,
      18vw 34vh 0 0 #8da1bf,
      11vw 68vh 0 1px #d9a648,
      26vw 81vh 0 0 #d9d2be,
      33vw 22vh 0 0 #8da1bf,
      41vw 55vh 0 0 #d9d2be,
      49vw 9vh 0 1px #d9a648,
      57vw 71vh 0 0 #8da1bf,
      63vw 28vh 0 0 #d9d2be,
      71vw 84vh 0 0 #8da1bf,
      78vw 15vh 0 0 #d9d2be,
      84vw 47vh 0 1px #d9a648,
      91vw 66vh 0 0 #d9d2be,
      95vw 25vh 0 0 #8da1bf,
      3vw 44vh 0 0 #8da1bf;
}

[data-theme="dark"] .stars::after {
    box-shadow:
      5vw 88vh 0 0 #d9d2be,
      14vw 19vh 0 1px #d9a648,
      22vw 51vh 0 0 #8da1bf,
      30vw 74vh 0 0 #d9d2be,
      38vw 6vh 0 0 #8da1bf,
      46vw 38vh 0 0 #d9d2be,
      54vw 92vh 0 0 #8da1bf,
      61vw 13vh 0 0 #d9d2be,
      68vw 45vh 0 1px #d9a648,
      75vw 59vh 0 0 #8da1bf,
      82vw 79vh 0 0 #d9d2be,
      89vw 5vh 0 0 #8da1bf,
      97vw 52vh 0 0 #d9d2be,
      9vw 30vh 0 0 #d9a648,
      52vw 26vh 0 0 #d9d2be;
}

/* ---- motion ---- */

/*
 * All of it is gated twice: the script refuses to add the `js` class under
 * prefers-reduced-motion, and the CSS repeats the guard, so with no script
 * or no motion preference the page is simply the printed sheet.
 */
.js .reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 1.15s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 1.15s cubic-bezier(0.16, 0.84, 0.32, 1);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  /* The parallax script moves the .art container; the drift rides on the
     img and the hero's entrance on the picture, so none of the three
     transforms fight over one element. */
  .art img {
    animation: drift 14s ease-in-out infinite alternate;
  }

  .art--start img {
    animation: sway 22s ease-in-out infinite alternate;
  }

  .js .art--hero picture {
    animation: dive-in 1.8s cubic-bezier(0.16, 0.84, 0.32, 1) both;
  }

  .js .disc {
    animation: dawn 2.2s ease-out both;
  }

  .ticker-track {
    animation: tape 45s linear infinite;
  }

  .scrollcue {
    animation: usher 2.6s ease-in-out infinite;
  }

  .stars::before {
    animation: twinkle 5s ease-in-out infinite alternate;
  }

  .stars::after {
    animation: twinkle 7s ease-in-out infinite alternate-reverse;
  }

  .desk-gear.is-spinning svg {
    animation: desk-spin 0.85s linear infinite;
  }
}

@keyframes drift {
  from {
    transform: translateY(-10px);
  }
  to {
    transform: translateY(12px);
  }
}

@keyframes sway {
  from {
    transform: translateY(-8px) rotate(-1.2deg);
  }
  to {
    transform: translateY(8px) rotate(1.2deg);
  }
}

/* The god enters the way he means to go on: from above, falling. */
@keyframes dive-in {
  from {
    opacity: 0;
    transform: translateY(-70px);
  }
}

@keyframes dawn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}

@keyframes tape {
  to {
    transform: translateX(-50%);
  }
}

@keyframes usher {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

@keyframes desk-spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes twinkle {
  from {
    opacity: 0.25;
  }
  to {
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---- colophon ---- */

.colophon {
  position: relative;
  z-index: 1;
  padding: 1.75rem 0 2.25rem;
  background: transparent;
  border-top: 1px solid var(--rule);
}

.colophon-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
}

.colophon-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--display);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.device {
  margin: 0;
  width: 2.4rem;
  flex: none;
  pointer-events: none;
}

.device img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 1;
}

.colophon-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.35rem;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.colophon-nav a {
  color: var(--ink);
  text-decoration: none;
  opacity: 0.72;
}

.colophon-nav a:hover {
  opacity: 1;
}

.colophon-nav a[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

.colophon-nav a[aria-disabled="true"]:hover {
  opacity: 0.4;
}

/* A caption the table needs for screen readers but the layout does not. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

a.plain {
  color: inherit;
  text-decoration: none;
}

@media (max-width: 900px) {
  /* The side plates need a margin to live in; on narrow screens only the
     hero keeps its fall, tucked behind the headline's right shoulder. */
  .art--start,
  .art--rules {
    display: none;
  }

  .art--hero {
    top: -5rem;
    right: -7rem;
    width: 22rem;
    opacity: 0.5;
  }

  .art--disc {
    top: -3rem;
    right: -9rem;
    width: 24rem;
  }
}

/* ---- docs sheet ---------------------------------------------------------- */

.page-docs .masthead {
  padding: 1.15rem 0;
}

.docs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  padding: 1.5rem 0 3rem;
  align-items: start;
}

@media (min-width: 62rem) {
  .docs {
    grid-template-columns: 11.5rem minmax(0, 1fr);
    gap: 3.5rem;
    padding-top: 2rem;
  }

  .docs-toc {
    position: sticky;
    top: 1.25rem;
  }
}

.docs-toc__label {
  margin: 0 0 0.85rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.docs-toc nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.85rem;
}

.docs-toc nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.docs-toc nav a:hover,
.docs-toc nav a[aria-current="true"] {
  color: var(--ink);
}

.docs-toc__note {
  margin: 1.25rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.docs-toc__note a {
  color: var(--ink-soft);
}

.docs-hero {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.docs-hero h1 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.docs-hero .standfirst {
  margin-bottom: 1.25rem;
}

.docs-hero__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.docs-hero__meta code {
  margin-left: 0.35rem;
  color: var(--ink);
}

.docs-sec {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.docs-sec:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.docs-sec > h2 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.docs-sec > h3,
.docs-sec .docs-split h3 {
  margin: 2rem 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-sec > p,
.docs-split p {
  max-width: var(--measure);
}

.docs-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.25rem;
  margin-top: 1.75rem;
}

@media (min-width: 52rem) {
  .docs-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem 3rem;
  }
}

.docs-steps {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  max-width: var(--measure);
  counter-reset: docs-step;
}

.docs-steps li {
  position: relative;
  padding: 0.55rem 0 0.55rem 2.1rem;
  border-top: 1px solid var(--rule);
  counter-increment: docs-step;
}

.docs-steps li:last-child {
  border-bottom: 1px solid var(--rule);
}

.docs-steps li::before {
  content: counter(docs-step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.55rem;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.docs-steps--wide {
  max-width: none;
}

.docs-cta {
  margin: 1.5rem 0 0;
}

.docs-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 0;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.docs-table th,
.docs-table td {
  text-align: left;
  padding: 0.55rem 1rem 0.55rem 0;
  border: none;
  vertical-align: baseline;
}

.docs-table thead th {
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.625rem;
  color: var(--ink-soft);
}

.docs-table tbody tr:nth-child(even) td {
  background: none;
}

.docs-table code {
  font-size: 0.75rem;
}

.docs-fine {
  margin: 1.25rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.docs-links {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  max-width: var(--measure);
  border-top: 1px solid var(--ink);
}

.docs-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}

.docs-sec pre {
  margin-top: 1.25rem;
}

.docs-sec .endpoints {
  margin-top: 1.25rem;
}

.docs-sec .rules {
  margin-top: 1.5rem;
}

@media (max-width: 620px) {
  .masthead {
    gap: 0.6rem 0.75rem;
    padding: 1.25rem 0;
  }

  .wordmark {
    font-size: 1.05rem;
    letter-spacing: 0.1em;
  }

  .chip,
  .start-tab {
    font-size: 0.625rem;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.5rem;
  }

  .button--mast,
  .button--ghost {
    font-size: 0.625rem;
    letter-spacing: 0.08em;
    padding: 0.55rem 0.9rem;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    gap: 1.25rem;
  }
}
