/* =====================================================================
   Documentation layer — docs.vonix.network
   Loaded after wiki.css. Every value resolves from the token block that
   build.mjs inlines from theme.json; nothing here hard-codes a brand colour.
   ===================================================================== */

body { background: var(--bg); }

/* ---- top bar ------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: block; padding: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  width: 100%; max-width: var(--max-width); margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
}
.topnav { display: flex; gap: 4px; margin-left: 8px; flex: 1; min-width: 0; }
.topnav a {
  font-size: .875rem; color: color-mix(in srgb, var(--text) 55%, var(--text-muted));
  padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none;
  transition: color var(--motion) var(--ease), background var(--motion) var(--ease);
}
.topnav a:hover { color: var(--text); background: var(--hover); }
.search-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius-md); padding: 8px 12px; font: inherit; font-size: .8125rem; cursor: pointer;
  transition: border-color var(--motion) var(--ease), color var(--motion) var(--ease);
}
.search-trigger:hover { color: var(--text); border-color: var(--border-strong); }
.search-icon { display: block; flex: 0 0 auto; }
.search-trigger kbd { font-family: var(--font-mono); font-size: .6875rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 5px; color: var(--text-muted); }
.nav-toggle { display: none; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 8px 11px; cursor: pointer; }

/* ---- three column shell -------------------------------------------- */
.shell, .site-foot { position: relative; z-index: 1; }
.shell { max-width: var(--max-width); margin: 0 auto; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 232px; gap: var(--gap); padding: 28px 20px 72px; align-items: start; }
.shell.wide { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.shell main { min-width: 0; }
.side { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }

/* ---- sidebar navigation -------------------------------------------- */
.side-nav { display: flex; flex-direction: column; gap: 8px; }
.navgroup-head { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); }
.navgroup-head a {
  flex: 1; min-width: 0;
  text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 600;
  color: color-mix(in srgb, var(--text) 72%, var(--text-muted));
  text-decoration: none; padding: 8px; border-radius: var(--radius-sm);
  transition: color var(--motion) var(--ease), background var(--motion) var(--ease);
}
.navgroup-head a:hover,
.navgroup:hover .navgroup-head a { color: var(--text); }
.navgroup-head a[aria-current="page"] { color: var(--text-warm); }
.navgroup-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--text-muted);
  font: inherit; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm);
  transition: color var(--motion) var(--ease), background var(--motion) var(--ease);
}
.navgroup-toggle:hover { color: var(--text); background: var(--hover); }
.navgroup-toggle em { font-style: normal; font-size: .75rem; font-weight: 600; color: var(--accent-soft); }
.nav-chevron {
  width: 7px; height: 7px; margin-top: -2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform var(--motion) var(--ease);
}
.navgroup.is-open .nav-chevron { transform: rotate(225deg); margin-top: 2px; }
.navgroup ul { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.navgroup ul a {
  display: block; padding: 6px 8px 6px 10px; border-radius: var(--radius-sm);
  font-size: .875rem; line-height: 1.35; text-decoration: none;
  color: color-mix(in srgb, var(--text) 82%, var(--text-muted));
  transition: color var(--motion) var(--ease), background var(--motion) var(--ease);
}
.navgroup ul a:hover { color: var(--text-warm); background: var(--hover); }
.navgroup ul a.is-active {
  color: var(--text-warm); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  box-shadow: inset 2px 0 0 var(--accent);
}
/* Collapse is progressive: without JS every link stays in the page. */
.js .navgroup:not(.is-open) ul { display: none; }

/* ---- breadcrumb + article ------------------------------------------ */
.bc ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; font-size: .8125rem; color: color-mix(in srgb, var(--text) 62%, var(--text-muted)); }
.bc li + li::before { content: "/"; margin-right: 6px; color: var(--text-muted); }
.bc a { color: color-mix(in srgb, var(--text) 72%, var(--text-muted)); text-decoration: none; }
.bc a:hover { color: var(--accent-soft); }
.doc h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 10px; }
.doc .lede, .group-page .lede, .editor .lede { color: color-mix(in srgb, var(--text) 76%, var(--text-muted)); font-size: 1.0625rem; line-height: 1.6; margin: 0 0 18px; max-width: 68ch; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding-bottom: 20px; margin-bottom: 26px; border-bottom: 1px solid var(--border); font-size: .8125rem; color: var(--text-muted); }
.prose { font-size: 1rem; line-height: 1.72; color: var(--text); }
.prose h1 { font-size: 1.65rem; line-height: 1.2; letter-spacing: -.02em; margin: 8px 0 12px; }
.prose h2 { font-size: 1.5rem; margin: 44px 0 12px; letter-spacing: -.02em; scroll-margin-top: 90px; }
.prose h3 { font-size: 1.2rem; margin: 30px 0 10px; color: var(--text-warm); scroll-margin-top: 90px; }
.prose h4 { font-size: .9375rem; margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .06em; color: color-mix(in srgb, var(--text) 70%, var(--text-muted)); }
.prose p { margin: 0 0 16px; max-width: 74ch; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; max-width: 72ch; }
.prose li { margin: 6px 0; }
.prose a { color: var(--accent-soft); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.prose a:hover { color: var(--accent); }
.prose code { font-family: var(--font-mono); font-size: .875em; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 5px; }
.prose :not(pre) > code { color: var(--text-warm); }
.prose pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; overflow-x: auto; margin: 0 0 20px; }
.prose pre code { background: none; border: 0; padding: 0; font-size: .8125rem; line-height: 1.65; }
.prose blockquote { margin: 0 0 18px; padding: 10px 16px; border-left: 2px solid var(--accent); background: var(--surface); color: var(--text-muted); }
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.prose .table-wrap { max-height: min(70vh, 36rem); overflow: auto; }
/* separate, not collapse: a collapsed border keeps sticky th from sticking */
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.prose th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; letter-spacing: .01em; font-size: .75rem; font-weight: 600;
  color: color-mix(in srgb, var(--text) 78%, var(--text-muted));
  background: var(--elevated); padding: 10px 12px;
  border-bottom: 1px solid var(--border-strong);
  box-shadow: inset 0 -1px 0 var(--border-strong);
}
.prose td, .table-wrap td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: break-word; }
.prose td code { overflow-wrap: break-word; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--elevated) 65%, var(--surface)); }
.prose tr:last-child td { border-bottom: 0; }
.prose table:has(> thead > tr > th:nth-child(2)):not(:has(> thead > tr > th:nth-child(3))) { table-layout: fixed; }
.prose table:has(> thead > tr > th:nth-child(2)):not(:has(> thead > tr > th:nth-child(3))) :is(th, td):first-child { width: 34%; }
.prose table:has(> thead > tr > th:nth-child(2)):not(:has(> thead > tr > th:nth-child(3))) :is(th, td):nth-child(2) { width: 66%; }
.prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) { table-layout: fixed; }
.prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) :is(th, td):nth-child(1) { width: 14%; }
.prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) :is(th, td):nth-child(2) { width: 18%; }
.prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) :is(th, td):nth-child(3) { width: 26%; }
.prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) :is(th, td):nth-child(4) { width: 12%; }
.prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) :is(th, td):nth-child(5) { width: 30%; }

/* ---- right rail: on this page -------------------------------------- */
.doc-rail { position: sticky; top: 76px; align-self: start; }
.rail-label { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 600; color: color-mix(in srgb, var(--text) 68%, var(--text-muted)); margin: 0 0 8px; }
.toc { list-style: none; margin: 0 0 22px; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 12px; margin-left: -1px; border-left: 2px solid transparent; font-size: .8125rem; color: color-mix(in srgb, var(--text) 72%, var(--text-muted)); text-decoration: none; line-height: 1.4; transition: color var(--motion) var(--ease), border-color var(--motion) var(--ease); }
.toc .lvl3 a { padding-left: 24px; font-size: .78125rem; }
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--accent-soft); border-left-color: var(--accent); }
.doc-actions { border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.doc-actions summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 12px; font-size: .8125rem; font-weight: 600; color: var(--text); list-style: none; }
.doc-actions summary::-webkit-details-marker { display: none; }
.doc-actions-mark { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--accent); box-shadow: 0 0 0 3px var(--glow); flex: 0 0 auto; }
.doc-actions-chevron {
  margin-left: auto; width: 7px; height: 7px; margin-top: -2px;
  border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg); transition: transform var(--motion) var(--ease);
}
.doc-actions[open] .doc-actions-chevron { transform: rotate(225deg); margin-top: 2px; }
.doc-actions ul { list-style: none; margin: 0; padding: 0 0 6px; border-top: 1px solid var(--border); }
.doc-actions li { margin: 0; }
.doc-action { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; font: inherit; font-size: .8125rem; color: color-mix(in srgb, var(--text) 78%, var(--text-muted)); cursor: pointer; text-decoration: none; transition: color var(--motion) var(--ease), background var(--motion) var(--ease); }
.doc-action:hover { color: var(--text-warm); background: var(--hover); }
.chip {
  padding: 5px 11px; font-size: .8125rem;
  color: color-mix(in srgb, var(--text) 86%, var(--text-muted));
  background: var(--surface-alt); border-color: var(--border-strong);
}

/* ---- pager ---------------------------------------------------------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 46px; padding-top: 22px; border-top: 1px solid var(--border); }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; color: var(--text); background: var(--surface); transition: border-color var(--motion) var(--ease), transform var(--motion) var(--ease); }
.pager a:hover { border-color: var(--accent); transform: translateY(-1px); }
.pager small { display: block; text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--text-muted); margin-bottom: 4px; }
.pager-next { text-align: right; }

/* ---- home + group index -------------------------------------------- */
.home .hero { padding: 36px 0 32px; border-bottom: 1px solid var(--border); }
.home .eyebrow { font-size: .8125rem; letter-spacing: .08em; color: color-mix(in srgb, var(--text) 55%, var(--text-muted)); }
.home .hero h1 { font-size: clamp(2.1rem, 5vw, 3.1rem); line-height: 1.06; letter-spacing: -.03em; margin: 6px 0 14px; }
.home .lede { max-width: 66ch; color: color-mix(in srgb, var(--text) 78%, var(--text-muted)); font-size: 1.0625rem; line-height: 1.62; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.group-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 18px 18px 20px; text-decoration: none; color: inherit;
}
.group-card::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 2px;
  border-radius: var(--radius-pill); background: var(--accent); opacity: .4;
  transition: opacity var(--motion) var(--ease);
}
.group-card:hover { border-color: var(--accent); }
.group-card:hover::before { opacity: 1; }
.group-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.group-card h3 { margin: 0; font-size: 1.125rem; }
.group-card p { margin: 0; color: color-mix(in srgb, var(--text) 72%, var(--text-muted)); font-size: .9375rem; line-height: 1.5; }
.group-card .meta { margin: 0; padding: 0; color: var(--accent-soft); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.section { padding: 34px 0; }
.home .section-head { margin-bottom: 16px; }
.section-note { margin: 4px 0 0; font-size: .8125rem; color: var(--text-muted); }
.two-up { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--gap); }
.latest { list-style: none; margin: 0; padding: 0; }
.latest li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.latest a { color: var(--text); text-decoration: none; }
.latest a:hover { color: var(--accent-soft); }
.latest span { color: var(--text-muted); font-size: .75rem; white-space: nowrap; }
.rows { display: flex; flex-direction: column; margin-top: 26px; }
.row {
  display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px;
  padding: 14px 12px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
  border-radius: var(--radius-sm); transition: background var(--motion) var(--ease);
}
.row:hover { background: var(--surface); }
.row-title { font-weight: 600; color: var(--text-warm); }
.row:hover .row-title { color: var(--accent-soft); }
.row-desc { color: var(--text-muted); font-size: .875rem; }
.muted { color: var(--text-muted); }

/* ---- mod matrix ----------------------------------------------------- */
.mod-matrix { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border); }
.matrix-foot { font-size: .8125rem; color: var(--text-muted); margin-top: 10px; }

/* ---- footer --------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--border); background: var(--bg-deep); }
.foot-inner { max-width: var(--max-width); margin: 0 auto; padding: 26px 20px 40px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; font-size: .8125rem; color: var(--text-muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }
.foot-links a { color: var(--text-muted); text-decoration: none; }
.foot-links a:hover { color: var(--accent-soft); }

/* ---- editor --------------------------------------------------------- */
.editor h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); letter-spacing: -.02em; margin-top: 0; }
.editor-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 28px; max-width: 760px; }
.field input[type="color"] { width: 48px; height: 30px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-deep); }
.export { width: 100%; min-height: 220px; background: var(--bg-deep); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; font-family: var(--font-mono); font-size: .75rem; line-height: 1.55; }

/* ---- responsive ----------------------------------------------------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .doc-rail { display: none; }
  .shell.wide { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 16px; height: 1.5px; background: currentColor; border-radius: var(--radius-pill);
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }
.nav-scrim {
  position: fixed; inset: 0; z-index: 34;
  background: color-mix(in srgb, var(--bg-deep) 62%, transparent);
}
@media (max-width: 980px) {
  .topnav { display: none; }
  .topbar-inner { gap: 8px; padding: 8px 14px; }
  .shell, .shell.wide { grid-template-columns: minmax(0, 1fr); padding-top: 18px; }
  .search-trigger { width: 44px; height: 44px; padding: 0; justify-content: center; gap: 0; flex: 0 0 auto; margin-left: auto; }
  .prose table:has(> thead > tr > th:nth-child(5)):not(:has(> thead > tr > th:nth-child(6))) { min-width: 40rem; }
  .search-trigger .search-label, .search-trigger kbd { display: none; }
  .side { position: static; top: auto; max-height: none; height: auto; overflow: visible; border-bottom: 1px solid var(--border); margin-bottom: 8px; padding-bottom: 8px; }
  .js .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; flex: 0 0 auto;
  }
  .js .side {
    position: fixed; top: 61px; bottom: 0; left: 0; right: auto;
    width: min(20rem, calc(100vw - 48px)); height: auto; max-height: none;
    margin: 0; background: var(--bg); border-right: 1px solid var(--border); border-bottom: 0;
    padding: 16px 16px 32px; overflow-y: auto;
    transform: translateX(-105%); transition: transform var(--motion) var(--ease); z-index: 36;
  }
  .js .side.is-open { transform: translateX(0); }
  .two-up { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { text-align: left; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); max-width: none; }
}

/* Focus rings also come from wiki.css. These cover controls that are not bare buttons. */
.search-trigger:focus-visible,
.nav-toggle:focus-visible,
.navgroup-toggle:focus-visible,
.navgroup-head a:focus-visible,
.doc-action:focus-visible,
.group-card:focus-visible,
.row:focus-visible,
.toc a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .nav-chevron, .doc-actions-chevron, .js .side, .group-card, .group-card::before, .pager a, .toc a, .doc-action, .navgroup ul a, .search-trigger {
    transition: none;
  }
}
@media print {
  .topbar, .side, .doc-rail, .site-foot, .palette, .pager, .doc-actions, .search-trigger, .nav-toggle, .nav-scrim { display: none !important; }
  .shell, .shell.wide { display: block; max-width: none; padding: 0; }
  body { background: #fff; color: #111; }
  .prose, .prose a, .doc h1, .doc .lede { color: #111; }
  .prose a { border-bottom: 0; }
  .prose a::after { content: " (" attr(href) ")"; font-size: .75em; color: #555; }
  .prose a[href^="#"]::after { content: ""; }
  .prose pre, .prose code, .prose table { border-color: #bbb; background: #fafafa; }
  .doc-meta { border-color: #bbb; }
  .card, .panel { border-color: #bbb; }
}

/* A document that arrives with its own top-level heading must not paint a
   second title under the article H1. */
.prose h1 {
  font-size: 1.25rem;
  margin: 32px 0 10px;
  color: var(--text-warm);
}
