/* ==========================================================================
   infixtopostfixconverter.com — instrument-panel theme
   Dark by default; light is opt-in via the header toggle ([data-theme]).
   ========================================================================== */

:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype",
    Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  --max: 1180px;
  --gutter: 22px;
  --measure: 68ch;
  --column: 660px;
  --band-gap: clamp(52px, 7vw, 92px);

  --r-xs: 6px;  --r-sm: 10px; --r-md: 14px;
  --r-lg: 20px; --r-xl: 26px;

  --t-fast: .16s;
  --t-med: .3s;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --glass: blur(14px) saturate(1.35);
  --glass-strong: blur(22px) saturate(1.5);

  /* ---- dark (default) ---- */
  --ground: #06070b;
  --ground-2: #0a0c12;
  --ink: #eef1f6;
  --ink-soft: #c2c9d6;
  --muted: #7e8799;
  --faint: #454d5e;

  --hairline: rgba(255, 255, 255, .13);
  --hairline-2: rgba(255, 255, 255, .06);

  --plate: rgba(255, 255, 255, .032);
  --plate-solid: #10131b;
  --plate-sunk: rgba(0, 0, 0, .26);
  --plate-hover: rgba(255, 255, 255, .058);

  --blued: #7aa2ff;
  --blued-wash: rgba(122, 162, 255, .10);
  --brass: #d4a843;
  --critical: #ff6f6f;

  --grad: linear-gradient(120deg, #6366f1 0%, #a855f7 52%, #38bdf8 100%);
  --grad-1: rgba(99, 102, 241, .30);
  --grad-2: rgba(168, 85, 247, .30);
  --grad-3: rgba(56, 189, 248, .26);

  --tok-operand: #5eead4;
  --tok-operator: #e8be5c;
  --tok-paren: #c4a5ff;

  --orb-opacity: .30;

  --shadow-plate: inset 0 1px 0 rgba(255, 255, 255, .045),
                  0 24px 60px -32px rgba(0, 0, 0, .92);
  --shadow-lift: 0 26px 60px -26px rgba(0, 0, 0, .85);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --ground: #fbfbfd;
  --ground-2: #f3f4f9;
  --ink: #10131a;
  --ink-soft: #3c4353;
  --muted: #697184;
  --faint: #b3bac7;

  --hairline: rgba(12, 18, 34, .15);
  --hairline-2: rgba(12, 18, 34, .075);

  --plate: rgba(255, 255, 255, .74);
  --plate-solid: #ffffff;
  --plate-sunk: #f5f6fa;
  --plate-hover: #ffffff;

  --blued: #4f46e5;
  --blued-wash: rgba(79, 70, 229, .07);
  --brass: #9a7614;
  --critical: #d92d2d;

  --grad: linear-gradient(120deg, #4f46e5 0%, #9333ea 52%, #0284c7 100%);
  --grad-1: rgba(99, 102, 241, .17);
  --grad-2: rgba(168, 85, 247, .17);
  --grad-3: rgba(56, 189, 248, .15);

  --tok-operand: #0b7c66;
  --tok-operator: #8a6410;
  --tok-paren: #6d28d9;

  --orb-opacity: .13;

  --shadow-plate: 0 1px 2px rgba(16, 20, 30, .05),
                  0 20px 46px -28px rgba(16, 20, 30, .32);
  --shadow-lift: 0 22px 48px -22px rgba(16, 20, 30, .30);

  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizelegibility;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--blued); text-decoration-color: color-mix(in srgb, var(--blued) 40%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
::selection { background: var(--grad-1); }
:focus-visible { outline: 2px solid var(--blued); outline-offset: 3px; border-radius: var(--r-xs); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  letter-spacing: -.02em;
  text-wrap: balance;
  overflow-wrap: break-word;
  margin: 0 0 .5em;
  font-weight: 600;
  line-height: 1.14;
}
h1 { font-size: clamp(34px, 4.8vw, 58px); letter-spacing: -.032em; font-weight: 700; line-height: 1.06; }
h2 { font-size: clamp(24px, 2.9vw, 34px); margin-top: 2.1em; }
h3 { font-size: clamp(17px, 1.7vw, 20px); margin-top: 1.9em; }
h4 { font-size: 16px; margin-top: 1.6em; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.35em; }
li { margin-bottom: .5em; }
li::marker { color: var(--faint); }
strong { color: var(--ink); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--hairline-2); margin: 2.5rem 0; }

code, kbd, samp { font-family: var(--mono); font-size: .9em; }
:not(pre) > code {
  background: var(--plate-sunk);
  border: 1px solid var(--hairline-2);
  color: var(--ink);
  padding: .14em .42em;
  border-radius: var(--r-xs);
  white-space: nowrap;
}
kbd {
  background: var(--plate-sunk); border: 1px solid var(--hairline);
  border-bottom-width: 2px; border-radius: var(--r-xs);
  padding: .1em .42em; font-size: .82em; color: var(--ink);
}

/* ---------- Ambient field ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(120px); opacity: var(--orb-opacity);
  animation: orbFloat 24s var(--ease) infinite;
}
.orb-1 { background: var(--grad-1); width: 46vw; height: 46vw; top: -12vw; left: -8vw; }
.orb-2 { background: var(--grad-3); width: 40vw; height: 40vw; top: 32vh; right: -10vw; animation-delay: -8s; }
.orb-3 { background: var(--grad-2); width: 38vw; height: 38vw; bottom: -14vw; left: 26vw; animation-delay: -16s; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0) scale(1); }
  33%      { transform: translate(4vw, -3vh) scale(1.08); }
  66%      { transform: translate(-3vw, 4vh) scale(.94); }
}

/* ---------- Layout ---------- */
.wrap { max-width: var(--max); padding-inline: var(--gutter); margin: 0 auto; }
/* A nested .prose is a reading column inside the centred .wrap. */
.prose { max-width: var(--measure); margin-inline: 0; }
/* Four pages put both roles on one element: keep the wrap centred at full
   width and cap its children instead, so the text still starts at the
   wrap's left edge and lines up with the hero above it. */
.wrap.prose { max-width: var(--max); margin-inline: auto; }
.wrap.prose > * { max-width: var(--column); }
.wrap.prose > .table-scroll, .wrap.prose > .codeblock { max-width: var(--column); }

/* Every page uses one centred reading column under a full-width header. */
.hero--center { text-align: center; }
.hero--center .hero__lede { margin-inline: auto; }

/* Structure A — .wrap and .prose on one element: the wrap stays full width
   and each child is capped and centred. The doubled class beats component
   rules further down the file that set a `margin` shorthand (.steps,
   .figure, .callout, .codeblock, .toc). */
.prose.prose--center > * { margin-inline: auto; }
.prose.prose--center > .table-scroll,
.prose.prose--center > .figure { max-width: 880px; }

/* Structure B — .prose nested inside .wrap: centre the column itself.
   Doubled selectors so these outrank .prose and .legal above. */
.prose--center:not(.wrap),
.legal.prose--center { max-width: var(--column); margin-inline: auto; }
.prose > p, .prose > ul, .prose > ol { color: var(--ink-soft); }
.section { padding-block: var(--band-gap); position: relative; }
.section + .section { border-top: 1px solid var(--hairline-2); }
.section--alt { background: var(--ground-2); border-block: 1px solid var(--hairline-2); }
.sr-only, .skip-link {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  background: var(--grad); color: #fff; font: 600 13px/1 var(--sans);
  border-radius: 0 0 var(--r-sm) 0; text-decoration: none;
}
.skip-link:focus {
  position: fixed; z-index: 100; inset-inline-start: 0; top: 0;
  clip-path: none; width: auto; height: auto; padding: 14px 20px; overflow: visible;
}

/* ---------- Masthead ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--hairline-2);
}
.site-header__inner { display: flex; align-items: center; gap: 22px; height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; text-decoration: none; min-width: 0; }
.brand__mark {
  flex: none; width: 34px; height: 34px; display: block;
  filter: drop-shadow(0 8px 18px rgba(124, 58, 237, .38));
}
.brand__text {
  font-family: var(--serif); color: var(--ink);
  font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1;
}
.brand__sub {
  display: block; margin-top: 2px;
  font-family: var(--sans); font-size: 9.5px; font-weight: 500;
  letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
}
.nav { display: flex; align-items: center; gap: 30px; }
.nav a { font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; transition: color var(--t-fast); }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--blued); }
.theme-toggle {
  flex: none; width: 42px; height: 42px; margin-left: -8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--plate-sunk); border: 1px solid var(--hairline-2);
  border-radius: var(--r-sm); color: var(--muted); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--grad-1); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (max-width: 900px) {
  .site-header__inner { gap: 14px; }
  .nav { gap: 16px; }
  .nav a.nav--hide-sm { display: none; }
}
@media (max-width: 620px) {
  .nav a { font-size: 12.5px; }
  .brand__sub { display: none; }
  .brand__text { font-size: 17px; white-space: nowrap; }
}
@media (max-width: 400px) { .nav a { display: none; } .nav a[aria-current="page"] { display: inline; } }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding-top: 20px; font-size: 12px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { display: flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-size: 10px; }
.breadcrumbs li + li::before { content: "/"; color: var(--faint); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blued); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(44px, 6vw, 84px) clamp(26px, 3vw, 40px); }
.hero h1 { margin-bottom: .34em; }
.hero h1 em {
  font-style: normal;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lede {
  color: var(--ink-soft);
  font-size: clamp(16px, 1.35vw, 18.5px);
  max-width: 64ch; margin: 0 0 4px;
}
.eyebrow {
  display: inline-block; margin: 0 0 16px;
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Plates ---------- */
.card {
  background: var(--plate);
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-plate);
  padding: clamp(22px, 2.8vw, 34px);
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card__title {
  margin: 0; font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Tool ---------- */
.tool { scroll-margin-top: 90px; }
.tool__label {
  display: block; margin-bottom: 9px;
  font-size: 10px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.tool__inputrow { display: flex; gap: 10px; flex-wrap: wrap; }
.tool__input {
  flex: 1 1 320px; min-width: 0;
  font-family: var(--mono); font-size: 17px; letter-spacing: .02em;
  color: var(--ink); background: var(--plate-sunk);
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 15px 17px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.tool__input::placeholder { color: var(--faint); }
.tool__input:focus {
  outline: none; border-color: var(--blued);
  box-shadow: 0 0 0 3px var(--blued-wash);
}
.tool__input[aria-invalid="true"] { border-color: var(--critical); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: 600 14px/1 var(--sans); letter-spacing: -.005em;
  padding: 15px 24px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  background: var(--grad); color: #fff; text-decoration: none;
  box-shadow: 0 10px 30px -12px var(--grad-2);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 38px -12px var(--grad-2); color: #fff; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; flex: none; display: block; }
.btn--ghost {
  background: var(--plate-sunk); color: var(--ink-soft);
  border-color: var(--hairline); box-shadow: none;
}
.btn--ghost:hover { color: var(--ink); border-color: var(--grad-1); box-shadow: none; }
.btn--sm { padding: 10px 16px; font-size: 12.5px; }

.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 15px; }
.examples__label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.chip {
  font: 500 12.5px/1 var(--mono);
  padding: 10px 14px; border-radius: 999px; cursor: pointer;
  background: var(--plate-sunk); color: var(--ink-soft);
  border: 1px solid var(--hairline-2);
  transition: border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.chip:hover { border-color: var(--grad-1); color: var(--ink); transform: translateY(-1px); }

/* ---------- Error ---------- */
.error-box {
  display: flex; gap: 11px; align-items: flex-start;
  margin-top: 16px; padding: 14px 16px;
  background: color-mix(in srgb, var(--critical) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--critical) 32%, transparent);
  border-radius: var(--r-md);
  color: var(--critical); font-size: 14px; line-height: 1.6;
}
.error-box svg { width: 17px; height: 17px; flex: none; margin-top: 3px; }
.error-box strong { display: block; color: inherit; margin-bottom: 2px; }
.error-box code { background: color-mix(in srgb, var(--critical) 14%, transparent); border-color: transparent; color: inherit; }

/* ---------- Readouts ---------- */
.results { margin-top: 24px; }
.result-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 17px 20px; border-radius: var(--r-md);
  background: var(--plate-sunk); border: 1px solid var(--hairline-2);
}
.result-row + .result-row { margin-top: 8px; }
.result-row__label {
  flex: none; min-width: 96px;
  font-size: 10px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.result-row__value {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 19px; font-weight: 500; letter-spacing: .05em;
  color: var(--ink); word-break: break-all;
}
.result-row--primary { background: var(--blued-wash); border-color: var(--grad-1); }
.result-row--primary .result-row__label { color: var(--blued); }
.result-row--primary .result-row__value {
  font-size: clamp(22px, 3vw, 30px); font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.copy-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  font: 600 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 13px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--hairline-2);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.copy-btn:hover { color: var(--blued); border-color: var(--grad-1); }
.copy-btn[data-copied="true"] { color: var(--tok-operand); border-color: currentColor; }
.copy-btn svg { width: 13px; height: 13px; }

/* ---------- Token pills ---------- */
.tok {
  display: inline-block; font-family: var(--mono); font-weight: 600;
  font-size: .92em; line-height: 1.5;
  padding: .1em .42em; border-radius: var(--r-xs); border: 1px solid transparent;
}
.tok--operand  { color: var(--tok-operand);  background: color-mix(in srgb, var(--tok-operand) 12%, transparent);  border-color: color-mix(in srgb, var(--tok-operand) 30%, transparent); }
.tok--operator { color: var(--tok-operator); background: color-mix(in srgb, var(--tok-operator) 12%, transparent); border-color: color-mix(in srgb, var(--tok-operator) 30%, transparent); }
.tok--paren    { color: var(--tok-paren);    background: color-mix(in srgb, var(--tok-paren) 12%, transparent);    border-color: color-mix(in srgb, var(--tok-paren) 30%, transparent); }
.legend {
  display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend .l-operand  { background: var(--tok-operand); }
.legend .l-operator { background: var(--tok-operator); }
.legend .l-paren    { background: var(--tok-paren); }

/* ---------- Tables ---------- */
.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: 26px;
  border: 1px solid var(--hairline-2); border-radius: var(--r-md);
  background: var(--plate-sunk);
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
caption {
  caption-side: top; text-align: left;
  padding: 14px 16px 10px;
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
th, td { text-align: left; padding: 12px 16px; vertical-align: baseline; border-bottom: 1px solid var(--hairline-2); }
thead th {
  font-size: 10.5px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
}
tbody td { color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--blued-wash); }
.t-mono { font-family: var(--mono); font-size: .93em; color: var(--ink); white-space: nowrap; }
.t-num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--brass); width: 1%; white-space: nowrap; font-size: 11px; }
.t-center { text-align: center; }

.trace-table td { white-space: nowrap; }
.trace-table .trace-action { white-space: normal; min-width: 240px; color: var(--muted); font-size: 13.5px; }
.trace-empty { color: var(--faint); font-style: italic; }
.trace-table tr.is-active td { background: var(--blued-wash); }
.trace-table tr.is-active td:first-child { box-shadow: inset 2px 0 0 var(--blued); }

/* ---------- Code ---------- */
.codeblock {
  position: relative; margin: 0 0 26px;
  border: 1px solid var(--hairline-2); border-radius: var(--r-md);
  background: #080a0f; overflow: hidden;
}
.codeblock__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, .022);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.codeblock__name { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #7e8799; }
.codeblock__bar .copy-btn { color: #7e8799; border-color: rgba(255, 255, 255, .1); }
.codeblock__bar .copy-btn:hover { color: #fff; border-color: rgba(255, 255, 255, .28); }
.codeblock pre { margin: 0; padding: 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.codeblock code {
  display: block; white-space: pre;
  font-family: var(--mono); font-size: 13px; line-height: 1.75; color: #dfe4ee;
}
.codeblock--plain { background: var(--plate-sunk); border-color: var(--hairline-2); }
.codeblock--plain code { color: var(--ink-soft); }

.hl-kw  { color: #c792ea; } .hl-typ { color: #7fd1e8; } .hl-str { color: #a5d66f; }
.hl-num { color: #f0955f; } .hl-com { color: #5d6577; font-style: italic; }
.hl-pre { color: #e8be5c; } .hl-fn  { color: #82aaff; } .hl-op  { color: #89ddff; }

/* ---------- Visualiser ---------- */
.viz { scroll-margin-top: 90px; }
.viz__expr {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 64px; padding: 16px; margin-bottom: 16px;
  background: var(--plate-sunk); border: 1px solid var(--hairline-2);
  border-radius: var(--r-md); font-family: var(--mono); font-size: 18px;
}
.viz__tok {
  padding: .16em .44em; border-radius: var(--r-xs);
  border: 1px solid transparent; color: var(--ink-soft);
  opacity: .42; transition: opacity var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.viz__tok.is-done { opacity: 1; }
.viz__tok.is-current {
  opacity: 1; font-weight: 700; color: var(--blued);
  background: var(--blued-wash); border-color: var(--blued);
  box-shadow: 0 0 14px -2px var(--blued);
}
.viz__grid { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(0, 1.4fr); gap: 1px; background: var(--hairline-2); border: 1px solid var(--hairline-2); border-radius: var(--r-md); overflow: hidden; }
@media (max-width: 620px) { .viz__grid { grid-template-columns: 1fr; } }
.viz__panel { background: var(--plate-sunk); padding: 16px; }
.viz__panel h3 {
  margin: 0 0 14px; font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.viz__stack { display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 5px; min-height: 172px; }
.viz__cell {
  padding: 9px; border-radius: var(--r-xs);
  background: var(--plate-solid); border: 1px solid var(--hairline);
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: var(--ink); text-align: center;
  animation: pop .18s var(--ease);
}
.viz__cell--top { border-color: var(--blued); color: var(--blued); box-shadow: 0 0 0 1px var(--blued-wash), 0 0 16px -4px var(--blued); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.viz__stackbase {
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--hairline);
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--faint); text-align: center;
}
.viz__out { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px; min-height: 172px; font-family: var(--mono); }
.viz__narration {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 0; padding: 15px 17px; min-height: 58px;
  background: var(--blued-wash); border: 1px solid var(--grad-1);
  border-radius: var(--r-md); color: var(--ink-soft); font-size: 14.5px;
}
.step-badge {
  flex: none; font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .1em; padding: 5px 9px; border-radius: 999px;
  background: var(--grad); color: #fff;
}
.viz__controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.viz__progress { flex: 1 1 120px; min-width: 100px; height: 4px; border-radius: 3px; background: var(--hairline-2); overflow: hidden; }
.viz__progress i { display: block; height: 100%; background: var(--grad); border-radius: 3px; transition: width .2s var(--ease); }
.viz__count { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.faq details {
  background: var(--plate);
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border: 1px solid var(--hairline-2); border-radius: var(--r-md);
  transition: border-color var(--t-fast);
}
.faq details:hover { border-color: var(--hairline); }
.faq details[open] { border-color: var(--grad-1); }
.faq summary {
  display: flex; align-items: center; gap: 16px;
  padding: 19px clamp(18px, 2vw, 26px);
  font-family: var(--serif); font-size: clamp(15.5px, 1.6vw, 17.5px);
  font-weight: 600; letter-spacing: -.01em; color: var(--ink);
  cursor: pointer; list-style: none;
  transition: color var(--t-fast);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--blued); }
.faq summary::after {
  content: ""; flex: none; margin-inline-start: auto;
  width: 8px; height: 8px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t-med), border-color var(--t-fast);
}
.faq details[open] summary::after { border-color: var(--blued); transform: rotate(225deg) translate(-2px, -2px); }
.faq__body { padding: 0 clamp(18px, 2vw, 26px) 22px; color: var(--ink-soft); font-size: 15px; }
.faq__body > *:last-child { margin-bottom: 0; }

/* ---------- Callouts ---------- */
.callout {
  margin: 0 0 26px; padding: 4px 0 4px 20px;
  border-inline-start: 2px solid transparent;
  border-image: var(--grad) 1;
  color: var(--ink-soft); font-size: 15px;
}
.callout > *:last-child { margin-bottom: 0; }
.callout__title {
  margin-bottom: 5px; font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.callout--warn { border-image: linear-gradient(180deg, var(--brass), color-mix(in srgb, var(--brass) 30%, transparent)) 1; }
.callout--warn .callout__title { background: none; color: var(--brass); }

/* ---------- Steps ---------- */
.steps { list-style: none; counter-reset: step; margin: 0 0 26px; padding: 0; }
.steps > li {
  position: relative; counter-increment: step;
  padding-inline-start: 40px; margin-bottom: 20px;
  color: var(--ink-soft); font-size: 15.5px;
}
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; inset-inline-start: 0; top: 5px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.steps > li > strong:first-child { display: block; margin-bottom: 2px; color: var(--ink); }
.steps > li > *:last-child { margin-bottom: 0; }

/* ---------- Link cards ---------- */
.cardgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.linkcard {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px; text-decoration: none; color: inherit;
  background: var(--plate);
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border: 1px solid var(--hairline-2); border-radius: var(--r-md);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.linkcard:hover { border-color: var(--grad-1); background: var(--plate-hover); transform: translateY(-2px); }
.linkcard__title {
  font-family: var(--serif); font-size: 17.5px; font-weight: 600;
  letter-spacing: -.015em; color: var(--ink);
  display: flex; align-items: baseline; gap: 8px;
}
.linkcard__title::after { content: "\2192"; color: var(--blued); transition: transform var(--t-fast); }
.linkcard:hover .linkcard__title::after { transform: translateX(3px); }
.linkcard p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* ---------- TOC ---------- */
.toc {
  margin-bottom: 34px; padding: 20px 24px;
  background: var(--plate-sunk); border: 1px solid var(--hairline-2); border-radius: var(--r-md);
}
.toc h2 {
  margin: 0 0 12px !important; font-family: var(--sans);
  font-size: 10px !important; font-weight: 700; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted);
}
.toc ol { margin: 0; padding-inline-start: 20px; font-size: 14px; }
.toc li { margin-bottom: 6px; }
.toc li::marker { font-family: var(--mono); font-size: 11px; color: var(--brass); }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--blued); text-decoration: underline; }

/* ---------- Legal / prose pages ---------- */
.legal { max-width: var(--measure); margin-inline: 0; }
.legal h2 { font-size: clamp(20px, 2.2vw, 25px); margin-top: 2.4em; }
.legal h3 { font-size: 17px; }
.legal__updated {
  display: inline-block; margin-bottom: 30px; padding: 8px 14px;
  border: 1px solid var(--hairline-2); border-radius: 999px;
  background: var(--plate-sunk);
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--muted);
}

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block; margin-bottom: 8px;
  font-size: 10px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 15px; color: var(--ink);
  padding: 13px 15px; background: var(--plate-sunk);
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blued); box-shadow: 0 0 0 3px var(--blued-wash);
}
.field--mono input { font-family: var(--mono); }
.field__hint { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* ---------- Sitemap page ---------- */
.sitemap-group { margin-bottom: 40px; }
.sitemap-group > h2 {
  margin: 0 0 18px; font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.sitemap-list { list-style: none; margin: 0; padding: 0; }
.sitemap-list li { position: relative; margin-bottom: 18px; padding-inline-start: 22px; }
.sitemap-list li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: 12px;
  width: 8px; height: 2px; border-radius: 2px; background: var(--grad);
}
.sitemap-list a { font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -.015em; color: var(--ink); text-decoration: none; }
.sitemap-list a:hover { color: var(--blued); }
.sitemap-list p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--hairline-2);
  background: var(--ground-2);
  padding-block: clamp(48px, 6vw, 76px) 40px;
  margin-top: clamp(48px, 6vw, 80px);
  font-size: 14px;
}
.site-footer__grid {
  display: grid; gap: clamp(28px, 4vw, 60px);
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
  padding-bottom: 40px; border-bottom: 1px solid var(--hairline-2);
}
@media (max-width: 900px) { .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .site-footer__grid { grid-template-columns: minmax(0, 1fr); } }
.site-footer h2 {
  margin: 0 0 14px; font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.site-footer p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.6; max-width: 42ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.site-footer li { margin: 0; }
.site-footer a { color: var(--ink-soft); font-size: 13.5px; text-decoration: none; transition: color var(--t-fast); }
.site-footer a:hover { color: var(--blued); }
.site-footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 14px 26px; margin-top: 30px; padding-top: 26px;
  border-top: 1px solid var(--hairline-2);
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--faint);
}
.footer-email {
  display: inline-block; align-self: start;
  font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere;
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 1px solid var(--hairline-2); padding-bottom: 1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.footer-email:hover { color: var(--blued); border-color: var(--grad-1); }

.footer-legal { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.footer-legal a {
  font-family: var(--sans); font-size: 12.5px; letter-spacing: 0;
  color: var(--muted); text-decoration: none;
}
.footer-legal a:hover { color: var(--blued); }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* Inline code must not force the page wide on a phone. It stays on one line
   where there is room, and breaks rather than overflowing where there is not. */
@media (max-width: 700px) {
  :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
@media print {
  .ambient, .site-header, .theme-toggle, .viz__controls { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Diagrams ---------- */
.figure { margin: 0 0 30px; display: flex; flex-direction: column; gap: 14px; }
.figure-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { color: var(--muted); font-size: 13.5px; line-height: 1.6; max-width: var(--measure); }
.figure figcaption b { color: var(--ink-soft); font-weight: 600; }

/* shared diagram primitives */
.d-surface   { fill: var(--plate-sunk); stroke: var(--hairline-2); }
.d-plate     { fill: var(--plate-solid); stroke: var(--hairline); }
.d-hair      { stroke: var(--hairline); fill: none; }
.d-hair-2    { stroke: var(--hairline-2); fill: none; }
.d-wire      { stroke: var(--faint); fill: none; }
.d-arrow     { fill: var(--faint); }
.d-text      { fill: var(--ink); font-family: var(--mono); font-size: 15px; }
.d-text-sans { fill: var(--ink); font-family: var(--sans); font-size: 13px; font-weight: 600; }
.d-muted     { fill: var(--muted); font-family: var(--sans); font-size: 11.5px; }
.d-tag       { fill: var(--muted); font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; }
.d-brass     { fill: var(--brass); font-family: var(--mono); font-size: 10px; letter-spacing: .12em; }
.d-accent    { fill: var(--blued); }
.d-accent-s  { stroke: var(--blued); fill: none; }
.d-operand   { fill: var(--tok-operand); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.d-operator  { fill: var(--tok-operator); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.d-paren     { fill: var(--tok-paren); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.d-operand-c  { fill: color-mix(in srgb, var(--tok-operand) 13%, transparent);  stroke: color-mix(in srgb, var(--tok-operand) 40%, transparent); }
.d-operator-c { fill: color-mix(in srgb, var(--tok-operator) 13%, transparent); stroke: color-mix(in srgb, var(--tok-operator) 40%, transparent); }
.d-accent-c   { fill: var(--blued-wash); stroke: var(--blued); }
.figure svg text { font-family: var(--mono); }
.figure svg text.d-muted, .figure svg text.d-text-sans { font-family: var(--sans); }
.d-mid { text-anchor: middle; }
.d-end { text-anchor: end; }

/* ---------- Site search ---------- */
.search-btn {
  flex: none; width: 42px; height: 42px; margin-left: -4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--plate-sunk); border: 1px solid var(--hairline-2);
  border-radius: var(--r-sm); color: var(--muted); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.search-btn:hover { color: var(--ink); border-color: var(--grad-1); }
.search-btn svg { width: 16px; height: 16px; display: block; }

.search-veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 5, 9, .62);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.search-panel {
  position: fixed; z-index: 61; top: 84px; left: 50%; transform: translateX(-50%);
  width: min(620px, calc(100vw - 28px));
  background: var(--plate-solid); border: 1px solid var(--hairline);
  border-radius: var(--r-md); box-shadow: var(--shadow-plate), var(--shadow-lift);
  display: flex; flex-direction: column; overflow: hidden;
}
.search-box { display: flex; align-items: center; gap: 11px; padding: 4px 14px; border-bottom: 1px solid var(--hairline-2); }
.search-box .search-glyph { color: var(--muted); flex: none; width: 17px; height: 17px; }
.search-panel input[type="search"] {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  background: none; border: 0; outline: none;
  font-family: var(--sans); font-size: 16px; color: var(--ink); padding: 15px 0;
}
.search-panel input::placeholder { color: var(--faint); }
.search-panel input::-webkit-search-cancel-button { display: none; }
.search-hint {
  flex: none; font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--faint); border: 1px solid var(--hairline-2);
  border-radius: 5px; padding: 3px 6px;
}
.search-results { list-style: none; margin: 0; padding: 6px; max-height: min(56vh, 420px); overflow-y: auto; }
.search-results li { margin: 0; }
.search-results a {
  display: block; padding: 10px 12px; border-radius: var(--r-sm);
  text-decoration: none; color: inherit;
}
.search-results a:hover, .search-results a.is-active { background: var(--blued-wash); }
.search-results a.is-active { box-shadow: inset 2px 0 0 var(--blued); }
.sr-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.sr-page {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brass); margin-top: 3px;
}
.sr-snip {
  font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sr-title mark, .sr-snip mark { background: none; color: var(--blued); font-weight: 600; }
.search-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.search-foot {
  display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--hairline-2);
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--faint);
}
@media (max-width: 620px) {
  .search-panel { top: 62px; }
  .search-hint, .search-foot { display: none; }
}

/* ---------- Practice quiz ---------- */
.quiz-bar {
  position: sticky; top: 76px; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 26px; padding: 14px 18px;
  background: var(--plate); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border: 1px solid var(--hairline-2); border-radius: var(--r-md);
}
.quiz-bar__stat { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.quiz-bar__stat b { color: var(--ink); font-size: 15px; }
.quiz-bar__track { flex: 1 1 120px; min-width: 90px; height: 5px; border-radius: 3px; background: var(--hairline-2); overflow: hidden; }
.quiz-bar__track i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 3px; transition: width .25s var(--ease); }

.quiz-list { list-style: none; margin: 0 0 30px; padding: 0; }
.quiz-q {
  margin-bottom: 14px; padding: 18px 20px;
  background: var(--plate); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
  border: 1px solid var(--hairline-2); border-radius: var(--r-md);
  transition: border-color var(--t-fast);
}
.quiz-q[data-state="right"] { border-color: color-mix(in srgb, var(--tok-operand) 55%, transparent); }
.quiz-q[data-state="wrong"] { border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.quiz-ask { margin: 0 0 12px; font-size: 15px; color: var(--ink); }
.quiz-ask b { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--brass); margin-right: 8px; }
.quiz-form { display: flex; gap: 9px; flex-wrap: wrap; }
.quiz-input {
  flex: 1 1 240px; min-width: 0;
  font-family: var(--mono); font-size: 15px; color: var(--ink);
  padding: 11px 14px; background: var(--plate-sunk);
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.quiz-input::placeholder { color: var(--faint); }
.quiz-input:focus { outline: none; border-color: var(--blued); box-shadow: 0 0 0 3px var(--blued-wash); }
.quiz-verdict {
  margin: 12px 0 0; padding: 10px 13px; border-radius: var(--r-sm);
  font-size: 13.5px; font-family: var(--mono);
}
.quiz-verdict--right { color: var(--tok-operand); background: color-mix(in srgb, var(--tok-operand) 10%, transparent); }
.quiz-verdict--wrong { color: var(--critical);    background: color-mix(in srgb, var(--critical) 10%, transparent); }
.quiz-verdict--idle  { color: var(--muted);       background: var(--plate-sunk); }
.quiz-q details { margin-top: 12px; }
.quiz-q summary {
  cursor: pointer; font-size: 13px; color: var(--muted); list-style: none;
  font-family: var(--sans);
}
.quiz-q summary::-webkit-details-marker { display: none; }
.quiz-q summary:hover { color: var(--blued); }
.quiz-q summary::before { content: "▸ "; }
.quiz-q details[open] summary::before { content: "▾ "; }
@media (max-width: 620px) { .quiz-bar { top: 66px; } }

/* ---------- Grouped navigation ---------- */
.nav-group { position: relative; }
.nav-top, .nav-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  background: none; border: 0; padding: 8px 2px; cursor: pointer;
  transition: color var(--t-fast);
}
.nav-top:hover, .nav-trigger:hover { color: var(--ink); }
.nav-top[aria-current="page"], .nav-trigger[data-current="true"] { color: var(--blued); }
.nav-trigger svg { width: 13px; height: 13px; transition: transform var(--t-fast); }
.nav-trigger[aria-expanded="true"] { color: var(--ink); }
.nav-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

.nav-menu {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  z-index: 55; min-width: 262px; padding: 7px;
  background: var(--plate-solid); border: 1px solid var(--hairline);
  border-radius: var(--r-md); box-shadow: var(--shadow-plate), var(--shadow-lift);
  display: flex; flex-direction: column;
}
.nav-menu a {
  display: block; padding: 9px 12px; border-radius: var(--r-sm);
  text-decoration: none; color: inherit;
}
.nav-menu a:hover, .nav-menu a:focus-visible { background: var(--blued-wash); }
.nav-menu a[aria-current="page"] { background: var(--blued-wash); box-shadow: inset 2px 0 0 var(--blued); }
.nav-menu__label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.nav-menu__note  { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.nav-burger {
  display: none; width: 42px; height: 42px; flex: none;
  align-items: center; justify-content: center;
  background: var(--plate-sunk); border: 1px solid var(--hairline-2);
  border-radius: var(--r-sm); color: var(--ink); cursor: pointer;
}
.nav-burger:hover { border-color: var(--grad-1); }
.nav-burger svg { width: 18px; height: 18px; }

@media (max-width: 860px) {
  .nav-burger { display: inline-flex; }
  .nav { gap: 8px; }
  .nav > .nav-top, .nav > .nav-group { display: none; }
  .nav.is-open {
    position: absolute; top: 72px; right: var(--gutter); left: var(--gutter);
    flex-direction: column; align-items: stretch; gap: 2px; padding: 10px;
    background: var(--plate-solid); border: 1px solid var(--hairline);
    border-radius: var(--r-md); box-shadow: var(--shadow-plate), var(--shadow-lift);
  }
  .nav.is-open > .nav-top, .nav.is-open > .nav-group { display: block; }
  .nav.is-open .nav-top, .nav.is-open .nav-trigger {
    width: 100%; justify-content: space-between; padding: 11px 12px;
    border-radius: var(--r-sm); font-size: 15px;
  }
  .nav.is-open .nav-menu {
    position: static; transform: none; min-width: 0; box-shadow: none;
    border: 0; border-left: 2px solid var(--hairline); border-radius: 0;
    margin: 2px 0 6px 14px; padding: 0 0 0 6px;
  }
  .nav.is-open .search-btn, .nav.is-open .theme-toggle { display: none; }
}
