/* CLATTER 12's project page. The visual language is CLATTER Pocket's site (same authors, GPL-3.0):
   a black desktop, heavy frames, titles in tabs with a slanted edge, dither, inverted selection,
   one amber. The Plinky is drawn the way its pads look lit: a black panel, a 16 x 16 field of
   rounded pads, LEDs that glow. Fonts: Silkscreen and IBM Plex Sans (SIL OFL, assets/fonts). */

@font-face { font-family: 'Silkscreen'; src: url('fonts/silkscreen-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-display: swap; }

:root {
  color-scheme: dark;
  --desktop: #000;
  --panel: #0c0c0c;
  --ink: #f4f4f0;
  --dim: #b4b4ae;
  --line: #5c5c58;
  --amber: #ff9a1f;
  --paper: #eef2ea;
  --paper-ink: #0a0a0a;
  --frame: 3px;
  --gutter: clamp(16px, 4vw, 48px);
  --pixel: 'Silkscreen', ui-monospace, Menlo, Consolas, monospace;
  --prose: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --dither: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%23fff'/%3E%3Crect x='2' y='2' width='1' height='1' fill='%23fff'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--desktop); scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desktop); color: var(--ink); font: 400 17px/1.55 var(--prose); overflow-wrap: break-word; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
h1, h2, h3, p, ol, ul, dl, figure { margin: 0; }
p + p { margin-top: .7em; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--amber); }
b { font-weight: 600; }
code { font: .9em ui-monospace, Menlo, Consolas, monospace; }
kbd { display: inline-block; padding: 0 .4em; border: 1px solid var(--line); border-bottom-width: 2px; font: .82em/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dim { color: var(--dim); }
.skip { position: absolute; left: var(--gutter); top: -60px; z-index: 10; padding: 8px 12px; background: var(--paper); color: var(--paper-ink); }
.skip:focus { top: 8px; }

.strip { display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: baseline; padding: 8px var(--gutter); background: var(--amber); color: #000; font-size: 15px; }
.strip b { font: 400 14px/1.4 var(--pixel); }
.strip a { color: #000; margin-left: auto; }

.top { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; justify-content: space-between; padding: 14px var(--gutter); border-bottom: var(--frame) solid var(--ink); }
.brand { font: 400 18px/1.3 var(--pixel); text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 15px; }
.top nav a { padding: 6px 0; text-decoration: none; }
.top nav a:hover { text-decoration: underline; }

main > section, .hero { padding: clamp(40px, 7vw, 88px) var(--gutter) 0; max-width: 1280px; margin: 0 auto; }
main > section:last-of-type { padding-bottom: clamp(40px, 7vw, 88px); }
.section { display: flex; gap: .7em; align-items: baseline; padding-bottom: 10px; margin-bottom: 24px; font: 400 clamp(26px, 4.4vw, 44px)/1.15 var(--pixel); border-bottom: var(--frame) solid var(--ink); position: relative; }
.section span { color: var(--amber); }
.section::after { content: ''; position: absolute; left: 0; right: 0; bottom: -11px; height: 8px; background: var(--dither); }
.intro { max-width: 68ch; margin-bottom: 26px; }

/* hero */
.hero { padding-top: clamp(28px, 5vw, 64px); }
.title { font: 400 clamp(44px, 13.4vw, 168px)/.95 var(--pixel); letter-spacing: -.02em; white-space: nowrap; }
.title i { font-style: normal; color: var(--amber); }
.sub { margin-top: clamp(20px, 3vw, 32px); font: 400 clamp(19px, 3.1vw, 30px)/1.25 var(--pixel); color: var(--amber); }
.lede { max-width: 60ch; margin-top: 14px; font-size: clamp(17px, 1.8vw, 20px); }
.cta { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-top: 28px; }
.link { font: 400 14px/1.4 var(--pixel); padding: 8px 0; }
.button { display: inline-block; padding: 13px 20px; border: var(--frame) solid var(--ink); background: var(--desktop); color: var(--ink); font: 400 16px/1.2 var(--pixel); text-decoration: none; cursor: pointer; box-shadow: 4px 4px 0 var(--ink); transition: transform .06s steps(2), box-shadow .06s steps(2); }
.button.primary { background: var(--amber); border-color: var(--amber); color: #000; box-shadow: 4px 4px 0 #8a4f00; }
.button:hover { background: var(--ink); color: #000; border-color: var(--ink); }
.button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* windows */
.windows { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 30px 22px; padding-top: 24px; }
.window { position: relative; display: block; padding: 18px; border: var(--frame) solid var(--ink); background: var(--panel); font-size: 16px; }
.window.wide { grid-column: 1 / -1; background: linear-gradient(90deg, var(--panel) 62%, transparent), var(--dither), var(--panel); }
.window.wide p { max-width: 62ch; }
.window .tab { margin: -18px 0 14px -18px; }
.tab { width: fit-content; max-width: calc(100% + 18px); padding: 7px 34px 6px 14px; background: var(--ink); color: #000; font: 400 15px/1.25 var(--pixel); clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 100%, 0 100%); }
.tags { margin-top: 10px; color: var(--amber); font: 400 12.5px/1.75 var(--pixel); }

/* the grid explorer */
.guide { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px 28px; align-items: start; }
.stage { min-width: 0; }
.readout { position: sticky; top: 16px; padding: 14px 16px 16px; border: var(--frame) solid var(--ink); background: var(--paper); color: var(--paper-ink); font-size: 16px; min-height: 300px; }
.readout p { margin: 0 0 .55em; }
.readout-name { margin: -14px -16px 10px !important; padding: 8px 16px; background: var(--paper-ink); color: var(--paper); font: 400 22px/1.2 var(--pixel); }
.readout-kind { color: #3c3c38; font-size: 14px; }
.readout-does { font-size: 17px; font-weight: 600; }
.readout-try { margin-top: 12px !important; padding-top: 10px; border-top: 1px solid #9a9a94; font-size: 14.5px; color: #26261f; }

.board { position: relative; }
.board.faceplate { padding-left: 132px; }
.rows { position: absolute; right: calc(100% + 12px); top: 6.2cqw; height: 94.5cqw; display: grid; grid-template-rows: repeat(16, 1fr); font: 400 10.5px/1 var(--pixel); text-align: right; color: var(--dim); }
.rows span { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.rows span::after { content: ''; width: 8px; height: 8px; background: var(--k, transparent); }

/* the Plinky 12: a steel case, a black panel, 16 x 16 pads, four side buttons */
.plinky { container-type: inline-size; position: relative; width: 100%; aspect-ratio: 1; padding: 3.2%; border-radius: 1.8cqw; background: #34373a; border: 1px solid #5b5f63; box-shadow: inset 0 1px 0 #6b7075, inset 0 -2px 0 #1f2123, 0 0 0 var(--frame) var(--ink); }
.panel-face { position: relative; height: 100%; padding: 3.1%; border-radius: .8cqw; background: #050505; box-shadow: inset 0 0 0 1px #1a1a1a, inset 0 0 30px #000; }
#pads { display: grid; grid-template-columns: repeat(16, 1fr); grid-template-rows: repeat(16, 1fr); gap: .62cqw; height: 100%; }
.pad { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 22%; background: #0b0b0b; box-shadow: inset 0 0 0 1px #1b1b1b; cursor: pointer; font: 400 clamp(6px, 1.25cqw, 11px)/1 var(--pixel); color: transparent; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; transition: background-color .05s linear; }
.pad:hover { box-shadow: inset 0 0 0 1px #6a6a66; }
.pad:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; z-index: 2; }
.pad.sel { box-shadow: 0 0 0 2px var(--amber); z-index: 1; }
.pad .t { pointer-events: none; mix-blend-mode: normal; color: var(--tc, transparent); }
.faceplate .pad .t { --tc: var(--lab, rgba(255,255,255,.55)); }
@container (max-width: 480px) { .pad .t { display: none; } }
.side { position: absolute; width: 1.9cqw; height: 5.4cqw; background: #101112; border: 1px solid #6b7075; border-radius: .5cqw; padding: 0; cursor: pointer; box-shadow: inset 0 1px 0 #3a3d40; }
.side:hover { border-color: var(--amber); }
.side:active { background: var(--amber); }
.side.l { left: -1.1%; } .side.r { right: -1.1%; }
.side.a { top: 37%; } .side.b { top: 53%; }

.lcd { margin-top: 18px; padding: 9px 12px; border: var(--frame) solid var(--amber); background: #120a00; color: var(--amber); font: 400 clamp(11px, 1.9vw, 15px)/1.4 var(--pixel); min-height: 2.9em; display: flex; flex-wrap: wrap; gap: 2px 18px; align-items: baseline; }
.lcd b { color: #ffd9a0; font-weight: 400; }

.tools { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; margin-top: 16px; }
.tools label { display: flex; align-items: center; gap: 10px; font: 400 13px/1.2 var(--pixel); color: var(--dim); }
.tools output { color: var(--ink); min-width: 3ch; }
.tools input[type=range] { accent-color: var(--amber); width: 180px; height: 28px; }
.chip { min-height: 40px; padding: 8px 12px; border: 2px solid var(--ink); background: #000; color: var(--ink); font: 400 13px/1.2 var(--pixel); cursor: pointer; }
.chip:hover { border-color: var(--amber); color: var(--amber); }
.chip[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #000; }
.meter { display: inline-block; width: 70px; height: 12px; border: 2px solid var(--line); vertical-align: middle; }
.meter i { display: block; height: 100%; width: 0; background: var(--amber); }
.fine { margin-top: 12px; color: var(--dim); font-size: 14px; max-width: 78ch; }

/* notice, steps, status */
.notice { padding: 18px 20px; border: var(--frame) solid var(--amber); background: repeating-linear-gradient(135deg, #1d1000 0 10px, #000 10px 20px); }
.notice-head { display: inline-block; padding: 3px 9px; background: var(--amber); color: #000; font: 400 15px/1.35 var(--pixel); }
.notice-body { margin: 12px 0 0 !important; font-size: clamp(18px, 2.2vw, 23px); font-weight: 600; line-height: 1.3; }
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 44px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; background: var(--ink); color: #000; font: 400 15px/1 var(--pixel); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 9px 14px 9px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { font: 400 13px/1.3 var(--pixel); border-bottom: var(--frame) solid var(--ink); white-space: nowrap; }
tbody th { font-weight: 600; white-space: nowrap; }
td.ok b { color: var(--ink); }
td.no b { color: var(--amber); }
pre { margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--line); background: #080808; overflow-x: auto; font: 13.5px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.foot { margin-top: 56px; padding: 26px var(--gutter) 36px; border-top: var(--frame) solid var(--ink); color: var(--dim); font-size: 14px; }
.foot a { color: var(--dim); }
.foot > * { max-width: 1184px; margin-inline: auto; }

@media (max-width: 980px) {
  .guide { grid-template-columns: minmax(0, 1fr); }
  /* above the grid and pinned to the top of the screen: a tap has to show its answer in view */
  .readout { order: 0; top: 0; z-index: 5; height: 150px; min-height: 0; padding: 10px 14px 12px; font-size: 14px; overflow-y: auto; }
  .readout-name { margin: -10px -14px 8px !important; padding: 6px 14px; font-size: 17px; }
  .readout-kind, .readout-try { display: none; }
  .readout-does { font-size: 14.5px; line-height: 1.4; margin: 0; }
  .stage { order: 1; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .rows { display: none; }
  .board.faceplate { padding-left: 0; }
  .strip a { margin-left: 0; }
  .cta .button { flex: 1 1 100%; text-align: center; }
  .window.wide { background: var(--panel); }
  .side { display: none; }
}

/* pages and the save page (the panel's own pages, as row 15 and Plinky's side buttons reach them) */
.pagebar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pagebar button { min-height: 36px; padding: 6px 12px; border: 2px solid var(--line); background: #000; color: var(--dim); font: 400 13px/1.2 var(--pixel); cursor: pointer; }
.pagebar button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #000; }
.panel-face { position: relative; }
.savepage { position: absolute; inset: 22% 8%; display: grid; place-items: center; padding: 16px; border: 2px dashed var(--amber); background: rgba(0,0,0,.82); color: var(--ink); font-size: 15px; text-align: center; }
.savepage[hidden] { display: none; }
.savepage b { display: block; margin-bottom: 8px; color: var(--amber); font: 400 16px/1.2 var(--pixel); }
.filechip { position: relative; display: inline-flex; align-items: center; color: var(--ink) !important; }
.filechip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
