/* Blueprint design. Rules: knowledge/design.md
   Grid: 4 tiny / 64 cell / 256 block. Spacing: powers of two only. */

:root {
  --s: 1280px;
  --bg: #123a86; --code: #0d2f70; --ink: #eef4ff; --muted: #b9cdf2; --soft: #d3e0f8; --lbl: #9fb8e6;
  --line: #ffffff59; --frame: #ffffff99; --g1: #ffffff08; --g2: #ffffff26; --g3: #ffffff0f;
  --hover: #ffffff0d; --px1: #ffffff33; --px2: #ffffff12; --corner: #eef4ffb3; --hl: #ffe08a;
  --aw: 2px; --as: dashed;
  /* syntax */
  --c-key: #c4a8ff; --c-num: #ffb4a2; --c-id: #d3e0f8; --c-flow: #ff9fd0; --c-op: #9fd0ff; --c-str: #8ff0c0; --c-brace: #8fe6ff; --c-com: #8aa3d6;
  /* tag families */
  --t-pixel: #ffb4a2; --t-gl: #9fd0ff; --t-noise: #cdb8ff; --t-math: #8ff0c0; --t-css: #ffe08a; --t-js: #8fe6ff; --t-sound: #ff9fd0; --t-other: #e3eaf7;
  color-scheme: dark;
}
/* articles: deeper paper, quieter lines, so text leads */
.is-article {
  --bg: #0b2861; --code: #081e4b; --line: #ffffff2e; --frame: #ffffff4d; --g1: #ffffff05; --g2: #ffffff14; --g3: #ffffff08;
}
:root[data-theme="light"], :root[data-theme="light"] .is-article,
.editor-dialog /* tool dialogs drawn on light panels keep light colours in any theme */ {
  --bg: #f3f6fb; --code: #e6edf8; --ink: #0f2f6e; --muted: #3d5a92; --soft: #2c4677; --lbl: #4d6aa0;
  --line: #123a8659; --frame: #123a8699; --g1: #123a860a; --g2: #123a8629; --g3: #123a8612;
  --hover: #123a860d; --px1: #123a8633; --px2: #123a8612; --corner: #123a86b3; --hl: #c2410c;
  --c-key: #6a3fd1; --c-num: #b3361b; --c-id: #2c4677; --c-flow: #a8235f; --c-op: #2350c8; --c-str: #127a4f; --c-brace: #0b6d86; --c-com: #6b7fa8;
  --t-pixel: #b3361b; --t-gl: #2350c8; --t-noise: #6a3fd1; --t-math: #127a4f; --t-css: #8a5a00; --t-js: #0b6d86; --t-sound: #a8235f; --t-other: #33405a;
  color-scheme: light;
}
.editor-dialog { color: var(--soft); }
@media (max-width: 1311px) { :root { --s: 1216px; } } /* 1280 laptops: full layout, 19 cells */
@media (max-width: 1247px) { :root { --s: 1024px; } }
@media (max-width: 1055px) { :root { --s: 768px; } }
@media (max-width: 799px)  { :root { --s: calc(100vw - 32px); } }

html, body { margin: 0; background: var(--bg); }
body {
  font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 16px; line-height: 24px; color: var(--ink);
  overflow-x: hidden;
}
p, h1, h2, h3, h4, li { text-wrap: pretty; }
a { color: var(--ink); text-decoration: none; transition: color .5s cubic-bezier(.22,1,.36,1); }
a:hover { color: var(--hl); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
.ul, .main-wrap.text a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.m { font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 16px; letter-spacing: .04em; }
.lbl { color: var(--lbl); text-transform: uppercase; }
.clear { clear: both; }
/* pixel art is scaled 2x: keep pixels square, never smoothed (crisp-edges first so pixelated wins where supported) */
canvas, .article-list-icon, .ico img, .ico-s img, .art-icon { image-rendering: crisp-edges; image-rendering: pixelated; }

/* ---------- sheet on the grid ---------- */
.bp {
  position: relative; padding: 64px 0 128px;
  background-image: linear-gradient(var(--g1) 1px, transparent 1px), linear-gradient(90deg, var(--g1) 1px, transparent 1px);
  background-size: 64px 64px; background-position: calc(50% + 32px - var(--s) / 2) 0;
}
.bp:before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--g2) 1px, transparent 1px), linear-gradient(90deg, var(--g2) 1px, transparent 1px),
                    linear-gradient(var(--g3) 1px, transparent 1px), linear-gradient(90deg, var(--g3) 1px, transparent 1px);
  background-size: 256px 256px, 256px 256px, 64px 64px, 64px 64px;
  background-position: calc(50% + 128px - var(--s) / 2) 0, calc(50% + 128px - var(--s) / 2) 0, calc(50% + 32px - var(--s) / 2) 0, calc(50% + 32px - var(--s) / 2) 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 calc(50% - var(--s) / 2), #000 calc(50% + var(--s) / 2), transparent 100%), linear-gradient(transparent 0, #000 384px, #000 calc(100% - 384px), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 calc(50% - var(--s) / 2), #000 calc(50% + var(--s) / 2), transparent 100%), linear-gradient(transparent 0, #000 384px, #000 calc(100% - 384px), transparent 100%);
  mask-composite: intersect;
}
.sheet { position: relative; width: calc(var(--s) + 1px); margin: 0 auto; padding-bottom: 1px; outline: 1px solid var(--frame); outline-offset: -1px; }
/* lines are painted, never borders, so they don't move layout */
.t { background-image: linear-gradient(var(--line), var(--line)); background-size: 100% 1px; background-repeat: no-repeat; }
.l { background-image: linear-gradient(var(--line), var(--line)); background-size: 1px 100%; background-repeat: no-repeat; }
/* frames: left/top inside, right/bottom just outside, so all four edges land on grid pixels */
.frame { box-shadow: inset 1px 1px 0 var(--line), 1px 1px 0 var(--line); }
.pad { padding-left: 64px; padding-right: 64px; }
.h64 { height: 64px; overflow: hidden; }
.h256 { height: 256px; overflow: hidden; }
.px { background: repeating-conic-gradient(var(--px1) 0 25%, var(--px2) 0 50%) 0 0 / 16px 16px; }

/* drafting corners: the clickable cue */
.hov { position: relative; transition: background-color .5s cubic-bezier(.22,1,.36,1); }
.hov:hover { background-color: var(--hover); }
.hov:before, .hov:after { content: ''; position: absolute; width: 12px; height: 12px; border-color: var(--corner); border-style: solid; pointer-events: none;
  transition: width .5s cubic-bezier(.22,1,.36,1), height .5s cubic-bezier(.22,1,.36,1), border-color .5s; }
.hov:before { left: 0; top: 0; border-width: 2px 0 0 2px; }
.hov:after { right: 0; bottom: 0; border-width: 0 2px 2px 0; }
.hov:hover:before, .hov:hover:after { width: 24px; height: 24px; border-color: var(--hl); }

/* dimension line: years and section headings */
.dim { margin: 0; height: 128px; position: relative; font-weight: 600; font-size: 32px; line-height: 40px; letter-spacing: -.01em; }
.dim > span { position: absolute; top: 96px; left: 4px; right: 4px; height: 1px; display: flex; align-items: center; }
.dim .dl { flex: 1 1 auto; height: 0; border-top: var(--aw) var(--as) var(--ink); }
.dim .ar { width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.dim .ar-l { border-right: 8px solid var(--ink); }
.dim .ar-r { border-left: 8px solid var(--ink); }
.dim b { font-weight: 600; padding: 0 16px; background: var(--bg); }
.dim--small { height: 96px; font-size: 24px; line-height: 32px; }
.dim--small > span { top: 64px; }

/* ---------- header / footer ---------- */
.hdr { display: flex; height: 64px; }
.logo { flex: 0 0 256px; display: flex; align-items: center; gap: 16px; padding: 0 64px; box-sizing: border-box; font-weight: 600; font-size: 20px; }
.is-article .logo span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.nav { flex: 1 1 auto; display: flex; align-items: center; justify-content: flex-end; gap: 0 32px; padding: 0 16px 0 64px; }
.nav a { padding: 16px 0; }
.theme { width: 44px; height: 44px; display: flex; align-items: center; justify-content: flex-end; background: none; border: 0; color: var(--ink); cursor: pointer; margin-left: 8px; padding: 0; transition: color .5s; }
.theme:hover { color: var(--hl); }
.theme .sun, :root[data-theme="light"] .theme .moon { display: none; }
:root[data-theme="light"] .theme .sun { display: block; }

.foot { display: flex; height: 64px; }
.foot > * { flex: 1 1 0; box-sizing: border-box; padding: 0 16px; display: flex; align-items: center; }
.foot .social { justify-content: center; gap: 8px; }
.foot .social a { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.foot .social a:hover { color: var(--hl); }
.foot > :last-child { justify-content: flex-end; }

/* ---------- index ---------- */
.hero { display: flex; }
.intro { flex: 0 1 768px; box-sizing: border-box; padding: 64px 64px 0; display: flex; flex-direction: column; gap: 16px; }
.intro p { margin: 0; max-width: 576px; font-size: 28px; line-height: 36px; font-weight: 500; letter-spacing: -.01em; }
.skiacell { flex: 0 1 512px; box-sizing: border-box; padding: 16px; }
.skia { height: 100%; box-sizing: border-box; padding: 16px 32px 0; display: flex; flex-direction: column; gap: 16px; }
.skia > * { margin-left: 16px; margin-right: 16px; }
.skia svg { width: 192px; height: auto; display: block; }
.skia .sk { fill: url(#skg); fill-opacity: .3; stroke: url(#skg); stroke-width: 1.4; }
.split { display: flex; padding-bottom: 32px; }
.toolcol { flex: 0 0 768px; }
.repocol { flex: 0 0 512px; }
.tools { display: grid; grid-template-columns: repeat(3, 256px); }
.cell { height: 256px; padding: 16px; box-sizing: border-box; }
.card { height: 224px; padding: 32px; box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; }
.card .ico-s { width: 64px; height: 64px; flex: 0 0 64px; }
.card .ico-s canvas, .card .ico-s img { width: 64px; height: 64px; }
.card small, .repo small { font-size: 14px; line-height: 20px; color: var(--muted); }
.repos { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.repo { height: 44px; padding: 0 16px; display: flex; align-items: center; gap: 8px; box-sizing: border-box; white-space: nowrap; overflow: hidden; }
.repo small { overflow: hidden; text-overflow: ellipsis; }
.repo i { margin-left: auto; font-style: normal; color: var(--lbl); }

.filter { display: flex; align-items: flex-start; gap: 32px; min-height: 128px; padding: 32px 16px 0; box-sizing: border-box; }
.chips { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 8px; }
.search { position: relative; flex: 0 0 320px; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; box-sizing: border-box; color: var(--lbl); }
.search input { flex: 1; min-width: 0; height: 100%; font: inherit; color: var(--ink); background: transparent; border: 0; outline: 0; }
.search input::placeholder { color: var(--lbl); }
.tag { font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 16px; height: 32px; padding: 0 8px; box-sizing: border-box;
  display: inline-flex; align-items: center; border: 1px solid; white-space: nowrap; color: var(--t-other); background: transparent; }
button.tag { cursor: pointer; font-weight: 400; }
button.tag:hover { background: var(--hover2, var(--hover)); }
button.tag[aria-pressed="true"] { background: currentColor; }
button.tag[aria-pressed="true"] span { color: var(--bg); }
.tag--pixel { color: var(--t-pixel); } .tag--gl { color: var(--t-gl); } .tag--noise { color: var(--t-noise); } .tag--math { color: var(--t-math); }
.tag--css { color: var(--t-css); } .tag--js { color: var(--t-js); } .tag--sound { color: var(--t-sound); } .tag--all { color: var(--ink); }

.posts > .year-band:first-child .dim { height: 64px; }
.posts > .year-band:first-child .dim > span { top: 32px; }
.pcell { height: 256px; padding: 16px; box-sizing: border-box; }
.post { display: flex; height: 100%; box-sizing: border-box; }
.post .rail { flex: 0 0 224px; margin: 16px 0 0 16px; box-sizing: border-box; padding: 32px 32px 0; display: flex; flex-direction: column; gap: 8px; }
/* no icon yet: empty drafting square; size label appears on hover */
.ico--empty, .ico-s.px:empty { outline: 1px solid var(--frame); outline-offset: 4px; }
.post .size { color: var(--lbl); width: 128px; text-align: center; opacity: 0; transition: opacity .5s cubic-bezier(.22,1,.36,1); }
.post:hover .size, .post:focus-visible .size { opacity: 1; }
.post .ico { width: 128px; height: 128px; display: flex; align-items: center; justify-content: center; }
.post .ico canvas, .post .ico img { width: 128px; height: 128px; }
.post .txt { flex: 1 1 auto; min-width: 0; margin-right: 16px; padding: 16px 32px 0 0; display: flex; flex-direction: column; gap: 8px; }
.post .meta { display: flex; flex-wrap: wrap; gap: 8px; min-height: 32px; align-items: center; }
.post .date { margin-left: auto; color: var(--muted); }
/* Experiment: true — a half cell strip on the left edge of the card, 1px diagonal hatching, the label cut out of it with the page background */
.post .experiment { position: absolute; left: 0; top: 0; bottom: 0; width: 32px; display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: repeating-linear-gradient(-45deg, var(--line) 0 1px, transparent 1px 8px); box-shadow: inset -1px 0 0 var(--line); }
.post .experiment span { writing-mode: vertical-rl; transform: rotate(180deg); padding: 4px 2px; background: var(--bg); color: var(--lbl);
  font: 500 12px/16px 'IBM Plex Mono', monospace; letter-spacing: .08em; }
.post h3 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.01em; }
.post p { margin: 0; max-width: 704px; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.post:hover h3, .card:hover strong, .repo:hover strong { color: var(--hl); }
.empty { padding: 64px; }
.empty button { font: inherit; color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--ink); padding: 8px 0; cursor: pointer; }
.white-articles { position: absolute; left: 200vw; top: 0; }

/* ---------- article ---------- */
.art-head { display: flex; min-height: 64px; }
.art-rail { flex: 0 0 256px; box-sizing: border-box; padding: 32px 16px 0 64px; }
.art-icon { width: 128px; height: 128px; background-size: contain !important; image-rendering: pixelated; }
.art-icon canvas { width: 128px; height: 128px; display: block; }
.art-icon hr { display: none; }
.art-icon[style=""]:empty { display: none; }
.art-meta { flex: 1 1 auto; padding: 32px 64px 0 0; }
.top-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 32px; max-width: 704px; }
.top-bar .article-date { order: 2; margin-left: auto; color: var(--muted); }
.mainTags { display: flex; flex-wrap: wrap; gap: 8px; }
.mainTags .tag a { color: inherit; }
.art-body { display: flex; }
.art-body > .art-rail { position: sticky; top: 32px; align-self: flex-start; padding-top: 0; }
.art-body > .art-rail { display: flex; flex-direction: column; gap: 32px; }
html:has(body.is-article) { background: #0b2861; }
:root[data-theme="light"]:has(body.is-article) { background: #f3f6fb; }
.toc { display: flex; flex-direction: column; gap: 16px; font-size: 14px; line-height: 16px; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--hl); }
.toc .toc-sub { padding-left: 16px; font-size: 12px; }

.main-wrap.text { flex: 1 1 auto; min-width: 0; padding: 0 64px 128px 0; color: var(--soft); font-size: 18px; line-height: 32px; }
.text > p, .text > ul, .text > ol, .text > blockquote, .text > h1, .text > h2, .text > h3, .text > h4, .text > h5, .text > table, .text .column, .text .p { max-width: 704px; }
.text p, .text ul, .text ol { margin: 16px 0; }
.text ul, .text ol { padding-left: 16px; }
.text li { margin: 0; }
.text strong, .text b { color: var(--ink); font-weight: 600; }
.text h1, .text h2, .text h3, .text h4, .text h5 { color: var(--ink); font-weight: 600; position: relative; }
/* minimal margins; hint() grows them until the baseline sits on a grid line */
.text h1 { margin: 16px 0; font-size: 48px; line-height: 64px; letter-spacing: -.02em; }
.text h2 { margin: 64px 0 16px; font-size: 24px; line-height: 32px; letter-spacing: -.01em; }
.text h3 { margin: 32px 0 16px; font-size: 20px; line-height: 32px; }
.text h4, .text h5 { margin: 32px 0 16px; font-size: 18px; line-height: 32px; }
.heading-anchor { position: absolute; left: -32px; width: 32px; color: var(--lbl); opacity: 0; font-weight: 400; text-decoration: none !important; }
.text :is(h1, h2, h3, h4, h5):hover .heading-anchor { opacity: 1; }
.anchor { display: none; }

/* code */
code { font-family: 'IBM Plex Mono', monospace; font-size: 14px; color: var(--ink); }
.text p code, .text li code, .code { font-size: 16px; padding: 2px 4px; background: var(--code); white-space: nowrap; }
pre {
  margin: 32px 0; padding: 8px 16px; background: var(--code); line-height: 18px; position: relative; /* polish.js snap() rounds the height to 16 */
  white-space: pre-wrap; overflow: auto; /* overflow: narrows beside a floated canvas instead of running under it */
  box-shadow: inset 1px 1px 0 var(--line), 1px 1px 0 var(--line);
}
pre code { font-size: 13px; }
code .keyword, code .arrow { color: var(--c-key); }
code .numeric { color: var(--c-num); }
code .identifier { color: var(--c-id); }
code .control-flow, code .boolean { color: var(--c-flow); }
code .param { color: var(--c-key); }
code .operator { color: var(--c-op); }
code .brace-round, code .brace-curve, code .brace-square { color: var(--c-brace); }
code .string, code .template, code .regularexpression { color: var(--c-str); }
code .block-comment, code .line-comment { color: var(--c-com); }
.inner-code { min-width: 0; }
/* //hidden{ } parts of snippets: collapsed, one click to see the rendering code */
details.code-hidden { display: block; margin: 0; }
details.code-hidden > summary { display: inline-block; cursor: pointer; list-style: none; font: 400 12px/18px 'IBM Plex Mono', monospace; letter-spacing: .04em; color: var(--lbl); }
details.code-hidden > summary::-webkit-details-marker { display: none; }
details.code-hidden > summary:before { content: '\25B8  '; }
details.code-hidden[open] > summary:before { content: '\25BE  '; }
details.code-hidden > summary:hover { color: var(--hl); }

/* canvases sit on the paper colour (no page grid behind their own drawing) and never get a baseline gap */
.text canvas { vertical-align: top; align-self: flex-start; }
.text canvas:only-of-type { background-color: var(--bg); } /* stacked layer canvases (siblings) stay transparent */ /* flex rows would stretch a canvas past its height */

/* blueprint controls (only for buttons without their own class; tools keep their UI): framed, mono, drafting corners on hover, ink fill while pressed */
.text button:not([class]) {
  position: relative; height: 32px; padding: 0 8px; margin: 0; box-sizing: border-box; cursor: pointer;
  font: 400 12px/16px 'IBM Plex Mono', monospace; letter-spacing: .04em; color: var(--ink);
  background-color: transparent; border: 0; box-shadow: inset 0 0 0 1px var(--line);
  transition: color .5s cubic-bezier(.22,1,.36,1), background-color .5s cubic-bezier(.22,1,.36,1);
}
.text button:not([class]):before, .text button:not([class]):after { content: ''; position: absolute; width: 6px; height: 6px; border-color: var(--corner); border-style: solid; pointer-events: none;
  transition: width .5s cubic-bezier(.22,1,.36,1), height .5s cubic-bezier(.22,1,.36,1), border-color .5s; }
.text button:not([class]):before { left: 0; top: 0; border-width: 2px 0 0 2px; }
.text button:not([class]):after { right: 0; bottom: 0; border-width: 0 2px 2px 0; }
.text button:not([class]):hover { color: var(--hl); background-color: var(--hover); }
.text button:not([class]):hover:before, .text button:not([class]):hover:after { width: 12px; height: 12px; border-color: var(--hl); }
.text button:not([class]):active { color: var(--bg); background-color: var(--ink); }
.text input[type="number"], .text input[type="text"], .text .numberInput__input, .text select {
  height: 32px; box-sizing: border-box; padding: 0 8px; font: 400 14px/16px 'IBM Plex Mono', monospace;
  color: var(--ink); background: var(--code); border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 0;
}
.text input[type="number"]:focus, .text input[type="text"]:focus, .text .numberInput__input:focus { outline: 0; box-shadow: inset 0 0 0 1px var(--hl); }
.text .numberInput--dragger { color: var(--lbl); }
.text input[type="radio"], .text input[type="checkbox"] { accent-color: var(--hl); cursor: pointer; }

/* canvases: float right at natural size, text and code keep flowing on the left; rows share a half-cell gap */
.canvas-wrapper { float: right; position: relative; margin: 0 0 16px 32px; z-index: 1; line-height: 0; }
.canvas-wrapper--normal, .pre-ckit .canvas-wrapper { background: transparent; }
.hide-code .canvas-wrapper { float: left; margin: 0 32px 16px 0; }
.pre-pixelart-inline { float: right; clear: right; display: block; width: max-content; margin: 0 0 32px 32px; padding: 16px; }
.pre-pixelart-inline .canvas-wrapper { float: none; margin: 0; }
.pre-pixelart-float--left { float: left; margin: 0 32px 32px 0 !important; }
.pre-pixelart-float--right { float: right; margin: 0 0 32px 32px !important; }
.pre-inline { display: inline-block; vertical-align: top; }
.pre-pixelart.inline .clear { display: none; }
canvas.canvas-only { display: block; }
.canvas.pixelart.ups {
    bottom: -8px;
    right: 0;
    position: absolute;
}
.html-wrapper { float: right; position: relative; margin: 0 0 16px 32px; padding-left: 32px; box-shadow: inset 1px 0 0 var(--line); line-height: normal; }
.pre-tool { background: transparent; }
.pre-tool .canvas-wrapper { float: none; margin: 0; }
.pixelgrid-area, .memory-area { margin: 16px 0; }
.memory-area { font-family: 'IBM Plex Mono', monospace; }
.memory-area b { cursor: pointer; font-weight: 400; }
.memory-area b:hover { background: var(--hover); color: var(--hl); }
.shader-error { background: #ff7171; color: #041210; padding: 2px 4px; }

/* author layout helpers kept from the old engine */
.flex, .flex-wrap { display: flex; justify-content: flex-start; align-items: flex-start; gap: 32px; margin: 32px 0; clear: both; }
.flex-wrap { flex-wrap: wrap; }
.flex pre, .flex-wrap pre { margin: 0; }
.flex-wrap > div { flex: 1 1 320px; min-width: 0; }
.space { height: 64px; } .half-space { height: 32px; }
.hiddenImage { position: absolute; left: -2000px; }

/* notes */
blockquote { margin: 32px 0; padding: 16px 16px 16px 64px; position: relative; box-shadow: inset 1px 1px 0 var(--line), 1px 1px 0 var(--line); background: var(--code); }
blockquote p { margin: 0; }
blockquote p + p { margin-top: 16px; }
blockquote:before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--t-gl); }
.block-solution:before { background: var(--t-math); }
.block-warn:before, .block-wary:before { background: var(--t-css); }
.block-tiny { font-size: 16px; line-height: 24px; }
.block-tiny:before { background: var(--t-css); }
.article-icon { position: absolute; left: 24px; width: 24px; height: 24px; margin-top: 4px; }
:root:not([data-theme="light"]) .article-icon { filter: invert(1) hue-rotate(180deg) brightness(1.4); }

/* the page background at 50% under tables dims the grid where a table does not follow it.
   tables sit on the grid: start on the text column line, lines are 32 (half a cell), long cells wrap so rows grow by whole lines; only unbreakable content scrolls */
.text table { display: block; width: fit-content; max-width: 100%; overflow-x: auto; background: color-mix(in srgb, var(--bg) 50%, transparent); margin: 32px 0; border-spacing: 0; border-collapse: collapse; font-size: 16px; line-height: 32px; }
.text table th, .text table td { box-sizing: border-box; height: 32px; padding: 0 16px; margin: 0; white-space: normal; text-align: left; vertical-align: top; box-shadow: inset 0 -1px 0 var(--line); }
.text table th { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--lbl); text-transform: uppercase; }
.text table thead td { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--lbl); text-transform: uppercase; }
/* column hover (polish.js marks the hovered column's cells) */
/* header row is a full cell; polish.js rounds column widths to whole cells and moves the table onto a 64 line */
.text table thead td, .text table thead th, .text table tr:first-child > th { height: 64px; }
/* row + column hover: a crosshair; the crossing cell gets both tints */
.text table tbody tr:hover > td, .text table tbody tr:hover > th { background-color: var(--hover); }
.text table .col-hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.text table th.col-hover, .text table thead .col-hover { color: var(--hl); }
textarea, .cmp-number__input { font: inherit; color: var(--ink); background: var(--code); border: 0; box-shadow: inset 0 -1px 0 var(--line); }
.cmp-number__input { width: 2.5em; -moz-appearance: textfield; appearance: textfield; }
input[type='number']::-webkit-outer-spin-button, input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cmp-number__input:focus { outline: 0; background: var(--hl); color: var(--bg); }
a#email-contact:before { content: 'kubota+'; }
.comment { color: var(--lbl); }

/* prev / next in the same tag */
.cycle { margin-top: 0; }
.cycle-navigation { display: flex; flex-wrap: wrap; padding-bottom: 64px; }
.cycle-navigation > * { flex: 1 1 384px; padding: 16px; box-sizing: border-box; }
.navigation-link { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 96px; padding: 16px 32px; box-sizing: border-box;
  box-shadow: inset 1px 1px 0 var(--line), 1px 1px 0 var(--line); font-size: 20px; line-height: 28px; font-weight: 600; }
.navigation-link small { font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--lbl); text-transform: uppercase; letter-spacing: .04em; }
.navigation-link--next { align-items: flex-end; text-align: right; }

/* ---------- narrower sheets ---------- */
/* 1216 sheet: same layout, tools take 3 x 240 with a quarter-cell gap */
@media (max-width: 1311px) and (min-width: 1248px) {
  .intro { flex-basis: 768px; }
  .skiacell { flex-basis: 448px; }
  .toolcol { flex-basis: 720px; }
  .repocol { flex-basis: 496px; }
  .tools { grid-template-columns: repeat(3, 240px); }
  .tools .cell { padding: 16px 8px; }
}
@media (max-width: 1247px) {
  .split { flex-direction: column; }
  .toolcol, .repocol { flex: none; }
  /* intro and Skia Docs stay on one row down to the 768 sheet */
  .intro { flex: 1 1 auto; min-width: 0; }
  .skiacell { flex: 0 0 512px; }
  .intro { padding-top: 32px; }
  .intro p { font-size: 24px; line-height: 32px; }
  .filter { min-height: 192px; }
  .text > p, .text > ul, .text > ol, .text > h1, .text > h2, .text > h3 { max-width: 640px; }
}
@media (max-width: 1055px) {
  .skiacell { flex-basis: 384px; }
  .skia svg { width: 160px; }
  .intro { padding: 64px 32px 0 64px; }
  .intro p { font-size: 22px; line-height: 28px; }
  .filter { min-height: 256px; }
  .filter .search { flex: 0 0 256px; }
  .post p { -webkit-line-clamp: 4; }
  .art-rail { flex-basis: 192px; padding-left: 32px; }
  .canvas-wrapper, .pre-pixelart-inline, .pre-pixelart-float--right { float: none; margin: 16px 0 !important; }
}
/* phone: one flowing column, 16px gutters, rows size to content */
@media (max-width: 799px) {
  .bp { padding: 64px 0; }
  .bp:before { display: none; }
  .sheet { width: var(--s); }
  .h64, .h256, .pcell, .cell, .card, .post { height: auto; overflow: visible; }
  .pad, .logo { padding-left: 16px; padding-right: 16px; }
  .hdr { flex-wrap: wrap; height: auto; }
  .logo { flex: 1 1 auto; height: 64px; }
  .nav { padding: 0 16px; }
  .hero { flex-direction: column; }
  .intro, .skiacell { flex: none; }
  .intro { padding: 32px 16px; }
  .intro p { font-size: 22px; line-height: 28px; }
  .skiacell, .cell, .pcell { padding: 8px 16px; }
  .skia { padding: 16px; }
  .skia > * { margin: 0; }
  .tools { grid-template-columns: 1fr; }
  .card { flex-direction: row; align-items: center; padding: 16px; }
  .split { padding-bottom: 0; }
  .repos { padding: 8px 16px; gap: 8px; }
  .repo { height: auto; padding: 8px 16px; flex-wrap: wrap; white-space: normal; }
  .filter { flex-direction: column; min-height: 0; gap: 16px; padding: 16px; }
  .filter .search { flex: none; width: 100%; order: -1; }
  .dim { height: 96px; font-size: 24px; }
  .dim > span, .posts > .year-band:first-child .dim > span { top: 60px; }
  .post { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 16px; }
  .post .rail { margin: 0; padding: 32px 0 0; }
  .post .ico, .post .ico canvas, .post .ico img { width: 64px; height: 64px; }
  .post .size { display: none; }
  .post .txt { margin: 0; padding: 0; }
  .post p { display: block; }
  .art-head, .art-body { flex-direction: column; }
  .art-head > .art-rail { display: none; }
  .art-body > .art-rail { position: static; padding: 16px; flex: none; }
  .art-meta { padding: 16px; }
  .main-wrap.text { padding: 0 16px 64px; }
  .text h1 { font-size: 32px; line-height: 40px; }
  .foot { flex-wrap: wrap; height: auto; }
  .foot > * { flex: 1 1 100%; padding: 8px 16px; justify-content: flex-start !important; }
}
@media (prefers-reduced-motion: reduce) {
  a, .hov, .hov:before, .hov:after, .theme { transition: none; }
}
