/* stylesheet.org — a small, standards-compliant CSS framework.
 *
 * Semantic HTML + a handful of utility classes. No custom tags, no IDs, no
 * JavaScript. Write a normal page (header / main / footer, one h1 in main,
 * sections by depth) and it looks right; reach for a class only where HTML has
 * no element for the job (layout and a few presentational components).
 *
 * The file is in five sections. A theme only ever changes section 2.
 *   1. RESET          — constant
 *   2. THEME TOKENS   — :root variables (colour, type, space, shape)
 *   3. LAYOUT         — constant: row, column, grid, flow, stretch
 *   4. ELEMENTS       — constant: semantic tags styled directly
 *   5. COMPONENTS     — constant: panel, card, chip, buttons, status, paging, menu
 *
 * Layout model: children of .row / .column take their natural size and stack
 * from the start — a fixed item is just a width/height, no class. .stretch is
 * the one flexing element (empty = a spacer; with content = a flexible region;
 * .stretch-2 / .stretch-3 weight the shares).
 */

/* ============================================================
   1. RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { max-width: 100%; height: auto; display: block; }

/* ============================================================
   2. THEME TOKENS  — the only section a theme changes  (green / black / white / grey / red)
   ============================================================ */
:root {
  /* colour */
  --bg: #f4f4f4;               /* light grey page base */
  --surface: #ffffff;          /* white panels, cards */
  --surface-soft: #ececec;     /* nested panels / soft grey fills */
  --section-bg: #f0f0f0;
  --band: #ececec;             /* full-width section band */
  --pad: 28px;                 /* content side padding */
  --header-bg: #111111;        /* black menu */
  --header-bg-2: #1c1c1c;      /* charcoal sub-nav */
  --header-bg-3: #262626;      /* slightly lighter third bar */
  --fg: #111111;               /* black text */
  --heading: #111111;
  --muted: #6b6b6b;            /* grey */
  --border: #d4d4d4;
  --border-strong: #b0b0b0;
  --accent: #1a9d3a;           /* green — buttons, links, active */
  --accent-hover: #147a2c;     /* darker green */
  --accent-fg: #ffffff;
  --accent-tint: #d8f5de;      /* pale green — hovers, quotes */
  --accent-2: #d31b1b;         /* red — contrast chips */
  --accent-2-tint: #fde8e8;
  --code-bg: #111111;          /* black code block */
  --code-fg: #e8e8e8;
  /* syntax highlighting — bright tokens on black */
  --hl-tag:     #7cc4ff;
  --hl-attr:    #f0c66b;
  --hl-value:   #8fe0a0;
  --hl-comment: #9b9b9b;
  --hl-kw:      #cbb6f5;
  --hl-fn:      #7fd6e0;
  --hl-num:     #f0a98a;
  --ok-fg: #147a2c; --ok-bg: #d8f5de; --ok-bd: #8fd9a4;
  --err-fg: #d31b1b; --err-bg: #fde8e8; --err-bd: #f5b4b4;
  --info-fg: #111111; --info-bg: #ececec; --info-bd: #b0b0b0;
  --warn-fg: #d31b1b; --warn-bg: #fde8e8; --warn-bd: #f5b4b4;
  /* type */
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-hand: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* space + shape */
  --gap: 16px;
  --sep-1: 28px;
  --sep-2: 20px;
  --sep-3: 14px;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --maxw: 1100px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 6px 14px -4px rgba(0, 0, 0, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 30px -12px rgba(0, 0, 0, 0.22);
}

/* ============================================================
   3. LAYOUT  — structure only; references --gap, never colour
   ============================================================ */
.row, .column { display: flex; gap: var(--gap); }
.row { flex-direction: row; }
.column { flex-direction: column; }
.row > *, .column > * { flex: 0 0 auto; min-width: 0; min-height: 0; }   /* natural size, from the start */
.stretch { flex: 1 1 0; min-width: 0; min-height: 0; }                    /* eats / shares the remainder */
.stretch-2 { flex-grow: 2; }
.stretch-3 { flex-grow: 3; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* explicit grids collapse gracefully on narrow screens */
@media (max-width: 860px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ============================================================
   4. ELEMENTS  — semantic tags styled directly
   ============================================================ */
body {
  background: radial-gradient(130% 760px at 50% 120px, #f7f7f7, #ffffff);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}

/* typography */
h1, h2, h3, h4, h5, h6 { color: var(--heading); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
h4 { font-size: 1.02rem; letter-spacing: 0; }
h5, h6 { font-size: 0.9rem; letter-spacing: 0; }
/* Headings carry no spacing of their own. Within a part everything is one gap; the only
   margin in the flow is a section's own top margin (see the sections rules below), and a
   heading is always its section's first child, so it sits flush with nothing to reset. */
a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
strong { font-weight: 650; color: var(--heading); }
small { color: var(--muted); font-size: 0.875em; }
ul, ol { padding-left: 1.4em; }
li { margin: 5px 0; }
li::marker { color: var(--accent); }
/* description list — term → description pairs, laid out as two columns */
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
dt { font-weight: 600; color: var(--heading); }
dd { color: var(--fg); }
hr { border: none; border-top: 1px solid var(--border); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-soft); border: 1px solid var(--border); padding: 0.1em 0.4em; border-radius: 6px; }
pre { background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; box-shadow: var(--shadow-sm); font-size: 0.85rem; line-height: 1.6; width: 100%; max-width: 54rem; margin-inline: auto; }   /* one consistent width (fills to the cap, not to its content), centred, a touch narrower than the content — and it fills once the screen itself is narrower */
/* a captioned code block: the figure is the centred, capped unit; the code fills it and the short caption sits beneath, aligned to the code's left edge */
figure:has(> pre) { width: 100%; max-width: 54rem; margin-inline: auto; }
figure:has(> pre) > pre { max-width: 100%; }
pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
/* syntax highlighting: a language tab pinned to the top-right, and per-token colours.
   Spans are baked into the markup — <code class="html|css|js"> with .tag/.attr/.value/.comment inside. */
pre { position: relative; }                             /* positioning context for the language tab */
pre > code[class] { display: block; padding-top: 14px; }  /* reserve room so the tab clears the first line */
pre > code[class]::before {
  position: absolute; top: 0; right: 0; padding: 3px 11px;
  font-family: var(--font); font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--code-fg); background: rgba(255, 255, 255, 0.06);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0 var(--radius-sm) 0 var(--radius-sm);
}
pre > code.html::before { content: "html"; }
pre > code.css::before  { content: "css"; }
pre > code.js::before   { content: "javascript"; }
pre > code.python::before { content: "python"; }
pre > code.c::before    { content: "c"; }
pre > code.sh::before   { content: "shell"; }
code.html         { color: #f5f5f5; }   /* html: plain element text reads white, not the warm cream */
pre code .tag     { color: var(--hl-tag); }
pre code .attr    { color: var(--hl-attr); }
pre code .value   { color: var(--hl-value); }
pre code .comment { color: var(--hl-comment); }
pre code .kw      { color: var(--hl-kw); }
pre code .fn      { color: var(--hl-fn); }
pre code .num     { color: var(--hl-num); }
blockquote { padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-tint); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--fg); }
/* figure: a block (image, code) tied to its caption — the caption is part of the
   component, sitting tight at a fixed distance, outside the flow rhythm */
figure { display: flex; flex-direction: column; gap: 6px; }
figcaption { color: var(--muted); font-size: 0.9em; text-align: center; }   /* caption centred beneath the block */

/* header: the site chrome — a black menu, sticky, stacked bars */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
nav > a, nav > span { font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }   /* a bar's title */
nav > a:hover { text-decoration: none; }
nav > ul { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
nav > ul > li { margin: 0; }
nav ul a { display: block; padding: 7px 13px; border-radius: 8px; white-space: nowrap; color: var(--fg); font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: background 0.15s, color 0.15s; }
nav ul a:hover { background: rgba(0, 0, 0, 0.07); color: var(--heading); text-decoration: none; }
nav a[aria-current] { background: var(--accent); color: #fff; }
nav a[aria-current]:hover { background: var(--accent); color: #fff; }
header > nav { padding: 12px 28px; }
header > nav:first-of-type > a { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-hand); font-weight: 700; font-size: 1.7rem; letter-spacing: 0; line-height: 1; }   /* brand: sun icon + bold handwritten wordmark */
header > nav:first-of-type > a img { width: 32px; height: 32px; display: block; }
header > nav:first-of-type > ul { margin-left: auto; }                        /* brand left, links right */
header > nav ~ nav { border-top: 1px solid rgba(0, 0, 0, 0.08); background: var(--header-bg-2); padding-top: 9px; padding-bottom: 9px; }
header > nav ~ nav > span { font-size: 0.85rem; color: var(--accent-hover); text-transform: uppercase; letter-spacing: 0.05em; }
header > nav ~ nav ul a { font-size: 0.9rem; }

/* third-level page bar: a paler band under the section bar */
header > nav ~ nav ~ nav { background: var(--header-bg-3); padding-top: 8px; padding-bottom: 8px; }
header > nav ~ nav ~ nav > span { font-size: 0.8rem; }
header > nav ~ nav ~ nav ul a { font-size: 0.88rem; padding: 5px 11px; }

/* nav dropdowns (no JS): a nested <ul> in <details> (click) or bare (hover/focus) */
nav li { position: relative; }
nav li > ul, nav details > ul {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 210px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
nav li > ul li, nav details > ul li { margin: 0; }
nav summary { display: block; padding: 7px 13px; border-radius: 8px; cursor: pointer; color: var(--fg); font-size: 0.95rem; font-weight: 500; list-style: none; }
nav summary:hover { background: rgba(0, 0, 0, 0.07); color: var(--heading); }
nav summary::-webkit-details-marker { display: none; }
nav summary::after { content: "  ▾" / ""; color: var(--muted); }
nav details[open] > summary { background: rgba(0, 0, 0, 0.07); color: var(--heading); }
nav details[open] > summary::after { content: "  ▴" / ""; }
nav li:has(> ul) > a::after { content: "  ▾" / ""; color: var(--muted); }
nav li > ul { visibility: hidden; opacity: 0; transform: translateY(-4px); transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s; }
nav li:hover > ul, nav li:focus-within > ul { visibility: visible; opacity: 1; transform: none; }

/* a category on the Components bar stays lit while the current page is one of its items */
header > nav ~ nav li:has(> ul a[aria-current]) > a { background: var(--accent); color: #fff; }
header > nav ~ nav li:has(> ul a[aria-current]) > a:hover { background: var(--accent); color: #fff; }

/* main: a white intro with a warm radial glow; sections sit on pale yellow */
main {
  flex: 1 0 auto;                /* grow to fill: footer sticks to the bottom */
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 44px var(--pad) 0;
  display: flex; flex-direction: column; gap: 0;
  /* no background here — the intro shows the body glow through, full-width with no edge */
}
/* darker band filler — keeps short pages banded all the way down to the footer */
main::after { content: ""; flex: 1 0 auto; margin-inline: calc(var(--pad) * -1); background: var(--band); box-shadow: 0 0 0 100vw var(--band); clip-path: inset(0 -100vw); }
main > h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); letter-spacing: -0.025em; line-height: 1.12; }
main > h1 + p { max-width: 72ch; font-size: 1.15rem; color: var(--muted); }
/* a top-level feature list (e.g. the homepage goals): roomy, a lead line each */
main > ul { padding-left: 1.3em; max-width: 70ch; }
main > ul > li { margin: 0 0 18px; }
main > ul > li:last-child { margin-bottom: 0; }
main > ul > li > strong { font-size: 1.05rem; }
main > ul > li > p { margin-top: 4px; color: var(--muted); }

/* A section is the always-on structural unit — one around each heading and its content,
   nested to mirror the outline. Flow spacing is two rules and nothing else:
     • content rides one --gap, imposed by the container on its direct children (any element);
     • a subsection carries the between-part margin --sep, which tightens with nesting depth.
   Only sections set a margin; a first child is always flush. */
section { display: flex; flex-direction: column; }

main > *, main section > *                       { margin-top: var(--gap); }   /* content rhythm */
main > :first-child, main section > :first-child { margin-top: 0; }            /* first child flush */

main > *                  { --sep: var(--sep-1); }   /* separation tightens with depth */
main section > *          { --sep: var(--sep-2); }
main section section > *  { --sep: var(--sep-3); }

main section > section    { margin-top: var(--sep); }   /* a subsection sits --sep apart */

/* Backgrounds are a styling layer applied by position (or the user's own selector) — no
   class. The default theme paints the first-level sections as full-width bands: content
   stays centred while the background bleeds edge-to-edge via a clipped spread shadow. The
   first band keeps its --sep above it; the rest run flush. Nested sections stay transparent. */
main > section               { margin-top: 0; margin-inline: calc(var(--pad) * -1); padding: var(--sep) var(--pad); background: var(--band); box-shadow: 0 0 0 100vw var(--band); clip-path: inset(0 -100vw); }
main > section:first-of-type { margin-top: var(--sep); }
main > section > h2          { padding-bottom: 8px; border-bottom: 2px solid var(--border-strong); }

/* tables */
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; padding: 8px 0; font-weight: 600; color: var(--muted); }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
thead th { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--border-strong); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--accent-tint); }
tbody tr:last-child td { border-bottom: none; }

/* forms */
form { display: grid; gap: 15px; }
fieldset { padding: 16px; display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
legend { font-weight: 600; padding: 0 6px; color: var(--heading); }
label > p { font-weight: 550; font-size: 0.9rem; margin-bottom: 6px; color: var(--heading); }
input, select, textarea { width: 100%; padding: 9px 12px; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 7px; accent-color: var(--accent); }
/* The 100% width above is for a stacked form (form / fieldset are grids). In a row
   a field is a flex item: let it shrink so it shares the free space and fits the
   flow instead of forcing 100% and pushing the row wider. .row > * already sets
   min-width: 0, so it can shrink cleanly; checkboxes and radios are width: auto,
   so they have nothing to shrink and stay their natural size. */
.row > :is(input, select, textarea) { flex-shrink: 1; }

/* buttons (the element) + link buttons */
button, input[type="submit"], input[type="reset"], input[type="button"], a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: auto; padding: 9px 18px; font: inherit; font-weight: 550; line-height: 1.4;
  cursor: pointer; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
button:hover, input[type="submit"]:hover, input[type="button"]:hover, a.button:hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg);
  box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px);
}
/* button variants */
.button.secondary, input[type="reset"], button.secondary { background: var(--surface); color: var(--fg); border-color: var(--border-strong); box-shadow: none; }
.button.secondary:hover, input[type="reset"]:hover, button.secondary:hover { background: var(--surface-soft); color: var(--fg); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.button.ghost, button.ghost { background: transparent; color: var(--accent); border-color: transparent; box-shadow: none; }
.button.ghost:hover, button.ghost:hover { background: var(--accent-tint); color: var(--accent-hover); }
.button.small, button.small { padding: 5px 12px; font-size: 0.9rem; }
.button.large, button.large { padding: 12px 24px; font-size: 1.05rem; }

/* menu: a sidebar nav */
menu { display: block; margin: 0; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
menu ol, menu ul { list-style: none; margin: 0; padding: 0; }
menu li { margin: 2px 0; }
menu p { margin: 12px 8px 4px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
menu a { display: block; padding: 7px 12px; color: var(--fg); border-radius: 8px; transition: background 0.15s; }
menu a:hover { background: var(--surface-soft); text-decoration: none; }
menu a[aria-current] { background: var(--accent-tint); color: var(--accent-hover); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }

/* ============================================================
   5. COMPONENTS
   ============================================================ */
/* panel — a soft surface (a neutral skin that composes with layout classes).
   card — a styling class, not an element: a bordered, padded surface you add to
   whatever already carries the meaning (article, section, p, div, a). It only
   paints — children flow at the system --gap, so adding or removing .card never
   reflows them. <article> is not boxed on its own; add .card when you want the
   surface. */
.panel { display: block; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.panel .panel { background: var(--surface-soft); box-shadow: none; }
.card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--gap); transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.12s ease; }
.card .card { background: var(--surface-soft); box-shadow: none; }   /* a nested card is an inset surface — same gap, just softer */
/* a card title takes no special colour: a plain heading stays the heading colour; a
   heading that is a link gets the link colour from the <a>, so accent follows the link. */
/* card links — two ways to make a whole card clickable.
   boxed link (a.card): the whole card is one <a>. Simplest, but it can hold no other links.
   stretched title link (.stretch-link): a card whose heading is a link; the link is stretched
   over the whole surface, so the card opens from anywhere while inner links/buttons still work
   and the card keeps its hover. Trade-off: card text isn't selectable (the overlay is the link). */
a.card { color: inherit; }
a.card:hover, .grid > a.card:hover { text-decoration: none; box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-2px); }
.stretch-link { position: relative; }
.stretch-link :is(h1, h2, h3, h4, h5, h6) a::after { content: ""; position: absolute; inset: 0; }
.stretch-link a:not(:is(h1, h2, h3, h4, h5, h6) a), .stretch-link button { position: relative; z-index: 1; }
.stretch-link:hover { text-decoration: none; box-shadow: var(--shadow-md); border-color: var(--accent); transform: translateY(-2px); }
.stretch-link:hover :is(h1, h2, h3, h4, h5, h6) a { color: var(--accent-hover); text-decoration: underline; }   /* the title link fills the card, so its lit state follows the CARD's hover — steady wherever the pointer is, even over a sub-link */

/* thumb — a small line-diagram of a component page, sitting atop an overview card.
   A wireframe in the site's three tones only: the darker yellow (#ffd21a) draws every
   outline, the lighter yellow (#fff6cf) is the one fill, everything else stays white.
   No frame and no vertical padding — each SVG's viewBox is cropped to its content, so it
   sits tight top-and-bottom; the side padding keeps it narrower than the card. */
.thumb { display: block; width: 100%; height: auto; padding: 0 12px; }
.thumb .box { fill: #fff; stroke: var(--header-bg); stroke-width: 2; }               /* a plain surface — outline only */
.thumb .bar { fill: var(--surface-soft); stroke: var(--header-bg); stroke-width: 2; } /* a filled bar / nav */
.thumb .at  { fill: var(--surface-soft); stroke: var(--header-bg); stroke-width: 2; } /* a highlighted / active surface */
.thumb .a   { fill: var(--surface-soft); stroke: var(--header-bg); stroke-width: 2; } /* headings, buttons, the brand mark — a filled accent */
.thumb .m   { fill: none; stroke: var(--header-bg); stroke-width: 1.5; }              /* text lines — outlined */
.thumb .ln  { stroke: var(--header-bg); stroke-width: 1.5; }                          /* table rules */

/* chip — an inline pill label; a button/a chip is interactive */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 0.85rem; font-weight: 550; line-height: 1.5; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); }
button.chip, a.chip { cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s, color 0.15s; }
button.chip:hover, a.chip:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-hover); text-decoration: none; }
.chip.accent { background: var(--accent-tint); border-color: transparent; color: var(--accent-hover); }
.chip.teal { background: var(--accent-2-tint); border-color: transparent; color: var(--accent-2); }

/* buttons — a group of actions */
.buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* tabset — an in-page tab set, no JavaScript and no IDs. Inside .tabset a <label> holding a
   radio is a tab, and the element immediately after it is that tab's content. The radios
   share a name, so exactly one is ever chosen; :has() hides every unchosen tab's content
   and leaves the chosen one showing. Anything else you drop in (a lead line, a note) is
   neither a tab nor hidden, so it rides along above the strip. The radios hold the state,
   so a script can read the choice from a radio's value via its change event. */
/* the unit is a soft strip; the tabs ride along its top, the chosen tab's content joins
   flush beneath as one bordered card */
.tabset { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 8px; background: var(--surface-soft); border: 1px solid var(--border-strong); border-radius: var(--radius); }
/* a tab — a label styled like a button; its radio is taken out of sight but stays focusable */
.tabset > label { order: 1; position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; cursor: pointer; font-weight: 550; line-height: 1.4; color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s; }
.tabset > label:hover { border-color: var(--accent); color: var(--accent-hover); }
.tabset > label:has(input:checked) { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); box-shadow: var(--shadow-md); }
.tabset > label:has(input:checked):hover { color: var(--accent-fg); }
.tabset > label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabset > label > input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); overflow: hidden; }
/* the content — the element straight after a tab. It breaks out to the strip's edges and
   joins flush at the bottom; only the chosen tab's content is left showing. */
.tabset > label:has(input) + * { order: 2; flex: 0 0 auto; width: calc(100% + 16px); margin: 0 -8px -8px; padding: 20px; background: var(--surface); border-top: 1px solid var(--border-strong); border-radius: 0 0 var(--radius) var(--radius); }
.tabset > label:has(input) + * > * + * { margin-top: var(--gap); }        /* content inside the panel rides the one gap */
.tabset > label:has(input:not(:checked)) + * { display: none; }           /* hide every unchosen tab's content */
/* vertical — the tabs stack in a column and the chosen content fills the space beside them */
.tabset.vertical { display: grid; grid-template-columns: max-content minmax(0, 1fr); row-gap: 0; column-gap: 8px; align-content: start; }
.tabset.vertical > label { grid-column: 1; width: 100%; margin-bottom: 6px; justify-content: flex-start; }
.tabset.vertical > label:has(input) + * { grid-column: 2; grid-row: 1 / span 50; width: auto; margin: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }

/* accordion — a stack of disclosure panels built on the native <details> element. Each
   row is a <details>; its <summary> is the always-visible header and the rest of the
   content shows when the row is open. No JS — the browser owns open/closed. Give every
   <details> the same name to make a single-open set (opening one closes the siblings);
   leave the name off and any number of rows can stand open at once. Wrapping the rows in
   .accordion fuses them into one bordered unit with shared dividers. */
.accordion { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.accordion > details + details { border-top: 1px solid var(--border-strong); }   /* a divider between rows */
.accordion > details > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 600; color: var(--heading); background: var(--surface); cursor: pointer; list-style: none; transition: background 0.15s; }
.accordion > details > summary:hover { background: var(--surface-soft); }
.accordion > details > summary::-webkit-details-marker { display: none; }         /* drop the native triangle; the chevron below replaces it */
.accordion > details > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform 0.2s ease; }
.accordion > details[open] > summary { background: var(--surface-soft); border-bottom: 1px solid var(--border-strong); }
.accordion > details[open] > summary::after { transform: rotate(180deg); }
.accordion > details > :not(summary) { padding-inline: 18px; }                    /* body content keeps the header's side inset */
.accordion > details > summary + :not(summary) { padding-top: 14px; }             /* first body block clears the header */
.accordion > details > :last-child:not(summary) { padding-bottom: 16px; }         /* last body block leaves a base */
.accordion > details > :not(summary) + :not(summary) { margin-top: var(--gap); }  /* the content rhythm between body blocks */

/* status — a banner / live region */
.status { display: block; padding: 11px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-weight: 500; }
.status.success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.status.error   { background: var(--err-bg); border-color: var(--err-bd); color: var(--err-fg); }
.status.info    { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }
.status.warning { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }

/* paging — a Pagination nav */
.paging { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.paging a, .paging span { display: inline-block; padding: 7px 13px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.paging a:hover { background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; }
.paging a[aria-current] { background: var(--accent); color: var(--accent-fg); }
.paging span { color: var(--muted); }

/* footer — full-width bar; columns share the row */
footer { flex-shrink: 0; background: var(--bg); border-top: 1px solid var(--border-strong); color: var(--muted); }
footer > .row { width: 100%; padding: 22px var(--pad); align-items: flex-start; flex-wrap: wrap; }
footer > .row:first-of-type { justify-content: space-between; gap: 32px; }
footer > .row:first-of-type > * { flex: 1 1 0; min-width: 10rem; }
footer a { color: var(--muted); text-decoration: underline; }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { margin: 4px 0; }
footer strong { color: var(--heading); }
footer > .row:last-of-type { align-items: center; }

/* micropython.com — black header, white type, green brand mark */
header > nav:first-of-type > a {
  font-family: var(--font);
  font-size: 1.25rem;
  color: #fff;
}
header > nav:first-of-type > a:hover { color: #fff; }
header > nav:first-of-type > a img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
header nav > span { color: var(--accent); }
header nav ul a { color: #d4d4d4; }
header nav ul a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
header > nav ~ nav { border-top-color: #2a2a2a; }

/* sidebar menu beside long lists (examples, devices) */
main > .row > menu, main section > .row > menu {
  width: 220px; flex: 0 0 220px;
  position: sticky; top: 96px; align-self: flex-start;
  max-height: calc(100vh - 120px); overflow: auto;
}
@media (max-width: 720px) {
  main > .row, main section > .row { flex-direction: column; }
  main > .row > menu, main section > .row > menu {
    width: 100%; flex: none; position: static; max-height: none;
  }
  footer > .row:first-of-type > * { flex: 1 1 12rem; }
}
