/* ------------------------------------------------------------------------------------------------
   EVN ALPHA MicroPython - documentation site.
   The type and the colours follow the Centre of Robotics Excellence site (edu.coresg.tech):
   Jost, self-hosted; the warm taupe #a8977b for decoration, a deeper #7f715c wherever the colour
   carries text (AA on white); near-black headings, a near-black footer.
   ------------------------------------------------------------------------------------------------ */

/* ---- Jost, self-hosted variable font (no Google Fonts request) --------------------------------- */
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/jost-latin-ext-wght-normal.woff2") format("woff2");
  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;
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/jost-latin-wght-normal.woff2") format("woff2");
  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;
}

/* ---- Tokens ------------------------------------------------------------------------------------ */
:root {
  --page: #ffffff;
  --surface: #f4f4f5;
  --surface-2: #ffffff;
  --line: #eaeaec;
  --line-strong: #d8d8dc;
  --heading: #111518;
  --text: #3f4245;
  --muted: #5c6166;
  --accent: #a8977b;          /* decoration: rules, underlines, the mark */
  --accent-ink: #7f715c;      /* anything that carries text on the page background (AA on white) */
  --accent-deep: #6a5e4c;
  --on-accent: #ffffff;
  --code-bg: #f4f4f5;
  --shadow: 0 1px 2px rgba(17, 21, 24, .04), 0 8px 24px rgba(17, 21, 24, .06);
  --shadow-lift: 0 2px 4px rgba(17, 21, 24, .06), 0 16px 40px rgba(17, 21, 24, .10);
  --radius: 4px;
  --radius-lg: 10px;
  --header-h: 66px;
  --maxw: 1180px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #111518; --surface: #1a1f24; --surface-2: #171c21; --line: #2a3138;
    --line-strong: #3a424a; --heading: #f4f5f6; --text: #d7dade; --muted: #a3a8ad;
    --accent: #c9b99c; --accent-ink: #c9b99c; --accent-deep: #ddd0b8; --on-accent: #111518;
    --code-bg: #1a1f24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #111518; --surface: #1a1f24; --surface-2: #171c21; --line: #2a3138;
  --line-strong: #3a424a; --heading: #f4f5f6; --text: #d7dade; --muted: #a3a8ad;
  --accent: #c9b99c; --accent-ink: #c9b99c; --accent-deep: #ddd0b8; --on-accent: #111518;
  --code-bg: #1a1f24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---- Base -------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Jost", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3, h4, h5, h6 { color: var(--heading); line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 3px; }
::selection { background: rgba(168, 151, 123, .28); }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--page); color: var(--heading); padding: 10px 18px; border: 1px solid var(--line);
}
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  clip-path: inset(50%); white-space: nowrap;
}
/* main carries tabindex="-1" so the skip link and a route change can move the focus onto it;
   the focus ring belongs on what the user tabbed to, not on the whole page */
main:focus { outline: none; }

/* ---- Buttons ----------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 5px 20px; border-radius: var(--radius);
  font-size: 15px; font-weight: 500; letter-spacing: .02em; line-height: 1.3;
  border: 1px solid transparent; cursor: pointer; text-align: center;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.btn-primary { background: var(--accent-ink); color: var(--on-accent); border-color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--heading); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface); color: var(--heading); border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }

/* ---- Header ------------------------------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(4px)) {
  .site-header { background: color-mix(in srgb, var(--page) 90%, transparent); backdrop-filter: saturate(160%) blur(10px); }
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--heading); flex: 0 0 auto; }
.brand:hover { text-decoration: none; color: var(--heading); }
.brand .mark {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 7px;
  background: var(--accent); display: grid; place-items: center;
}
.brand .mark svg { width: 25px; height: 25px; fill: #111518; display: block; }
.brand .words { display: flex; flex-direction: column; line-height: 1.05; }
.brand .word-1 { font-size: 17px; font-weight: 600; letter-spacing: .06em; }
.brand .word-2 { font-size: 10.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.site-nav a {
  color: var(--muted); font-size: 15px; font-weight: 500; letter-spacing: .02em;
  padding: 8px 10px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.site-nav a:hover { color: var(--heading); text-decoration: none; border-bottom-color: var(--line-strong); }
.site-nav a.current { color: var(--heading); border-bottom-color: var(--accent); }
.header-tools { display: flex; align-items: center; gap: 8px; margin-left: 10px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--heading); border-color: var(--line-strong); background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7;
                stroke-linecap: round; stroke-linejoin: round; }
#menu-btn { display: none; }

/* the toggle shows the scheme it will switch to */
.theme-sun { display: none; }
.theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: block; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="light"] .theme-sun { display: none; }
:root[data-theme="light"] .theme-moon { display: block; }

@media (max-width: 980px) {
  #menu-btn { display: grid; }
  /* the nav leaves the flex row here (absolute or hidden), so the tools take over the right edge */
  .header-tools { margin-left: auto; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 16px 16px;
    background: var(--page); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .site-nav:not(.open) { display: none; }
  .site-nav a { padding: 12px 6px; border-bottom: 1px solid var(--line); }
  .site-nav a.current { border-bottom-color: var(--accent); }
}

/* ---- Home: hero --------------------------------------------------------------------------------- */
.hero { padding: 58px 0 18px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 340px at 10% -10%, rgba(168, 151, 123, .22), transparent 70%),
    radial-gradient(620px 320px at 95% 4%, rgba(168, 151, 123, .12), transparent 70%);
}
.hero .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
@media (max-width: 980px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 999px; padding: 4px 14px;
  background: var(--page);
}
.hero-mark { display: flex; align-items: center; gap: 18px; margin: 22px 0 0; }
.hero-mark .glyph {
  width: 74px; height: 74px; flex: 0 0 74px; border-radius: 15px; background: var(--accent);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.hero-mark .glyph svg { width: 50px; height: 50px; fill: #111518; }
.hero-mark h1 { margin: 0; font-size: clamp(32px, 6.2vw, 50px); font-weight: 700; letter-spacing: .01em; }
.hero-mark .sub {
  display: block; font-size: clamp(12px, 2.4vw, 15px); font-weight: 500; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted); margin-top: 4px;
}
.hero p.pitch { font-size: clamp(17px, 2.2vw, 20px); color: var(--text); max-width: 60ch; margin: 24px 0 0; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .meta { margin-top: 16px; font-size: 14.5px; color: var(--muted); }
.hero-photo { position: relative; }
.hero-photo img {
  width: 100%; height: auto; display: block; border-radius: var(--radius-lg);
  border: 1px solid var(--line); box-shadow: var(--shadow-lift); background: var(--surface);
}
.hero-photo figcaption { margin: 12px 2px 0; font-size: 13.5px; color: var(--muted); }
figure { margin: 0; }

/* ---- Home: sections ----------------------------------------------------------------------------- */
.section { padding: 42px 0; }
.section h2 {
  font-size: 12.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px 24px 26px; display: flex; flex-direction: column; color: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
a.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.card .kicker {
  font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink);
}
.card h3 { margin: 10px 0 8px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.card .more { align-self: flex-start; margin-top: auto; padding-top: 16px; font-size: 14.5px; font-weight: 500; color: var(--accent-ink); }
a.card:hover .more { text-decoration: underline; text-underline-offset: 3px; }

.dl-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dl-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  padding: 24px; display: flex; flex-direction: column;
}
.dl-card h3 { margin: 0; font-size: 19px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ver {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; font-weight: 500; letter-spacing: .02em;
  background: var(--page); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 10px;
  color: var(--accent-ink);
}
.dl-card p { color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.dl-card .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 18px; }
.dl-note { margin-top: 18px; font-size: 14.5px; color: var(--muted); }
.ide-card {
  border: 1px solid var(--accent); border-radius: var(--radius-lg);
  background: linear-gradient(120deg, rgba(168, 151, 123, .16), rgba(168, 151, 123, .03));
  padding: 26px 28px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
}
.ide-card .txt { flex: 1 1 320px; }
.ide-card h3 { margin: 0 0 6px; font-size: 21px; }
.ide-card p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* ---- Home: the peripherals gallery ---------------------------------------------------------------- */
.gallery-intro { color: var(--muted); font-size: 16px; max-width: 70ch; margin: -6px 0 22px; }
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.shot {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  overflow: hidden; display: flex; flex-direction: column;
}
.shot img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface); }
.shot figcaption { padding: 10px 12px 12px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.shot figcaption strong { display: block; color: var(--heading); font-size: 14.5px; font-weight: 600; }

/* ---- Home: the story ------------------------------------------------------------------------------- */
.story-grid { display: grid; gap: 34px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .story-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; } }
.story-prose p { margin: 0 0 16px; font-size: 16.5px; color: var(--text); max-width: 68ch; }
.story-prose .actions { margin-top: 22px; }
.credit {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-lg);
  background: var(--surface); padding: 24px 26px 26px;
}
.credit .kicker {
  font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink);
}
.credit .who { margin: 8px 0 0; font-size: 25px; font-weight: 600; color: var(--heading); line-height: 1.2; }
.credit .person + .person { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.credit .person .credit-link + .credit-link { margin-left: 12px; }
.credit .what { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.credit-link {
  display: inline-block; margin-top: 12px; font-size: 14.5px; font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.stats { list-style: none; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line-strong); }
.stats li { display: flex; align-items: baseline; gap: 10px; margin: 8px 0; }
.stats strong { color: var(--heading); font-size: 19px; font-weight: 600; flex: 0 0 auto; }
.stats span { color: var(--muted); font-size: 14.5px; }

/* ---- Home: document list -------------------------------------------------------------------------- */
.doc-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.doc-row {
  display: flex; gap: 18px; align-items: baseline; padding: 20px 4px;
  border-bottom: 1px solid var(--line); color: inherit;
}
.doc-row:hover { text-decoration: none; background: var(--surface); }
.doc-row .n {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; color: var(--accent-ink); flex: 0 0 34px;
}
.doc-row .t { flex: 1 1 auto; }
.doc-row .t strong { display: block; font-size: 18px; color: var(--heading); font-weight: 600; }
.doc-row .t span { color: var(--muted); font-size: 15px; }
.doc-row .go { color: var(--accent-ink); flex: 0 0 auto; font-size: 20px; }

/* ---- Documents ------------------------------------------------------------------------------------ */
.layout { display: grid; grid-template-columns: 276px minmax(0, 1fr); gap: 44px; align-items: start;
          max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .layout { padding: 0 32px; } }
.toc {
  position: sticky; top: var(--header-h); align-self: start;
  max-height: calc(100vh - var(--header-h)); overflow: auto; padding: 28px 0 40px;
  font-size: 14.5px; border-right: 1px solid var(--line);
}
.toc-title { font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
             color: var(--muted); margin: 0 18px 12px 0; }
.toc-filter {
  width: calc(100% - 18px); margin-bottom: 14px; padding: 8px 12px; min-height: 38px;
  font: inherit; font-size: 14.5px; color: var(--text);
  background: var(--page); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.toc-filter::placeholder { color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block; padding: 5px 12px; margin-right: 18px; color: var(--muted);
  border-left: 2px solid transparent; border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toc li.h3 a { padding-left: 26px; font-size: 13.5px; }
.toc li a:hover { color: var(--heading); background: var(--surface); text-decoration: none; }
.toc li a.current { color: var(--heading); font-weight: 500; border-left-color: var(--accent); background: var(--surface); }
.toc .empty { color: var(--muted); font-size: 14px; padding: 6px 12px; }
.toc-toggle { display: none; }

.doc { min-width: 0; padding: 28px 0 72px; }
.doc-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
            padding-bottom: 14px; margin-bottom: 8px; }
.crumb { font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.edit-link { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.edit-link:hover { color: var(--accent-ink); }
.edit-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7;
                 stroke-linecap: round; stroke-linejoin: round; }

.doc-body h1 { font-size: clamp(30px, 5vw, 40px); font-weight: 700; margin: 0 0 8px; }
.doc-body h2 { font-size: 26px; margin: 52px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.doc-body h3 { font-size: 20px; margin: 34px 0 10px; }
.doc-body h4 { font-size: 17px; margin: 26px 0 8px; font-weight: 600; }
.doc-body h2:target, .doc-body h3:target, .doc-body h4:target { color: var(--accent-ink); }
.doc-body p, .doc-body li { font-size: 16.5px; }
.doc-body ul, .doc-body ol { padding-left: 24px; }
.doc-body li { margin: 6px 0; }
.doc-body li::marker { color: var(--accent); }
.doc-body strong { color: var(--heading); font-weight: 600; }
.doc-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .87em; background: var(--code-bg); border: 1px solid var(--line);
  padding: .08em .38em; border-radius: 3px; color: var(--heading);
}
.doc-body pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; overflow: auto; line-height: 1.55; position: relative; margin: 20px 0;
}
.doc-body pre code { background: none; border: 0; padding: 0; font-size: 14px; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s ease;
  font: inherit; font-size: 12px; font-weight: 500; letter-spacing: .04em;
  padding: 3px 10px; min-height: 28px; border-radius: var(--radius);
  background: var(--page); color: var(--muted); border: 1px solid var(--line-strong); cursor: pointer;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
/* a touch device has no hover: the button was invisible and still tappable */
@media (hover: none) { .copy-btn { opacity: 1; } }
.copy-btn:hover { color: var(--heading); border-color: var(--accent); }
.copy-btn.done { color: var(--accent-ink); border-color: var(--accent); opacity: 1; }
.doc-body table {
  border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%;
  margin: 22px 0; font-size: 15.5px;
}
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: 9px 14px; vertical-align: top; text-align: left; }
.doc-body th { background: var(--surface); color: var(--heading); font-weight: 600; }
.doc-body tbody tr:nth-child(even) td { background: var(--surface); }
.doc-body blockquote {
  margin: 20px 0; padding: 4px 20px; color: var(--muted); border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0;
}
.doc-body img { border-radius: var(--radius); border: 1px solid var(--line); }
.doc-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent); }

.pager { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a {
  flex: 1 1 240px; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px;
  color: inherit; background: var(--surface-2);
}
.pager a:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.pager .lbl { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pager .ttl { display: block; margin-top: 4px; font-size: 17px; font-weight: 600; color: var(--heading); }
.pager a.next { text-align: right; }

.notice {
  padding: 16px 20px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface); color: var(--muted);
  font-size: 15.5px;
}
.spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 10px; vertical-align: -2px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent-ink); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc {
    position: static; max-height: none; overflow: visible; border-right: 0;
    border-bottom: 1px solid var(--line); padding: 16px 0;
  }
  .toc-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: 6px 0;
  }
  .toc-toggle::after { content: "\25BE"; transition: transform .2s ease; }
  .toc.collapsed .toc-toggle::after { transform: rotate(-90deg); }
  .toc.collapsed .toc-title, .toc.collapsed .toc-filter, .toc.collapsed ul, .toc.collapsed .empty { display: none; }
  .toc-title { display: none; }
  .toc-filter { width: 100%; margin-top: 12px; }
  .toc li a { margin-right: 0; }
  .hero { padding: 36px 0 12px; }
  .hero-mark .glyph { width: 58px; height: 58px; flex-basis: 58px; border-radius: 12px; }
  .hero-mark .glyph svg { width: 40px; height: 40px; }
}

/* ---- Footer --------------------------------------------------------------------------------------- */
.site-footer {
  background: rgba(18, 21, 25, .98); color: rgba(255, 255, 255, .74); margin-top: 40px;
  border-top: 1px solid var(--line);   /* the only thing that separates it from a dark page */
}
.site-footer .wrap { padding-top: 46px; padding-bottom: 38px; display: grid; gap: 30px;
                     grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
/* the first column carries the CORE attribution and the creator credit, so it gets the room */
@media (min-width: 900px) { .site-footer .wrap { grid-template-columns: 1.75fr 1fr 1fr 1.1fr; gap: 40px; } }
.site-footer a { color: rgba(255, 255, 255, .74); }
.site-footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.f-brand { display: flex; gap: 14px; align-items: flex-start; }
.f-logo {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 10px; background: #fff;
  display: grid; place-items: center; padding: 7px;
}
.f-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.f-brand strong { display: block; color: #fff; font-weight: 600; font-size: 16px; letter-spacing: .02em; }
.f-brand span { font-size: 14.5px; line-height: 1.6; display: block; margin-top: 4px; }
.f-credit { margin-top: 12px !important; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12);
            font-size: 14px !important; color: rgba(255, 255, 255, .62); }
.f-credit a { color: #d8cdb6; }
.f-col h4 { color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: .14em;
            text-transform: uppercase; margin: 0 0 12px; }
.f-col ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.f-col li { margin: 7px 0; }
.f-legal {
  border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13.5px; color: rgba(255, 255, 255, .58);
  padding: 18px 16px 30px; max-width: var(--maxw); margin: 0 auto;
}
@media (min-width: 720px) { .f-legal { padding-left: 32px; padding-right: 32px; } }

/* ---- Motion and print ------------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  a.card:hover { transform: none; }
}
@media print {
  .site-header, .toc, .site-footer, .pager, .copy-btn, .edit-link, .hero .actions, .header-tools { display: none !important; }
  body { font-size: 11pt; color: #000; background: #fff; }
  .layout { display: block; padding: 0; }
  .doc { padding: 0; }
  .doc-body h2 { page-break-after: avoid; }
  .doc-body pre, .doc-body table, .doc-body blockquote { page-break-inside: avoid; border: 1px solid #ccc; }
  .doc-body a { color: #000; text-decoration: underline; }
  .doc-body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}
