/* Near Enough's page: the slab's page's paper, ink and signal, its bar, type and sections (~/projects/keyboard/box/site/www/slab.css) */
:root {
  --paper: #e8e6e1;
  --paper-2: #dedbd4;
  --ink: #161616;
  --ink-2: #55534e;
  --rule: rgb(22 22 22 / .14);
  --signal: #f05a1e;
  --panel-dark: #1a1b1e;
  --panel-lit: #c9cac8;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 56px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
.mono { font-family: var(--mono); font-size: .85em; }

/* ---------------------------------------------------------------- the stage: one 3D canvas behind everything */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; opacity: 0; transition: opacity .9s ease; }
#stage.ready { opacity: var(--stage-o, 1); transition: none; }
#leaders { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 2; pointer-events: none; overflow: visible; color: var(--ink); }
#leaders polyline { stroke-width: 1; }
#leaders .halo { stroke: var(--paper); stroke-width: 3; opacity: .85; }
#leaders circle { fill: var(--signal); }
#leaders text { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; fill: var(--ink); text-transform: uppercase;
  paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }   /* legible over the dark boards */
main, .bar, .foot { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- bar */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  background: rgb(232 230 225 / .95); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.bar nav { display: flex; gap: 20px; margin-left: auto; }
.bar nav a { text-decoration: none; opacity: .7; }
.bar nav a:hover { opacity: 1; }
.mark { font-family: var(--mono); font-weight: 700; font-style: italic; font-size: 22px; text-transform: none; letter-spacing: 0; text-decoration: none; }
.crumb { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.maker { text-decoration: none; opacity: .7; }
.maker:hover { opacity: 1; }
.crumb .sep { opacity: .35; }
.code { opacity: .55; }
@media (max-width: 860px) { .bar nav { display: none; } .code { margin-left: auto; } }
@media (max-width: 440px) { .code { display: none; } }

/* ---------------------------------------------------------------- type */
.label { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 18px; }
h1, h2 { font-weight: 500; letter-spacing: -.035em; line-height: .98; margin: 0 0 24px; }
h1 { font-size: clamp(44px, 5.4vw, 86px); }
h1 em { font-family: var(--mono); font-style: italic; font-weight: 700; letter-spacing: -.06em; color: var(--signal); }
h2 { font-size: clamp(34px, 4.6vw, 68px); }
h3 { font-size: 19px; font-weight: 500; letter-spacing: -.01em; margin: 0 0 8px; }
.lede { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.45; max-width: 34em; margin: 0 0 24px; color: #2a2926; }
.narrow { max-width: 30em; }
.small { font-size: 14px; color: var(--ink-2); max-width: 36em; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter); }
section { padding: 140px 0; }
.half { max-width: 46%; }
@media (max-width: 860px) { .half { max-width: 100%; } }

/* ---------------------------------------------------------------- hero */
.hero { min-height: 100vh; min-height: 100svh; display: flex; align-items: flex-end; padding: 0 var(--gutter) 9vh; }
.hero-copy { max-width: 44%; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.readout { font-family: var(--mono); font-size: 15px; margin: 0; color: var(--ink-2); }
.readout b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.readout span { font-variant-numeric: tabular-nums; }
.readout i { font-style: normal; color: var(--signal); }
.scroll-cue { position: absolute; left: 50%; bottom: 28px; width: 1px; height: 46px; background: var(--rule); overflow: hidden; }
.scroll-cue span { position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--ink); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { to { top: 100%; } }
@media (max-width: 860px) {
  /* the copy starts under the clock (posed in the top half of the screen) */
  .hero { padding-top: calc(50svh + 8vw); padding-bottom: 92px; }
  .hero-copy { max-width: 100%; }
  .hero h1 { font-size: 46px; }
}

/* ---------------------------------------------------------------- how near: the modes, the readout and the hour */
.near .readout { margin: 0 0 18px; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.modes button, .pill {
  font: 500 15px var(--sans); padding: 8px 15px 9px; border-radius: 999px; border: 1px solid var(--rule); background: transparent;
  cursor: pointer; color: var(--ink); display: inline-flex; gap: 8px; align-items: center;
}
.modes button[aria-checked="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.modes button small { font-family: var(--mono); font-size: 11px; opacity: .7; }
.pill.on { border-color: var(--signal); color: var(--signal); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.buttons .pill { margin: 0; }
.rules { list-style: none; margin: 32px 0 0; padding: 0; }
.rules li { padding: 12px 0; border-top: 1px solid var(--rule); font-size: 16px; }
.rules li b { font-weight: 500; }
.rules li:last-child { border-bottom: 1px solid var(--rule); }
.hour { margin: 0 0 22px; }
.hour svg { display: block; width: 100%; height: auto; overflow: visible; }
.hour figcaption { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.hour .axis { stroke: var(--rule); stroke-width: 1; }
.hour .zero { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 4; }
.hour .trace { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.hour .band { fill: rgb(22 22 22 / .05); }
.hour .wild-band { fill: var(--signal); opacity: .12; }
.hour .wild-label { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; fill: var(--signal); text-transform: uppercase; }
.hour .now { stroke: var(--signal); stroke-width: 1.5; }
.hour .dot { fill: var(--signal); }
.hour .tick { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); letter-spacing: .06em; }
.hour .on-hour { fill: var(--signal); }

/* ---------------------------------------------------------------- apart: a tall section, the model held still while it comes apart */
.apart { height: 420vh; padding: 0; }
.apart-sticky { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; padding: 0 var(--gutter); }
.apart-copy { width: min(380px, 34vw); }
.apart h2 { font-size: clamp(30px, 3.4vw, 50px); margin-bottom: 18px; }
@media (min-width: 761px) { .apart .layers li { padding: 9px 0; } }
.layers { list-style: none; padding: 0; margin: 0; counter-reset: layer; }
.layers li { padding: 12px 0; border-top: 1px solid var(--rule); opacity: .32; transition: opacity .35s; counter-increment: layer; }
.layers li.on { opacity: 1; }
.layers b { display: block; font-weight: 500; font-size: 18px; }
.layers b::before { content: "0" counter(layer) "  "; font-family: var(--mono); font-size: 11px; color: var(--signal); white-space: pre; }
.layers span { display: block; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
@media (max-width: 760px) {
  .apart-sticky { align-items: flex-end; padding-bottom: 4vh; }
  .apart-copy { width: 100%; }
  .apart h2 { font-size: 30px; margin-bottom: 10px; }
  .layers li, .layers li.on { max-height: 0; overflow: hidden; padding: 0; border: 0; opacity: 0; }   /* hidden, but still counted */
  .layers li.current { max-height: 12em; padding: 6px 0; opacity: 1; }
}

/* ---------------------------------------------------------------- the motor, daylight saving: copy on the left, the clock on the right */
.motor, .dst { min-height: 110vh; display: flex; align-items: center; }
.facts { margin: 28px 0 0; display: grid; gap: 0; max-width: 34em; }
.facts div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
.facts dt { font-family: var(--mono); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; font-size: 15px; color: var(--ink-2); }
.dst-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
@media (max-width: 860px) {
  .motor, .dst { align-items: flex-end; min-height: 120vh; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------------------------------------------------------------- set it: Web Serial, for real */
.setup { background: #111214; color: #e9e7e2; }
.setup .label, .setup .small { color: #8d8b86; }
.setup .lede { color: #c9c7c1; }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.setup .steps { color: #c9c7c1; }
.console { background: var(--panel-dark); border-radius: 8px; box-shadow: inset 0 0 0 1px #2c2d31; padding: 20px; }
.console .row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.console button, .console select {
  font: 500 14px var(--sans); padding: 8px 14px 9px; border-radius: 999px; border: 1px solid #3a3b40; background: transparent;
  color: #e9e7e2; cursor: pointer;
}
.console button.go { background: #e9e7e2; color: var(--ink); border-color: #e9e7e2; }
.console button:disabled { opacity: .35; cursor: default; }
.console select { appearance: none; padding-right: 30px; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c9cac8'/%3E%3C/svg%3E") no-repeat right 12px center; }
.console select option { color: var(--ink); }
.console .state { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #8d8b86; }
.console .state b { color: var(--signal); font-weight: 400; }
.console pre { margin: 0; height: 220px; overflow: auto; font: 12.5px/1.6 var(--mono); color: var(--panel-lit); white-space: pre-wrap; }
.console pre .me { color: var(--signal); }
@media (max-width: 860px) { .setup-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- the board */
.inside { background: var(--paper-2); }
.inside-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.board-shot { margin: 0; }
.board-shot img { display: block; width: 100%; height: auto; }
.chips { margin: 28px 0 0; display: grid; gap: 0; }
.chips div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
.chips dt { font-family: var(--mono); font-size: 13px; padding-top: 2px; }
.chips dd { margin: 0; font-size: 15px; color: var(--ink-2); }
@media (max-width: 860px) { .inside-grid { grid-template-columns: 1fr; } .chips div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------------------------------------------------------------- make it yours */
.steps { margin: 0 0 14px; padding-left: 1.3em; font-size: 15px; }
.steps li { margin-bottom: 6px; }
.steps li::marker { font-family: var(--mono); color: var(--signal); }
.hack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 56px; border-top: 1px solid var(--rule); }
.hack-grid article { padding: 26px 28px 30px 0; }
.hack-grid article + article { padding-left: 28px; border-left: 1px solid var(--rule); }
.hack-grid p { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); }
.pins { margin: 18px 0 0; font-size: 13px; }
.pins div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--rule); }
.pins dt { font-family: var(--mono); font-size: 12px; }
.pins dd { margin: 0; color: var(--ink-2); }
.hack-code { margin-top: 40px; }
.hack-code figure { margin: 0; min-width: 0; }
.hack-code figcaption { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 8px; }
.hack-code pre { margin: 0; padding: 18px 20px; background: var(--panel-dark); color: var(--panel-lit); border-radius: 8px; overflow-x: auto;
  font: 13.5px/1.6 var(--mono); }
@media (max-width: 960px) {
  .hack-grid { grid-template-columns: 1fr; }
  .hack-grid article, .hack-grid article + article { padding: 22px 0; border-left: 0; }
  .hack-grid article + article { border-top: 1px solid var(--rule); }
}

/* ---------------------------------------------------------------- specs */
.specs table { width: 100%; border-collapse: collapse; margin-top: 40px; font-size: 16px; }
.specs th, .specs td { text-align: left; vertical-align: top; padding: 14px 0; border-top: 1px solid var(--rule); }
.specs th { width: 220px; font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding-top: 17px; }
.specs .catch th { color: var(--signal); }
@media (max-width: 600px) { .specs th { width: 120px; } }

/* ---------------------------------------------------------------- foot */
.foot { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: baseline; padding: 40px var(--gutter) 48px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); }
.small-mark { font-size: 18px; color: var(--ink); }
.foot .mono { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue span { animation: none; }
}

/* ---------------------------------------------------------------- r0.2: the wheel */
.wild { margin: 8px 0 22px; }
.wild .label { margin-bottom: 10px; }
.wild input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
.wild input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
.wild input[type=range]::-moz-range-track { height: 2px; background: var(--ink); }
.wild input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; border-radius: 50%;
  background: #c9a45f; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .25), 0 2px 6px rgb(0 0 0 / .2); }
.wild input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #c9a45f; }
.wild input[type=range]:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }
.wild-scale { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.wild-scale b { color: var(--ink); font-weight: 700; }
.near .readout { margin-bottom: 16px; }
.readout i.lit { color: var(--signal); }
.hour .lit { fill: none; stroke: var(--signal); stroke-width: 4; stroke-linecap: butt; opacity: .85; }
