/* ==========================================================================
   OPENLAB — design system
   Open-source platform aesthetic: monospace chrome, sans prose, repo pages,
   docs sidebars. Light (default, GitHub-like) + dark theme. Contrast-checked.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-inset: #eff2f5;
  --bg-overlay: #ffffff;
  --border: #d0d7de;
  --border-muted: #e4e8ec;
  --fg: #1f2328;
  --fg-muted: #59636e;      /* 5.7:1 on white */
  --fg-subtle: #6e7781;     /* 4.6:1 on white */
  --accent: #0969da;        /* 4.9:1 on white */
  --accent-fg: #ffffff;
  --accent-subtle: #ddf4ff;
  --accent-muted: #54aeff66;
  --success: #1a7f37;
  --success-subtle: #dafbe1;
  --attention: #9a6700;
  --attention-subtle: #fff8c5;
  --danger: #cf222e;
  --danger-subtle: #ffebe9;
  --done: #8250df;
  --done-subtle: #fbefff;
  --code-bg: #f6f8fa;
  --code-line: #6e7781;
  --shadow: 0 1px 0 rgba(31,35,40,.04), 0 8px 24px rgba(140,149,159,.2);
  --radius: 6px;
  --radius-lg: 10px;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wrap: 1280px;
  --gutter: clamp(16px, 3vw, 32px);
  --dur: .18s;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-subtle: #161b22;
  --bg-inset: #010409;
  --bg-overlay: #161b22;
  --border: #30363d;
  --border-muted: #21262d;
  --fg: #e6edf3;
  --fg-muted: #9aa4ae;      /* 7.4:1 on #0d1117 */
  --fg-subtle: #8b949e;     /* 6.2:1 */
  --accent: #4493f8;        /* 6.1:1 */
  --accent-fg: #0d1117;
  --accent-subtle: #121d2f;
  --accent-muted: #388bfd66;
  --success: #3fb950;
  --success-subtle: #12261e;
  --attention: #d29922;
  --attention-subtle: #272115;
  --danger: #f85149;
  --danger-subtle: #2d1214;
  --done: #a371f7;
  --done-subtle: #221a2f;
  --code-bg: #161b22;
  --code-line: #6e7681;
  --shadow: 0 0 0 1px #30363d, 0 8px 24px rgba(1,4,9,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-sans); font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: .3em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
code { font-size: .9em; background: var(--bg-inset); padding: .1em .35em; border-radius: 4px; }
pre code { background: none; padding: 0; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.small { font-size: .875rem; }
.xs { font-size: .8rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; background: var(--accent); color: var(--accent-fg); padding: 8px 14px; border-radius: var(--radius); font-family: var(--font-mono); }
.skip-link:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Layout ---------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 900px; }
main { display: block; }
.page { padding-top: 1.5rem; padding-bottom: 3rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.layout-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.layout-sidebar-left { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 900px) {
  .layout-sidebar, .layout-sidebar-left { grid-template-columns: minmax(0, 1fr) !important; }
}
.layout-sidebar > *, .layout-sidebar-left > *, .grid-2 > *, .grid-3 > *, .entry-grid > *, .cd-summary > * { min-width: 0; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }

/* ---------- Header ---------- */
.site-header { background: var(--bg-subtle); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 56px; flex-wrap: wrap; padding-top: .4rem; padding-bottom: .4rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--fg); font-family: var(--font-mono); font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand svg { width: 28px; height: 28px; }
.site-nav { display: flex; gap: .15rem; flex-wrap: wrap; align-items: center; margin-left: auto; }
.site-nav a, .site-nav button { font-family: var(--font-mono); font-size: .85rem; color: var(--fg); padding: .4rem .6rem; border-radius: var(--radius); text-decoration: none; background: none; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.site-nav a:hover, .site-nav button:hover { background: var(--bg-inset); text-decoration: none; }
.site-nav a[aria-current="page"] { border-color: var(--border); background: var(--bg); font-weight: 600; }
.site-nav .back-hub { color: var(--fg-muted); }
.nav-toggle { display: none; }
@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .site-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; padding-bottom: .5rem; }
  .site-nav.open { display: flex; }
  .site-nav a, .site-nav button { width: 100%; justify-content: flex-start; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2rem 0; color: var(--fg-muted); font-size: .875rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: center; }
.site-footer .foot-links { display: flex; flex-wrap: wrap; gap: 1rem; font-family: var(--font-mono); font-size: .8rem; }
.site-footer .quiet { font-size: .8rem; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-subtle); color: var(--fg); font-family: var(--font-mono); font-size: .875rem; cursor: pointer; text-decoration: none; line-height: 1.3; white-space: nowrap; transition: background var(--dur), border-color var(--dur); }
.btn:hover { background: var(--bg-inset); text-decoration: none; border-color: var(--fg-subtle); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: var(--success); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-subtle); border-color: var(--danger); }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn[aria-pressed="true"] { background: var(--accent-subtle); border-color: var(--accent); color: var(--fg); font-weight: 600; }
.input, textarea.input, select.input { width: 100%; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg); font-family: var(--font-sans); font-size: 1rem; }
.input.mono { font-family: var(--font-mono); font-size: .9rem; }
.input:focus { border-color: var(--accent); outline: 2px solid var(--accent-muted); outline-offset: 0; }
textarea.input { min-height: 6rem; resize: vertical; line-height: 1.5; }
label.lbl, .lbl { display: block; font-family: var(--font-mono); font-size: .8rem; color: var(--fg-muted); margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .8rem; color: var(--fg-subtle); margin-top: .3rem; }
.field .error { font-size: .8rem; color: var(--danger); margin-top: .3rem; }
.field.invalid .input { border-color: var(--danger); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; min-width: 0; }
legend { font-family: var(--font-mono); font-size: .85rem; padding: 0 .4rem; color: var(--fg-muted); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1rem; height: 1rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; padding: .2rem 0; cursor: pointer; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: inline-flex; align-items: center; padding: 0 .6rem; border: 1px solid var(--border); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--bg-subtle); font-family: var(--font-mono); color: var(--fg-muted); }
.input-prefix .input { border-radius: 0 var(--radius) var(--radius) 0; }
.search-box { display: flex; gap: .5rem; }
.search-box .input { font-family: var(--font-mono); }

/* ---------- Chips, labels, badges ---------- */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--border); font-family: var(--font-mono); font-size: .75rem; line-height: 1.6; color: var(--fg-muted); background: var(--bg-subtle); white-space: nowrap; }
.chip-accent { color: var(--accent); border-color: var(--accent-muted); background: var(--accent-subtle); }
.chip-success { color: var(--success); border-color: var(--success); background: var(--success-subtle); }
.chip-attention { color: var(--attention); border-color: var(--attention); background: var(--attention-subtle); }
.chip-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-subtle); }
.chip-done { color: var(--done); border-color: var(--done); background: var(--done-subtle); }
.chip-btn { cursor: pointer; }
.chip-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); font-weight: 600; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--fg-subtle); }
.dot-physics { background: #8250df; } .dot-chemistry { background: #bf3989; } .dot-biology { background: #1a7f37; }
.dot-electronics { background: #0969da; } .dot-robotics { background: #cf222e; } .dot-computing { background: #6e7781; }
.dot-mathematics { background: #9a6700; } .dot-environmental { background: #0e8a8a; }
.counter { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--bg-inset); font-family: var(--font-mono); font-size: .75rem; text-align: center; color: var(--fg-muted); }

/* ---------- Boxes / cards ---------- */
.box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.box-header { padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg-subtle); font-family: var(--font-mono); font-size: .85rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; border-radius: var(--radius) var(--radius) 0 0; }
.box-body { padding: 1rem; }
.box-row { padding: .75rem 1rem; border-top: 1px solid var(--border-muted); }
.box-row:first-child { border-top: 0; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 1rem; }
.card h3 { margin-top: 0; }
.callout { border-left: 4px solid var(--accent); background: var(--accent-subtle); padding: .75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 1rem; }
.callout-warn { border-left-color: var(--attention); background: var(--attention-subtle); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-subtle); }
.callout-success { border-left-color: var(--success); background: var(--success-subtle); }
.callout p:last-child { margin-bottom: 0; }
.meta-block { font-family: var(--font-mono); font-size: .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); }
.meta-block dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; }
.meta-block dt { padding: .4rem .75rem; color: var(--fg-muted); border-top: 1px solid var(--border-muted); }
.meta-block dd { padding: .4rem .75rem; margin: 0; border-top: 1px solid var(--border-muted); word-break: break-word; }
.meta-block dt:first-of-type, .meta-block dd:first-of-type { border-top: 0; }
.stat { font-family: var(--font-mono); }
.stat .stat-n { font-size: 1.6rem; font-weight: 600; display: block; line-height: 1.1; }
.stat .stat-l { font-size: .75rem; color: var(--fg-muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: .55rem .75rem; text-align: left; border-top: 1px solid var(--border-muted); vertical-align: top; }
.tbl thead th { border-top: 0; background: var(--bg-subtle); font-family: var(--font-mono); font-size: .75rem; font-weight: 600; color: var(--fg-muted); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.tbl tfoot td { font-weight: 600; background: var(--bg-subtle); }
.tbl .core-tag { font-family: var(--font-mono); font-size: .7rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .1rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tabs [role="tab"] { background: none; border: 0; border-bottom: 2px solid transparent; padding: .6rem .8rem; font-family: var(--font-mono); font-size: .85rem; color: var(--fg-muted); cursor: pointer; white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; margin-bottom: -1px; }
.tabs [role="tab"]:hover { color: var(--fg); background: var(--bg-subtle); border-radius: var(--radius) var(--radius) 0 0; }
.tabs [role="tab"][aria-selected="true"] { color: var(--fg); border-bottom-color: #fd8c73; font-weight: 600; }
[role="tabpanel"] { padding-top: 1.25rem; }
[role="tabpanel"][hidden] { display: none; }

/* ---------- Repo rows (search results) ---------- */
.repo-list { border: 1px solid var(--border); border-radius: var(--radius); }
.repo-row { padding: .9rem 1rem; border-top: 1px solid var(--border-muted); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1.5rem; }
.repo-row:first-child { border-top: 0; }
.repo-row h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.repo-row h3 a { font-family: var(--font-mono); }
.repo-row p { margin: 0 0 .5rem; color: var(--fg-muted); font-size: .92rem; }
.repo-row .meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-family: var(--font-mono); font-size: .75rem; color: var(--fg-muted); }
.repo-row .cost { font-family: var(--font-mono); font-weight: 600; text-align: right; white-space: nowrap; }
.repo-row .cost small { display: block; font-weight: 400; color: var(--fg-muted); }
.repo-row mark { background: var(--attention-subtle); color: inherit; border-radius: 2px; padding: 0 .1em; }
@media (max-width: 600px) { .repo-row { grid-template-columns: 1fr; } .repo-row .cost { text-align: left; } }

/* ---------- Code blocks ---------- */
.codeblock { border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); margin: 0 0 1.25rem; overflow: hidden; }
.codeblock .cb-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .4rem .75rem; border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: .78rem; color: var(--fg-muted); flex-wrap: wrap; }
.codeblock .cb-head .actions { display: flex; gap: .3rem; }
.codeblock pre { margin: 0; overflow-x: auto; padding: .75rem 0; font-size: .82rem; line-height: 1.55; tab-size: 4; }
.codeblock .ln { display: grid; grid-template-columns: 3.2em 1fr; }
.codeblock .ln > span:first-child { text-align: right; padding-right: 1em; color: var(--code-line); user-select: none; }
.codeblock .ln > span:last-child { padding-right: 1rem; white-space: pre; }
.codeblock .ln:hover { background: var(--bg-inset); }

/* ---------- Docs sidebar tree ---------- */
.doc-tree { font-family: var(--font-mono); font-size: .85rem; position: sticky; top: 72px; }
.doc-tree ul { list-style: none; padding: 0; margin: 0; }
.doc-tree li { margin: 0; }
.doc-tree a { display: block; padding: .3rem .6rem; color: var(--fg); border-left: 2px solid transparent; border-radius: 0 var(--radius) var(--radius) 0; }
.doc-tree a:hover { background: var(--bg-subtle); text-decoration: none; }
.doc-tree a[aria-current="true"], .doc-tree a.active { border-left-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.doc-tree .tree-group { color: var(--fg-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: .8rem .6rem .2rem; }
.doc-tree ul ul a { padding-left: 1.4rem; }
.doc-tree ul ul a::before { content: '└ '; color: var(--fg-subtle); }
.prose { max-width: 76ch; }
.prose h2 { padding-bottom: .3em; border-bottom: 1px solid var(--border); margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }
.prose table { font-size: .9rem; }

/* ---------- Activity feed / timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); margin-left: .6rem; }
.timeline li { position: relative; padding: .3rem 0 .8rem 1.25rem; font-size: .9rem; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: .7rem; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--fg-subtle); }
.timeline li.ev-rating::before { border-color: var(--attention); }
.timeline li.ev-issue::before { border-color: var(--danger); }
.timeline li.ev-fork::before, .timeline li.ev-contribution::before { border-color: var(--success); }
.timeline li.ev-improvement::before, .timeline li.ev-moderation::before { border-color: var(--done); }
.timeline .when { font-family: var(--font-mono); font-size: .72rem; color: var(--fg-subtle); }
.commit-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.commit-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; padding: .6rem .9rem; border-top: 1px solid var(--border-muted); align-items: baseline; font-size: .9rem; }
.commit-list li:first-child { border-top: 0; }
.commit-list .sha { font-family: var(--font-mono); color: var(--accent); font-size: .8rem; }
.commit-list .ver { font-family: var(--font-mono); font-size: .75rem; color: var(--fg-muted); white-space: nowrap; }

/* ---------- Stars ---------- */
.stars { font-family: var(--font-mono); font-size: .85rem; color: var(--attention); white-space: nowrap; }
.star-input { display: inline-flex; gap: .15rem; }
.star-input button { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--fg-subtle); padding: .1rem; }
.star-input button[aria-checked="true"], .star-input button.lit { color: var(--attention); }

/* ---------- Toast & misc ---------- */
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius); font-family: var(--font-mono); font-size: .85rem; z-index: 200; box-shadow: var(--shadow); max-width: min(90vw, 480px); }
.toast[hidden] { display: none; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--fg-muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty h3 { font-family: var(--font-mono); font-weight: 600; }
.progress { height: .5rem; background: var(--bg-inset); border-radius: 999px; overflow: hidden; border: 1px solid var(--border-muted); }
.progress > span { display: block; height: 100%; background: var(--success); }
.progress.partial > span { background: var(--attention); }
.kbd { font-family: var(--font-mono); font-size: .75rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: var(--bg-subtle); }
details.disc { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; margin-bottom: .5rem; }
details.disc summary { cursor: pointer; padding: .6rem .9rem; font-family: var(--font-mono); font-size: .85rem; }
details.disc summary:hover { background: var(--bg-subtle); }
details.disc > div { padding: 0 .9rem .9rem; }
.diff-line { font-family: var(--font-mono); font-size: .82rem; padding: .15rem .6rem; white-space: pre-wrap; word-break: break-word; }
.diff-del { background: var(--danger-subtle); color: var(--danger); }
.diff-add { background: var(--success-subtle); color: var(--success); }
.svg-preview { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: .5rem; max-height: 360px; overflow: auto; }
.svg-preview svg { width: 100%; height: auto; max-height: 340px; }
.cad-list li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .5rem 1rem; align-items: center; }

/* ---------- Landing ---------- */
.hero { padding: 3rem 0 2rem; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-subtle), var(--bg)); }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); max-width: 22ch; }
.hero .tagline { font-family: var(--font-mono); color: var(--accent); font-size: .9rem; margin-bottom: .75rem; }
.hero .lede { font-size: 1.1rem; color: var(--fg-muted); max-width: 60ch; }
.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.entry { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); padding: 1.1rem; box-shadow: var(--shadow); }
.entry h2 { font-family: var(--font-mono); font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.entry h2 .n { color: var(--accent); }
.entry p { font-size: .9rem; color: var(--fg-muted); }
.section { padding: 2.5rem 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.subject-grid a { border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .8rem; color: var(--fg); font-family: var(--font-mono); font-size: .85rem; display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.subject-grid a:hover { border-color: var(--accent); text-decoration: none; background: var(--bg-subtle); }
.problem-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

/* ---------- Cost-down report ---------- */
.cd-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.swap-row td .arrow { color: var(--fg-subtle); font-family: var(--font-mono); }
.impact-bar { display: inline-block; width: 60px; height: 6px; background: var(--bg-inset); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.impact-bar > span { display: block; height: 100%; background: var(--attention); }

/* ---------- Print ---------- */
@media print { .site-header, .site-footer, .no-print { display: none !important; } }
