:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel-2: #1d2027;
  --text: #e7e9ee;
  --muted: #9aa0ad;
  --border: #2a2e37;
  --accent: #5b8cff;
  --accent-2: #b46bff;
  --code-bg: #1a1d23;
  --max: 820px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 264px; flex: 0 0 264px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; background: var(--panel); border-right: 1px solid var(--border);
  padding: 22px 16px;
}
.content { flex: 1 1 auto; min-width: 0; padding: 40px 32px 80px; }
article { max-width: var(--max); margin: 0 auto; }

/* Topbar (mobile) */
.topbar { display: none; }
.brand {
  font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: .2px;
}
.brand span {
  color: var(--accent-2); font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .12em; vertical-align: middle; margin-left: 2px;
}

/* Sidebar nav */
.nav a.nav-site, .topbar-site { color: var(--muted); font-size: 13px; }
.nav a.nav-site { padding: 0 10px; margin: 0 0 10px; }
.nav a.nav-site:hover, .topbar-site:hover { background: none; color: var(--text); text-decoration: none; }
.topbar-site { margin-left: auto; }
.nav .nav-home { display: block; font-weight: 700; color: var(--text); margin: 6px 0 14px; }
.nav ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); padding-top: 12px; }
.nav li { margin: 1px 0; }
.nav a {
  display: block; padding: 7px 10px; border-radius: 7px; color: var(--muted);
  font-size: 14.5px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }

/* Typography */
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 22px; margin: 1.8em 0 .5em; padding-top: .3em; border-top: 1px solid var(--border); }
h3 { font-size: 17px; margin: 1.4em 0 .4em; color: #f2f4f8; }
p, ul, ol { margin: .6em 0; }
ul, ol { padding-left: 1.3em; }
li { margin: .25em 0; }
strong { color: #fff; }
hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* Code */
code {
  background: var(--code-bg); padding: .12em .4em; border-radius: 5px;
  font: 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--border);
}
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
pre code { background: none; border: none; padding: 0; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: #fff; border-bottom: 2px solid var(--border); }
tr:hover td { background: rgba(255,255,255,.02); }

/* Images */
img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 1.2em 0; }

/* Alerts (GitHub-style) */
.alert { margin: 1.2em 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); border-left: 4px solid var(--muted); }
.alert p { margin: .3em 0; }
.alert-title { text-transform: uppercase; font-size: 12px; letter-spacing: .08em; font-weight: 700; margin: 0 0 .2em; color: var(--muted); }
.alert-note    { border-left-color: var(--accent); }
.alert-note .alert-title { color: var(--accent); }
.alert-tip     { border-left-color: #43c59e; }
.alert-tip .alert-title { color: #43c59e; }
.alert-warning { border-left-color: #e0a93b; }
.alert-warning .alert-title { color: #e0a93b; }
.alert-important { border-left-color: var(--accent-2); }
.alert-important .alert-title { color: var(--accent-2); }
.alert-caution { border-left-color: #e06b6b; }
.alert-caution .alert-title { color: #e06b6b; }

/* Plain blockquote */
blockquote:not(.alert) { margin: 1em 0; padding: .4em 1em; border-left: 3px solid var(--border); color: var(--muted); }

/* Pager */
.pager { display: flex; justify-content: space-between; margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--border); font-size: 14.5px; }

/* Cards (section list) */
.cards { list-style: none; padding: 0; }

footer { max-width: var(--max); margin: 4em auto 0; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 820px) {
  .topbar { display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 10;
            background: var(--panel); border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .menu-btn { cursor: pointer; font-size: 20px; color: var(--text); }
  .layout { display: block; }
  .sidebar { position: fixed; top: 47px; left: 0; width: 80%; max-width: 300px; height: calc(100vh - 47px);
             transform: translateX(-105%); transition: transform .2s ease; z-index: 9; }
  #nav-toggle:checked ~ .layout .sidebar { transform: translateX(0); }
  .content { padding: 24px 18px 60px; }
}

/* ---- figswitch: tabbed image variant switcher -------------------------- */
.figswitch { margin: 1.4em 0; text-align: center; }
.figswitch-tabs {
  display: flex; width: fit-content; gap: 2px; padding: 3px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 9px; margin: 0 auto 10px; flex-wrap: wrap;
}
.figswitch-tab {
  appearance: none; cursor: pointer;
  font: 500 12.5px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--muted); background: transparent;
  border: 0; border-radius: 6px; padding: 6px 12px;
  transition: background .12s ease, color .12s ease;
}
.figswitch-tab:hover { color: var(--text); }
.figswitch-tab.is-active { background: var(--accent); color: #fff; }
.figswitch-stage {
  display: inline-grid; max-width: 100%; vertical-align: top;
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: var(--panel);
}
/* align-self/justify-self: grid's default `stretch` inflates the shorter
   variants to the tallest one's cell (Global/Sliders distorted to 3 Wheels'
   height) — pin them to the top instead, centred. */
.figswitch-img { grid-area: 1 / 1; width: auto; height: auto; max-width: 100%; max-height: 520px; display: block; opacity: 0; visibility: hidden; align-self: start; justify-self: center; }
.figswitch-img.is-active { opacity: 1; visibility: visible; }

/* Inspector screenshots: keep tall strips (Tone, Color Wheels) from towering
   over the shorter stages by capping display height — width scales to match. */
.doc-shot { max-height: 520px; width: auto; margin-left: auto; margin-right: auto; }
.figswitch figcaption { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
