/* ==========================================================================
   agentic development · lab.blackpixel.pl — one stylesheet.
   Structure follows "w pigułce" (sidebar tree, numbered sections, fixed callout
   types); look follows blackpixel.pl (black, cream text, brand squares, pills).
   Order: fonts → tokens → base → shell (header, sidebar) → lesson head →
   COMPONENTS (contract, see guide/COMPONENTS.md) → index → glossary → popover.
   ========================================================================== */

@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin-ext.woff2") format("woff2"); font-weight: 300 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  /* blackpixel brand */
  --orange: #fe652b; --pink: #ef357a; --yellow: #ffc409; --blue: #11afe7; --teal: #2ed8b4;
  --grad-warm: linear-gradient(90deg, #fe652a, #ef357a);

  --bg: #000;
  --surface: #0c0c0d;
  --surface-2: #131315;
  --surface-3: #1b1b1e;
  --line: rgba(255, 247, 233, .10);
  --line-strong: rgba(255, 247, 233, .2);
  --text: #fff7e9;
  --muted: #b3ada3;
  --faint: #7d7a74;

  --code-bg: #0a0a0b;
  --tok-k: #ff7eb0; --tok-s: #7ee6c9; --tok-c: #77736c; --tok-n: #ffd25a; --tok-f: #6fd0f5;

  --radius: 14px;
  --radius-sm: 8px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --header-h: 64px;
  --sidebar-w: 288px;
  --doc-w: 62rem;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ec; --surface: #fffdf8; --surface-2: #f1ede4; --surface-3: #e9e4d8;
  --line: rgba(16, 16, 16, .10); --line-strong: rgba(16, 16, 16, .2);
  --text: #101010; --muted: #4c4943; --faint: #7d7a74;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 17px; line-height: 1.65; overflow-x: hidden; }
a { color: var(--blue); text-underline-offset: 3px; }
p { margin: 0 0 1em; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
b, strong { font-weight: 600; }
code { font-family: var(--mono); font-size: .84em; background: var(--surface-3); border: 1px solid var(--line); border-radius: 5px; padding: .08em .38em; overflow-wrap: anywhere; color: var(--text); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sq { display: inline-block; width: .62em; height: .62em; border-radius: 2px; background: var(--c, var(--blue)); flex: none; }

/* ---------- header (as on blackpixel.pl) ---------- */
.hdr { position: fixed; inset: 0 0 auto 0; z-index: 40; height: var(--header-h); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line-strong); }
.hdr-in { height: 100%; display: flex; align-items: center; gap: 14px; padding: 0 20px; }
.site-name { color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.03em; white-space: nowrap; flex: none; }
.site-name::after { content: "_"; color: var(--orange); margin-left: 1px; animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .site-name::after { animation: none; } }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; flex: none; }
.logo .mark { width: 17px; height: 17px; }
.logo .word { width: 92px; height: 21px; fill: currentColor; position: relative; top: 2px; }
.logo-sub { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; font-size: 15px; white-space: nowrap; text-decoration: none; }
.logo-sub::before { content: ""; width: 1px; height: 20px; background: var(--line-strong); }
.hdr-nav { display: flex; gap: 6px; margin-left: 18px; }
.hdr-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; padding: 7px 14px; border-radius: 999px; }
.hdr-nav a:hover { color: var(--text); }
.hdr-nav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.hdr-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill-btn { display: inline-flex; align-items: center; gap: 8px; font: 500 15px var(--font); color: var(--text); background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 16px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.pill-btn:hover { border-color: var(--text); }
.pill-btn.solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line-strong); background: none; color: var(--text); cursor: pointer; font-size: 16px; }
.menu-btn { display: none; }

/* ---------- layout + sidebar ---------- */
.layout { padding-top: var(--header-h); }
.sidebar { position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w); overflow-y: auto; border-right: 1px solid var(--line); padding: 18px 14px 40px; background: var(--bg); z-index: 30; }
.main { margin-left: var(--sidebar-w); padding: 40px 48px 0; min-width: 0; }
.tree-topic { display: flex; align-items: center; gap: 8px; font: 600 11.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 22px 8px 6px; }
.tree-topic:first-child { margin-top: 0; }
.tree-track { font-size: 14px; font-weight: 600; color: var(--text); margin: 8px 8px 4px; }
.tree-track small { display: block; font-weight: 400; color: var(--faint); font-size: 12.5px; }
.tree-item { display: grid; grid-template-columns: 58px 1fr; gap: 6px; padding: 7px 8px; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-size: 14.5px; line-height: 1.35; }
.tree-item .code { font: 12px var(--mono); color: var(--faint); padding-top: 2px; }
a.tree-item:hover { background: var(--surface-2); color: var(--text); }
.tree-item.current { background: var(--surface-3); color: var(--text); }
.tree-item.current .code { color: var(--c, var(--blue)); }
.tree-item.soon { opacity: .45; }
.tree-item .done { color: var(--teal); }
.toc-mini { list-style: none; margin: 4px 0 10px 64px; padding: 0 0 0 10px; border-left: 1px solid var(--line-strong); }
.toc-mini a { display: block; padding: 3px 6px; font-size: 13.5px; color: var(--faint); text-decoration: none; line-height: 1.35; }
.toc-mini a:hover, .toc-mini a.active { color: var(--text); }
.scrim { display: none; }

@media (max-width: 1000px) {
  .menu-btn { display: grid; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; width: min(320px, 86vw); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.6); z-index: 25; }
  .main { margin-left: 0; padding: 28px 16px 0; }
  .hdr-in { padding: 0 12px; gap: 10px; }
  .hdr-nav { display: none; }
}


/* ---------- lesson head ---------- */
.doc { max-width: var(--doc-w); margin: 0 auto; container-type: inline-size; }
.doc-head { padding-bottom: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .topic { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--faint); }
.crumbs .lcode { margin-left: auto; font: 12.5px var(--mono); color: var(--faint); }
.doc-head h1 { font-size: clamp(30px, 5.4vw, 46px); font-weight: 700; letter-spacing: -.03em; }
.lede { font-size: 19px; color: var(--muted); margin: 16px 0 18px; max-width: 52rem; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 14px; color: var(--faint); margin-bottom: 20px; }
.meta span + span::before { content: "·"; margin: 0 10px; }
.meta b { color: var(--muted); font-weight: 500; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.new-terms { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.new-terms .lbl { font: 600 11.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; font-size: 14.5px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--teal); }
.chip small { color: var(--faint); font: 11.5px var(--mono); }

/* ---------- sections (numbered automatically, brand square per section) ---------- */
.doc { counter-reset: sec; }
.doc > section { margin-top: 72px; counter-increment: sec; }
.doc > section > h2 { display: flex; align-items: center; gap: 12px; font-size: clamp(25px, 3.6vw, 32px); font-weight: 700; margin-bottom: 18px; }
.doc > section > h2::before { content: ""; order: -2; width: 11px; height: 11px; border-radius: 2px; background: var(--sc, var(--blue)); flex: none; }
.doc > section > h2::after { content: counter(sec, decimal-leading-zero); order: -1; font: 500 15px var(--mono); color: var(--faint); }
.doc > section:nth-of-type(5n+1) { --sc: var(--orange); }
.doc > section:nth-of-type(5n+2) { --sc: var(--yellow); }
.doc > section:nth-of-type(5n+3) { --sc: var(--teal); }
.doc > section:nth-of-type(5n+4) { --sc: var(--blue); }
.doc > section:nth-of-type(5n+5) { --sc: var(--pink); }
.doc h3 { font-size: 20px; font-weight: 600; margin: 30px 0 12px; }
.doc ul:not([class]), .doc ol:not([class]) { padding-left: 22px; margin: 0 0 1em; }
.doc li { margin-bottom: 4px; }

/* term: glossary word (tap → popover). No text-decoration: it clashed with `_` and code boxes. */
.term { color: inherit; text-decoration: none; border-bottom: 1.5px dotted var(--teal); cursor: help; }
.term:hover { border-bottom-style: solid; }
.term:has(code) { border-bottom: 0; }
.term code { border-color: color-mix(in srgb, var(--teal) 55%, transparent); box-shadow: inset 0 -1.5px 0 color-mix(in srgb, var(--teal) 75%, transparent); }
.chip.term { border-bottom: 1px solid var(--line-strong); }
/* cite: source marker (tap → popover with the verbatim quote) */
.cite { display: inline-block; font: 600 10.5px/1 var(--mono); vertical-align: .5em; color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); border-radius: 4px; padding: 3px 5px; margin-left: 2px; text-decoration: none; cursor: pointer; }

/* ---------- callouts (w pigułce types) ---------- */
.callout { --c: var(--blue); margin: 0 0 16px; padding: 14px 18px 14px 20px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--radius-sm); }
.callout-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; color: var(--c); margin-bottom: 4px; }
.callout-label::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout dfn { font-style: normal; font-weight: 700; }
.callout.def { --c: var(--teal); }
.callout.key { --c: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
.callout.warn { --c: var(--pink); }
.callout.add { --c: var(--orange); border-style: dashed; border-left-style: solid; background: color-mix(in srgb, var(--orange) 5%, var(--surface)); }
.callout.add .callout-label::after { content: "nasza rada, nie dokumentacja"; font-weight: 400; color: var(--faint); font-size: 13px; }
.callout.ex { --c: var(--yellow); }
.callout.tip { border-left-color: var(--orange); background: linear-gradient(90deg, color-mix(in srgb, var(--orange) 11%, var(--surface)), var(--surface) 65%); }
.callout.tip .callout-label { color: var(--orange); }
.callout.tip .callout-label::before { background: var(--grad-warm); }

/* ---------- flow (stages at a glance) ---------- */
ol.flow { list-style: none; padding: 0; margin: 0 0 18px; display: flex; align-items: stretch; }
ol.flow li { flex: 1; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; }
ol.flow li:first-child { border-color: color-mix(in srgb, var(--teal) 60%, transparent); }
ol.flow li + li { margin-left: 28px; position: relative; }
ol.flow li + li::before { content: "→"; position: absolute; left: -21px; top: 50%; transform: translateY(-50%); color: var(--faint); }
ol.flow b { display: block; }
ol.flow .sub { display: block; font: 12.5px var(--mono); color: var(--muted); margin-top: 2px; }
@container (max-width: 640px) {
  ol.flow { flex-direction: column; }
  ol.flow li + li { margin: 22px 0 0; }
  ol.flow li + li::before { content: "↓"; left: 50%; top: -19px; transform: translateX(-50%); }
}

/* ---------- steps ---------- */
ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 18px; }
ol.steps > li { counter-increment: s; position: relative; padding: 0 0 16px 44px; margin: 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface-2); font: 600 13px var(--mono); display: grid; place-items: center; }
ol.steps > li::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 4px; width: 1px; background: var(--line); }
ol.steps > li:last-child::after { display: none; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.doc table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.doc th { text-align: left; font-weight: 500; font-size: 13.5px; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line-strong); }
.doc td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.doc td:first-child { font-weight: 600; }
.table-caption { font-size: 13.5px; color: var(--faint); margin: -8px 0 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: currentColor; }
.pill.ok { color: var(--teal); background: color-mix(in srgb, var(--teal) 12%, transparent); }
.pill.warn { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 12%, transparent); }
.pill.bad { color: var(--pink); background: color-mix(in srgb, var(--pink) 13%, transparent); }
.pill.info { color: var(--blue); background: color-mix(in srgb, var(--blue) 13%, transparent); }
.note { display: block; font-size: 13px; color: var(--faint); font-weight: 400; margin-top: 2px; }
@media (max-width: 640px) { .doc table { font-size: 14px; } .doc th, .doc td { padding: 9px 10px; } }

/* ---------- code ---------- */
.codeblock { margin: 0 0 18px; background: var(--code-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid rgba(255,247,233,.1); font: 12.5px var(--mono); color: #b3ada3; }
.code-head .dots { display: inline-flex; gap: 5px; margin-right: 10px; }
.code-head .dots i { width: 9px; height: 9px; border-radius: 2px; background: var(--orange); }
.code-head .dots i:nth-child(2) { background: var(--yellow); } .code-head .dots i:nth-child(3) { background: var(--teal); }
.code-copy { background: none; border: 1px solid rgba(255,247,233,.2); color: #b3ada3; border-radius: 999px; font: 12px var(--mono); padding: 3px 10px; cursor: pointer; }
.doc pre { margin: 0; padding: 14px 0; overflow-x: auto; font: 13.5px/1.6 var(--mono); color: #fff7e9; background: var(--code-bg); }
.doc pre code { background: none; border: 0; padding: 0; white-space: pre; font-size: inherit; color: inherit; box-shadow: none; }
.doc pre .ln { display: block; padding: 0 16px; }
.doc pre .ln.hl { background: rgba(17, 175, 231, .12); box-shadow: inset 2px 0 0 var(--blue); }
.tok-k { color: var(--tok-k); } .tok-s { color: var(--tok-s); } .tok-c { color: var(--tok-c); font-style: italic; } .tok-n { color: var(--tok-n); } .tok-f { color: var(--tok-f); }
.toolcall { display: grid; gap: 12px; margin-bottom: 18px; }
.toolcall .codeblock { margin: 0; }
.toolcall > * { min-width: 0; }
@container (min-width: 720px) { .toolcall { grid-template-columns: 1fr 1fr; } }

/* ---------- interactive diagram: figure + step-through ---------- */
figure.diagram { margin: 0 0 18px; }
figure.diagram figcaption { font-size: 13.5px; color: var(--faint); margin-top: 8px; }
.loop { display: grid; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.loop > * { min-width: 0; }
.loop-fig { padding: 16px; border-bottom: 1px solid var(--line); }
.loop-fig svg { display: block; width: 100%; max-width: 440px; height: auto; margin: 0 auto; }
.loop-panel { padding: 16px; }
@container (min-width: 760px) {
  .loop { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .loop-fig { border-bottom: 0; border-right: 1px solid var(--line); display: grid; place-items: center; }
}
.loop-label { font: 600 11.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.loop-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.loop-steps li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); border-left: 2px solid transparent; font-size: 15px; line-height: 1.45; color: var(--muted); cursor: pointer; margin: 0; }
.loop-steps li b { color: var(--text); }
.loop-steps .n { width: 24px; height: 24px; border-radius: 6px; background: var(--blue); color: #000; font: 700 12px var(--mono); display: grid; place-items: center; }
.loop-steps li.on { background: var(--surface-3); border-left-color: var(--blue); color: var(--text); }
.loop-ctrl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.loop-ctrl .pill-btn { font-size: 14px; padding: 6px 14px; }
.loop-ctrl .pill-btn[disabled] { opacity: .35; cursor: default; }
.fx-node rect { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.2; }
.fx-node[data-tone="accent"] rect { fill: color-mix(in srgb, var(--blue) 16%, var(--surface)); stroke: var(--blue); }
.fx-node[data-tone="warn"] rect { fill: color-mix(in srgb, var(--orange) 10%, var(--surface)); stroke: var(--orange); stroke-dasharray: 4 3; }
.fx-node .t { fill: var(--text); font: 600 13px var(--font); }
.fx-node .s { fill: var(--muted); font: 11px var(--mono); }
.fx-edge path { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.fx-edge text { fill: var(--muted); font: 11px var(--mono); }
.fx-mark rect { fill: var(--blue); }
.fx-mark text { fill: #000; font: 700 10.5px var(--mono); }
.loop[data-active] [data-s] { opacity: .22; transition: opacity .2s; }
.loop[data-active] [data-s].on { opacity: 1; }
.loop[data-active] .fx-edge.on path { stroke: var(--blue); }

/* ---------- stack (layered: what goes where) ---------- */
.stack-grid { display: grid; gap: 24px; margin-bottom: 18px; }
.stack-grid > * { min-width: 0; }
@container (min-width: 760px) { .stack-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.stack { display: flex; flex-direction: column; }
.stack-layer { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; }
.stack-layer[data-tone="accent"] { background: color-mix(in srgb, var(--blue) 14%, var(--surface)); border-color: color-mix(in srgb, var(--blue) 60%, transparent); }
.stack-layer b, .stack-item b { display: block; }
.stack-layer span, .stack-item span { display: block; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.stack-arrow { position: relative; padding: 8px 0 8px 34px; font-size: 13.5px; font-style: italic; color: var(--muted); }
.stack-arrow::before { content: ""; position: absolute; left: 16px; top: 2px; bottom: 6px; width: 1px; background: var(--line-strong); }
.stack-arrow::after { content: ""; position: absolute; left: 12.5px; bottom: 2px; border: 4px solid transparent; border-top: 6px solid var(--line-strong); }
.stack-group { border: 1px solid var(--blue); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; }
.stack-group > .loop-label { color: var(--blue); }
.stack-item { border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); }
.stack-item[data-tone="ok"] { background: color-mix(in srgb, var(--teal) 9%, var(--surface)); border-color: color-mix(in srgb, var(--teal) 40%, transparent); }
.stack-item[data-tone="ok"] b { color: var(--teal); }
.stack-item[data-tone="warn"] { background: color-mix(in srgb, var(--yellow) 6%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--yellow) 60%, transparent); }
.stack-item[data-tone="warn"] b { color: var(--yellow); }
.stack-notes h4 { font-size: 17px; margin: 0 0 4px; }
.stack-notes p { color: var(--muted); font-size: 15.5px; margin-bottom: 18px; }

/* ---------- questions + summary ---------- */
details.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 10px; }
details.quiz summary { cursor: pointer; padding: 13px 18px; font-weight: 500; list-style: none; display: flex; gap: 12px; }
details.quiz summary::-webkit-details-marker { display: none; }
details.quiz summary > span { flex: 1; min-width: 0; }
details.quiz summary::before { content: "?"; flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font: 700 12px var(--mono); background: color-mix(in srgb, var(--yellow) 16%, transparent); color: var(--yellow); }
details.quiz[open] summary::before { content: "✓"; background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
details.quiz .answer { padding: 0 18px 14px 54px; color: var(--muted); }
details.quiz .answer > :last-child { margin-bottom: 0; }
ul.summary { list-style: none; padding: 0; margin: 0; }
ul.summary li { position: relative; padding: 0 0 0 24px; margin-bottom: 10px; }
ul.summary li::before { content: ""; position: absolute; left: 3px; top: .55em; width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--orange)); }
ul.summary li:nth-child(4n+2) { --c: var(--yellow); } ul.summary li:nth-child(4n+3) { --c: var(--teal); } ul.summary li:nth-child(4n+4) { --c: var(--blue); }

/* ---------- sources + pager + footer ---------- */
ol.sources { padding-left: 22px; margin: 0; font-size: 15.5px; }
ol.sources li { margin-bottom: 10px; }
ol.sources li:target { background: color-mix(in srgb, var(--blue) 12%, transparent); border-radius: 4px; }
ol.sources .when { display: block; color: var(--faint); font: 12.5px var(--mono); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a, .pager span { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--text); }
.pager small { display: block; color: var(--faint); font: 12px var(--mono); }
.pager .next { grid-column: 2; text-align: right; }
.pager .soon { opacity: .45; }
.footer { max-width: var(--doc-w); margin: 96px auto 0; border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--faint); font-size: 14px; }
.footer a { color: var(--muted); }

/* ---------- index (Lekcje): track-first, no big brand hero ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home { max-width: 72rem; margin: 0 auto; }
.intro-line { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 16px; margin: 0 0 28px; }
.intro-line b { color: var(--text); }
.track-block { display: grid; gap: 28px; padding: 32px; border: 1px solid var(--line); border-radius: 22px; background:
  radial-gradient(70% 90% at 0% 0%, color-mix(in srgb, var(--orange) 9%, transparent), transparent 60%),
  radial-gradient(60% 80% at 100% 100%, color-mix(in srgb, var(--blue) 8%, transparent), transparent 60%), var(--surface); }
.track-block + .track-block { margin-top: 20px; }
@media (min-width: 980px) { .track-block { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 40px; padding: 40px; } }
.tb-topic { display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tb-title { margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.tb-code { font-size: clamp(54px, 9vw, 88px); line-height: .9; letter-spacing: -.05em; font-weight: 700; }
.tb-name { font-size: clamp(22px, 3vw, 28px); font-weight: 500; color: var(--muted); letter-spacing: -.02em; }
.tb-desc { color: var(--muted); margin: 16px 0 18px; max-width: 30rem; }
.tb-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--faint); }
.tb-stats b { color: var(--text); font-weight: 600; }
.tb-pixels { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 24px; }
.tb-pixels i { width: 18px; height: 18px; border-radius: 3px; border: 2px solid var(--c); }
.tb-pixels i.on { background: var(--c); }
.tb-groups { display: grid; gap: 22px; align-content: start; }
.tb-gname { display: flex; align-items: baseline; gap: 10px; font: 600 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.tb-gname span { color: var(--orange); }
.tb-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tb-list li { margin: 0; border-bottom: 1px solid var(--line); }
.tb-list a { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: start; padding: 18px 4px; color: var(--text); text-decoration: none; }
.tb-list a:hover .t b { color: var(--orange); }
.tb-list .n { font: 600 18px var(--mono); color: var(--faint); line-height: 1.2; }
.tb-list .t b { display: block; font-size: 18px; font-weight: 600; line-height: 1.3; transition: color .2s; }
.tb-list .t small { display: block; color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.tb-list .m { font: 13px var(--mono); color: var(--faint); white-space: nowrap; padding-top: 3px; }
@media (max-width: 640px) { .track-block { padding: 22px 18px; } .tb-list a { grid-template-columns: 36px 1fr; } .tb-list .m { grid-column: 2; padding: 0; } }
.recent { margin-top: 48px; }
.recent-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.recent-head h2 { font-size: 22px; }
.recent-head a { color: var(--muted); font-size: 15px; text-decoration: none; }
.recent .chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- glossary ---------- */
.g-page { max-width: var(--doc-w); margin: 0 auto; }
.g-tools { position: sticky; top: var(--header-h); z-index: 5; background: var(--bg); padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.g-search { width: 100%; font: 16px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 10px 18px; }
.g-letters { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.g-letters a { font: 600 13px var(--mono); color: var(--muted); text-decoration: none; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); }
.g-letter { font: 700 15px var(--mono); color: var(--orange); margin: 32px 0 6px; }
.g-entry { padding: 18px 0; border-top: 1px solid var(--line); scroll-margin-top: 170px; }
.g-entry:target { background: linear-gradient(90deg, color-mix(in srgb, var(--teal) 10%, transparent), transparent 70%); }
.g-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.g-term { font-size: 22px; font-weight: 700; margin: 0; }
.g-en { font: 13px var(--mono); color: var(--faint); }
.g-short { margin: 6px 0; font-weight: 500; }
.g-long { color: var(--muted); font-size: 15.5px; margin-bottom: 8px; }
.g-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--faint); }
.g-foot a { color: var(--muted); }
.g-see a { margin-right: 8px; }

/* ---------- popover ---------- */
.pop { position: fixed; z-index: 60; width: min(360px, calc(100vw - 32px)); background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); font-size: 15px; line-height: 1.5; }
.pop[hidden] { display: none; }
.pop-k { display: flex; align-items: center; gap: 8px; font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.pop-k::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.pop.is-cite .pop-k { color: var(--blue); }
.pop h5 { margin: 6px 0 0; font-size: 17px; }
.pop .pop-en { font: 12.5px var(--mono); color: var(--faint); }
.pop p { margin: 8px 0 10px; }
.pop blockquote { margin: 8px 0 10px; padding-left: 10px; border-left: 2px solid var(--blue); font-style: italic; }
.pop a { font-size: 14px; }
@media (max-width: 640px) { .pop { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; border-radius: 16px; padding: 16px 18px 20px; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.preview-banner { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 70; background: var(--yellow); color: #000; font: 700 12px var(--mono); letter-spacing: .12em; padding: 6px 14px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
