/* ASI-20 field unit, printed flat.
   The 3D housing was dropped on Vadim's review of 2026-10-27: a photoreal shell cut into pieces
   cannot follow a column that grows with the content (the flanks were upscaled 1.63x and tiled with
   a seam every 163 px, eighteen of them down the page). What carries the register now is the
   drawing, not a render: hairline frames, corner brackets, a stencil face, the olive and amber inks
   measured off his picture, and the same warm ground it stood on.

   One type scale:    16 / 20 / 24 / 32 / 44   (16 is the floor, his own order of 2026-09-13)
   One spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48
*/

@font-face {
  font-family: "Big Shoulders Stencil";
  src: url("/fonts/big-shoulders-stencil-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bai Jamjuree";
  src: url("/fonts/bai-jamjuree-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bai Jamjuree";
  src: url("/fonts/bai-jamjuree-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/fonts/martian-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --page: min(1120px, 100vw - 32px);

  --ink: #f6c57a;            /* the amber the screen is written in */
  --ink-hi: #ffe7ab;         /* a value, a lit key, the one display line */
  --ink-dim: #dca866;        /* labels; measured at 7.6:1 on the sheet */
  --line: #a06c2c;           /* a frame that should be seen */
  --line-dim: #5d3d19;       /* a rule between rows */
  --sheet: #171209;          /* the panel */
  --sheet-2: #1f180d;        /* a lifted row */
  --knock: #140f06;          /* text knocked out of a filled key */
  --olive: #c9cdae;          /* the one second hue: corner brackets and the unit's own marks */

  --s4: 4px; --s8: 8px; --s12: 12px; --s16: 16px; --s24: 24px; --s32: 32px; --s48: 48px;
  --row: 56px;
  --pad: clamp(16px, 2.4vw, 32px);
}

* { box-sizing: border-box; }

html {
  /* his ground, measured off the reference: amber behind the top, burnt orange at the foot */
  background:
    radial-gradient(70% 22% at 50% 0%, rgba(255, 190, 102, 0.55), rgba(0, 0, 0, 0) 70%),
    radial-gradient(120% 40% at 50% 104%, rgba(52, 14, 2, 0.78), rgba(0, 0, 0, 0) 70%),
    radial-gradient(100% 60% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(40, 10, 0, 0.42)),
    linear-gradient(#cf7430, #a4460f 34%, #7c2f0b 72%, #5c2208);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  font-family: "Bai Jamjuree", system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

/* the grain of the ground, even and regular, never noise */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("/img/grain.png");
  background-size: 160px 160px;
  opacity: 0.1;
  mix-blend-mode: overlay;
}

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.sheet {
  width: var(--page);
  margin: clamp(24px, 4vw, 56px) 0 clamp(32px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* no child may stretch the sheet past the column */
  gap: var(--s16);
}

/* ------------------------------------------------------------------ blocks */

/* every block is the same object: a dark plate, a hairline frame, two corner brackets */
.block {
  position: relative;
  background: linear-gradient(180deg, var(--sheet-2), var(--sheet));
  border: 1px solid var(--line-dim);
  padding: var(--pad);
}
.block::before,
.block::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--olive);
  opacity: 0.55;
  pointer-events: none;
}
.block::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.block::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }

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

.masthead__row {
  display: flex;
  justify-content: space-between;
  gap: var(--s16);
  flex-wrap: wrap;
}

.stamp {
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.stamp--r { color: var(--ink); }
.stamp--r #identNum { font-family: "Big Shoulders Stencil", sans-serif; font-size: 20px; line-height: 1.2; }

.masthead__name {
  margin: var(--s12) 0 var(--s8);
  font-family: "Big Shoulders Stencil", sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 5.2vw, 44px);
  line-height: 1.16;
  letter-spacing: 0.01em;
  color: var(--ink-hi);
}

.premise {
  margin: 0;
  max-width: 76ch;
  font-size: 16px;
  color: var(--ink);
}

/* ------------------------------------------------------- the section index */

.index {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: var(--s8);
}

.index__item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s8);
  min-height: var(--s48);
  padding: var(--s12) var(--s24);
  border: 1px solid var(--line-dim);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.index__n {
  font-family: "Big Shoulders Stencil", sans-serif;
  font-size: 20px;
  line-height: 1.2;
  color: var(--ink-dim);
}
.index__item:hover { background: #241b0e; border-color: var(--line); }
.index__item:active { transform: translateY(1px); }
.index__item:focus-visible { outline: 2px solid var(--ink-hi); outline-offset: 2px; }
.index__item[aria-current="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--knock);
}
.index__item[aria-current="true"] .index__n { color: var(--knock); }

/* --------------------------------------------------------------- the panel */

.panel { padding: 0; }

.reads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s16) var(--s24);
  padding: var(--pad) var(--pad) var(--s16);
}

.read { display: grid; gap: var(--s4); align-content: start; min-width: 0; }
.read__k {
  font-size: 16px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.read__v {
  font-size: 20px;
  line-height: 1.2;
  color: var(--ink-hi);
  font-variant-numeric: tabular-nums;
}
.read__v--big { font-size: clamp(24px, 3.4vw, 32px); }

.plot {
  position: relative;
  padding: 0 var(--pad) var(--s16);
}
.plot canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 7 / 3;
}
.plot canvas[data-kind="split"] { aspect-ratio: 16 / 5; }
.plot__empty {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(48ch, 80%);
  text-align: center;
  font-size: 16px;
  color: var(--ink-dim);
}
.plot__empty b {
  display: block;
  margin-bottom: var(--s4);
  font-family: "Big Shoulders Stencil", sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.panel__foot {
  display: flex;
  justify-content: space-between;
  gap: var(--s16);
  padding: var(--s12) var(--pad);
  border-top: 1px solid var(--line-dim);
  font-size: 16px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------- the reading keys */

.keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s8);
}

.skey {
  min-height: var(--s48);
  padding: var(--s12) var(--s16);
  border: 1px solid var(--line-dim);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.skey:hover { background: #241b0e; border-color: var(--line); }
.skey:active { transform: translateY(1px); }
.skey:focus-visible { outline: 2px solid var(--ink-hi); outline-offset: 2px; }
.skey[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--knock); }

/* --------------------------------------------------------------- the rows */

.screen { display: grid; gap: var(--s16); }

.block__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s4) var(--s16);
  padding: var(--s12) var(--s16);
  border-bottom: 1px solid var(--line-dim);
  font-size: 16px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.block__head a { color: var(--ink); }

.rows { display: grid; }

/* the column header: his first complaint, two columns of dashes nobody could read */
.rowhead {
  display: grid;
  align-items: end;
  gap: var(--s12);
  padding: var(--s8) var(--s24) var(--s8) var(--s16);
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.row {
  display: grid;
  align-items: center;
  gap: var(--s12);
  min-height: var(--row);
  padding: var(--s8) var(--s24) var(--s8) var(--s16);
  border: 0;
  border-bottom: 1px solid var(--line-dim);
  border-left: 3px solid transparent;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background 0.12s ease;
}
.row:hover { background: #221a0d; }
.row:focus-visible { outline: 2px solid var(--ink-hi); outline-offset: -2px; }
/* the cursor: the row the arrows and Enter act on, marked so it is never a highlight with no reason */
.row[aria-current="true"] { background: #241b0e; border-left-color: var(--ink); }
.row[aria-current="true"] .cell--mark { color: var(--ink-hi); }
.row--static { cursor: default; }
.row--static:hover { background: none; }

.row--agent { min-height: 64px; }
.row--agent, .rowhead--agent { grid-template-columns: 18px 104px minmax(0, 1.4fr) minmax(0, 1fr) 104px 108px 80px 140px; column-gap: var(--s16); }
.row--board, .rowhead--board { grid-template-columns: 56px minmax(0, 1fr) 96px 136px; }
.row--log { grid-template-columns: 96px 88px minmax(0, 1fr) 132px; align-items: start; }
.row--pair { grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); align-items: start; }

.cell { min-width: 0; }
.cell--k { color: var(--ink-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.cell--n { font-variant-numeric: tabular-nums; text-align: right; }
.cell--mono { font-family: "Martian Mono", ui-monospace, monospace; font-size: 16px; letter-spacing: -0.02em; }
.cell--hi { color: var(--ink-hi); }
.cell--dim { color: var(--ink-dim); }
.cell--mark { color: var(--ink-dim); font-family: "Big Shoulders Stencil", sans-serif; line-height: 1.2; }
.unit { color: var(--ink-dim); }
.cell--clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell--wrap { white-space: normal; overflow-wrap: anywhere; }
.cell--model { display: grid; gap: 0; align-content: center; min-width: 0; }
.cell--model span { overflow-wrap: anywhere; }

.callsign { display: flex; align-items: baseline; gap: var(--s8); }
.callsign__n { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.note {
  margin: var(--s12) var(--s16) 0;
  max-width: 80ch;
  color: var(--ink-dim);
  font-size: 16px;
}
.note:last-child { margin-bottom: var(--s12); }

.steps { display: grid; margin: 0; padding: 0; list-style: none; }
.step {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: var(--s16);
  padding: var(--s16);
  border-bottom: 1px solid var(--line-dim);
}
.step__n {
  font-family: "Big Shoulders Stencil", sans-serif;
  font-size: 24px;
  line-height: 1.22;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.step__t { margin: 0 0 var(--s4); font-size: 20px; color: var(--ink-hi); }
.step__b { margin: 0; font-size: 16px; }

.actions { display: flex; flex-wrap: wrap; gap: var(--s12); padding: var(--s16); }

/* --------------------------------------------------------------- the coin */

.plate { padding: 0; }

.plate__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s8) var(--s16);
  padding: var(--pad) var(--pad) var(--s12);
}
.plate__tick {
  font-family: "Big Shoulders Stencil", sans-serif;
  font-size: 32px;
  line-height: 1.18;
  color: var(--ink-hi);
}
.plate__note {
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.plate__mint {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s12);
  padding: 0 var(--pad);
}

.mint {
  display: flex;
  align-items: center;
  min-height: 56px;
  min-width: 0;
  padding: var(--s12) var(--s16);
  background: #0d0a05;
  border: 1px solid var(--line-dim);
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
}
.mint[data-empty="1"] { color: var(--ink-dim); user-select: none; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s8);
  min-height: 56px;
  padding: var(--s12) var(--s24);
  border: 1px solid var(--line);
  background: var(--sheet-2);
  color: var(--ink-hi);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.key:hover { background: #2a2010; border-color: var(--ink); }
.key:active { transform: translateY(1px); }
.key:focus-visible { outline: 2px solid var(--ink-hi); outline-offset: 2px; }
.key[disabled],
.key[aria-disabled="true"] {
  cursor: not-allowed;
  color: var(--ink-dim);
  border-color: var(--line-dim);
  background: #191308;
  pointer-events: none;
}
.key img { display: block; width: 20px; height: 20px; object-fit: contain; }
.key[aria-disabled="true"] img { opacity: 0.5; }
.key--copy { white-space: nowrap; }
.key--primary {
  width: 100%;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--knock);
}
.key--primary:hover { background: var(--ink-hi); border-color: var(--ink-hi); }
.key--primary[aria-disabled="true"] { background: #191308; color: var(--ink-dim); border-color: var(--line-dim); }

.plate__keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s12);
  padding: var(--s12) var(--pad) 0;
}
.plate__keys .key--primary { grid-column: 1 / -1; }

.plate__foot {
  margin-top: var(--s16);
  padding: var(--s12) var(--pad);
  border-top: 1px solid var(--line-dim);
  display: grid;
  gap: var(--s4);
}
.plate__line {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.plate__line--dim { color: var(--ink-dim); letter-spacing: 0; }

/* -------------------------------------------------------------- the widths */

@media (max-width: 1100px) {
  .row--agent, .rowhead--agent { grid-template-columns: 20px 96px minmax(0, 1.3fr) minmax(0, 1fr) 96px 100px 72px; }
  .cell--last, .rowhead--agent .cell--last { display: none; }
}

@media (max-width: 900px) {
  .row--agent, .rowhead--agent { grid-template-columns: 20px 92px minmax(0, 1fr) 92px 96px; }
  .cell--strategy, .rowhead--agent .cell--strategy,
  .cell--trades, .rowhead--agent .cell--trades { display: none; }
}

@media (max-width: 760px) {
  :root { --page: calc(100vw - 16px); --row: 52px; }
  .keys { grid-template-columns: repeat(2, 1fr); }
  .row--log { grid-template-columns: 92px minmax(0, 1fr); row-gap: var(--s4); }
  .row--log .cell:nth-child(3), .row--log .cell:nth-child(4) { grid-column: 1 / -1; }
  .row--board, .rowhead--board { grid-template-columns: 40px minmax(0, 1fr) 112px; }
  .row--board .cell:nth-child(3), .rowhead--board .cell:nth-child(3) { display: none; }
  .row--pair { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .plot canvas { aspect-ratio: 4 / 3; }
  .step { grid-template-columns: 44px minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .index { grid-template-columns: 1fr; }
  /* four cells are left here (marker, agent, bank, pnl), so the grid must have four tracks:
     with three they wrapped into the marker column and cut themselves. The padding stays at
     16/24, because narrowing it to buy column width breaks the inner padding rule instead. */
  .row--agent, .rowhead--agent { grid-template-columns: 16px minmax(0, 1fr) 64px 76px; column-gap: var(--s12); }
  .cell--model, .rowhead--agent .cell--model { display: none; }
  /* "0.037 SOL" wraps in a 64 px column, and a wrapped unit reads worse than a header carrying it */
  .row .unit { display: none; }
  .rowhead .unit--head { display: inline; }
  .plate__keys { grid-template-columns: 1fr; }
  .plate__mint { grid-template-columns: minmax(0, 1fr); }
  .key--copy { width: 100%; }
}

/* under 380 two columns of figures no longer fit beside a callsign without squeezing one of them:
   the second one leaves and the record behind the row still carries it. 390, his narrowest width,
   stays above this line and keeps both. */
@media (max-width: 380px) {
  .row--agent, .rowhead--agent { grid-template-columns: 16px minmax(0, 1fr) 88px; }
  .cell--drop-narrow, .rowhead--agent .cell--drop-narrow { display: none; }
  .row--board, .rowhead--board { grid-template-columns: 32px minmax(0, 1fr) 88px; }
}

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