/* Proof of History.
   One container, one twelve column grid, one spacing scale, one type scale, one palette.
   Built to his Gradix board: black ground, a block pixel face for the display, a plain grotesque for
   every label, lime outlined chips, hairline rules that belong to their own section.
   Fonts: Pixel Operator HB (CC0), Apfel Grotezk (OFL), Necto Mono (OFL). Credits in README.md. */

@font-face {
  font-family: "Pixel Operator HB";
  src: url("/assets/font/PixelOperatorHB.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Apfel Grotezk";
  src: url("/assets/font/ApfelGrotezk-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Apfel Grotezk";
  src: url("/assets/font/ApfelGrotezk-Fett.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Necto Mono";
  src: url("/assets/font/NectoMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  /* ---- palette. Yellow is a status colour and nothing else ---- */
  --bg: #000000;
  --surface: #0a0f0b;
  --surface-2: #0f1611;
  --border: #253a2b;
  --border-strong: #3c5c45;
  --text: #e4e8e5;
  --text-dim: #9ba49e;
  --accent: #4ce86f;
  --accent-dim: #3fa85c;
  --warn: #def95e;
  --bad: #f0917a;

  /* ---- spacing, the only values on the page ---- */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* ---- type: 16 / 18 / 20 / 24 / 32 / 48, and the display on a clamp ---- */
  --t-sm: 16px;
  --t-md: 18px;
  --t-lg: 20px;
  --t-xl: 24px;
  --t-2xl: 32px;
  --t-3xl: 48px;
  --t-display: clamp(30px, 4.4vw, 60px);

  --display: "Pixel Operator HB", monospace;
  --face: "Apfel Grotezk", system-ui, sans-serif;
  --mono: "Necto Mono", ui-monospace, monospace;

  /* ---- the grid ---- */
  --gutter: var(--s6);
  --page: min(1360px, calc(100vw - 2 * var(--gutter)));
  --gap: var(--s5);
  --rail-cols: 18;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  overflow-x: clip;
  background: var(--bg);
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-md)/1.6 var(--face);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9;
  background: var(--accent);
  color: #000;
  padding: var(--s3) var(--s5);
}
.skip:focus { left: var(--s5); }

/* ---- the page and its grid ----------------------------------------------------------------- */

.board {
  width: var(--page);
  margin: 0 auto;
  padding-bottom: var(--s7);
}

.g12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-12 { grid-column: span 12; }

/* A rule that belongs to its own row of cells: drawn in the gutter, never across the document. */
.ruled > * { position: relative; }
.ruled > * + *::before {
  content: "";
  position: absolute;
  left: calc(var(--gap) / -2);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

/* ---- type roles ----------------------------------------------------------------------------- */

p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }

.lab {
  margin: 0 0 var(--s2);
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--text-dim);
}
.val { color: var(--accent); }
.val.warn { color: var(--warn); }

.eyebrow {
  margin: 0 0 var(--s3);
  font-size: var(--t-sm);
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

h1 { margin: 0; }
h2 {
  margin: 0;
  font: 400 var(--t-2xl)/1 var(--display);
  color: var(--accent);
  -webkit-font-smoothing: none;
}
h3 {
  margin: 0 0 var(--s2);
  font: 700 var(--t-lg)/1.3 var(--face);
  color: var(--text);
}

/* ---- the top bar ----------------------------------------------------------------------------- */

.top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  padding: var(--s5) 0;
}
.top::after,
.facts::after,
.band::before,
.tote-foot::before,
.rows > div::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}
.top::after, .facts::after, .rows > div::after { bottom: 0; }
.band::before, .tote-foot::before { top: 0; }
.ident { display: flex; align-items: center; gap: var(--s3); }
.mark { width: 36px; height: 36px; image-rendering: pixelated; display: block; }
.wordmark {
  font-family: var(--display);
  font-size: var(--t-xl);
  line-height: 1;
  color: var(--accent);
  -webkit-font-smoothing: none;
  /* a bitmap face sits high in its box: this lands it on the mark's optical centre */
  transform: translateY(2px);
}
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); }
.topnav a {
  position: relative;
  font-size: var(--t-sm);
  line-height: 1.4;
  color: var(--text-dim);
  text-decoration: none;
  padding: var(--s1) 0;
}
.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: transparent;
}
.topnav a:hover,
.topnav a:focus-visible { color: var(--accent); text-decoration: none; }
.topnav a:hover::after,
.topnav a:focus-visible::after { background: var(--accent); }
.topnav a[aria-current="true"] { color: var(--accent); }
.topnav a[aria-current="true"]::after { background: var(--accent); }

/* ---- the facts row --------------------------------------------------------------------------- */

.facts { position: relative; padding: var(--s5) 0; align-items: start; }
.facts dl { margin: 0; }
.facts .pair {
  padding: 0 0 var(--s3);
  font-size: var(--t-sm);
  line-height: 1.5;
}
.facts .pair:last-child { padding-bottom: 0; }
.facts dt { color: var(--text-dim); }
.facts dd { margin: 0; color: var(--accent); }
.facts dd.warn { color: var(--warn); }

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

.hero { padding: var(--s7) 0; align-items: center; }
.hero-lead .headline {
  margin: 0 0 var(--s4);
  font: 400 var(--t-2xl)/1.15 var(--display);
  color: var(--text);
  -webkit-font-smoothing: none;
}
.hero-lead p { color: var(--text-dim); max-width: 46ch; }
.hero-actions { margin-top: var(--s5); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); }

/* the live block, one bordered readout */
.tote { border: 1px solid var(--border-strong); background: var(--surface); padding: var(--s6); }
.tote-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--s5);
  row-gap: var(--s4);
  align-items: center;
}
.dtext {
  font-family: var(--display);
  font-size: var(--t-display);
  line-height: 1;
  color: var(--accent);
  -webkit-font-smoothing: none;
  white-space: nowrap;
  overflow: hidden;
}
.pill {
  justify-self: end;
  align-self: center;
  border: 1px solid var(--warn);
  border-radius: 999px;
  color: var(--warn);
  font-size: var(--t-sm);
  line-height: 1.2;
  padding: var(--s2) var(--s4);
  white-space: nowrap;
}
.tote-foot {
  position: relative;
  margin-top: var(--s5);
  padding-top: var(--s4);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s3) var(--s5);
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--text-dim);
}
.tote-foot b { color: var(--accent); font-weight: 400; }

/* ---- controls --------------------------------------------------------------------------------- */

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  padding: var(--s3) var(--s5);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font: 700 var(--t-sm)/1.2 var(--face);
  cursor: pointer;
  transition: background-color 90ms linear, color 90ms linear, border-color 90ms linear;
}
.key:hover { background: var(--accent); color: #000; }
.key img { width: 20px; height: 20px; }
.key img.dex { width: 22px; height: 22px; }
/* an official mark is the platform's own file and is never recoloured, so these keys light their
   outline instead of filling, and the mark stays exactly as it was supplied */
.key.mark-key:hover { background: transparent; color: var(--warn); border-color: var(--warn); }
.key[disabled],
.key[aria-disabled="true"] {
  border-color: var(--border-strong);
  color: var(--accent-dim);
  background: transparent;
  cursor: not-allowed;
  pointer-events: none;
}
.key.big {
  min-height: 56px;
  padding: var(--s4) var(--s6);
  font: 400 var(--t-lg)/1 var(--display);
  -webkit-font-smoothing: none;
}
.key.primary { background: var(--accent); color: #000; }
.key.primary:hover { background: var(--warn); border-color: var(--warn); color: #000; }
.keystate { margin: 0; font-size: var(--t-sm); line-height: 1.5; color: var(--text-dim); max-width: 44ch; }

/* one segmented control: two halves of one group, no gap between them */
.segmented { display: inline-flex; border: 1px solid var(--border-strong); }
.segmented .key { border: 0; min-width: 100px; color: var(--text-dim); }
.segmented .key + .key { border-left: 1px solid var(--border-strong); }
.segmented .key:hover { background: var(--surface-2); color: var(--accent); }
.segmented .key[aria-pressed="true"] { background: var(--accent); color: #000; }
.segmented .key[aria-pressed="true"]:hover { background: var(--accent); color: #000; }

.fieldwrap { display: flex; align-items: stretch; }
.field {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--accent);
  font: 400 var(--t-sm)/1.4 var(--mono);
}
.field::placeholder { color: #6a7670; }
.field:focus { border-color: var(--accent); outline: none; }
.field.bad { border-color: var(--bad); }
.field.good { border-color: var(--accent); }
.fieldwrap .clear {
  flex: none;
  width: 48px;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-left: 0;
  background: var(--surface);
  color: var(--text-dim);
  font: 400 var(--t-lg)/1 var(--face);
  cursor: pointer;
}
.fieldwrap .clear:hover { color: var(--accent); }
.note { margin: var(--s2) 0 0; font-size: var(--t-sm); line-height: 1.5; color: var(--text-dim); }
.note.bad { color: var(--bad); }
.note.good { color: var(--accent); }

/* ---- the year rail ----------------------------------------------------------------------------- */

.rail {
  display: grid;
  grid-template-columns: repeat(var(--rail-cols), minmax(0, 1fr));
  border: 1px solid var(--border);
  border-right: 0;
  border-bottom: 0;
}
.ycell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 92px;
  padding: var(--s3) var(--s2);
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font: 400 var(--t-sm)/1 var(--mono);
  cursor: pointer;
  transition: background-color 90ms linear, color 90ms linear;
}
.ycell:hover { background: var(--surface-2); color: var(--accent); }
.ycell[aria-pressed="true"] { background: var(--accent); color: #000; }
.ycell[aria-pressed="true"] .ybar { background: rgba(0, 0, 0, 0.3); }
.ycell[aria-pressed="true"] .yfill { background: #000; }
.ycell[aria-pressed="true"] img { filter: brightness(0); }
.ycell[disabled] { cursor: not-allowed; color: #5d6a62; }
.ycell[disabled]:hover { background: transparent; color: #5d6a62; }
.ycell[disabled] img { opacity: 0.35; }
.ybar { display: block; width: 100%; max-width: 60px; height: 4px; background: var(--border); }
.yfill { display: block; height: 100%; width: 0; background: var(--accent); }
.ymarks { display: flex; gap: var(--s1); align-items: center; min-height: 32px; }
.ymarks img { width: 32px; height: 32px; image-rendering: pixelated; }
.railnote {
  margin: var(--s3) 0 0;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--text-dim);
}

/* ---- sections ------------------------------------------------------------------------------------ */

.band { position: relative; padding-top: var(--s7); margin-top: var(--s7); }
.head { margin-bottom: var(--s6); }
.head h2 { margin-bottom: var(--s3); }
.head .lab { max-width: 92ch; margin-bottom: 0; }

.panel { border: 1px solid var(--border); background: var(--surface); padding: var(--s5); min-width: 0; }
.panel > .lab:first-child { margin-bottom: var(--s4); }

/* label left, value right, one right line, one row height */
.rows { margin: 0; }
.rows > div {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s4);
  align-items: baseline;
  min-height: 44px;
  padding: var(--s2) 0;
}
.rows > div:last-child::after { display: none; }
.rows dt { color: var(--text-dim); font-size: var(--t-sm); }
.rows dd {
  margin: 0;
  color: var(--accent);
  font: 400 var(--t-sm)/1.4 var(--mono);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rows dd.dim { color: var(--text-dim); }

/* ---- block 0: the token ----------------------------------------------------------------------------- */

.genesis {
  margin-top: var(--s7);
  border: 1px solid var(--warn);
  background: var(--surface);
  align-items: stretch;
  gap: 0;
}
.gcol { padding: var(--s6); min-width: 0; }
.gcol + .gcol { border-left: 1px solid var(--warn); }
.gnum {
  margin: 0 0 var(--s2);
  font: 400 var(--t-2xl)/1 var(--display);
  color: var(--warn);
  -webkit-font-smoothing: none;
}
.gtext { color: var(--text-dim); max-width: 48ch; }
.ghead {
  margin: var(--s4) 0 0;
  font: 400 var(--t-sm)/1.6 var(--mono);
  color: var(--accent);
  overflow-wrap: anywhere;
}
.gticker {
  margin: 0 0 var(--s3);
  font: 400 var(--t-2xl)/1 var(--display);
  color: var(--accent);
  -webkit-font-smoothing: none;
}
.caline { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.ca {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  font: 400 var(--t-lg)/1.5 var(--mono);
  color: var(--accent);
  overflow-wrap: anywhere;
  user-select: all;
}
.ca.unset { color: var(--text-dim); font: 400 var(--t-md)/1.5 var(--face); user-select: auto; }
.grow { display: flex; flex-wrap: wrap; gap: var(--s3); }

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

.table { border: 1px solid var(--border); background: var(--surface); }
.trow {
  display: grid;
  gap: var(--s4);
  align-items: center;
  min-height: 52px;
  padding: var(--s3) var(--s5);
  border: 0;
  border-bottom: 1px solid var(--border);
  font: 400 var(--t-sm)/1.5 var(--mono);
  color: var(--text);
  text-align: left;
  width: 100%;
  background: transparent;
}
.trow:last-child { border-bottom: 0; }
.thead {
  color: var(--text-dim);
  font: 400 var(--t-sm)/1.4 var(--face);
  background: var(--surface-2);
  min-height: 44px;
}
button.trow { cursor: pointer; }
button.trow:hover { background: var(--surface-2); }
.trow .dim { color: var(--text-dim); }
.trow .accent { color: var(--accent); }
.trow .warn { color: var(--warn); }
.trow .num { text-align: right; font-variant-numeric: tabular-nums; }
/* two real controls inside a row, so neither is a button inside a button */
.trow .linkish,
.trow .hash {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  text-align: left;
  min-width: 0;
  cursor: pointer;
}
.trow .linkish { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.trow .linkish:hover { text-decoration-color: var(--accent); }
.trow .hash { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); cursor: copy; }
.trow .hash:hover { color: var(--accent); }
.empty {
  display: block;
  padding: var(--s6) var(--s5);
  color: var(--text-dim);
  font: 400 var(--t-md)/1.6 var(--face);
}
/* chain: block, year, era, finder, reward, hash */
.table-chain .trow { grid-template-columns: 96px 72px 92px minmax(120px, 1fr) 140px 150px; }
/* season: place, wallet, found, pooled, paid */
.table-season .trow { grid-template-columns: 72px minmax(140px, 1fr) 96px 96px 140px; }
/* calendar: day, then, what, pays */
.table-calendar .trow { grid-template-columns: 88px 140px minmax(140px, 1fr) minmax(220px, 1.6fr); }

/* ---- steps and risks --------------------------------------------------------------------------------- */

.steps { align-items: stretch; }
.step,
.risk {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  height: 100%;
  padding: var(--s5);
  border: 1px solid var(--border);
  background: var(--surface);
}
.stepno {
  margin: 0;
  font: 400 var(--t-sm)/1 var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.step h3 { color: var(--accent); margin-bottom: 0; }
.step p,
.risk p { color: var(--text-dim); margin-bottom: 0; }
.step .note { margin-top: auto; padding-top: var(--s3); }
.risk h3 { font: 700 var(--t-lg)/1.3 var(--face); color: var(--warn); margin-bottom: var(--s1); }

.hashline {
  margin: 0;
  font: 400 var(--t-sm)/1.6 var(--mono);
  color: var(--accent);
  overflow-wrap: anywhere;
  user-select: all;
}
.mono { font-family: var(--mono); color: var(--accent); }

/* the row labels exist for the phone, where the header row is gone; never on a wide screen */
.cellab { display: none; }

/* ---- widths, at the bottom so a later base rule cannot beat them --------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 1440px) {
  :root { --rail-cols: 9; }
}
@media (max-width: 1100px) {
  :root { --gutter: var(--s5); --gap: var(--s4); }
  .hero { padding: var(--s7) 0; }
  .col-5, .col-7 { grid-column: span 12; }
  /* four readouts across a 1024 window squeeze every value onto two lines: two by two instead */
  .col-3 { grid-column: span 6; }
  .table-chain .trow { grid-template-columns: 80px 64px 80px minmax(100px, 1fr) 120px 150px; }
  .table-calendar .trow { grid-template-columns: 72px 120px minmax(120px, 1fr) minmax(160px, 1.4fr); }
  .genesis { grid-template-columns: minmax(0, 1fr); }
  .gcol + .gcol { border-left: 0; border-top: 1px solid var(--warn); }
}
@media (max-width: 860px) {
  :root { --rail-cols: 6; }
  .col-3, .col-4, .col-6 { grid-column: span 6; }
  .top { flex-direction: column; align-items: flex-start; gap: var(--s4); }
  .ruled > * + *::before { display: none; }
}
@media (max-width: 600px) {
  :root { --gutter: var(--s4); --gap: var(--s4); --rail-cols: 3; --t-2xl: 24px; }
  /* On a phone the nine facts would fill the first screen, so the readout comes first and they
     follow it. Everything else keeps the order it is written in. */
  .board { display: flex; flex-direction: column; }
  .board > * { order: 3; }
  .top { order: 1; }
  .hero { order: 2; padding-top: var(--s5); }
  .col-3, .col-4, .col-5, .col-6, .col-7 { grid-column: span 12; }
  .band { padding-top: var(--s7); margin-top: var(--s7); }
  .hero { padding: var(--s6) 0; gap: var(--s6); }
  .gcol { padding: var(--s5); }
  .tote { padding: var(--s5); }
  .tote-rows { grid-template-columns: minmax(0, 1fr); row-gap: var(--s2); }
  .pill { justify-self: start; margin-bottom: var(--s3); }
  .key.big { width: 100%; }
  .trow,
  .table-chain .trow,
  .table-season .trow,
  .table-calendar .trow {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s1);
    padding: var(--s4);
  }
  .thead { display: none; }
  .trow .num { text-align: left; }
  .trow .hash { white-space: normal; overflow-wrap: anywhere; }
  .cellab { display: inline; color: var(--text-dim); }
}
