/* ============================================================================
   The Behavior Layer — explainer webapp
   One design system. Zero dependencies. Light + dark via [data-theme].
   ==========================================================================*/

/* ----- Design tokens ---------------------------------------------------- */
:root {
  /* The semantic hues double as TEXT colour on their own -weak tint
     (.badge--*, .tier-badge, .callout-label). At those sizes AA needs 4.5:1,
     and the original values measured 2.86–4.17 in this theme. Each is darkened
     along its own hue to the lightest value clearing 4.6:1 on the tint it sits
     on, so the palette reads the same while the labels become legible. The dark
     theme measured clean and is unchanged. Originals kept in the comments. */
  --accent:        #6366f1;  /* indigo — the layer / intent */
  --accent-strong: #4f46e5;
  --accent-weak:   #eef0ff;
  --teal:          #0b7b71;  /* was #0d9488 — behavior / tests */
  --teal-weak:     #e6f5f3;
  --amber:         #a55b05;  /* was #d97706 — governance / warn / quarantined */
  --amber-weak:    #fdf1df;
  --red:           #d12222;  /* was #dc2626 — block / regression */
  --red-weak:      #fdeaea;
  --green:         #117e39;  /* was #16a34a — accepted / pass */
  --green-weak:    #e8f6ec;
  --slate:         #64748b;  /* proposed / neutral */
  --violet:        #7c3aed;
  /* Slate and violet paint their own tints via color-mix on the SAME token, so
     darkening the token darkens the background too and contrast barely moves.
     These two inks are the text-on-tint variants; the tints stay as they were. */
  --slate-ink:     #5b6a7f;
  --violet-ink:    #7b39ed;

  --bg:            #ffffff;
  --bg-subtle:     #f7f8fa;
  --bg-inset:      #eef1f5;
  --surface:       #ffffff;
  --surface-2:     #fbfcfe;
  --border:        #e4e7ec;
  --border-strong: #cfd4dc;
  --text:          #1a1d24;
  --text-muted:    #59606d;
  /* was #8b93a1 — 3.09:1 on white, which fails WCAG AA (4.5:1) for the small
     text this token is used for (.flow .sub, .hint, .filter-empty, .toc-title,
     .tree .gi, .tier-lane .lane-label …). Darkened to the lightest value that
     clears 4.5:1 on every surface it lands on, so it stays a distinct third
     step below --text-muted (5.13:1 vs 6.33:1) rather than collapsing into it. */
  --text-faint:    #666e7d;

  --code-bg:       #0f1626;
  --code-text:     #e6e9f2;
  --code-comment:  #7f8aa3;
  --code-key:      #c4b5fd;
  --code-str:      #86e1c0;
  --code-num:      #f0b866;

  --radius:   12px;
  --radius-s: 8px;
  --radius-l: 18px;
  --shadow-s: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --shadow-m: 0 4px 16px rgba(16,24,40,.08);
  --shadow-l: 0 12px 40px rgba(16,24,40,.12);

  --maxw: 1200px;
  --prose: 760px;
  --nav-h: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --accent:        #818cf8;
  --accent-strong: #a5b4fc;
  --accent-weak:   #1e2130;
  --teal:          #2dd4bf;
  --teal-weak:     #10251f;
  --amber:         #f59e0b;
  --amber-weak:    #2a2110;
  --red:           #f87171;
  --red-weak:      #2a1414;
  --green:         #4ade80;
  --green-weak:    #10241a;
  --slate:         #94a3b8;
  --violet:        #a78bfa;
  /* dark theme measured clean, so the inks are just the hues themselves */
  --slate-ink:     #94a3b8;
  --violet-ink:    #a78bfa;

  --bg:            #0c0e14;
  --bg-subtle:     #10131b;
  --bg-inset:      #161a24;
  --surface:       #12151d;
  --surface-2:     #161a24;
  --border:        #242a37;
  --border-strong: #333b4d;
  --text:          #e7eaf0;
  --text-muted:    #a3abbb;
  /* was #6b7385 — 4.06:1 on the dark page background, below AA. Same reasoning
     as the light value above; stays well below --text-muted (4.99 vs 8.36). */
  --text-faint:    #798294;

  --code-bg:       #0a0e18;
  --shadow-s: 0 1px 2px rgba(0,0,0,.4);
  --shadow-m: 0 4px 16px rgba(0,0,0,.45);
  --shadow-l: 0 12px 40px rgba(0,0,0,.55);
}

/* ----- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.65; font-size: 17px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 2.4rem; margin: 0 0 .5em; }
h2 { font-size: 1.65rem; margin: 2.4em 0 .6em; }
h3 { font-size: 1.2rem; margin: 1.8em 0 .4em; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin: .3em 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
strong { font-weight: 680; }

/* ----- Layout ----------------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 40px 0; }
main { min-height: 60vh; }
.prose { max-width: var(--prose); }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .9rem; }
.lead { font-size: 1.22rem; color: var(--text-muted); line-height: 1.55; }

/* ----- Top nav ---------------------------------------------------------- */
.site-nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: var(--maxw); margin: 0 auto; height: 100%; padding: 0 24px;
  display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em;
  color: var(--text); font-size: 1.02rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; flex: none; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link { padding: 7px 12px; border-radius: 8px; color: var(--text-muted); font-size: .93rem;
  font-weight: 550; white-space: nowrap; }
.nav-link:hover { background: var(--bg-inset); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--accent-strong); background: var(--accent-weak); }
.theme-toggle { flex: none; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ----- Doc layout with sidebar TOC -------------------------------------- */
.doc { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 48px;
  max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 96px; }
.toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start;
  max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; font-size: .9rem; }
.toc-title { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700;
  color: var(--text-faint); margin: 0 0 10px; padding-left: 12px; }
.toc a { display: block; padding: 5px 12px; color: var(--text-muted); border-left: 2px solid var(--border);
  line-height: 1.35; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }
.toc a.lvl-3 { padding-left: 24px; font-size: .85rem; }
.doc-body { min-width: 0; }
.doc-body > :first-child { margin-top: 0; }

@media (max-width: 940px) {
  .doc { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; margin-bottom: 24px;
         border: 1px solid var(--border); border-radius: var(--radius-s);
         padding: 12px 14px; background: var(--surface); }
  .toc a { border-left: 0; padding: 4px 0; }
}

/* ----- Hero ------------------------------------------------------------- */
.hero { padding: 72px 0 40px; text-align: center; }
.hero .eyebrow { display: inline-block; font-size: .8rem; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-strong); background: var(--accent-weak);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 22px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); max-width: 16ch; margin: 0 auto .3em; }
.hero .lead { max-width: 60ch; margin: 0 auto 8px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }

/* ----- Buttons ---------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 10px;
  font-weight: 600; font-size: .96rem; cursor: pointer; border: 1px solid transparent; transition: .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-m); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-inset); }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; transform: none; }

/* ----- Cards ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-s); }
.card h3 { margin-top: 0; }
.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-weak); color: var(--accent-strong); margin-bottom: 14px; }
.card .ico svg { width: 22px; height: 22px; }

/* problem cards get a red-ish accent */
.card.problem .ico { background: var(--red-weak); color: var(--red); }

/* ----- Callouts --------------------------------------------------------- */
.callout { border: 1px solid var(--border); border-left: 4px solid var(--accent);
  background: var(--surface-2); border-radius: var(--radius-s); padding: 16px 20px; margin: 1.4em 0; }
.callout p:last-child { margin-bottom: 0; }
.callout .callout-label { font-weight: 700; font-size: .82rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-strong); margin-bottom: 6px; display: block; }
.callout--why    { border-left-color: var(--violet);  background: var(--accent-weak); }
.callout--why    .callout-label { color: var(--violet); }
.callout--info   { border-left-color: var(--accent); }
.callout--warn   { border-left-color: var(--amber); background: var(--amber-weak); }
.callout--warn   .callout-label { color: var(--amber); }
.callout--danger { border-left-color: var(--red);   background: var(--red-weak); }
.callout--danger .callout-label { color: var(--red); }
.callout--success{ border-left-color: var(--green); background: var(--green-weak); }
.callout--success .callout-label { color: var(--green); }

/* ----- Code ------------------------------------------------------------- */
code { font-family: var(--mono); font-size: .875em; background: var(--bg-inset);
  padding: .12em .4em; border-radius: 5px; color: var(--text); }
pre { margin: 1.3em 0; }
pre.code { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-s);
  padding: 16px 18px; overflow-x: auto; font-size: .85rem; line-height: 1.6; border: 1px solid rgba(255,255,255,.06); }
pre.code code { background: none; padding: 0; color: inherit; font-size: 1em; }
.code-block { margin: 1.4em 0; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-s); }
.code-block .code-head { background: var(--bg-inset); padding: 8px 16px; font-family: var(--mono);
  font-size: .78rem; color: var(--text-muted); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; }
.code-block .code-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.code-block pre.code { margin: 0; border: 0; border-radius: 0; }
.tok-c { color: var(--code-comment); font-style: italic; }
.tok-k { color: var(--code-key); }
.tok-s { color: var(--code-str); }
.tok-n { color: var(--code-num); }
.tok-p { color: #f0a0c0; }

/* ----- Badges / pills --------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 650;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .01em; white-space: nowrap;
  border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--proposed   { color: var(--slate-ink); background: color-mix(in srgb, var(--slate) 12%, transparent); }
.badge--confirmed  { color: var(--teal);  background: var(--teal-weak); }
.badge--accepted   { color: var(--green); background: var(--green-weak); }
.badge--quarantined{ color: var(--amber); background: var(--amber-weak); }
.badge--deprecated { color: var(--text-faint); background: var(--bg-inset); }
.badge--block      { color: var(--red);   background: var(--red-weak); }
.badge--advisory   { color: var(--accent-strong); background: var(--accent-weak); }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--bg-inset); color: var(--text-muted); }
.kbd { font-family: var(--mono); font-size: .8em; background: var(--surface); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text); }

/* ----- Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--border); border-radius: var(--radius-s); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 11px 15px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--bg-subtle); font-weight: 650; font-size: .82rem; letter-spacing: .02em;
  text-transform: uppercase; color: var(--text-muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

/* ----- Diagrams --------------------------------------------------------- */
figure.diagram { margin: 1.8em 0; padding: 24px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center; box-shadow: var(--shadow-s); overflow-x: auto; }
figure.diagram figcaption { margin-top: 14px; font-size: .88rem; color: var(--text-muted); }
.diagram svg { display: block; margin: 0 auto; height: auto; }

/* generic chip used inside svg-free flow diagrams */
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 1.5em 0; }
.flow .node { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-s); }
.flow .node .sub { display: block; font-weight: 400; font-size: .74rem; color: var(--text-faint); }
.flow .arrow { color: var(--text-faint); font-weight: 700; }
.flow .node.intent { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-strong); }
.flow .node.beh    { border-color: var(--teal);   background: var(--teal-weak); }
.flow .node.test   { border-color: var(--green);   background: var(--green-weak); }
.flow .node.code   { border-color: var(--border-strong); }

/* ----- Steppers (governance walkthrough) -------------------------------- */
.stepper { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 1.6em 0;
  box-shadow: var(--shadow-s); background: var(--surface); }
.stepper-track { display: flex; background: var(--bg-subtle); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; }
.stepper-track::-webkit-scrollbar { display: none; }
.step-tab { flex: 1; min-width: 120px; padding: 12px 14px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--text-faint); text-align: left;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.step-tab .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-inset); color: var(--text-muted); font-size: .72rem; margin-right: 7px; }
.step-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.step-tab.active .n { background: var(--accent); color: #fff; }
.step-tab.done .n { background: var(--green); color: #fff; }
.step-panel { padding: 24px; display: none; }
.step-panel.active { display: block; animation: fade .25s ease; }
.stepper-nav { display: flex; justify-content: space-between; padding: 14px 24px; border-top: 1px solid var(--border);
  background: var(--surface-2); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ----- Timeline (journey) ----------------------------------------------- */
.timeline { position: relative; margin: 2em 0; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 26px; }
.tl-item::before { content: ""; position: absolute; left: -28px; top: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl-item.done::before { background: var(--accent); }
.tl-item.parked::before { border-color: var(--slate); }
.tl-phase { font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-strong); }
.tl-item h3 { margin: 2px 0 6px; }

/* ----- Interactive explorer panels -------------------------------------- */
.explorer { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin: 1.6em 0; }
.explorer .stage { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; min-height: 260px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-s); }
.panel h4 { margin: 0 0 6px; font-size: 1.02rem; }
.panel .placeholder { color: var(--text-faint); font-size: .92rem; }
@media (max-width: 780px) { .explorer { grid-template-columns: 1fr; } }
.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip-btn { padding: 7px 13px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font: inherit; font-size: .85rem; font-weight: 550; color: var(--text-muted); }
.chip-btn:hover { border-color: var(--accent); color: var(--text); }
.chip-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ----- Footer ----------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-subtle); margin-top: 60px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 34px 24px; display: flex;
  flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; font-size: .88rem;
  color: var(--text-muted); }
.footer-inner a { color: var(--text-muted); }
.footer-inner a:hover { color: var(--text); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ----- Heading anchors -------------------------------------------------- */
.doc-body h2, .doc-body h3 { scroll-margin-top: calc(var(--nav-h) + 20px); position: relative; }
.anchor-link { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--text-faint); text-decoration: none; }
.doc-body h2:hover .anchor-link, .doc-body h3:hover .anchor-link { opacity: 1; }

/* ----- Misc utility ----------------------------------------------------- */
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }
.stat { text-align: center; padding: 20px; }
.stat .num { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; color: var(--accent-strong); line-height: 1; }
.stat .lbl { font-size: .85rem; color: var(--text-muted); margin-top: 6px; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.next-prev { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; flex-wrap: wrap; }
.np-card { flex: 1; min-width: 220px; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); }
.np-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-s); }
.np-card .np-dir { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.np-card .np-title { font-weight: 650; color: var(--text); margin-top: 3px; }

/* ----- Page-specific hooks --------------------------------------------- */
.hero h1 em { font-style: italic; color: var(--accent-strong); }
.principle-list > li { margin: .8em 0; }
ol.principle-list { counter-reset: p; list-style: none; padding-left: 0; }
ol.principle-list > li { position: relative; padding-left: 44px; }
ol.principle-list > li::before { counter-increment: p; content: counter(p); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-weak); color: var(--accent-strong);
  font-weight: 700; display: grid; place-items: center; font-size: .95rem; }

/* interactive graph explorer */
.bgraph { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.bgraph svg { width: 100%; height: auto; display: block; }
.bgraph .hit { cursor: pointer; transition: opacity .12s; }
.bgraph .hit:hover { opacity: .82; }
.bgraph .hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { font-size: .85rem; color: var(--text-faint); margin: 8px 2px 0; }

/* definition-list detail used in interactive panels */
.dl { margin: 0; }
.dl div { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dl div:last-child { border-bottom: 0; }
.dl dt { flex: none; width: 130px; color: var(--text-muted); font-size: .85rem; }
.dl dd { margin: 0; font-size: .9rem; }
.result-line { font-family: var(--mono); font-size: .9rem; background: var(--bg-inset); padding: 8px 12px;
  border-radius: 6px; margin: 10px 0 0; }

/* glossary */
dl.glossary { margin: 0; }
dl.glossary dt { font-weight: 700; margin-top: 16px; color: var(--text); }
dl.glossary dd { margin: 3px 0 0; color: var(--text-muted); }

/* ========================================================================
   Plugin-explainer additions (freya-devkit whole-plugin site)
   ======================================================================== */

/* hero stat row */
.hero-stats { display: flex; gap: 34px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }
.hero-stats .stat { padding: 0; }
.hero-stats .num { font-size: 2rem; }

/* tier badges (reused across pages) */
.tier-badge { display: inline-flex; align-items: center; font-size: .68rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tier-1 { color: var(--accent-strong); background: var(--accent-weak); }
.tier-2 { color: var(--teal);  background: var(--teal-weak); }
.tier-3 { color: var(--amber); background: var(--amber-weak); }
.tier-4 { color: var(--violet-ink); background: color-mix(in srgb, var(--violet) 15%, transparent); }
.tier-5 { color: var(--slate-ink); background: color-mix(in srgb, var(--slate) 15%, transparent); }

/* the 10-skill roster grid (overview) */
.roster { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); margin: 1.5em 0; }
.roster .tile { display: block; padding: 15px 17px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-s); }
.roster a.tile { transition: .15s; }
.roster a.tile:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-m); transform: translateY(-1px); }
.roster .tile .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.roster .tile .nm { font-family: var(--mono); font-weight: 650; font-size: .9rem; color: var(--text); }
.roster .tile .ds { font-size: .84rem; color: var(--text-muted); line-height: 1.45; }

/* tier lanes diagram (architecture) */
.tiers { display: flex; flex-direction: column; gap: 12px; margin: 1.6em 0; }
.tier-lane { display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 13px 16px; }
.tier-lane .lane-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.tier-lane .lane-skills { display: flex; gap: 8px; flex-wrap: wrap; }
.tier-node { font-family: var(--mono); font-size: .82rem; font-weight: 600; padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; transition: .12s; }
.tier-node:hover { border-color: var(--accent); }
.tier-node.key { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-strong); }
.tier-node.active { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-strong); box-shadow: 0 0 0 2px var(--accent-weak); }
@media (max-width: 640px) { .tier-lane { grid-template-columns: 1fr; gap: 9px; } }

/* knowledge-base file tree */
.tree { font-family: var(--mono); font-size: .83rem; line-height: 1.85; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; overflow-x: auto; margin: 1.5em 0; }
.tree .row { white-space: pre; display: flex; align-items: baseline; }
.tree .path.dir { color: var(--accent-strong); font-weight: 600; }
.tree .own { margin-left: auto; padding-left: 22px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.tree .own.o-code   { color: var(--accent-strong); }
.tree .own.o-docs   { color: var(--teal); }
.tree .own.o-spec   { color: var(--violet); }
.tree .own.o-sec    { color: var(--red); }
.tree .own.o-status { color: var(--amber); }
.tree .gi { font-size: .67rem; color: var(--text-faint); margin-left: 10px; font-weight: 500; }

/* skill deep cards (skills page) — native <details> */
.skill { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-s); margin: 13px 0; overflow: hidden; scroll-margin-top: calc(var(--nav-h) + 20px); }
.skill > summary { list-style: none; cursor: pointer; padding: 15px 20px; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.skill > summary::-webkit-details-marker { display: none; }
.skill > summary::after { content: "+"; margin-left: auto; color: var(--text-faint); font-size: 1.25rem; font-weight: 300; }
.skill[open] > summary::after { content: "\2013"; }
.skill > summary:hover { background: var(--surface-2); }
.skill .s-name { font-family: var(--mono); font-weight: 680; font-size: 1rem; color: var(--text); }
.skill .s-purpose { color: var(--text-muted); font-size: .9rem; flex: 1 1 240px; min-width: 0; }
.skill .s-body { padding: 6px 20px 20px; border-top: 1px solid var(--border); }
.skill .s-body h4 { margin: 16px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.badge--script { color: var(--green); background: var(--green-weak); }
.badge--prose  { color: var(--slate-ink); background: color-mix(in srgb, var(--slate) 13%, transparent); }

/* compare (monolith vs composable) */
.compare .card.bad  { border-top: 3px solid var(--red); }
.compare .card.good { border-top: 3px solid var(--green); }
.compare h4 { margin-top: 0; }

/* segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; margin: 0 0 6px; }
.seg button { padding: 9px 18px; border: 0; background: var(--surface); color: var(--text-muted); font: inherit;
  font-weight: 600; font-size: .9rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: #fff; }

/* numbered command steps */
ol.cmd-steps { list-style: none; counter-reset: c; padding-left: 0; }
ol.cmd-steps > li { position: relative; padding-left: 44px; margin: 1.15em 0; }
ol.cmd-steps > li::before { counter-increment: c; content: counter(c); position: absolute; left: 0; top: -2px;
  width: 29px; height: 29px; border-radius: 8px; background: var(--accent-weak); color: var(--accent-strong);
  font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
ol.cmd-steps > li > strong:first-child { display: block; margin-bottom: 2px; }

/* text filter box + hide helper */
.filter-input { width: 100%; max-width: 360px; padding: 9px 13px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; margin: 0 0 4px; }
.filter-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
tr.hide, .skill.hide, .roster .tile.hide, .filter-empty.hide { display: none; }
.filter-empty { color: var(--text-faint); font-size: .9rem; padding: 12px 2px; }

/* mini inline legend */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--text-muted); margin: 10px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ========================================================================
   One-site restructure additions
   ======================================================================== */

/* document eyebrow (Layout B). The .hero .eyebrow pill rule above is
   unaffected; this is the flat, non-pill variant used above an <h1>. */
.doc-body .eyebrow { display: inline-block; font-size: .8rem; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-strong); margin-bottom: 6px; }

/* A centred prose column. This exists so no page needs an inline
   style="max-width:var(--prose);margin:0 auto" — the soup on the old pages.
   Put it on any block that should be prose-width and centred in a wide section:
   .lead paragraphs, callouts, code blocks under a centred h2. */
.prose-center { max-width: var(--prose); margin-left: auto; margin-right: auto; }

/* h4 is the correct heading level inside a card that sits under an h3, and is
   deliberately excluded from the TOC. .card h3 already had a margin reset; h4
   did not, so it inherited a browser default that broke card spacing. */
.card h4 { margin: 0 0 .4em; font-size: 1.02rem; }

/* .flow .node .sub is 11.8px and sits on the tinted node fills, where
   --text-faint measured 3.8:1 — under AA. --text-muted clears it on every
   node variant while staying subordinate to the node's own label. */
.flow .node .sub { color: var(--text-muted); }

/* .btn-primary set #fff on --accent: 4.47:1 in light (just under AA) and
   2.98:1 in dark, where --accent is deliberately the lighter of the pair.
   Light keeps a white label on the stronger indigo (6.29:1); dark inverts to
   a dark label on the light accent (6.47:1). Hover stays a visible step. */
.btn-primary { background: var(--accent-strong); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-strong) 86%, black); }
[data-theme="dark"] .btn-primary { background: var(--accent); color: var(--bg); }
[data-theme="dark"] .btn-primary:hover { background: var(--accent-strong); color: var(--bg); }

/* outbound links into the markdown source of truth (see §6 of the shell spec).
   Link text is always the repo-relative path; the ↗ is added here, never typed. */
.md-link { font-family: var(--mono); font-size: .92em; }
.md-link::after { content: " \2197"; color: var(--text-faint); font-family: var(--font); }
.md-links { display: flex; flex-direction: column; gap: 6px; margin: .6em 0 0; padding: 0; list-style: none; }
.md-links li { font-size: .93rem; }
