/* Manovella docs: shared design system.
   Sibling of the home page (../site.css): same palette, same faces. Dark only:
   there is no light theme and no prefers-color-scheme branch. The faces come
   and the palette come from ../base.css, which every page links itself. */

:root {
  color-scheme: dark;
  --bg: var(--navy); --surface: #1a1832; --surface-2: #2a2750; --border: #3a3558;
  --border-strong: #554d75; --text: var(--ink); --faint: #9a8eb3;
  --accent-ink: #BE98FF; --accent-soft: rgba(137, 52, 250, .20);
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 18px 44px rgba(8, 5, 24, .55);

  --maxw: 720px;
  --sidebar: 268px;
  --topbar: 56px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; border-radius: 4px; }

.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

/* sidebar */
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  border-right: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 20px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; transition: background .15s; }
a.brand:hover { text-decoration: none; background: var(--surface-2); }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.brand b { font-weight: 700; letter-spacing: -.2px; font-size: 17px; }
.brand .ver { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border-strong); padding: 2px 7px; border-radius: 20px; }
nav.side { padding: 14px 12px 24px; }
.navgroup { margin-bottom: 18px; }
.navgroup > .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 6px 10px; }
.navlink {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  color: var(--muted); font-size: 14px; padding: 7px 10px; border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.navlink:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.navlink .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: none; transition: background .15s; }
.navlink.active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.navlink.active .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.sidebar-foot { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 12px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sidebar-foot a { color: var(--muted); }

/* topbar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; height: var(--topbar);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.crumbs { font-family: var(--mono); font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.iconbtn {
  flex: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; background: none;
  border: 1px solid var(--border-strong); color: var(--muted); font: inherit;
  font-size: 13px; cursor: pointer; padding: 6px 11px; border-radius: 8px;
  transition: color .15s, border-color .15s;
}
.iconbtn:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }
/* Discord and Sponsor are the bar's third and fourth links: a phone has no room, and the sidebar's foot carries them. */
@media (max-width: 700px) { .tb-extra { display: none; } }
@media (max-width: 400px) { .topbar { padding: 0 14px; gap: 8px; } .iconbtn { padding: 6px 9px; } }

/* article */
main.doc { padding: 44px 28px 40px; flex: 1; }
main.doc p > code, main.doc li > code, main.doc td > code { overflow-wrap: anywhere; }
.page { max-width: var(--maxw); margin: 0 auto; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; margin: 0 0 12px; }
h1 { font-weight: 700; letter-spacing: -.03em; font-size: clamp(30px, 4.4vw, 42px); line-height: 1.1; margin: 0 0 14px; text-wrap: balance; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 34px; max-width: 62ch; }
h2 { font-weight: 700; font-size: 22px; letter-spacing: -.02em; margin: 46px 0 14px; padding-top: 8px; scroll-margin-top: 76px; text-wrap: balance; }
h3 { font-weight: 600; font-size: 17px; margin: 30px 0 10px; scroll-margin-top: 76px; }
p { margin: 0 0 16px; max-width: 65ch; }
.doc ul, .doc ol { max-width: 65ch; padding-left: 22px; margin: 0 0 16px; }
.doc li { margin: 6px 0; }
code { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); border: 1px solid rgba(137, 52, 250, .28); padding: 1.5px 6px; border-radius: 6px; color: var(--text); }
kbd { font-family: var(--mono); font-size: 12.5px; line-height: 1; display: inline-block; min-width: 1.4em; text-align: center; padding: 4px 7px; border-radius: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: 0 1.5px 0 var(--border-strong); }

/* code block */
.code { position: relative; margin: 0 0 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: var(--text); }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.code .prompt { color: var(--faint); user-select: none; }
.code .cmt { color: var(--faint); font-style: italic; }
.copy { position: absolute; top: 9px; right: 9px; font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s, color .15s; }
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--text); }
@media (hover: none) { .copy { opacity: 1; } }

/* pictures: the engine's own stills, in a frame; clicking one enlarges it */
figure.shot { margin: 0 0 12px; }
.frame { border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: #0c0a1c; box-shadow: var(--shadow); }
.frame img { display: block; width: 100%; height: auto; }
figcaption { font-size: 13px; color: var(--faint); margin: 10px 2px 30px; }
.frame.zoomable { cursor: zoom-in; }
.frame.zoomable:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; }

.lb { position: fixed; inset: 0; z-index: 60; display: none; background: color-mix(in srgb, var(--bg) 92%, black); backdrop-filter: blur(6px); }
.lb.open { display: grid; grid-template-rows: auto 1fr; }
body.lb-lock { overflow: hidden; }
.lb-bar { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.lb-count { color: var(--faint); }
.lb-cap { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-btn { font-family: var(--mono); font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.lb-btn:hover, .lb-btn:focus-visible { color: var(--text); border-color: var(--border-strong); }
.lb-btn[hidden] { display: none; }
.lb-stage { display: grid; place-items: center; overflow: auto; padding: 18px; }
.lb-stage img { display: block; max-width: 96vw; max-height: calc(100vh - 100px); width: auto; height: auto; border-radius: 10px; border: 1px solid var(--border-strong); }
.lb.zoomed .lb-stage { place-items: start; }
.lb.zoomed .lb-stage img { max-width: none; max-height: none; cursor: zoom-out; }

/* callout: a grid, so a note of several paragraphs stacks them beside its icon */
.note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; align-items: start; margin: 0 0 22px; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; }
.note .ic { grid-column: 1; grid-row: 1 / -1; color: var(--accent-ink); font-family: var(--mono); font-weight: 700; }
.note p { grid-column: 2; margin: 0; font-size: 14.5px; max-width: none; }

/* tables */
.keys { width: 100%; border-collapse: collapse; margin: 0 0 26px; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.keys caption { text-align: left; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 0 0 8px; }
.keys th { text-align: left; font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 6px 10px; border-bottom: 1px solid var(--border-strong); }
.keys td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.keys td.k { width: 150px; white-space: nowrap; }
.keys tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; margin: 0 0 22px; }
.tablewrap .keys { margin: 0; min-width: 480px; }
@media (max-width: 560px) { .keys td.k { white-space: normal; width: auto; } }

/* pager */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 54px; padding-top: 22px; border-top: 1px solid var(--border); }
.pager.top { margin: 0 0 30px; padding: 0 0 18px; border-top: 0; border-bottom: 1px solid var(--border); }
.pager a { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; min-width: 180px; color: var(--text); }
.pager a:hover { border-color: var(--muted); text-decoration: none; }
.pager a.next { text-align: right; margin-left: auto; align-items: flex-end; }
.pager small { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }
.pager b { font-weight: 600; color: var(--accent-ink); }
@media (max-width: 480px) { .pager { flex-direction: column; } .pager a { min-width: 0; } .pager a.next { margin-left: 0; } }

/* publisher line (docs.js) */
.legal-foot { max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 0 28px 40px; font-size: 12px; color: var(--muted); text-align: center; }
.legal-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.legal-foot .dot { margin: 0 .5em; }
.legal-foot .made { margin: 8px 0 0; max-width: none; }

/* mobile */
.menu-btn { display: none; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; width: 84%; max-width: 320px; height: 100vh; transform: translateX(-100%); transition: transform .25s ease; visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; box-shadow: 0 0 0 100vmax rgba(8, 5, 24, .6); }
  .menu-btn { display: inline-flex; }
  main.doc { padding: 32px 20px 32px; }
  .legal-foot { padding: 0 20px 40px; }
}

/* ---------- release notes (releases.html) ---------- */
.rel { margin: 0 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.rel-latest { border-color: var(--border-strong); }
.rel > summary { cursor: pointer; padding: 14px 18px; list-style: none; border-radius: 12px; transition: background .15s ease; }
.rel > summary::-webkit-details-marker { display: none; }
.rel > summary:hover { background: var(--surface-2); }
.rel > summary .rel-head::before { content: "\25B8"; color: var(--faint); margin-right: 4px; transition: transform .15s ease; display: inline-block; }
.rel[open] > summary .rel-head::before { transform: rotate(90deg); }
.rel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rel-latest > .rel-head { padding: 16px 18px 0; }
.rel-ver { font-family: var(--mono); font-weight: 700; font-size: 16px; color: var(--accent-ink); }
.rel-name { font-weight: 600; font-size: 15px; }
.rel-date { color: var(--muted); font-size: 13px; }
.rel-tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 5px; padding: 1px 6px; }
.rel-link { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.rel-link:hover { color: var(--accent-ink); }
.rel-body { padding: 2px 18px 6px; }
.rel-body > *:first-child { margin-top: 12px; }
.rel-body h3 { font-size: 18px; margin: 28px 0 10px; }
.rel-body h4 { font-size: 16px; margin: 26px 0 10px; }
.rel-body h5 { font-size: 14.5px; margin: 20px 0 8px; color: var(--muted); }
.rel-body h6 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); }
.rel-body p, .rel-body li { font-size: 15px; line-height: 1.75; }
.rel-body hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.rel-code-wrap { position: relative; margin: 0 0 18px; }
.rel-code-wrap:hover .copy, .rel-code-wrap:focus-within .copy { opacity: 1; }
.rel-code { margin: 0; padding: 14px 16px; white-space: pre-wrap; overflow-wrap: break-word; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--text); }
.rel-code[data-lang]:not([data-lang=""])::before { content: attr(data-lang); display: block; margin: -4px 0 8px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.rel-code code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.rel-ln { display: block; padding-left: 2.2ch; text-indent: -2.2ch; }
.rel-table-wrap { overflow-x: auto; margin: 0 0 18px; }
.rel-table-wrap table { border-collapse: collapse; width: 100%; font-size: 14px; }
.rel-table-wrap th, .rel-table-wrap td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rel-table-wrap th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.rel-count { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
