/* ============================================================================
   KPMG CTF 2026 — write-up site
   Minimal technical journal: typography first, hairline borders, restrained orange.
   Dark is the default; light is a complete second theme. Code is the only place
   that uses many colours (VS Code Dark+ / Light+ inspired Rouge theme below).
   ========================================================================== */

/* ---- Tokens --------------------------------------------------------------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --max: 1040px;
  --measure: 720px;           /* article reading column */
  --narrow: 760px;            /* listing pages */
  --gutter: 20px;
  --header-h: 56px;
  --radius: 6px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Dark (default) */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111311;
  --bg-soft: #151815;
  --text: #e5e7e5;
  --text-2: #929992;
  --text-3: #5d645d;         /* decorative only (separators) */
  --border: #292d29;
  --border-strong: #3a403a;
  --accent: #f0883e;
  --accent-soft: rgba(240, 136, 62, .14);
  --hover-bg: #1a1d1a;
  --code-bg: #181b19;
  --code-border: #242824;
  --code-inline-bg: #1c201d;
  --code-inline: #e9b48a;
  --mark: rgba(240, 136, 62, .24);
  --warn: #d4a24c;

  /* syntax — VS Code Dark+ inspired */
  --sx-text: #d4d4d4;
  --sx-comment: #6a9955;
  --sx-keyword: #569cd6;
  --sx-control: #c586c0;
  --sx-string: #ce9178;
  --sx-number: #b5cea8;
  --sx-function: #dcdcaa;
  --sx-type: #4ec9b0;
  --sx-variable: #9cdcfe;
  --sx-constant: #4fc1ff;
  --sx-regex: #d16969;
  --sx-escape: #d7ba7d;
  --sx-tag: #569cd6;
  --sx-attr: #9cdcfe;
  --sx-punct: #a9b0a9;
  --sx-deleted: #f48771;
  --sx-inserted: #89d185;
  --sx-muted: #7d857d;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --text: #242424;
  --text-2: #6b7280;
  --text-3: #c2c6cc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #c2410c;
  --accent-soft: rgba(194, 65, 12, .10);
  --hover-bg: #f5f6f5;
  --code-bg: #f5f5f5;
  --code-border: #e8e8e8;
  --code-inline-bg: #f2f3f2;
  --code-inline: #9a3412;
  --mark: rgba(194, 65, 12, .14);
  --warn: #92400e;

  /* syntax — VS Code Light+ inspired */
  --sx-text: #1f1f1f;
  --sx-comment: #008000;
  --sx-keyword: #0000ff;
  --sx-control: #af00db;
  --sx-string: #a31515;
  --sx-number: #098658;
  --sx-function: #795e26;
  --sx-type: #267f99;
  --sx-variable: #001080;
  --sx-constant: #0070c1;
  --sx-regex: #811f3f;
  --sx-escape: #ee0000;
  --sx-tag: #800000;
  --sx-attr: #e50000;
  --sx-punct: #3b3b3b;
  --sx-deleted: #a31515;
  --sx-inserted: #098658;
  --sx-muted: #6e7681;
}

/* ---- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.site-main { flex: 1 0 auto; outline: none; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; letter-spacing: -.012em; }
img { max-width: 100%; height: auto; }
svg.icon { flex: none; display: inline-block; vertical-align: middle; }
button { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.visually-hidden, .skip-link:not(:focus) {
  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: fixed; top: 8px; left: 8px; z-index: 200; padding: 8px 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--accent); border-radius: var(--radius);
  font-size: .875rem;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--mark); }

/* ---- Draft banner --------------------------------------------------------- */
.draft-banner { border-bottom: 1px solid var(--border); background: var(--bg-soft); font-size: .78rem; line-height: 1.5; }
.draft-banner-inner { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-block: 7px; color: var(--text-2); }
.draft-tag { color: var(--warn); font-family: var(--font-mono); font-weight: 500; font-size: .74rem;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }

/* ---- Header --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--header-h); }
.brand { display: inline-flex; align-items: baseline; gap: 10px; color: var(--text); font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { font-family: var(--font-mono); font-size: .875rem; font-weight: 500; color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-menu { list-style: none; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; }
.nav-menu a {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: .875rem; font-weight: 450;
  transition: color .15s var(--ease);
}
.nav-menu a:hover { color: var(--text); }
.nav-menu a.is-active { color: var(--accent); }
.ext { opacity: .7; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  background: none; border: 0; border-radius: var(--radius); color: var(--text-2); cursor: pointer;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--hover-bg); }
.theme-toggle { margin-left: 4px; }
:root[data-theme="dark"] .ico-moon, :root:not([data-theme]) .ico-moon,
:root[data-theme="light"] .ico-sun { display: none; }
.nav-toggle { display: none; }
.nav-toggle .ico-close { display: none; }
.nav-toggle[aria-expanded="true"] .ico-close { display: inline-block; }
.nav-toggle[aria-expanded="true"] .ico-menu { display: none; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-grid; }
  .nav-menu {
    display: none;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 16px; background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .nav-menu.open { display: flex; }
  .nav-menu a { display: flex; padding: 11px 0; font-size: .9375rem; border-radius: 0; }
  .nav-menu li + li { border-top: 1px solid var(--border); }
}

/* ---- Shared page scaffolding --------------------------------------------- */
.page { padding-top: 32px; padding-bottom: 96px; }
.page--narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; font-size: .8125rem; color: var(--text-2); }
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "/"; color: var(--text-3); margin: 0 8px; }
.breadcrumb a { color: var(--text-2); transition: color .15s var(--ease); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current] { color: var(--text-2); overflow-wrap: anywhere; }

.page-head { margin: 28px 0 40px; }
.page-kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text-2);
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .02em; }
.page-title { font-size: clamp(1.75rem, 4vw, 2.125rem); margin: 0 0 10px; letter-spacing: -.022em; }
.page-sub { margin: 0; color: var(--text-2); font-size: 1.0625rem; max-width: 62ch; }
.page-meta { margin: 16px 0 0; color: var(--text-2); font-family: var(--font-mono); font-size: .75rem; }

.section { margin-top: 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title { margin: 0; font-size: .75rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.section-more { font-size: .8125rem; color: var(--text-2); transition: color .15s var(--ease); }
.section-more:hover { color: var(--accent); }

.empty { color: var(--text-2); padding: 40px 0; margin: 0; text-align: center; font-size: .9375rem; }
.empty a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }

/* ---- Home: intro ---------------------------------------------------------- */
.intro { padding-top: 72px; max-width: 640px; }
.home { padding-bottom: 96px; }
.intro-title { font-size: clamp(2rem, 5vw, 2.5rem); margin: 0 0 12px; letter-spacing: -.028em; }
.intro-sub { margin: 0 0 20px; font-size: 1.125rem; color: var(--text); font-weight: 450; }
.intro-text { margin: 0 0 24px; color: var(--text-2); max-width: 60ch; }

.social { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; font-size: .875rem; }
.social a { display: inline-flex; align-items: center; gap: 2px; color: var(--text-2); transition: color .15s var(--ease); }
.social a:hover { color: var(--accent); }

/* ---- Category tiles ------------------------------------------------------- */
.tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tiles > li { display: flex; }
.tile {
  flex: 1; display: flex; flex-direction: column;
  padding: 20px 20px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
  transition: border-color .15s var(--ease);
}
.tile-icon { color: var(--text-2); transition: color .15s var(--ease); }
.tile-name { margin: 16px 0 6px; font-size: 1rem; font-weight: 600; letter-spacing: -.005em; }
.tile-desc { margin: 0 0 18px; color: var(--text-2); font-size: .875rem; line-height: 1.55; }
.tile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.tile-count { font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); }
.tile-arrow { color: var(--text-3); transition: color .15s var(--ease), transform .15s var(--ease); }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tile:hover .tile-icon, .tile:hover .tile-arrow { color: var(--accent); }
.tile:hover .tile-arrow { transform: translateX(2px); }

/* ---- Editorial rows (write-up lists) ---------------------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.row { border-bottom: 1px solid var(--border); }
.row-link { display: flex; align-items: center; gap: 20px; padding: 20px 0; color: var(--text); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-cat { font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); }
.row-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.008em; transition: color .15s var(--ease); }
.row-desc {
  color: var(--text-2); font-size: .9375rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.row-desc mark, .row-title mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.row-arrow { color: var(--text-3); transition: color .15s var(--ease), transform .15s var(--ease); }
.row-link:hover .row-title { color: var(--accent); }
.row-link:hover .row-arrow { color: var(--accent); transform: translateX(2px); }


/* ---- Filters ----------------------------------------------------- */
.field {
  width: 100%; min-width: 0;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: transparent; color: var(--text);
  font-family: var(--font-sans); font-size: .9375rem;
  transition: border-color .15s var(--ease);
}
.field::placeholder { color: var(--text-2); opacity: .8; }
.field:hover { border-color: var(--border-strong); }
.field:focus { outline: none; border-color: var(--accent); }
.field:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; border-radius: var(--radius); }

.filter-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.filter-bar .field { flex: 1; }
.filter-count { color: var(--text-2); font-family: var(--font-mono); font-size: .75rem; white-space: nowrap; }

.cat-filter { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 0 0 24px; }
.cat-filter button {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-size: .8125rem; color: var(--text-2);
  border-bottom: 1px solid transparent;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.cat-filter button:hover { color: var(--text); }
.cat-filter button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }


/* ---- Category page: other categories ------------------------------------- */
.other-cats { margin-top: 64px; }
.other-cats-title { margin: 0 0 12px; font-size: .75rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.other-cats ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; font-size: .875rem; }
.other-cats a { color: var(--text-2); transition: color .15s var(--ease); }
.other-cats a:hover { color: var(--accent); }
.other-cats .count { margin-left: 6px; font-family: var(--font-mono); font-size: .75rem; color: var(--text-3); }

/* ---- Article -------------------------------------------------------------- */
.article { position: relative; max-width: var(--measure); margin: 0 auto; padding: 32px 0 96px; }
.article-head { margin: 32px 0 40px; }
.article-title { margin: 0 0 16px; font-size: clamp(1.75rem, 4.2vw, 2.25rem); line-height: 1.2; letter-spacing: -.024em; overflow-wrap: anywhere; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--text-2); font-size: .875rem; }
.article-cat { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); transition: color .15s var(--ease); }
.article-cat:hover { color: var(--accent); }

/* table of contents: collapsible on small screens, quiet margin column on wide ones */
.toc { margin: 0 0 40px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .875rem; }
.toc > summary {
  padding: 10px 14px; cursor: pointer; color: var(--text-2); list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary::after { content: "+"; font-family: var(--font-mono); color: var(--text-3); }
.toc[open] > summary::after { content: "−"; }
.toc > summary:hover { color: var(--text); }
.toc-nav { display: flex; flex-direction: column; padding: 0 14px 12px; }
.toc-nav a { padding: 4px 0; color: var(--text-2); line-height: 1.4; transition: color .15s var(--ease); }
.toc-nav a:hover { color: var(--text); }
.toc-nav a.active { color: var(--accent); }

@media (min-width: 1280px) {
  .toc { position: absolute; top: 0; bottom: 0; left: calc(100% + 56px); width: 200px; margin: 0; border: 0; }
  .toc > summary { display: none; }
  .toc-nav { position: sticky; top: calc(var(--header-h) + 40px); padding: 120px 0 0; font-size: .8125rem;
    max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; }
  .toc-nav::before { content: "On this page"; display: block; margin-bottom: 8px; color: var(--text-2);
    font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; }
  .toc-nav a { padding: 3px 0; }
}

.article-foot { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--border); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.pn { display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.pn--next { text-align: right; grid-column: 2; }
.pn-dir { font-size: .75rem; color: var(--text-2); }
.pn-name { font-weight: 500; transition: color .15s var(--ease); }
.pn:hover .pn-name { color: var(--accent); }
.back-row { margin: 0; font-size: .875rem; }
.back-row a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); transition: color .15s var(--ease); }
.back-row a:hover { color: var(--accent); }

/* ---- Prose ---------------------------------------------------------------- */
.prose { font-size: 1.0625rem; line-height: 1.75; overflow-wrap: break-word; min-width: 0; }
.prose > *:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose dl { margin: 0 0 1.3em; }
.prose h2 { font-size: 1.5rem; margin: 2.4em 0 .75em; letter-spacing: -.018em; }
.prose h3 { font-size: 1.2rem; margin: 2em 0 .6em; }
.prose h4 { font-size: 1.0625rem; margin: 1.8em 0 .5em; }
.prose h5, .prose h6 { font-size: 1rem; margin: 1.6em 0 .5em; color: var(--text-2); }
.prose h2 + h3 { margin-top: 1.2em; }
.prose a { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); transition: color .15s var(--ease); }
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; padding-left: .2em; }
.prose li > ul, .prose li > ol { margin: .35em 0 0; }
.prose li::marker { color: var(--text-2); }
.prose blockquote { margin: 1.6em 0; padding: 0 0 0 20px; border-left: 2px solid var(--border-strong); color: var(--text-2); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 3em 0; }
.prose img { display: block; margin: 2em auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prose figcaption, .prose .caption { margin-top: -1.2em; text-align: center; font-size: .8125rem; color: var(--text-2); }
.prose kbd { font-family: var(--font-mono); font-size: .8em; padding: .1em .4em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; }
.prose dt { font-weight: 600; }
.prose dd { margin: 0 0 .8em 1.2em; color: var(--text-2); }

/* inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: .84em;
  padding: .14em .38em; border-radius: 4px;
  background: var(--code-inline-bg); color: var(--code-inline);
  overflow-wrap: anywhere;
}
.prose a > code { color: inherit; }

/* tables (GitHub-like; scroll horizontally rather than break the column) */
.prose table {
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  display: block; width: max-content; max-width: 100%; overflow-x: auto;
  margin: 0 0 1.6em; border-collapse: collapse; border-spacing: 0;
  font-size: .9rem; line-height: 1.55;
}
.prose th, .prose td { padding: 8px 14px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose thead th { font-weight: 600; background: var(--bg-soft); }
.prose td code, .prose th code { overflow-wrap: normal; white-space: nowrap; }

/* ---- Code blocks ---------------------------------------------------------- */
.prose div.highlighter-rouge,
.prose figure.highlight,
.prose > pre {
  position: relative;
  margin: 1.6em 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
}
.prose div.highlighter-rouge .highlight { margin: 0; background: none; }
.prose pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono); font-size: .8125rem; line-height: 1.65;
  color: var(--sx-text);
  tab-size: 4; -moz-tab-size: 4;
  white-space: pre; word-wrap: normal; overflow-wrap: normal;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
/* never let font ligatures change how code reads (e.g. `<!--` or `->`) */
code, kbd, pre, samp, .mono, .code-head { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.prose pre::-webkit-scrollbar { height: 8px; }
.prose pre::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.prose pre::-webkit-scrollbar-track { background: transparent; }
.prose > pre { padding: 14px 16px; }
.prose pre code { font: inherit; color: inherit; background: none; padding: 0; border: 0; white-space: inherit; }

/* header bar (language label + copy), injected by main.js */
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 32px; padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--code-border);
  font-family: var(--font-mono); font-size: .6875rem; color: var(--sx-muted);
}
.code-lang { text-transform: lowercase; letter-spacing: .02em; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px;
  background: none; border: 0; border-radius: 4px; cursor: pointer;
  font-family: var(--font-mono); font-size: .6875rem; color: var(--sx-muted);
  transition: color .15s var(--ease), background-color .15s var(--ease), opacity .15s var(--ease);
}
.copy-btn:hover { color: var(--text); background: var(--hover-bg); }
.copy-btn.copied { color: var(--accent); }
/* unlabelled blocks: no header bar, floating copy button */
.copy-btn--float { position: absolute; top: 6px; right: 6px; z-index: 1; background: var(--code-bg); opacity: 0; }
.has-float:hover .copy-btn--float, .copy-btn--float:focus-visible, .copy-btn--float.copied { opacity: 1; }
.has-float:hover .copy-btn--float:hover { background: var(--hover-bg); }
@media (hover: none) { .copy-btn--float { opacity: 1; } }

/* ---- Rouge token colours (VS Code Dark+ / Light+ inspired) ---------------- */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cd, .highlight .ch,
.highlight .cs, .highlight .cpf                                         { color: var(--sx-comment); }
.highlight .cp                                                         { color: var(--sx-control); }
.highlight .k, .highlight .kd, .highlight .kp, .highlight .kr,
.highlight .kv, .highlight .kc, .highlight .bp, .highlight .ow          { color: var(--sx-keyword); }
.highlight .kn                                                         { color: var(--sx-control); }
.highlight .kt, .highlight .nc, .highlight .nn, .highlight .ne          { color: var(--sx-type); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb,
.highlight .sc, .highlight .sd, .highlight .sh, .highlight .sx,
.highlight .dl, .highlight .ss                                         { color: var(--sx-string); }
.highlight .sa                                                         { color: var(--sx-keyword); }
.highlight .se                                                         { color: var(--sx-escape); }
.highlight .si                                                         { color: var(--sx-keyword); }
.highlight .sr                                                         { color: var(--sx-regex); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh,
.highlight .mo, .highlight .mb, .highlight .mx, .highlight .il          { color: var(--sx-number); }
.highlight .n, .highlight .nx, .highlight .nv, .highlight .vc,
.highlight .vg, .highlight .vi, .highlight .vm, .highlight .py,
.highlight .nl                                                         { color: var(--sx-variable); }
.highlight .nf, .highlight .fm, .highlight .nb, .highlight .nd          { color: var(--sx-function); }
.highlight .no                                                         { color: var(--sx-constant); }
.highlight .nt                                                         { color: var(--sx-tag); }
.highlight .na                                                         { color: var(--sx-attr); }
.highlight .ni                                                         { color: var(--sx-escape); }
.highlight .o                                                          { color: var(--sx-text); }
.highlight .p                                                          { color: var(--sx-punct); }
.highlight .err                                                        { color: var(--sx-text); background: none; }
.highlight .gd, .highlight .gr, .highlight .gt                         { color: var(--sx-deleted); }
.highlight .gi                                                         { color: var(--sx-inserted); }
.highlight .gh, .highlight .gu                                         { color: var(--sx-keyword); font-weight: 600; }
.highlight .gp                                                         { color: var(--sx-muted); user-select: none; }
.highlight .go                                                         { color: var(--sx-muted); }
.highlight .ge                                                         { font-style: italic; }
.highlight .gs                                                         { font-weight: 600; }

/* language-specific refinements */
.language-json .highlight .nt, .language-json .highlight .nl            { color: var(--sx-variable); }  /* keys */
.language-json .highlight .kc                                          { color: var(--sx-keyword); }   /* true/false/null */
.language-html .highlight .nt, .language-xml .highlight .nt            { color: var(--sx-tag); }
.language-python .highlight .n, .language-py .highlight .n             { color: var(--sx-variable); }
.language-c .highlight .n, .language-java .highlight .n                { color: var(--sx-text); }
/* bash: Rouge doesn't tokenise commands or flags; main.js tags them as .sx-cmd / .sx-flag */
.highlight .sx-cmd                                                     { color: var(--sx-function); }
.highlight .sx-flag                                                    { color: var(--sx-keyword); }

/* ---- 404 ------------------------------------------------------------------ */
.notfound { padding-top: 96px; }
.notfound-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; font-size: .9375rem; }
.notfound-links a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.notfound-links a:hover { color: var(--accent); }

/* ---- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-direction: column; gap: 32px; padding-block: 40px 36px; }
.footer-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; }
.footer-row p { margin: 0; }
.footer-name { display: flex; align-items: baseline; gap: 8px; font-size: .9375rem; font-weight: 600; color: var(--text); }
.footer-mark { font-family: var(--font-mono); font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.footer-row .footer-tag { margin-top: 4px; font-size: .8125rem; color: var(--text-2); }
.footer-links { font-size: .875rem; gap: 6px 22px; }
.footer-row--legal { font-size: .75rem; color: var(--text-2); }

/* ---- Small screens -------------------------------------------------------- */
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .intro { padding-top: 48px; }
  .section { margin-top: 48px; }
  .page { padding-top: 24px; }
  .page-head { margin: 20px 0 28px; }
  .article { padding-top: 24px; }
  .article-head { margin: 24px 0 32px; }
  .prose { font-size: 1rem; line-height: 1.72; }
  .prose h2 { font-size: 1.3rem; }
  .prose h3 { font-size: 1.1rem; }
  .prose pre { font-size: .78rem; padding: 12px 14px; }
  .prose div.highlighter-rouge, .prose > pre { margin-inline: 0; }
  .row-link { gap: 12px; padding: 16px 0; }
  .filter-count { display: none; }
  .footer-inner { gap: 24px; padding-block: 32px; }
  .footer-row { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-row--legal { gap: 6px; }
}

/* no rule above an empty-state message */
.rows:has(> .empty) { border-top: 0; }
