@font-face{font-family:"Atkinson Hyperlegible";font-weight:400;font-style:normal;font-display:swap;src:url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2")}
@font-face{font-family:"Atkinson Hyperlegible";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2")}
@font-face{font-family:"Atkinson Hyperlegible";font-weight:400;font-style:italic;font-display:swap;src:url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2")}
@font-face{font-family:"Bricolage Grotesque";font-weight:200 800;font-style:normal;font-display:swap;src:url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-weight:100 800;font-style:normal;font-display:swap;src:url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2")}
:root {
  --bg: #ffffff;
  --surface: #f4f4f4;
  --sunken: #ebebeb;
  --ink: #0a0a0a;
  --ink-2: #3d3d3d;
  --muted: #6a6a6a;
  --line: #e0e0e0;
  --accent: #ffd400;
  --accent-ink: #000000;
  --mark: rgba(255, 212, 0, .55);
  --warn: #b45309;
  --term-bg: #0d0d0d;
  --term-ink: #e8e8e8;
  --term-dim: #8a8a8a;
  --font-d: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-b: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-m: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  --side: 264px;
  --top: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #121212; --sunken: #1b1b1b; --ink: #f2f2f2; --ink-2: #c4c4c4;
    --muted: #8c8c8c; --line: #2e2e2e; --mark: rgba(255, 212, 0, .35); --warn: #ff9f43;
    --term-bg: #0b0b0b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #121212; --sunken: #1b1b1b; --ink: #f2f2f2; --ink-2: #c4c4c4;
  --muted: #8c8c8c; --line: #2e2e2e; --mark: rgba(255, 212, 0, .35); --warn: #ff9f43;
  --term-bg: #0b0b0b; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17.5px/1.7 var(--font-b); }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 3px; }
a:hover { background: var(--mark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, kbd, pre { font-family: var(--font-m); font-size: .86em; }
:not(pre) > code { background: var(--surface); border: 1px solid var(--line); padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #000; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px/1 var(--font-d); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { background: none; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #000; display: grid; place-items: center; font-size: 18px; }
.logo-img { display: block; height: 100px; width: auto; max-width: 160px; object-fit: contain; }
.logo[hidden], .logo-img[hidden] { display: none; }
.wiki { font-weight: 500; color: var(--muted); }
.ver { font: 600 12px/1 var(--font-m); color: var(--muted); border: 1px solid var(--line); padding: 4px 7px; border-radius: 6px; }
.search { position: relative; margin-left: auto; width: min(380px, 40vw); }
.search input { width: 100%; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 0 38px 0 12px; font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--muted); }
.search kbd { position: absolute; right: 9px; top: 9px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--bg); }
#results { position: absolute; top: 44px; left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .18); max-height: 60vh; overflow: auto; padding: 6px; }
#results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; }
#results a b { display: block; font-weight: 700; }
#results a span { font-size: 14px; color: var(--muted); }
#results a[aria-selected="true"], #results a:hover { background: var(--mark); }
#results .none { padding: 10px; color: var(--muted); font-size: 15px; }
.theme, .menu { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.theme svg { width: 18px; height: 18px; fill: currentColor; }
.lang-pick { position: relative; display: flex; align-items: center; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); flex: none; }
.lang-pick svg { position: absolute; left: 10px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; pointer-events: none; }
.lang-pick select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; height: 100%; padding: 0 12px 0 32px; cursor: pointer; border-radius: 10px; }
.lang-pick select:focus-visible { outline: 2px solid var(--accent, #ffd400); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.menu { display: none; }
.menu span, .menu span::before, .menu span::after { display: block; width: 16px; height: 2px; background: currentColor; position: relative; content: ""; }
.menu span::before { position: absolute; top: -5px; }
.menu span::after { position: absolute; top: 5px; }

.btn { display: inline-block; padding: 11px 18px; border-radius: 10px; font-weight: 700; text-decoration: none; border: 2px solid; }

/* cover: the one loud element */
.cover { background: var(--accent); color: #000; border-bottom: 1px solid #000; }
.cover-in { max-width: 1320px; margin: 0 auto; padding: clamp(36px, 6vw, 84px) clamp(16px, 4vw, 56px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 4vw, 64px); align-items: center; }
.cover-ver { font: 600 14px/1 var(--font-m); margin: 0 0 18px; }
.cover h1 { font: 800 clamp(44px, 7vw, 96px)/.95 var(--font-d); letter-spacing: -.04em; margin: 0 0 22px; max-width: 9ch; }
.cover-sub { font-size: 19px; line-height: 1.55; max-width: 44ch; margin: 0; }
.cover .hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.cover .btn { background: #000; color: var(--accent); border-color: #000; }
.cover .btn:hover { background: #222; }
.cover .btn.ghost { background: transparent; color: #000; border-color: #000; }
.cover .btn.ghost:hover { background: rgba(0, 0, 0, .08); }
.cover a { text-decoration-color: #000; }
.cover a:hover { background: none; }
.cover-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 22px 0 0; margin: 30px 0 0; border-top: 2px solid #000; max-width: 34em; }
.cover-facts li { font-size: 15px; }
.cover-facts b { font: 800 26px/1 var(--font-d); margin-right: 4px; }
.cover-term { background: #0b0b0b; border-radius: 16px; border: 2px solid #000; box-shadow: 14px 14px 0 #000; overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; background: #1a1a1a; border-bottom: 1px solid #2a2a2a; }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a3a3a; }
.term-bar span:first-child { background: var(--accent); }
.term-bar em { margin-left: 8px; font: 12.5px var(--font-m); color: #8a8a8a; font-style: normal; }
.cover-term .irc { border: 0; border-radius: 0; padding: 18px 18px 22px; font-size: 14px; min-height: 17.5em; }
@media (prefers-reduced-motion: no-preference) {
  .js .cover-term .irc .l { opacity: 0; transform: translateY(4px); animation: line-in .35s ease forwards; }
}
@keyframes line-in { to { opacity: 1; transform: none; } }

/* reading progress */
.progress { position: fixed; top: var(--top); left: 0; right: 0; height: 3px; z-index: 29; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); }

/* layout */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr) 230px; max-width: 1560px; margin: 0 auto; }
.toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow: auto; padding: 44px 20px 40px 8px; font-size: 14px; }
.toc p { margin: 0 0 8px; font-weight: 700; color: var(--muted); font-size: 13px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 12px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--ink-2); line-height: 1.35; }
.toc a:hover { background: none; color: var(--ink); }
.toc a.on { border-left-color: var(--accent); color: var(--ink); font-weight: 700; }
.toc:empty, .toc.empty { visibility: hidden; }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow: auto; padding: 22px 14px 40px 20px; border-right: 1px solid var(--line); font-size: 15px; }
.side .ng { margin: 18px 0 6px 10px; font-size: 13px; color: var(--muted); font-weight: 700; }
.side .ng:first-child { margin-top: 0; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); }
.side a:hover { background: var(--surface); }
.side a.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
main { min-width: 0; padding: 0 clamp(16px, 4vw, 56px) 40px; }
main > * { max-width: 900px; }
.doc-wrap > .doc:first-child { padding-top: 48px; }

/* irc transcript */
.irc { background: var(--term-bg); color: var(--term-ink); border-radius: 14px; padding: 14px 16px; font: 13.5px/1.55 var(--font-m); overflow-x: auto; border: 1px solid #222; }
.irc .l { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.irc .l.sys { display: block; color: var(--term-dim); }
.irc .who { text-align: right; color: #9ecbff; }
.irc .who.me { color: #ffd400; }
.irc .who.bnc { color: #ffd400; font-weight: 600; }
.irc .who.nick { color: #b9e6a5; }

/* sections */
.doc { padding: 44px 0 8px; border-bottom: 1px solid var(--line); }
.doc h2 { font: 800 34px/1.1 var(--font-d); letter-spacing: -.02em; margin: 0 0 18px; position: relative; }
.anchor { position: absolute; left: -1.1em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 500; }
.doc h2:hover .anchor { opacity: 1; }
.doc h3 { font: 700 22px/1.25 var(--font-d); margin: 32px 0 10px; letter-spacing: -.01em; }
.doc h3.group { font-size: 26px; margin-top: 42px; padding-top: 10px; }
.doc h4 { font: 700 16px/1.3 var(--font-b); margin: 18px 0 6px; }
.doc p, .doc li { max-width: 70ch; }
.doc p { margin: 0 0 1em; }
.lead { font-size: 1.1em; color: var(--ink); }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 4px 0; }
ul.check { list-style: none; padding-left: 0; }
ul.check li { position: relative; padding-left: 28px; }
ul.check li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 12px; height: 7px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(-45deg); }
ol.steps { list-style: none; counter-reset: s; padding-left: 0; }
ol.steps > li { counter-increment: s; position: relative; padding: 2px 0 10px 46px; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #000; font: 700 15px/30px var(--font-d); text-align: center; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { padding: 16px 14px 16px 0; }
.facts div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.facts b { display: block; font: 800 44px/1 var(--font-d); letter-spacing: -.03em; }
.facts span { color: var(--ink-2); font-size: 15px; }

pre { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; line-height: 1.55; margin: 12px 0 18px; tab-size: 4; }
pre code { font-size: 13.5px; }
.tw { overflow-x: auto; margin: 12px 0 20px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--surface); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
table.settings td:first-child { min-width: 12em; }
table.settings .k { margin-top: 3px; font-size: 13px; color: var(--muted); }
table.settings .k code { background: none; border: 0; padding: 0; }

.note { border-left: 6px solid var(--accent); background: var(--surface); padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 18px 0; max-width: 74ch; }
.note.warn { border-left-color: var(--warn); }

/* module and plugin sheets */
.card { padding: 22px 0 10px; border-top: 1px solid var(--line); }
.card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 6px; }
.card h3 { margin: 0; font-size: 21px; }
.mid { font: 600 13px/1 var(--font-m); color: var(--muted); }
.badge { font-size: 12.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.badge.new { background: var(--accent); color: #000; border-color: var(--accent); }
.card .lead { margin: 4px 0 10px; }
.ex { position: relative; margin: 14px 0; }
.exl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.ex pre, .ex .irc { margin: 0; }
.cli { font-size: 14.5px; color: var(--muted); }
.card[hidden] { display: none; }
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 20px 0 6px; padding: 12px 14px; background: var(--surface); border-radius: 12px; }
.filter label { font-weight: 700; font-size: 15px; }
.filter input { flex: 1 1 220px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); padding: 0 10px; font: inherit; font-size: 15px; }
.filter .count { font-size: 14px; color: var(--muted); }

/* tabs */
.tabs { margin: 16px 0; }
.tablist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tablist button { font: inherit; font-size: 15px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); cursor: pointer; }
.tablist button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 700; }

/* faq */
.faq dt { font-weight: 700; margin-top: 18px; }
.faq dd { margin: 4px 0 0; color: var(--ink-2); max-width: 74ch; }

/* diagram */
.diagram { width: 100%; height: auto; max-width: 760px; margin: 8px 0 20px; font-family: var(--font-b); }
.diagram rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram rect.off { stroke-dasharray: 5 4; fill: none; }
.diagram .core rect { fill: var(--accent); stroke: var(--accent); }
.diagram text { fill: var(--ink); font-size: 14px; text-anchor: middle; }
.diagram .core text { fill: #000; font-size: 15px; }
.diagram text.h { font: 700 17px var(--font-d); }
.diagram .core text.h { font-size: 26px; }
.diagram text.dim { fill: var(--muted); font-size: 13px; }
.diagram text.cap { fill: var(--muted); font-size: 12.5px; font-family: var(--font-m); }
.diagram .links path { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.diagram .ah { fill: var(--muted); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 28px 0 10px; color: var(--muted); font-size: 14px; }
.foot span:first-child { color: var(--ink); font-weight: 700; }

/* responsive */
@media (max-width: 1280px) {
  .layout { grid-template-columns: var(--side) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1000px) {
  .cover-in { grid-template-columns: 1fr; }
  .cover-term { box-shadow: 8px 8px 0 #000; }
}
@media (max-width: 860px) {
  .menu { display: grid; }
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 25; top: var(--top); left: 0; width: min(300px, 86vw); background: var(--bg); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .side.open { transform: none; }
  .ver, .wiki { display: none; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .doc h2 { font-size: 28px; }
  .anchor { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top { padding: 0 12px; gap: 8px; }
  .brand { font-size: 0; gap: 0; }
  .facts { grid-template-columns: 1fr; }
  .facts div + div { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .irc .l { grid-template-columns: 1fr; gap: 0; }
  .irc .who { text-align: left; }
  .cover h1 { font-size: 46px; }
  .cover-sub { font-size: 17px; }
  .cover-term .irc { min-height: 0; font-size: 13px; }
  .lang-pick { width: 38px; }
  .lang-pick svg { left: 10px; }
  .lang-pick select { width: 38px; padding: 0; color: transparent; }
  .lang-pick select option { color: var(--ink); background: var(--bg); }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media print {
  .top, .side, .filter, .toc, .progress, .cover-term { display: none; }
  .layout { display: block; }
}

/* Command tables: on narrow screens each row becomes a block, command first. */
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: .6rem 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.25)); }
  table.stack td { border: 0; padding: .15rem .75rem; }
  table.stack td:first-child { padding-top: .4rem; }
}
.lang-pick[hidden] { display: none; }
