/* [Doruk-Aksoy] The modding docs' look, after zt-bcc's doc/html (tools/docs/style.css), with ForkUnderA's accent and a print layout. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --sunken: #f3f1ec;
  --text: #1d2026;
  --muted: #5d6470;
  --faint: #8a909a;
  --border: #e5e1d8;
  --accent: #b93d12;
  --accent-soft: #fbeae2;
  --mark: #fff1b8;
  --code-bg: #f5f3ee;
  --code-border: #e8e4da;
  --syn-bg: #fdfbf5;
  --syn-border: #d9cfb4;
  --syn-ph: #9a5a12;
  --note-bg: #fdf3ee;
  --note-border: #eeb79d;
  --kw: #8a3fb8;
  --ty: #0b7a75;
  --cn: #b4441c;
  --str: #3f7a1f;
  --num: #b4441c;
  --com: #8b8f97;
  --pp: #b02a6e;
  --fn: #2253c0;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 6px 20px rgba(20, 20, 30, .06);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "JetBrains Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131519; --surface: #1a1d22; --sunken: #1f2329; --text: #e4e5e7; --muted: #a2a8b2; --faint: #747b86;
    --border: #2b3038; --accent: #ff9a6b; --accent-soft: #3a2419; --mark: #5a4a12; --code-bg: #181b20;
    --code-border: #2a2f37; --syn-bg: #1d1b16; --syn-border: #4a4230; --syn-ph: #e0a95c; --note-bg: #2a1e18;
    --note-border: #7a4a33; --kw: #c99bf0; --ty: #5cc8c0; --cn: #f0956b; --str: #9dd178; --num: #f0956b;
    --com: #7c828c; --pp: #f08cc0; --fn: #8fb2ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131519; --surface: #1a1d22; --sunken: #1f2329; --text: #e4e5e7; --muted: #a2a8b2; --faint: #747b86;
  --border: #2b3038; --accent: #ff9a6b; --accent-soft: #3a2419; --mark: #5a4a12; --code-bg: #181b20;
  --code-border: #2a2f37; --syn-bg: #1d1b16; --syn-border: #4a4230; --syn-ph: #e0a95c; --note-bg: #2a1e18;
  --note-border: #7a4a33; --kw: #c99bf0; --ty: #5cc8c0; --cn: #f0956b; --str: #9dd178; --num: #f0956b;
  --com: #7c828c; --pp: #f08cc0; --fn: #8fb2ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans);
  font-feature-settings: "kern", "liga";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 600 16px var(--display); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font: 700 12px var(--mono); letter-spacing: .02em; color: #fff; background: var(--accent);
  padding: 3px 7px 4px; border-radius: 6px;
}
.menu-btn, .theme-btn, .print-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent;
  border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
}
.menu-btn:hover, .theme-btn:hover, .print-btn:hover { background: var(--sunken); color: var(--text); }
.menu-btn { display: none; }
.print-btn { margin-left: auto; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* Search */
.search { position: relative; flex: 0 1 420px; margin-left: 24px; }
.search input {
  width: 100%; height: 36px; padding: 0 40px 0 34px; font: 14px var(--sans); color: var(--text);
  background: var(--sunken); border: 1px solid var(--border); border-radius: 9px; outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 11px; top: 10px; color: var(--faint); pointer-events: none; }
.search kbd {
  position: absolute; right: 9px; top: 8px; font: 11px var(--mono); color: var(--faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--surface);
}
.results {
  position: absolute; top: 42px; left: 0; right: 0; max-height: min(70vh, 520px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
}
.results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.results a:hover, .results a.sel { background: var(--accent-soft); text-decoration: none; }
.results .r-path { font-size: 12px; color: var(--faint); }
.results .r-head { font-weight: 600; font-size: 14px; }
.results .r-snip { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.results mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.results .empty { padding: 12px; color: var(--muted); font-size: 14px; }

/* Layout */
.layout {
  display: grid; grid-template-columns: 264px minmax(0, 1fr) 232px; max-width: 1440px; margin: 0 auto;
}
.sidebar {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 24px 16px 40px 20px;
  border-right: 1px solid var(--border); scrollbar-width: thin;
}
.nav-group + .nav-group { margin-top: 20px; }
.nav-group h2 {
  margin: 0 0 6px 10px; font: 600 11.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
}
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a {
  display: block; padding: 5px 10px; border-radius: 7px; color: var(--muted); font-size: 14.5px; line-height: 1.4;
}
.nav-group a:hover { color: var(--text); background: var(--sunken); text-decoration: none; }
.nav-group a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.scrim { display: none; }

.content { min-width: 0; padding: 40px 56px 64px; }
.doc { max-width: 780px; }
.rail { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 40px 20px 40px 8px; scrollbar-width: thin; }
.toc h2 { margin: 0 0 8px; font: 600 11.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a {
  display: block; padding: 3px 0 3px 12px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--muted); font-size: 13.5px; line-height: 1.4;
}
.toc li.l3 a { padding-left: 24px; font-size: 13px; }
.toc li a:hover { color: var(--text); text-decoration: none; }
.toc li a.on { color: var(--accent); border-left-color: var(--accent); }

/* Document typography */
.doc h1, .doc h2, .doc h3, .doc h4 { font-family: var(--display); line-height: 1.25; position: relative; color: var(--text); }
.doc h1 { font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 20px; }
.doc h2 {
  font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; margin: 52px 0 14px; padding-top: 22px;
  border-top: 1px solid var(--border);
}
.doc h3 { font-size: 1.18rem; font-weight: 650; margin: 34px 0 10px; }
.doc h4 { font-size: 1rem; font-weight: 650; margin: 26px 0 8px; }
.doc h1 + p { font-size: 1.08rem; color: var(--muted); }
.hash { margin-left: 8px; color: var(--faint); opacity: 0; font-weight: 400; transition: opacity .15s; }
.doc :is(h1, h2, h3, h4):hover .hash, .hash:focus { opacity: 1; text-decoration: none; }
.doc p, .doc ul, .doc ol { margin: 0 0 16px; }
.doc ul, .doc ol { padding-left: 24px; }
.doc li { margin: 4px 0; }
.doc li > p { margin: 0 0 6px; }
.doc strong { font-weight: 650; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.doc blockquote {
  margin: 0 0 20px; padding: 12px 16px; background: var(--note-bg); border: 1px solid var(--note-border); border-left-width: 4px;
  border-radius: 8px;
}
.doc blockquote > :last-child { margin-bottom: 0; }
.doc blockquote strong:first-child { color: var(--accent); }
.doc :not(pre) > code {
  font: .86em var(--mono); background: var(--code-bg); border: 1px solid var(--code-border);
  padding: .1em .38em; border-radius: 5px; overflow-wrap: anywhere;
}
.doc a code { color: var(--accent); }

/* Code */
.code-wrap { position: relative; margin: 0 0 20px; }
.doc pre {
  margin: 0; padding: 16px 18px; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: 10px; font: 13.5px/1.6 var(--mono); tab-size: 3; scrollbar-width: thin;
}
.doc pre code { font: inherit; background: none; border: 0; padding: 0; }
.doc pre, .doc code { font-variant-ligatures: none; }
.copy {
  position: absolute; top: 8px; right: 8px; padding: 3px 9px; font: 12px var(--sans); color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code-wrap:hover .copy, .copy:focus { opacity: 1; }
.copy.done { color: var(--ty); }
@media (hover: none) { .copy { opacity: 1; } }
.kw { color: var(--kw); font-weight: 500; }
.ty { color: var(--ty); }
.cn, .num { color: var(--num); }
.str { color: var(--str); }
.com { color: var(--com); font-style: italic; }
.pp { color: var(--pp); }
.fn { color: var(--fn); }

/* Syntax templates (<pre> with <i> placeholders) */
pre.synopsis {
  margin: 0 0 20px; padding: 14px 18px; overflow-x: auto; background: var(--syn-bg); border: 1px dashed var(--syn-border);
  border-radius: 10px; font: 14px/1.6 var(--mono); position: relative;
}
pre.synopsis::before {
  content: "Syntax"; display: block; font: 600 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--syn-ph); margin-bottom: 4px;
}
pre.synopsis i { color: var(--syn-ph); font-style: italic; }

/* Callouts */
p.callout {
  padding: 14px 16px; background: var(--note-bg); border: 1px solid var(--note-border); border-left-width: 4px; border-radius: 8px;
}
.callout-tag {
  display: inline-block; margin-right: 8px; font: 700 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.doc table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.5; }
.doc th, .doc td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.doc tr:last-child td { border-bottom: 0; }
.doc th { background: var(--sunken); font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.doc td:first-child { white-space: nowrap; }
.doc td ul { margin: 0; padding-left: 18px; }

/* Index cards */
ul.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
li.card {
  margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
li.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow); }
.card-title { display: block; font: 600 16px var(--display); color: var(--text); }
.card-desc { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
ul.chips { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
ul.chips li { margin: 0; }
ul.chips a {
  display: inline-block; padding: 2px 9px; font-size: 12.5px; line-height: 1.6; border-radius: 999px;
  background: var(--sunken); color: var(--muted); border: 1px solid transparent;
}
ul.chips a:hover { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); text-decoration: none; }
ul.chips code { background: none; border: 0; padding: 0; font-size: .95em; }

/* Pager + footer */
.pager { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pn {
  display: block; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-weight: 600;
  background: var(--surface);
}
.pn span { display: block; font: 500 12px var(--sans); color: var(--faint); margin-bottom: 2px; }
.pn:hover { border-color: var(--accent); text-decoration: none; }
.pn.next { text-align: right; grid-column: 2; }
.foot { max-width: 780px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--faint); }
.foot code { font: 12px var(--mono); }

/* Responsive */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 248px minmax(0, 1fr); }
  .rail { display: none; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  .search { margin-left: 4px; flex: 1 1 auto; }
  .search kbd { display: none; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; height: auto; width: min(300px, 84vw); z-index: 25;
    background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 56px 0 0; z-index: 20; background: rgba(0, 0, 0, .3); }
  .content { padding: 28px 16px 48px; }
  .doc h1 { font-size: 1.85rem; }
  .doc h2 { font-size: 1.3rem; margin-top: 40px; }
  ul.cards { grid-template-columns: 1fr; }
  .doc td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* [Doruk-Aksoy] The overview's category lists, one card per page. */
.doc ul.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: stretch; }
.doc ul.cards > li {
  margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px; color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.doc ul.cards > li:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow); }
.doc ul.cards > li > a:first-child { display: block; margin-bottom: 4px; font: 600 16px var(--display); color: var(--text); }
.doc ul.cards > li > a:first-child:hover { color: var(--accent); text-decoration: none; }

/* [Doruk-Aksoy] Printing, or saving as PDF: the page alone, code and tables kept whole where they fit. */
@media print {
  :root { --bg: #fff; --surface: #fff; }
  .topbar, .sidebar, .rail, .pager, .scrim, .copy, .hash { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .doc { max-width: none; }
  body { font-size: 11pt; }
  .doc pre, .table-wrap, .doc blockquote, .doc ul.cards > li { break-inside: avoid; }
  .doc h2, .doc h3 { break-after: avoid; }
  .doc pre { white-space: pre-wrap; overflow: visible; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: var(--muted); overflow-wrap: anywhere; }
}
