/* =====================================================================
   avatar tools - site stylesheet
   Three-column wiki layout: sidebar (collapsible) | content | TOC rail.
   Restrained palette: one accent (cyan) for emphasis, the rest neutral.
   No animations beyond short transitions, no gradients.

   THEMING
   -------
   Every colour is a token on :root. The dark palette is the default; the
   light palette is applied under `:root[data-theme="light"]` (the sidebar
   toggle, persisted in localStorage) and under `prefers-color-scheme:
   light` when no explicit choice is stored. Never hard-code a colour in a
   component rule: use the tokens, or `currentColor` inside inline SVG.

   SHARED COMPONENTS (reusable by any page, incl. the analyzer/viewer)
   ------------------------------------------------------------------
   .card-grid > .card        responsive grid of linked cards
                             (.card-title / .card-body inside)
   .pills > .pill            compact inline chips (.pill-accent/-warn/-error/-ok)
   .badge                    inline status label; .badge-accent/-ok/-warn/
                             -error/-info variants
   .meter                    horizontal bar: <div class="meter meter-ok">
                               <div class="meter-fill" style="width:40%"></div>
                             </div>; -ok/-warn/-error tint the fill;
                             .meter-label optional caption row
   .tabs > .tab              tab strip: buttons with role="tab" +
                             aria-selected="true"; panels are .tab-panel
                             ([hidden] hides them) - wiring is the page's JS
   .kbd / kbd                keyboard key cap
   .table-wrap               horizontal-scroll wrapper for wide tables
                             (_gen.py wraps bare <table>s automatically)
   .notice / .notice.warn    callout with .notice-title; .hint is the softer one
   .cli                      copyable shell block (main.js adds the copy button)
   .see-also                 related-links footer row
   .btn / .btn-primary /     buttons & CTA links
   .btn-ghost
   .tag / .tag-done/-partial/-open/-planned/-stub   status tags (tables)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ---------- Tokens: dark (default) ---------- */
:root {
  color-scheme: dark;

  --bg:            #0d1117;
  --bg-raised:     #11161e;
  --bg-card:       #131922;
  --bg-card-hi:    #19212d;
  --bg-code:       #0a0e15;
  --bg-elev:       #1a2230;

  --border:        #1f2630;
  --border-hi:     #2a323e;

  --text-strong:   #e6edf3;
  --text:          #c9d1d9;
  --text-muted:    #8b949e;
  --text-dim:      #636b76;
  --code-text:     #b8d6cf;

  --accent:        #58c4b3;     /* cyan, single emphasis colour */
  --accent-hi:     #7ad3c4;
  --accent-soft:   #1c2a2a;
  --accent-ink:    #0d1117;     /* text on a solid accent background */

  --ok:            #58c4b3;
  --warn:          #c19a4d;
  --error:         #b56b6b;
  --info:          #7aa2d3;
  --ok-soft:       #12302a;
  --warn-soft:     #302912;
  --error-soft:    #331818;
  --info-soft:     #16233a;

  --done:          var(--ok);
  --partial:       var(--warn);
  --open:          var(--error);
  --planned:       #6e7681;

  --shadow:        0 8px 28px rgba(0, 0, 0, 0.45);

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;

  --sidebar-w:     264px;
  --toc-w:         220px;
  --max-content-w: 800px;
  --measure:       72ch;
  --transition:    0.12s ease;
}

/* ---------- Tokens: light ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:            #f6f8fa;
  --bg-raised:     #eef1f5;
  --bg-card:       #ffffff;
  --bg-card-hi:    #f0f4f8;
  --bg-code:       #eef2f6;
  --bg-elev:       #e4e9ef;
  --border:        #d5dbe3;
  --border-hi:     #bfc7d2;
  --text-strong:   #0f1720;
  --text:          #1f2933;
  --text-muted:    #4b5563;
  --text-dim:      #7b8794;
  --code-text:     #0f5f55;
  --accent:        #0f8a7a;
  --accent-hi:     #0b6f62;
  --accent-soft:   #d8f0ec;
  --accent-ink:    #ffffff;
  --ok:            #0f8a7a;
  --warn:          #9a6b0a;
  --error:         #b23a3a;
  --info:          #2f5fa8;
  --ok-soft:       #d8f0ec;
  --warn-soft:     #fbf0d5;
  --error-soft:    #f9dede;
  --info-soft:     #dde8f9;
  --planned:       #6b7280;
  --shadow:        0 8px 28px rgba(15, 23, 32, 0.14);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg:            #f6f8fa;
    --bg-raised:     #eef1f5;
    --bg-card:       #ffffff;
    --bg-card-hi:    #f0f4f8;
    --bg-code:       #eef2f6;
    --bg-elev:       #e4e9ef;
    --border:        #d5dbe3;
    --border-hi:     #bfc7d2;
    --text-strong:   #0f1720;
    --text:          #1f2933;
    --text-muted:    #4b5563;
    --text-dim:      #7b8794;
    --code-text:     #0f5f55;
    --accent:        #0f8a7a;
    --accent-hi:     #0b6f62;
    --accent-soft:   #d8f0ec;
    --accent-ink:    #ffffff;
    --ok:            #0f8a7a;
    --warn:          #9a6b0a;
    --error:         #b23a3a;
    --info:          #2f5fa8;
    --ok-soft:       #d8f0ec;
    --warn-soft:     #fbf0d5;
    --error-soft:    #f9dede;
    --info-soft:     #dde8f9;
    --planned:       #6b7280;
    --shadow:        0 8px 28px rgba(15, 23, 32, 0.14);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
  -webkit-text-size-adjust: 100%;
  font-size: 15.5px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hi); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

img, svg { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

h1, h2, h3, h4 {
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  text-wrap: balance;
}

h1 { font-size: 1.7rem; }
h2 {
  font-size: 1.22rem;
  margin-top: 2.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  scroll-margin-top: 24px;
}
h3 {
  font-size: 1.02rem;
  margin-top: 1.8rem;
  position: relative;
  scroll-margin-top: 24px;
}
h4 { font-size: 0.94rem; color: var(--text); margin-top: 1.1rem; }
h2 + p, h3 + p, h4 + p { margin-top: 0.6rem; }

/* Heading anchor links (clickable §) */
.h-anchor {
  position: absolute;
  left: -1.4rem;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  text-decoration: none;
}
h2:hover .h-anchor, h3:hover .h-anchor, h4:hover .h-anchor,
.h-anchor:focus-visible { opacity: 1; }
.h-anchor:hover { color: var(--accent); text-decoration: none; }

p { margin: 0.75rem 0; max-width: var(--measure); }
li { max-width: var(--measure); }
.wide-page p, .wide-page li, .card p, .card li, td p { max-width: none; }

strong { color: var(--text-strong); font-weight: 600; }

code, pre { font-family: var(--font-mono); }

code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 0.05em 0.35em;
  border-radius: 3px;
  font-size: 0.86em;
  color: var(--code-text);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.65;
  position: relative;
  margin: 1rem 0;
  tab-size: 4;
}
pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
a:focus-visible { text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--text-strong); }

/* ---------- App shell: 3-column grid ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  min-height: 100vh;
}
.app.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  padding: 1rem 0.9rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  scrollbar-width: thin;
}

.sidebar-brand {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-strong);
  padding: 0.35rem 0.5rem 0.9rem;
  letter-spacing: -0.01em;
}
.sidebar-brand:hover { color: var(--text-strong); text-decoration: none; }
.sidebar-brand .prompt { color: var(--accent); margin-right: 0.3rem; }

/* Search trigger + theme toggle row */
.sidebar-tools { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; }
.sidebar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), color var(--transition);
}
.sidebar-search:hover { border-color: var(--border-hi); color: var(--text); }
.sidebar-search .icon { color: var(--text-dim); }
.sidebar-search .label { flex: 1; }
.sidebar-search .kbd { margin-left: auto; }

.theme-toggle {
  flex: 0 0 auto;
  width: 2.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { border-color: var(--border-hi); color: var(--text); }

/* Sidebar sections - collapsible */
.sidebar-section { margin-bottom: 0.55rem; }
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}
.sidebar-section-toggle:hover { background: var(--bg-card); color: var(--text-muted); }
.sidebar-section-toggle .arrow {
  font-size: 0.65rem;
  transition: transform var(--transition);
  display: inline-block;
}
.sidebar-section.collapsed .sidebar-section-toggle .arrow { transform: rotate(-90deg); }
.sidebar-section.has-active .sidebar-section-toggle { color: var(--text); }
.sidebar-section.has-active .sidebar-section-toggle .arrow { color: var(--accent); }

.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar-section.collapsed .sidebar-nav { display: none; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem 0.3rem 1.1rem;
  border-radius: 4px;
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
/* "Try it" accent on the inspector nav item */
.sidebar-nav .nav-accent {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  line-height: 1.5;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem 0.5rem 0;
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.6;
  border-top: 1px solid var(--border);
}
.sidebar-foot a { color: var(--text-muted); }
.sidebar-foot a:hover { color: var(--accent); }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 60;
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  color: var(--text);
  border-radius: 6px;
  width: 2.3rem;
  height: 2.3rem;
  font-size: 1.1rem;
  cursor: pointer;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 1100px) {
  .app, .app.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc-rail { display: none; }
}
@media (max-width: 880px) {
  .app, .app.no-toc { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: min(84vw, var(--sidebar-w));
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .content { padding-top: 3.4rem; }
}

/* ---------- Content column ---------- */
.content {
  padding: 2.2rem 3rem 3.5rem;
  max-width: calc(var(--max-content-w) + 6rem);
  width: 100%;
  min-width: 0;
}
.content.wide-page { max-width: none; }
@media (max-width: 720px) {
  .content { padding: 3.4rem 1.1rem 2.5rem; }
  .h-anchor { display: none; }
}

/* ---------- Page header ---------- */
.page-header { margin-bottom: 1.6rem; }
.page-header .breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}
.page-header .breadcrumb a { color: var(--text-muted); }
.page-header .breadcrumb a:hover { color: var(--accent); }
.page-header h1 { margin-bottom: 0.6rem; }
.page-header .lede {
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: var(--measure);
}

section.doc-section { margin-bottom: 1.4rem; }
section.doc-section > p { color: var(--text); }

/* Lists inside sections */
.doc-section ul:not(.bullets):not(.next-list):not(.pills):not(.tabs) > li,
.doc-section ul.bullets > li {
  position: relative;
  padding-left: 1.15rem;
  margin: 0.35rem 0;
  color: var(--text);
}
.doc-section ul:not(.bullets):not(.next-list):not(.pills):not(.tabs) > li::before,
.doc-section ul.bullets > li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.68em;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
}
.doc-section ol:not(.bullets) { counter-reset: step; }
.doc-section ol:not(.bullets) > li,
.doc-section ol.bullets > li {
  position: relative;
  padding-left: 1.9rem;
  margin: 0.45rem 0;
  counter-increment: step;
  color: var(--text);
}
.doc-section ol:not(.bullets) > li::before,
.doc-section ol.bullets > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.12em;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card ul > li::before, .card ol > li::before { display: none; }

/* ---------- Status tag ---------- */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  color: var(--text-muted);
  white-space: nowrap;
  vertical-align: middle;
  font-weight: 600;
}
.tag-done    { color: var(--done);    border-color: var(--done); }
.tag-partial { color: var(--partial); border-color: var(--partial); }
.tag-open    { color: var(--open);    border-color: var(--open); }
.tag-planned { color: var(--planned); border-color: var(--planned); }
.tag-stub    { color: var(--text-dim); border-color: var(--border-hi); font-weight: 500; }

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}
.table-wrap > table { margin: 0; border: 0; border-radius: 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
thead { background: var(--bg-raised); }
th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-card-hi); }
th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
td { color: var(--text-muted); }
td code { font-size: 0.82rem; padding: 0.05em 0.3em; white-space: nowrap; }
td:first-child code { white-space: normal; }
td strong { color: var(--text-strong); }
td.col-addr, td.col-crate { font-family: var(--font-mono); white-space: nowrap; font-size: 0.83rem; }
td.col-status { white-space: nowrap; }
table.num td:not(:first-child) { text-align: right; font-family: var(--font-mono); font-size: 0.83rem; }

/* ---------- Definition list ---------- */
dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0.8rem 0;
  font-size: 0.92rem;
}
dl.kv dt { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.82rem; }
dl.kv dd { color: var(--text); line-height: 1.55; }

/* ---------- Pills ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.14rem 0.6rem;
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--bg-card);
  white-space: nowrap;
}
a.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pill-accent { color: var(--accent); border-color: var(--accent); }
.pill-ok     { color: var(--ok);     border-color: var(--ok);     background: var(--ok-soft); }
.pill-warn   { color: var(--warn);   border-color: var(--warn);   background: var(--warn-soft); }
.pill-error  { color: var(--error);  border-color: var(--error);  background: var(--error-soft); }

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
  padding: 0.05rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-hi);
  background: var(--bg-card);
  color: var(--text-muted);
  vertical-align: middle;
  white-space: nowrap;
}
.badge-accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.badge-ok     { color: var(--ok);     border-color: var(--ok);     background: var(--ok-soft); }
.badge-warn   { color: var(--warn);   border-color: var(--warn);   background: var(--warn-soft); }
.badge-error  { color: var(--error);  border-color: var(--error);  background: var(--error-soft); }
.badge-info   { color: var(--info);   border-color: var(--info);   background: var(--info-soft); }

/* ---------- Meter ---------- */
.meter {
  position: relative;
  width: 100%;
  height: 0.55rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.meter-ok .meter-fill    { background: var(--ok); }
.meter-warn .meter-fill  { background: var(--warn); }
.meter-error .meter-fill { background: var(--error); }
.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0.3rem;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin: 1rem 0 0.8rem;
}
.tab {
  background: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--transition), background var(--transition);
}
.tab:hover { color: var(--text); background: var(--bg-card); }
.tab[aria-selected="true"] {
  color: var(--accent);
  background: var(--bg);
  border-color: var(--border);
  border-bottom: 1px solid var(--bg);
}
.tab-panel[hidden] { display: none; }

/* ---------- kbd ---------- */
kbd, .kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--border-hi);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
  vertical-align: middle;
}

/* ---------- Notice / hint / callout ---------- */
.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  border-radius: 0 6px 6px 0;
  padding: 0.8rem 1rem;
  margin: 1.1rem 0;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.notice .notice-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.notice.warn { border-left-color: var(--warn); }
.notice.warn .notice-title { color: var(--warn); }
.notice.error { border-left-color: var(--error); }
.notice.error .notice-title { color: var(--error); }
.notice p { max-width: none; }

.hint {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin: 1.1rem 0;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
}
.hint code { background: var(--bg-code); }

/* ---------- Native CLI command block ---------- */
.cli {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0 0.9rem;
  align-items: start;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  position: relative;
}
.cli::before {
  content: "$";
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--accent);
  line-height: 1.65;
  user-select: none;
}
.cli code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  display: block;
  min-width: 0;
}
@media (max-width: 560px) {
  .cli { grid-template-columns: 1fr; }
  .cli::before { display: none; }
}

/* ---------- "See also" footer row ---------- */
.see-also {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 2.4rem 0 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.see-also .see-also-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 0.3rem;
}
.see-also .see-also-label::after { content: " \2192"; }
.see-also a {
  font-size: 0.84rem;
  color: var(--text-muted);
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  background: var(--bg-card);
  transition: border-color var(--transition), color var(--transition);
}
.see-also a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ---------- Disclosure ---------- */
details.disclosure {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  margin: 1rem 0;
}
details.disclosure > summary {
  cursor: pointer;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
  list-style: none;
  user-select: none;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "+ "; color: var(--accent); font-family: var(--font-mono); }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
details.disclosure[open] > summary::before { content: "\2212 "; }
details.disclosure .disclosure-body { padding: 0.6rem 1rem 0.8rem; font-size: 0.92rem; }
details.disclosure .disclosure-body > :first-child { margin-top: 0; }
details.disclosure .disclosure-body > :last-child { margin-bottom: 0; }

/* ---------- Code copy button ---------- */
.copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
pre:hover .copy-btn, .cli:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Caption ---------- */
.caption {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.35rem 0 1rem;
  font-style: italic;
}

/* ---------- Buttons / CTAs ---------- */
.btn, .cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn:hover, .cta:hover { background: var(--accent-soft); color: var(--accent-hi); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hi); color: var(--accent-ink); }
.btn-ghost { border-color: var(--border-hi); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--bg-card); color: var(--text-strong); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.4rem 0.8rem;
  border-radius: 0 0 6px 6px;
  font-size: 0.85rem;
}
.skip-link:focus { top: 0; }

/* ===================================================================
   Cards
   =================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}
.card:hover { border-color: var(--accent); background: var(--bg-card-hi); text-decoration: none; }
.card:hover .card-title { color: var(--accent); }
a.card[href*="github.com"]::after {
  content: "\2197";
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.card-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--text-strong);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.card-title .tag, .card-title .badge { flex: 0 0 auto; }
.card-body { color: var(--text-muted); font-size: 0.88rem; line-height: 1.55; }
.card-body code { font-size: 0.8rem; }
.card-icon { font-size: 1.25rem; line-height: 1; color: var(--accent); margin-bottom: 0.45rem; }
.card-cmd {
  display: inline-block;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
}
.card-cmd::before { content: "$ "; color: var(--text-dim); }

/* ---------- next-list (quickstart) ---------- */
.next-list { margin: 0.8rem 0; border: 1px solid var(--border); border-radius: 6px; }
.next-list li { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.next-list li:last-child { border-bottom: none; }

/* ===================================================================
   Home: hero, pipeline strip, status
   =================================================================== */
.hero {
  padding: 0.6rem 0 1.2rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}
.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
}
.hero h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  line-height: 1.15;
  margin-bottom: 0.9rem;
  max-width: 24ch;
}
.hero h1 .hero-sub { color: var(--accent); }
.hero .hero-lede {
  font-size: 1.06rem;
  color: var(--text-muted);
  max-width: var(--measure);
  line-height: 1.7;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.3rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1.1rem; }

/* Pipeline strip */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem;
  margin: 1rem 0 0.4rem;
}
.pipeline-step {
  flex: 1 1 165px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem 0.75rem 0.95rem;
  color: var(--text);
  min-width: 0;
  transition: border-color var(--transition), background var(--transition);
}
.pipeline-step::before {
  content: attr(data-step);
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-dim);
}
.pipeline-step:hover { border-color: var(--accent); background: var(--bg-card-hi); text-decoration: none; }
.pipeline-step:hover .pipeline-title { color: var(--accent); }
.pipeline-step .pipeline-format {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.pipeline-step .pipeline-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-strong);
}
.pipeline-step .pipeline-cmd { font-family: var(--font-mono); font-size: 0.74rem; color: var(--accent); }
.pipeline-step .pipeline-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.45; }
.pipeline-arrow { display: none; }
.pipeline-step::after {
  content: "\2192";
  position: absolute;
  right: -0.72rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
  background: var(--bg);
  padding: 0 0.1rem;
  z-index: 1;
}
.pipeline-step:last-child::after { content: none; }
.pipeline { gap: 0.9rem 1.1rem; }
.pipeline-step.pipeline-external { border-style: dashed; opacity: 0.85; }
@media (max-width: 720px) {
  .pipeline { flex-direction: column; gap: 1.1rem; }
  .pipeline-step::after { content: "\2193"; right: auto; left: 50%; top: auto; bottom: -1.05rem; transform: translateX(-50%); }
  .pipeline-step:last-child::after { content: none; }
}

/* Status strip (compact pill row) */
.status-strip { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0; }

/* ===================================================================
   Architecture: inline SVG stack diagram
   =================================================================== */
.stack-figure {
  margin: 1.2rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 0.8rem 0.8rem 0.4rem;
  overflow-x: auto;
}
.stack-figure svg {
  width: 100%;
  height: auto;
  min-width: 560px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.stack-figure figcaption {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.6rem 0.2rem 0.3rem;
  font-style: italic;
}
/* layer bands */
.sd-layer rect { fill: var(--bg-raised); stroke: var(--border-hi); stroke-width: 1; }
.sd-layer text.sd-layer-title { fill: var(--text-strong); font-size: 12px; font-weight: 600; }
.sd-layer text.sd-layer-sub { fill: var(--text-dim); font-size: 10px; }
.sd-layer.sd-external rect { stroke-dasharray: 5 4; fill: transparent; }
/* crate boxes */
.sd-crate rect {
  fill: var(--bg-card);
  stroke: var(--border-hi);
  stroke-width: 1;
  transition: stroke var(--transition), fill var(--transition);
}
.sd-crate text { fill: var(--text); font-size: 11.5px; font-weight: 500; pointer-events: none; }
.sd-crate text.sd-crate-sub { fill: var(--text-dim); font-size: 9.2px; font-weight: 400; }
.sd-crate:hover rect, .sd-crate:focus-visible rect, .sd-crate.sd-lit rect {
  stroke: var(--accent);
  fill: var(--accent-soft);
}
.sd-crate:hover text, .sd-crate.sd-lit text { fill: var(--accent); }
.sd-crate:focus { outline: none; }
.sd-crate.sd-cli rect { stroke: var(--accent); }
/* arrows */
.sd-arrow { stroke: currentColor; stroke-width: 1.4; fill: none; opacity: 0.8; marker-end: url(#sd-head); }
.sd-arrow-label { fill: var(--text-dim); font-size: 9.5px; }
#sd-head path { fill: currentColor; }
.sd-legend text { fill: var(--text-dim); font-size: 10px; }

/* Layered "list" fallback under the diagram (also the accessible version) */
.layers-list { margin: 1rem 0; }
.layers-list > li {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--bg-card);
  padding: 0.7rem 1rem;
  margin: 0.5rem 0;
  max-width: none;
}
.layers-list > li::before { display: none; }
.layers-list .layer-title { font-family: var(--font-mono); font-weight: 600; color: var(--text-strong); }
.layers-list .layer-crates { margin: 0.3rem 0 0; }

/* ===================================================================
   TOC rail
   =================================================================== */
.toc-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 2.2rem 1rem 2rem 0.5rem;
  font-size: 0.8rem;
  scrollbar-width: thin;
}
.toc-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  padding-left: 0.7rem;
}
.toc-list { border-left: 1px solid var(--border); }
.toc-list a {
  display: block;
  color: var(--text-muted);
  padding: 0.22rem 0.7rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  line-height: 1.4;
  transition: color var(--transition), border-color var(--transition);
}
.toc-list a:hover { color: var(--text); text-decoration: none; }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); }
.toc-list a.h3 { padding-left: 1.4rem; font-size: 0.76rem; }

/* ===================================================================
   Prev / next footer
   =================================================================== */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
.page-nav a {
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition);
}
.page-nav a:hover { border-color: var(--accent); text-decoration: none; }
.page-nav .pn-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}
.page-nav .pn-title { font-size: 0.9rem; color: var(--text-strong); }
.page-nav .pn-prev { text-align: left; }
.page-nav .pn-next { text-align: right; grid-column: 2; }
.page-nav .pn-prev::before { content: "\2190 "; color: var(--text-dim); }
.page-nav .pn-next::after { content: " \2192"; color: var(--text-dim); }
.page-nav .pn-prev:only-child { grid-column: 1; }
@media (max-width: 540px) {
  .page-nav { grid-template-columns: 1fr; }
  .page-nav .pn-next { grid-column: 1; text-align: left; }
}

/* ===================================================================
   Search overlay
   =================================================================== */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}
.search-overlay.open { display: flex; }
.search-box {
  width: min(680px, 100%);
  background: var(--bg-raised);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap .icon { color: var(--text-dim); font-size: 0.95rem; }
.search-input {
  flex: 1;
  background: none;
  border: 0;
  color: var(--text-strong);
  font: inherit;
  font-size: 1rem;
  outline: none;
}
.search-close {
  background: none;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}
.search-close:hover { color: var(--text); }
.search-results { overflow-y: auto; flex: 1; }
.search-results li { border-bottom: 1px solid var(--border); }
.search-results li:last-child { border-bottom: none; }
.search-results a { display: block; padding: 0.55rem 0.9rem; color: var(--text); }
.search-results a:hover { text-decoration: none; background: var(--bg-card); }
.search-results li.active a { background: var(--accent-soft); }
.search-results .res-title { font-size: 0.92rem; color: var(--text-strong); }
.search-results a:hover .res-title { color: var(--accent-hi); }
.search-results .res-section {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 0.5rem;
}
.search-results .res-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-results mark { background: var(--accent-soft); color: var(--accent); border-radius: 2px; }
.search-empty { padding: 1rem; color: var(--text-dim); font-size: 0.9rem; text-align: center; }
.search-foot {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.search-foot kbd { margin-right: 0.2rem; }
@media (max-width: 540px) { .search-foot { display: none; } }

/* ---------- Analyzer page (drag-and-drop wasm FBX analysis) ----------
   Kept for the analyzer page's markup; analyzer.css may extend it. */
.an-drop {
  border: 2px dashed var(--border-hi);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 2.2rem 1.4rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}
.an-drop:hover, .an-drop:focus-visible { border-color: var(--accent); }
.an-drop.an-over { border-color: var(--accent-hi); background: var(--accent-soft); }
.an-drop.an-disabled { opacity: 0.55; cursor: not-allowed; }
.an-drop-icon { font-size: 1.8rem; color: var(--accent); margin-bottom: 0.4rem; }
.an-drop-text { color: var(--text-muted); font-size: 0.95rem; }

.an-chip-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.an-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  min-width: 5.2rem;
  text-align: center;
}
.an-chip-value { font-family: var(--font-mono); font-size: 1.1rem; color: var(--text); }
.an-chip-label { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.04em; }

.rank-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  border: 1px solid transparent;
  vertical-align: baseline;
}
.rank-excellent { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok); }
.rank-good      { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.rank-medium    { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn); }
.rank-poor      { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn); opacity: 0.9; }
.rank-verypoor  { background: var(--error-soft);  color: var(--error);  border-color: var(--error); }
.rank-na        { background: var(--bg-card);     color: var(--text-dim); border-color: var(--border); }

.an-issue { margin: 0.35rem 0; font-size: 0.9rem; }
.an-details { margin: 0.6rem 0; }
.an-details summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.an-details p code { word-break: break-word; }
.an-fineprint { color: var(--text-dim); font-size: 0.82rem; }
