/* The Pre-IPO Index. One phosphor terminal running one program.
   Every measurement in here comes from art/ref/reference-crt-poster.jpg (see NOTE.md > teardown):
   the column is 67% of the window, the masthead is set TO the column, the screen is 16:9,
   the console is a hairline frame with a 4 x 3 keymap and a command line, and the sheet closes
   on two panels of 47.9% with a 4.6% gap. */

@font-face {
  font-family: "Technor";
  src: url("/fonts/technor-black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sono";
  src: url("/fonts/sono-var.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* the column, and the two type sizes that are set TO it (measured: Technor 909.31px and
     Poppins 1434.91px per 100px of size for these two strings) */
  --col: min(1040px, 100vw - 48px);
  --t-display: calc(var(--col) / 9.0931);
  --t-sub: calc(var(--col) / 14.3491);

  /* his scale, and nothing off it: 14 / 16 / 20 / 24, plus the two display lines that are set to
     the column itself, by measurement, the way his reference sets them */
  --t-body: 16px;
  --t-label: 14px;
  --t-value: 20px;
  --t-big: 24px;

  --ground: #040704;
  --ground-2: #070d08;
  --line: #1f6b36;
  --line-soft: rgba(31, 107, 54, 0.45);
  --ink: #8fe0a0;
  --ink-dim: #5bb673;
  --ink-mute: #4fb06a;  /* 7.3:1 on the ground: the dimmest ink on the page */
  --ink-mute-line: #2c7a44; /* rules and frames only, never a letter */
  --ink-hot: #beffe3;
  --display: #21c24f;
  --gold: #f2c14e;

  /* spacing: 4 / 8 / 12 / 16 / 24 / 32 / 48, and nothing else */
  --pad: 24px;
  --key: 48px;

  --glow: 0 0 18px rgba(33, 194, 79, 0.16);
  --glow-hot: 0 0 22px rgba(190, 255, 227, 0.22);
}

* { box-sizing: border-box; }

html { background: var(--ground); }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Sono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.skip {
  position: absolute;
  left: 16px;
  top: 0;
  transform: translateY(-200%);
  background: var(--ground-2);
  color: var(--ink-hot);
  border: 1px solid var(--line);
  padding: 12px 24px;
  font-size: 16px;
  z-index: 9;
}
.skip:focus { transform: translateY(16px); }


.noscript {
  width: var(--col);
  margin: 0 auto 48px;
  border: 1px solid var(--line);
  padding: var(--pad);
}

.sheet {
  width: var(--col);
  margin: 0 auto;
  padding: 48px 0 48px;
}

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

.masthead { margin: 0 0 16px; }

.wordmark {
  margin: 0;
  font-family: "Technor", "Sono", sans-serif;
  font-weight: 900;
  font-size: var(--t-display);
  line-height: 0.96;
  letter-spacing: -0.015em;
  color: var(--display);
  text-shadow: 0 0 calc(var(--col) / 90) rgba(33, 194, 79, 0.5);
  white-space: nowrap;
}

.predicate {
  margin: 0;
  font-family: "Poppins", "Sono", sans-serif;
  font-weight: 700;
  font-size: var(--t-sub);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--display);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ screen */

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  box-shadow: var(--glow), inset 0 0 60px rgba(14, 70, 32, 0.35);
  background: #020402;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 8px;
  overflow: hidden;
}

.screen-strip {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: uppercase;
  padding: 4px 24px 12px;
  min-height: 30px;
  white-space: nowrap;
  overflow: hidden;
}
.screen-rule {
  height: 0;
  margin: 0 12px;
  border-top: 1px solid var(--line-soft);
}
.strip-cell b { color: var(--ink-hot); font-weight: 400; }
.strip-right { margin-left: auto; color: var(--ink-mute); }

.screen-glass {
  position: relative;
  min-height: 0;
  margin: 0 12px;
}
.screen-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 3px, rgba(0, 0, 0, 0.42) 3px 4px);
}
#raster { display: block; width: 100%; height: 100%; }

.screen-labels {
  position: relative;
  height: 20px;
  margin: 0 12px;
  font-size: var(--t-label);
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}
.screen-labels span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.screen-labels span.on { color: var(--ink-hot); }

.screen-legend.on { color: var(--ink-hot); }
.screen-legend {
  margin: 0;
  padding: 0 24px 8px;
  font-size: var(--t-label);
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------------- console */

.console {
  margin-top: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--glow);
  padding: 24px;
}

.console-rule {
  height: 0;
  border-top: 1px solid var(--line-soft);
  margin-top: 16px;
}

.keymap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.key {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--key);
  padding: 0 24px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-body);
  line-height: 1.3;
  letter-spacing: 0.03em;
  text-align: left;
  white-space: nowrap;
  min-width: 0;
  cursor: pointer;
  transition: color 0.12s linear, border-color 0.12s linear, background-color 0.12s linear, transform 0.08s linear;
}
.key .k { color: var(--ink-mute); flex: 0 0 auto; }
.key .l { overflow: hidden; text-overflow: ellipsis; }
.key:hover { color: var(--ink-hot); border-color: var(--line); }
.key:hover .k { color: var(--ink-dim); }
.key:focus-visible { outline: 2px solid var(--ink-hot); outline-offset: 2px; }
.key:active { transform: translateY(1px); }
.key[aria-current="page"] {
  color: var(--ink-hot);
  border-color: var(--line);
  background: rgba(31, 107, 54, 0.14);
}
.key[aria-current="page"] .k { color: var(--ink-hot); }
.key[disabled] { color: var(--ink-mute); cursor: default; opacity: 0.74; }
.key.flash { background: rgba(190, 255, 227, 0.16); color: var(--ink-hot); }

.mintline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  min-height: var(--key);
  flex-wrap: wrap;
}
.mint-label {
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  line-height: var(--key);
}
.mint-value {
  font-size: var(--t-body);
  line-height: var(--key);
  color: var(--ink-hot);
  user-select: all;
  overflow-wrap: anywhere;
  min-width: 0;
}
.mint-value.unset { color: var(--ink-mute); user-select: none; }
.mint-note {
  font-size: var(--t-label);
  line-height: var(--key);
  color: var(--ink-mute);
  margin-left: auto;
}

/* the copy control is a button and looks like one: a filled plate, and three states you can see */
.key.copy {
  border-color: var(--line);
  background: rgba(31, 107, 54, 0.16);
  color: var(--ink-hot);
  padding: 0 24px;
  font-variant-numeric: tabular-nums;
}
.key.copy:hover { background: rgba(31, 107, 54, 0.32); border-color: var(--ink-dim); color: var(--ink-hot); }
.key.copy:active { background: rgba(190, 255, 227, 0.22); transform: translateY(1px); }
.key.copy:focus-visible { outline: 2px solid var(--ink-hot); outline-offset: 2px; }
.key.copy.done { background: rgba(190, 255, 227, 0.26); border-color: var(--ink-hot); }
.key.copy[disabled] {
  background: transparent;
  border-color: var(--line-soft);
  color: var(--ink-mute);
  opacity: 0.74;
}

.prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  min-height: var(--key);
}
.cwd {
  font-size: var(--t-value);
  color: var(--ink-dim);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.cmd {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--ink-hot);
  font: inherit;
  font-size: var(--t-value);
  letter-spacing: 0.02em;
  padding: 8px 0;
  caret-color: var(--ink-hot);
}
.cmd:focus { outline: none; border-bottom-color: var(--line); }
.cmd::placeholder { color: var(--ink-mute); }
.caret {
  width: 10px;
  height: 20px;
  background: var(--ink-hot);
  animation: blink 1.1s steps(1, end) infinite;
  flex: 0 0 auto;
}
.prompt:focus-within .caret { display: none; }
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* the four places this coin lives: its own row, each one named, all four the same key */
.marks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.mark {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--key);
  padding: 0 16px;
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: var(--t-label);
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.12s linear, background-color 0.12s linear, color 0.12s linear, transform 0.08s linear;
}
.mark .mark-plate {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mark img { display: block; object-fit: contain; }
.mark:hover { border-color: var(--line); background: rgba(31, 107, 54, 0.16); color: var(--ink-hot); }
.mark:focus-visible { outline: 2px solid var(--ink-hot); outline-offset: 2px; }
.mark:active { transform: translateY(1px); }
.mark[aria-disabled="true"] { opacity: 0.74; pointer-events: none; color: var(--ink-mute); }

/* -------------------------------------------------------------------- pair */

/* Two cards, one composition: the drawing on the left, the words on the right, the same padding,
   the same alignment, the same box. The grid gives them equal columns by construction. */
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  margin-top: 32px;
}
.panel {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--glow);
  min-height: 224px;
  padding: 24px;
  overflow: hidden;
}
.wire { display: block; width: 160px; height: 160px; }
.panel-read { display: flex; flex-direction: column; gap: 8px; min-width: 0; text-align: left; }
.panel-title {
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}
.panel-lines {
  margin: 0;
  font-size: var(--t-label);
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  line-height: 1.6;
}
.funnel-value {
  font-size: var(--t-big);
  color: var(--gold);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(242, 193, 78, 0.45);
}

/* -------------------------------------------------------------------- view */

.view { margin-top: 32px; }
.view:focus { outline: none; }

.band { margin-bottom: 48px; }
.band:last-child { margin-bottom: 0; }

.band-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  margin-bottom: 16px;
}
.band-head h2 {
  margin: 0;
  font-size: var(--t-label);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-hot);
}
.band-head .sub { font-size: var(--t-label); color: var(--ink-mute); margin-left: auto; text-align: right; }

/* fixed proportions, so a column never jumps between two screens and the numbers keep one line */
.rows { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rows caption { text-align: left; font-size: var(--t-label); color: var(--ink-mute); padding-bottom: 8px; }
.rows th {
  text-align: left;
  font-weight: 400;
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.rows td {
  padding: 12px 24px;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rows td.name { color: var(--ink-hot); white-space: normal; }
.rows td.wrap { white-space: normal; overflow-wrap: anywhere; }
.rows .num { text-align: right; }
.rows tr.open:hover td { background: rgba(31, 107, 54, 0.16); }
.rows tr.open { cursor: pointer; }
.rows tr.on td { background: rgba(31, 107, 54, 0.22); }
.rows tr.out td { color: var(--ink-mute); }

/* the queue's proportions: the widest number of each column decides its share */
.rows.cols-7 col:nth-child(1) { width: 18%; }
.rows.cols-7 col:nth-child(2) { width: 17%; }
.rows.cols-7 col:nth-child(3) { width: 13%; }
.rows.cols-7 col:nth-child(4) { width: 11%; }
.rows.cols-7 col:nth-child(5) { width: 14%; }
.rows.cols-7 col:nth-child(6) { width: 13%; }
.rows.cols-7 col:nth-child(7) { width: 14%; }

/* a sortable head is a control: it answers to the pointer, the keyboard and the eye */
.rows th.sortable {
  cursor: pointer;
  user-select: none;
}
.rows th.sortable:hover { color: var(--ink-hot); }
.rows th.sortable:focus-visible { outline: 2px solid var(--ink-hot); outline-offset: -2px; }
.rows th[aria-sort] { color: var(--ink-hot); }
.rows th .arrow { color: var(--ink-hot); margin-left: 8px; }

/* the status is set the way every key on this page is set, in brackets: one column, one width,
   no plate to be a pixel wider than its neighbour */
.tag {
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.tag.filed { color: var(--ink-hot); }
.tag.grad { color: var(--gold); }
.tag.wait { color: var(--ink-mute); }

.up { color: var(--ink-hot); }
.down { color: var(--ink-mute); }

a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line); }
a:hover { color: var(--ink-hot); }
a:focus-visible { outline: 2px solid var(--ink-hot); outline-offset: 2px; }

.note { color: var(--ink-dim); max-width: 74ch; }
.note b { color: var(--ink-hot); font-weight: 400; }
.empty {
  border: 1px solid var(--line-soft);
  padding: 24px;
  color: var(--ink-dim);
}

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 0; padding: 0; list-style: none; }
.steps li { border-top: 1px solid var(--line); padding: 12px 24px 0; }
.steps .n { font-size: var(--t-big); color: var(--ink-hot); line-height: 1.2; }
.steps p { margin: 8px 0 0; color: var(--ink-dim); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.kv dt { color: var(--ink-dim); font-size: var(--t-label); letter-spacing: 0.06em; text-transform: uppercase; }
.kv dd { margin: 0; color: var(--ink-hot); overflow-wrap: anywhere; }

.figure { font-size: var(--t-big); color: var(--ink-hot); font-variant-numeric: tabular-nums; }
.figure.gold { color: var(--gold); }

.field {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
}
.field input {
  flex: 1 1 320px;
  min-width: 0;
  background: #020402;
  border: 1px solid var(--line-soft);
  color: var(--ink-hot);
  font: inherit;
  font-size: var(--t-body);
  padding: 12px 16px;
  min-height: 48px;
}
.field input:focus { outline: none; border-color: var(--line); }
.btn {
  appearance: none;
  min-height: 48px;
  padding: 0 24px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.12s linear, background-color 0.12s linear, transform 0.08s linear;
}
.btn:hover { color: var(--ink-hot); background: rgba(31, 107, 54, 0.14); }
.btn:focus-visible { outline: 2px solid var(--ink-hot); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { color: var(--ink-mute); border-color: var(--line-soft); cursor: default; opacity: 0.74; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1000px) {
  :root { --col: calc(100vw - 32px); --pad: 16px; }
  /* narrow: the four places go two by two. The table keeps its fixed grid and its nowrap numbers:
     a figure is never broken across two lines, a column is dropped instead. */
  .marks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rows th, .rows td { padding: 12px 16px; }
  .rows td.name, .rows td.wrap { white-space: normal; overflow-wrap: anywhere; }
  .rows th:nth-child(7), .rows td:nth-child(7) { display: none; }
  .rows.cols-7 col:nth-child(1) { width: 18.3%; }
  .rows.cols-7 col:nth-child(2) { width: 22.3%; }
  .rows.cols-7 col:nth-child(3) { width: 16.8%; }
  .rows.cols-7 col:nth-child(4) { width: 12.9%; }
  .rows.cols-7 col:nth-child(5) { width: 18.3%; }
  .rows.cols-7 col:nth-child(6) { width: 11.4%; }
  .rows.cols-7 col:nth-child(7) { width: 0; }
  .screen { aspect-ratio: 4 / 3; }
  .keymap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .pair { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 740px) {
  /* liquidity leaves before a number would have to wrap */
  .rows th:nth-child(5), .rows td:nth-child(5) { display: none; }
  .rows.cols-7 col:nth-child(1) { width: 22%; }
  .rows.cols-7 col:nth-child(2) { width: 27%; }
  .rows.cols-7 col:nth-child(3) { width: 20%; }
  .rows.cols-7 col:nth-child(4) { width: 15%; }
  .rows.cols-7 col:nth-child(5) { width: 0; }
  .rows.cols-7 col:nth-child(6) { width: 16%; }
}

@media (max-width: 620px) {
  :root { --key: 48px; }
  .screen { aspect-ratio: 4 / 5; }
  .screen-strip { flex-wrap: wrap; gap: 4px 16px; min-height: 0; white-space: normal; padding: 4px 16px 8px; }
  .strip-right { display: none; }
  .screen-labels { display: none; }
  .screen-legend { white-space: normal; }
  .keymap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 16 px of inner padding AND a label that is not cut: the tracking and the gap give the room */
  .key { padding: 0 16px; gap: 8px; letter-spacing: 0; }
  .panel { grid-template-columns: 128px minmax(0, 1fr); gap: 16px; padding: 16px; min-height: 0; }
  .wire { width: 128px; height: 128px; }
  .marks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mark { padding: 0 12px; gap: 8px; }
  .steps { grid-template-columns: 1fr; }
  .prompt { flex-wrap: wrap; }
  .cmd { font-size: var(--t-body); }
  .mint-note { margin-left: 0; width: 100%; line-height: 1.6; }
  /* a phone gets the whole row as a block with its own labels: nothing hidden, nothing squeezed */
  .rows, .rows tbody, .rows tr, .rows td { display: block; width: auto; }
  .rows thead { display: none; }
  .rows tr { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .rows tr.open:hover td, .rows tr.on td { background: none; }
  .rows tr.open:hover, .rows tr.on { background: rgba(31, 107, 54, 0.16); }
  .rows td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 0;
    padding: 4px 24px;
    text-align: left;
  }
  .rows td.num { text-align: left; }
  .rows td::before {
    content: attr(data-h);
    color: var(--ink-dim);
    font-size: var(--t-label);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .rows td:nth-child(5), .rows td:nth-child(7) { display: flex; }
}
@media (max-width: 440px) {
  /* two named places do not fit side by side here: one per row, nothing cut */
  .marks { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 360px) {
  /* two columns of keys cut their own labels at this width: one column, nothing clipped */
  .keymap { grid-template-columns: minmax(0, 1fr); }
  .key { min-height: 44px; }
}

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

/* the figures the basket does not hold yet: dim, but never below the floor */
.rows td.dim { color: var(--ink-mute); }
