/* Pack Index 500. Built to his CRT dossier picture: a dotted hairline card with round nodes at
   every junction, cells of 1 bit rasters with crop brackets, a label and value ladder, and a
   graticule chart with a digit dump under it. Two faces of one bitmap ROM family for the chrome,
   a text face for sentences, a mono for every figure. Monochrome: the only accent is inversion. */

@font-face { font-family: "CRT"; src: url("/fonts/crt-bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "CRT"; src: url("/fonts/crt.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Supreme"; src: url("/fonts/Supreme-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Supreme"; src: url("/fonts/Supreme-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Supreme"; src: url("/fonts/Supreme-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Sligoil"; src: url("/fonts/Sligoil-Micro.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sligoil"; src: url("/fonts/Sligoil-MicroMedium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ground: #06080b;
  --card: #0a1018;
  --cell: #0c131d;
  --sunk: #070c13;
  --rule: #35546b;
  --rule-soft: #23394a;
  --node: #9dc3da;
  --dim: #8fb0c6;
  --ink: #c9e3f3;
  --hot: #eaf7ff;

  --crt: "CRT", ui-monospace, monospace;
  --text: "Supreme", system-ui, sans-serif;
  --mono: "Sligoil", ui-monospace, monospace;

  --page: min(1120px, 100vw - 64px);
  --gut: 20px;
  --pad: 20px;
  --row: 40px;
}

* { box-sizing: border-box; }
html { background: var(--ground); }
body {
  margin: 0;
  padding: 40px 0 64px;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/24px var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* one texture layer for the whole field, and one even scan ruling over it */
.field {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("/img/grain.png") repeat;
  background-size: 320px 320px;
  opacity: .22;
}
.scan {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(157, 195, 218, .055) 0 1px, rgba(0, 0, 0, 0) 1px 4px);
}

/* ---------- the card ---------- */
.card {
  position: relative; z-index: 1;
  width: var(--page);
  margin: 0 auto;
  background: var(--card);
  border: 1px dotted var(--rule);
  padding: 14px;
}
.card::before { content: ""; position: absolute; inset: 5px; border: 1px dotted var(--rule-soft); pointer-events: none; }
.card::after { content: ""; position: absolute; inset: -3px; pointer-events: none;
  background-image:
    radial-gradient(circle 3px at 3px 3px, var(--node) 99%, rgba(0,0,0,0) 100%),
    radial-gradient(circle 3px at calc(100% - 3px) 3px, var(--node) 99%, rgba(0,0,0,0) 100%),
    radial-gradient(circle 3px at 3px calc(100% - 3px), var(--node) 99%, rgba(0,0,0,0) 100%),
    radial-gradient(circle 3px at calc(100% - 3px) calc(100% - 3px), var(--node) 99%, rgba(0,0,0,0) 100%);
  background-repeat: no-repeat;
}

/* ---------- the title strip ---------- */
.strip {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  border: 1px dotted var(--rule);
  background: var(--cell);
  padding: 20px max(var(--pad), 32px);
}
.mast {
  margin: 0;
  font: 700 48px/48px var(--crt);
  letter-spacing: 1px;
  color: var(--hot);
  text-shadow: 0 0 14px rgba(157, 195, 218, .45);
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
}
.strip__read { margin: 0; font: 400 16px/24px var(--mono); color: var(--dim); text-align: right; }
.strip__read b { color: var(--hot); font-weight: 500; }

/* ---------- the nodes: the nav sits on the frame's own rule ---------- */
.nodes {
  position: relative;
  display: flex; flex-wrap: wrap; gap: 0 20px;
  border-top: 1px dotted var(--rule);
  margin: 16px 2px 0;
  padding: 18px 0 2px;
}
.node {
  position: relative;
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 8px 16px 12px;
  font: 700 16px/24px var(--crt);
  letter-spacing: 1px;
  color: var(--dim);
  -webkit-font-smoothing: none;
}
.node::before {
  content: ""; position: absolute; top: -22px; left: 50%; width: 7px; height: 7px;
  transform: translateX(-50%);
  border: 1px solid var(--node); border-radius: 50%; background: var(--ground);
  transition: background .12s, box-shadow .12s;
}
.node:hover { color: var(--ink); }
.node:hover::before { background: var(--node); }
.node[aria-current="page"] { color: var(--hot); box-shadow: inset 0 -2px 0 var(--hot); }
.node[aria-current="page"]::before { background: var(--hot); box-shadow: 0 0 10px rgba(234, 247, 255, .8); }
.node:focus-visible { outline: 1px solid var(--hot); outline-offset: 4px; }

/* ---------- bands and cells ---------- */
.view { margin-top: 16px; }
.band { display: grid; gap: var(--gut); margin-bottom: var(--gut); align-items: stretch; }
.band--pix { grid-template-columns: 48fr 52fr; }
.band--main { grid-template-columns: 27fr 73fr; }
.band--one { grid-template-columns: 1fr; }
.stack { display: grid; gap: var(--gut); align-content: start; }
/* Both columns of this band keep their natural heights and happen to end within a few pixels of
   each other. Forcing equal rows instead left 150 to 500 px of nothing inside the shorter cells,
   which is the hole tools/legibility.mjs now measures. */
.band--main > .stack { align-content: start; }

.cell {
  position: relative;
  background: var(--cell);
  border: 1px dotted var(--rule);
  display: flex; flex-direction: column; min-width: 0;
}
.cell::after { content: ""; position: absolute; inset: -3px; pointer-events: none;
  background-image:
    radial-gradient(circle 2.5px at 2.5px 2.5px, var(--node) 99%, rgba(0,0,0,0) 100%),
    radial-gradient(circle 2.5px at calc(100% - 2.5px) 2.5px, var(--node) 99%, rgba(0,0,0,0) 100%),
    radial-gradient(circle 2.5px at 2.5px calc(100% - 2.5px), var(--node) 99%, rgba(0,0,0,0) 100%),
    radial-gradient(circle 2.5px at calc(100% - 2.5px) calc(100% - 2.5px), var(--node) 99%, rgba(0,0,0,0) 100%);
  background-repeat: no-repeat;
}
.cell__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px var(--pad);
  border-bottom: 1px dotted var(--rule);
  font: 700 16px/24px var(--crt); letter-spacing: 1px; color: var(--ink);
  -webkit-font-smoothing: none;
}
.cell__head span { font: 400 16px/24px var(--mono); color: var(--dim); letter-spacing: 0; white-space: nowrap; flex: 0 0 auto; }
.cell__body { padding: var(--pad); flex: 1 1 auto; min-width: 0; }
.cell__body--flush { padding: 0; }

/* ---------- picture cells ---------- */
.pic { position: relative; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 20px; min-height: 200px; }
/* the rasters are 1 bit ink on black: screened, the black drops out and the ink floats on the cell */
.pic img { display: block; width: auto; max-width: 100%; max-height: 264px; object-fit: contain; mix-blend-mode: screen; }
.pic::before, .pic::after, .crop::before, .crop::after {
  content: ""; position: absolute; width: 20px; height: 20px; pointer-events: none;
  border: 1px solid var(--node); opacity: .75;
}
.pic::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.pic::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.crop { position: absolute; inset: 0; pointer-events: none; }
.crop::before { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.crop::after { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.pic__note {
  margin: 0; padding: 12px var(--pad) 14px; border-top: 1px dotted var(--rule-soft);
  font: 400 16px/24px var(--mono); color: var(--dim); text-align: center;
}
.cell__body--flush .note, .cell > .note { margin: 0; padding: 12px var(--pad) 14px; border-top: 1px dotted var(--rule-soft); }

/* ---------- the readings ladder ---------- */
.fig {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 22px max(var(--pad), 32px) 24px;
  border-bottom: 1px dotted var(--rule);
}
.fig__v { font: 700 64px/64px var(--crt); color: var(--hot); -webkit-font-smoothing: none; text-shadow: 0 0 13px rgba(157, 195, 218, .42); }
.seal { display: block; width: 140px; height: 140px; object-fit: contain; margin: 0 auto 14px; opacity: .95; mix-blend-mode: screen; }
.fig__v--sm { font-size: 48px; line-height: 48px; }
.fig__side { text-align: right; font: 400 16px/24px var(--mono); color: var(--dim); }
.fig__side b { display: block; color: var(--ink); font-weight: 500; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: var(--row); padding: 8px var(--pad);
  border-bottom: 1px dotted var(--rule-soft);
}
.rows li:last-child { border-bottom: 0; }
.rows dt, .rows .k { font: 700 16px/24px var(--crt); letter-spacing: 1px; color: var(--dim); -webkit-font-smoothing: none; white-space: nowrap; }
.rows dd, .rows .v { margin: 0; font: 500 16px/24px var(--mono); color: var(--hot); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.rows .v--off { color: var(--dim); }

.tag { display: inline-block; padding: 6px 16px; font: 700 16px/24px var(--crt); letter-spacing: 1px; -webkit-font-smoothing: none; }
.tag--hot { background: var(--hot); color: #04070b; }
.tag--cold { border: 1px dotted var(--rule); color: var(--dim); }

/* ---------- canvas blocks ---------- */
.canvas-wrap { position: relative; padding: var(--pad); }
.canvas-wrap canvas { display: block; width: 100%; height: auto; }
.dump {
  padding: 12px var(--pad) 16px;
  border-top: 1px dotted var(--rule-soft);
  font: 400 16px/22px var(--mono); color: var(--dim);
  word-spacing: 6px; overflow-wrap: anywhere;
}

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font: 500 16px/24px var(--mono); }
.table th {
  text-align: right; font: 700 16px/24px var(--crt); letter-spacing: 1px; color: var(--dim);
  padding: 10px var(--pad); border-bottom: 1px dotted var(--rule); white-space: nowrap;
  -webkit-font-smoothing: none; background: var(--sunk);
}
.table th:first-child, .table td:first-child { text-align: left; }
.table td { padding: 9px var(--pad); border-bottom: 1px dotted var(--rule-soft); color: var(--ink); text-align: right; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: #101a26; color: var(--hot); }
.table tbody tr:focus-visible { outline: 1px solid var(--hot); outline-offset: -1px; }
.table .name { color: var(--hot); }
.table a, .rows a { color: var(--hot); text-decoration: none; border-bottom: 1px dotted var(--rule); }
.table a:hover, .rows a:hover { border-bottom-color: var(--hot); }
.table a:focus-visible, .rows a:focus-visible { outline: 1px solid var(--hot); outline-offset: 2px; }
.table .small { color: var(--dim); }
.table--rinsed td:first-child { font-family: var(--mono); color: var(--dim); }

/* ---------- the coin cell ---------- */
.mint {
  display: block; width: 100%; margin: 0 0 12px;
  padding: 12px 16px; background: var(--sunk); border: 1px dotted var(--rule-soft);
  font: 400 16px/24px var(--mono); color: var(--hot);
  overflow-wrap: anywhere; user-select: all;
}
.mint--empty { color: var(--dim); }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.key {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 21px;
  background: var(--sunk); border: 1px dotted var(--rule);
  font: 700 16px/24px var(--crt); letter-spacing: 1px; color: var(--ink);
  text-decoration: none; cursor: pointer; -webkit-font-smoothing: none;
  transition: background .12s, color .12s, transform .08s;
}
.key--wide { grid-column: 1 / -1; }
.key:hover { background: #121d29; color: var(--hot); }
.key:active { transform: translateY(1px); }
.key:focus-visible { outline: 1px solid var(--hot); outline-offset: 2px; }
.key[aria-disabled="true"] { opacity: .74; cursor: not-allowed; }
.key img { width: 16px; height: 16px; display: block; }
.key--mark { filter: brightness(0) invert(1); opacity: .92; }
.copied { margin: 10px 0 0; font: 400 16px/24px var(--mono); color: var(--dim); min-height: 24px; }

/* ---------- prose ---------- */
.prose { margin: 0; color: var(--ink); }
.prose p { margin: 0 0 14px; max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }
.prose b { color: var(--hot); font-weight: 500; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.steps .n { font: 700 32px/32px var(--crt); color: var(--hot); -webkit-font-smoothing: none; }
.dim { color: var(--dim); }
.boot { padding: 40px var(--pad); color: var(--dim); font: 400 16px/24px var(--mono); }
.note { margin: 10px 0 0; color: var(--dim); font: 400 16px/24px var(--text); }
.risk { margin: 16px 0 0; color: var(--dim); font: 400 16px/24px var(--text); }

.cap { font-family: var(--crt); font-weight: 700; letter-spacing: 1px; -webkit-font-smoothing: none; }
.up { color: var(--hot); }
.down { color: var(--dim); }

/* ---------- motion ---------- */
@keyframes blip { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--hot); margin-right: 8px; animation: blip 2.4s steps(12, end) infinite; vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------- widths. every override lives at the end of the file ---------- */
@media (max-width: 1200px) {
  /* the rail is too narrow for two keys side by side: a key must never clip its own word */
  .keys { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  :root { --page: calc(100vw - 40px); --gut: 16px; --pad: 18px; }
  .mast { font-size: 32px; line-height: 32px; }
  .fig__v { font-size: 48px; line-height: 48px; }
}
@media (max-width: 860px) {
  .band--pix, .band--main { grid-template-columns: 1fr; }
  .nodes { gap: 30px 20px; }
  .pic img { max-height: 240px; }
  .table .name { max-width: 180px; }
}
@media (max-width: 620px) {
  :root { --page: calc(100vw - 24px); --pad: 16px; --gut: 14px; }
  body { padding: 20px 0 40px; }
  .card { padding: 10px; }
  .strip { flex-direction: column; align-items: flex-start; gap: 6px; }
  .strip__read { text-align: left; }
  .mast { font-size: 32px; line-height: 32px; }
  .fig { flex-direction: column; align-items: flex-start; gap: 10px; }
  .fig__side { text-align: left; }
  .fig__v { font-size: 48px; line-height: 48px; }
  /* wrapped rows need room for their own dots, or a dot lands on the row above */
  /* on a phone the node sits in front of its word instead of over it: wrapped rows then need no
     room above them and the nav costs two tight rows instead of three loose ones */
  .nodes { gap: 10px 22px; padding-top: 14px; }
  .node { padding: 8px 16px 10px; }
  .node::before { position: static; display: inline-block; margin-right: 9px; transform: none; vertical-align: 1px; }
  .keys { grid-template-columns: 1fr; }
  /* No horizontal scroller on a phone. Every table keeps the columns that carry its point and
     drops the rest, so each cell keeps its full inner padding and nothing overflows its box. */
  .table--machines th:nth-child(2), .table--machines td:nth-child(2),
  .table--machines th:nth-child(4), .table--machines td:nth-child(4),
  .table--machines th:nth-child(5), .table--machines td:nth-child(5),
  .table--machines th:nth-child(6), .table--machines td:nth-child(6),
  .table--machines th:nth-child(7), .table--machines td:nth-child(7) { display: none; }
  .table--tape th:nth-child(3), .table--tape td:nth-child(3),
  .table--tape th:nth-child(4), .table--tape td:nth-child(4),
  .table--tape th:nth-child(6), .table--tape td:nth-child(6) { display: none; }
  .table--rinsed th:nth-child(3), .table--rinsed td:nth-child(3),
  .table--rinsed th:nth-child(4), .table--rinsed td:nth-child(4),
  .table--rinsed th:nth-child(6), .table--rinsed td:nth-child(6) { display: none; }
  .table--opens th:nth-child(4), .table--opens td:nth-child(4),
  .table--opens th:nth-child(5), .table--opens td:nth-child(5),
  .table--opens th:nth-child(7), .table--opens td:nth-child(7) { display: none; }
}
@media (max-width: 460px) {
  /* a cell title and its side note share one line until they cannot: then they stack */
  .cell__head { flex-wrap: wrap; row-gap: 4px; }
  .cell__head span { white-space: normal; }
}
@media (max-width: 420px) {
  /* At this width a row holds two figures and nothing else. */
  .table--machines th:nth-child(8), .table--machines td:nth-child(8) { display: none; }
  .table--tape th:nth-child(1), .table--tape td:nth-child(1) { display: none; }
  .table--rinsed th:nth-child(2), .table--rinsed td:nth-child(2) { display: none; }
  .table--opens th:nth-child(6), .table--opens td:nth-child(6) { display: none; }
  /* the name is the only thing allowed to wrap: the figures keep their padding */
  .table td:first-child { white-space: normal; word-break: break-word; }
  .table th, .table td { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 380px) {
  .mast { font-size: 32px; }
  .nodes { gap: 10px 14px; }
}
