/* Layout: a research plate. A fixed annunciator rail picks the family, the black sphere sits on paper in the middle,
   and a readout with fixed slots sits on the right. The paper below carries reading notes, method, limits and data. */
:root {
  --paper: #FAFAFA;
  --ink: #08090A;
  --muted: #62666D;
  --rule: #E2E2E2;
  --wash: #F1F2F2;
  --dz-blue: #005DFE;
  --tag-bg: #08090A;
  --tag-fg: #FAFAFA;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --family: #28CC95;
  --rail-width: 218px;
  --readout-width: 304px;
  --topbar-height: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #08090A; --ink: #FAFAFA; --muted: #9A9EA6; --rule: #25272C; --wash: #15161A; --dz-blue: #6A9BFF;
    --tag-bg: #FAFAFA; --tag-fg: #08090A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #08090A; --ink: #FAFAFA; --muted: #9A9EA6; --rule: #25272C; --wash: #15161A; --dz-blue: #6A9BFF;
  --tag-bg: #FAFAFA; --tag-fg: #08090A; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-height) + 12px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--sans); }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--dz-blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 30; padding: 8px 12px; background: var(--tag-bg); color: var(--tag-fg); font: 500 12px var(--mono); }
.skip:focus { top: 8px; }
.noscript { padding: 24px; font-family: var(--mono); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: var(--topbar-height);
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.wordmark { font: 300 24px/1 var(--serif); font-variation-settings: 'opsz' 40; letter-spacing: -.012em; text-decoration: none; white-space: nowrap; }
.wordmark em { font-style: italic; }
.topbar-sub { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.topnav { display: flex; gap: 22px; margin-left: auto; font: 400 13px var(--mono); }
.topnav a { text-decoration: none; }
.topnav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.snapshot-tag { margin: 0; padding: 5px 9px; background: var(--tag-bg); color: var(--tag-fg); font: 400 11.5px/1.2 var(--mono); white-space: nowrap; }
.icon-button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; background: none; border: 1px solid var(--rule); cursor: pointer; }
.icon-button:hover { border-color: var(--ink); }

/* Plate */
.plate {
  display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr) var(--readout-width);
  height: calc(100vh - var(--topbar-height)); height: calc(100svh - var(--topbar-height)); min-height: 620px;
  border-bottom: 1px solid var(--rule);
}

/* Annunciator rail: every family owns a fixed cell. */
.rail { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-right: 1px solid var(--rule); }
.rail-group + .rail-group { margin-top: 0; }
.rail-title { margin: 0; padding: 14px 16px 6px; font: 400 11px var(--mono); color: var(--muted); }
.cell {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; column-gap: 10px;
  width: 100%; min-height: 46px; padding: 8px 14px 8px 16px; text-align: left; background: none; border: 0; border-top: 1px solid var(--rule); cursor: pointer;
}
.rail-group:last-of-type .cell:last-child { border-bottom: 1px solid var(--rule); }
.cell:hover { background: var(--wash); }
.cell-pip { width: 10px; height: 10px; background: var(--c); box-shadow: 0 0 0 1px #08090A; }
.cell-pip.solana { background: linear-gradient(135deg, #9945FF, #14F195); }
.cell-pip.all, .eyebrow i.all { background: conic-gradient(#28CC95 0 60deg, #F0B90B 0 120deg, #97FCE3 0 180deg, #F4E9D5 0 240deg, #FFA548 0 300deg, #9945FF 0); }
.cell-name { font: 400 14.5px/1.2 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-span { font: 400 11px var(--mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell[aria-pressed="true"] { background: var(--tag-bg); color: var(--tag-fg); }
.cell[aria-pressed="true"] .cell-span { color: inherit; opacity: .72; }
.rail-note { margin: auto 0 0; padding: 14px 16px; font-size: 12px; line-height: 1.4; color: var(--muted); }

/* Stage */
.stage-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.feedbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 44px; padding: 8px 14px; border-bottom: 1px solid var(--rule); }
.chip { padding: 4px 8px; font: 400 11.5px/1.25 var(--mono); background: none; border: 1px solid var(--rule); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--tag-bg); color: var(--tag-fg); border-color: var(--tag-bg); }
.chip:disabled { color: var(--muted); border-style: dashed; cursor: default; }
.chip:disabled:hover { border-color: var(--rule); }
.feedbar-title { margin-right: 6px; font: 400 11px var(--mono); color: var(--muted); }

.figure { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { cursor: grab; touch-action: none; }
#overlay.dragging { cursor: grabbing; }
#overlay.pointing { cursor: pointer; }
#overlay:focus-visible { outline-offset: -3px; }
.hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); margin: 0; padding: 4px 8px; font: 400 11.5px var(--mono); color: var(--muted); background: var(--paper); pointer-events: none; white-space: nowrap; transition: opacity .4s; }
.hint.gone { opacity: 0; }
.controls { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 4px; }
.controls button { min-width: 30px; height: 28px; padding: 0 9px; font: 400 12px var(--mono); background: var(--paper); border: 1px solid var(--rule); cursor: pointer; }
.controls button:hover { border-color: var(--ink); }
.controls button[aria-pressed="true"] { background: var(--tag-bg); color: var(--tag-fg); border-color: var(--tag-bg); }

#tape { display: block; width: 100%; height: 46px; flex: none; border-top: 1px solid var(--rule); cursor: ew-resize; touch-action: none; }

.caption { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; row-gap: 2px; padding: 8px 14px 10px; border-top: 1px solid var(--rule); font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.caption p { margin: 0; }
#caption-text { grid-column: 1; }
#caption-text b { font-weight: 500; color: var(--ink); }
.legend { grid-column: 1; display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; padding: 0; list-style: none; font: 400 11px var(--mono); }
.legend li { display: inline-flex; align-items: center; gap: 4px; }
.legend b { font-weight: 500; color: var(--ink); }
.coords { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: 400 11px/1.5 var(--mono); text-align: right; white-space: pre; font-variant-numeric: tabular-nums; }

/* Readout: fixed slots, so each reading stays in one place between feeds. */
.readout { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--rule); }
.slot-finding { min-height: 164px; padding: 14px 16px 16px; border-bottom: 1px solid var(--rule); }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 10px; padding: 4px 8px; background: var(--tag-bg); color: var(--tag-fg); font: 400 11.5px/1.2 var(--mono); }
.eyebrow i { width: 8px; height: 8px; background: var(--family); box-shadow: 0 0 0 1px #08090A; }
.eyebrow i.solana { background: linear-gradient(135deg, #9945FF, #14F195); }
.finding { margin: 0; font: 200 27px/1.13 var(--serif); font-variation-settings: 'opsz' 48; letter-spacing: -.012em; text-wrap: balance; }
.finding em { font-style: italic; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-bottom: 1px solid var(--rule); }
.metrics > div { padding: 9px 16px 10px; }
.metrics > div:nth-child(odd) { border-right: 1px solid var(--rule); }
.metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
.metrics dt, .facts dt { font: 400 11px var(--mono); color: var(--muted); }
.metrics dd { margin: 2px 0 0; font: 300 23px/1.1 var(--serif); font-variation-settings: 'opsz' 30; font-variant-numeric: tabular-nums lining-nums; }
.metrics dd small { font: 400 11px var(--mono); color: var(--muted); margin-left: 4px; }
.facts { margin: 0; padding: 9px 16px; border-bottom: 1px solid var(--rule); display: grid; gap: 6px; }
.facts > div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; }
.facts dd { margin: 0; font-size: 12.5px; line-height: 1.35; min-height: 2.7em; }
.facts dd code { font: 400 11.5px var(--mono); white-space: nowrap; }
.metro-table-wrap { flex: 1; min-height: 100px; overflow-y: auto; }
.metro-table { width: 100%; border-collapse: collapse; font: 400 12px var(--mono); font-variant-numeric: tabular-nums; }
.metro-table th { position: sticky; top: 0; z-index: 1; padding: 6px 8px; text-align: right; font-weight: 400; font-size: 11px; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--rule); }
.metro-table th:first-child, .metro-table td:first-child { text-align: left; padding-left: 16px; }
.metro-table th:last-child, .metro-table td:last-child { padding-right: 16px; }
.metro-table td { padding: 0 8px; height: 26px; text-align: right; border-bottom: 1px solid var(--rule); }
.metro-table tr[data-metro] { cursor: pointer; }
.metro-table tr[data-metro]:hover, .metro-table tr.active { background: var(--wash); }
.metro-table td.zero { color: var(--muted); }
.metro-table .pips { display: inline-flex; gap: 3px; vertical-align: -1px; }
.metro-table .pip { width: 8px; height: 8px; background: var(--c); box-shadow: 0 0 0 1px #08090A; }
.metro-table .pip.ring { border-radius: 50%; }
.metro-table button { padding: 0; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.metro-detail { margin: 0; padding: 9px 16px 11px; min-height: 66px; font-size: 12px; line-height: 1.4; color: var(--muted); border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.metro-detail b { font-weight: 500; color: var(--ink); }
.metro-detail code { font: 400 11px var(--mono); }
.metro-detail .role { display: block; margin: 3px 0 1px; color: var(--ink); }
.metro-detail .role b { font: 500 10px var(--mono); letter-spacing: .04em; margin-right: 2px; }

/* Research paper below the plate */
.paper {
  display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); column-gap: 0;
  padding-block: 34px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--rule);
}
.paper h2 { margin: 0 24px 16px 0; font: 200 32px/1.08 var(--serif); font-variation-settings: 'opsz' 60; letter-spacing: -.012em; text-wrap: balance; grid-column: 1; }
.paper > :not(h2) { grid-column: 2; min-width: 0; }
.columns { columns: 3 280px; column-gap: 32px; }
.columns p { margin: 0 0 12px; break-inside: avoid; max-width: 44ch; }
.method-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px 24px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.method-steps li { font-size: 14px; }
.method-steps span { display: block; margin-bottom: 5px; font: 400 12px var(--mono); }
.method-steps span::before { counter-increment: step; content: counter(step) " "; display: inline-block; margin-right: 6px; padding: 1px 6px; background: var(--tag-bg); color: var(--tag-fg); }
.method-steps code { font: 400 12.5px var(--mono); }
.method-note { margin: 22px 0 0; font-size: 13px; color: var(--muted); max-width: 72ch; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px 32px; margin: 0; padding: 0; list-style: none; }
.limits li { max-width: 46ch; font-size: 14px; }
.limits strong { display: block; font-weight: 500; }
.limits code { font: 400 12.5px var(--mono); }
.table-note { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; min-width: 860px; border-collapse: collapse; font: 400 12px var(--mono); font-variant-numeric: tabular-nums; }
.data-table th { padding: 7px 10px; text-align: left; font-weight: 400; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--ink); }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data-table td.num, .data-table th.num { text-align: right; white-space: nowrap; }
.data-table code { white-space: nowrap; }
.data-table tr[data-select] { cursor: pointer; }
.data-table tr[data-select]:hover { background: var(--wash); }
.data-table tr.family-row td { font: 400 14px var(--sans); border-bottom-color: var(--ink); padding-top: 18px; }
.data-table tr.family-row td.num { font: 400 12px var(--mono); }
.data-table .pip { display: inline-block; width: 9px; height: 9px; margin-right: 8px; background: var(--c); box-shadow: 0 0 0 1px #08090A; }
.data-table .pip.solana { background: linear-gradient(135deg, #9945FF, #14F195); }
.sources { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 13px; max-width: 84ch; }
.sources code { font: 400 11.5px var(--mono); overflow-wrap: anywhere; }
.sources a { text-underline-offset: 3px; }

/* The fiber clock: how far the reach wave has spread, in fiber milliseconds. */
.fiber { position: absolute; right: 14px; bottom: 12px; margin: 0; padding: 4px 8px; font: 400 11.5px var(--mono); color: var(--muted); background: var(--paper); pointer-events: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) { .fiber { bottom: 48px; left: 14px; right: auto; } }

@media (max-width: 1240px) {
  .topbar-sub { display: none; }
}
@media (max-width: 1120px) {
  .plate { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; height: auto; min-height: 0; }
  .rail { flex-direction: row; overflow: visible; border-right: 0; border-bottom: 1px solid var(--rule); }
  #rail-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .rail-group { display: contents; }
  .rail-title, .rail-note { display: none; }
  .cell { border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-height: 42px; }
  .rail-group:last-of-type .cell:last-child { border-bottom: 1px solid var(--rule); }
  .stage { flex: none; height: min(76vh, 720px); }
  .readout { border-left: 0; border-top: 1px solid var(--rule); }
  .metro-table-wrap { overflow: visible; }
  .metro-table th { position: static; }
  .paper { grid-template-columns: minmax(0, 1fr); }
  .paper > * { grid-column: 1 !important; }
}
@media (max-width: 720px) {
  .topbar { gap: 10px; }
  .topnav { display: none; }
  .snapshot-tag { margin-left: auto; font-size: 10.5px; }
  .wordmark { font-size: 21px; }
  #rail-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cell-span { display: none; }
  .cell { grid-template-columns: 12px minmax(0, 1fr); }
  .stage { height: min(92vw, 62vh); min-height: 320px; }
  .caption { grid-template-columns: minmax(0, 1fr); }
  .coords { grid-column: 1; grid-row: auto; text-align: left; white-space: normal; }
  .finding { font-size: 25px; }
  .slot-finding { min-height: 0; }
  .hint { display: none; }
}
@media (max-width: 500px) {
  .snapshot-tag { display: none; }
  .icon-button { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hint { transition: none; }
}
