/* ---------- Reset & base ---------- */
:root {
  --ink: #1b1a17;
  --ink-soft: #4a4640;
  --paper: #fbf9f5;
  --paper-alt: #f2ede4;
  --line: #e3ddd1;
  --accent: #b5502f;
  --accent-dark: #8a3b21;
  --accent-soft: #f4e3d8;
  --good: #2f6b4f;
  --good-soft: #e2efe7;
  --bad: #9c3b3b;
  --bad-soft: #f4e2e0;
  --max-w: 980px;
  --max-w-narrow: 740px;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27, 26, 23, 0.04), 0 6px 20px rgba(27, 26, 23, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.6em;
}

h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; margin-bottom: 0.4em; }

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--paper-alt);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent-dark);
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; z-index: 200;
}
.skip-link:focus { left: 10px; top: 10px; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}
.wrap.narrow { max-width: var(--max-w-narrow); }

/* ---------- Sidebar nav ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: rgba(251, 249, 245, 0.98);
  border-right: 1px solid var(--line);
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.28s ease;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 28px 20px 22px;
}
.brand {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-bottom: 26px;
  padding: 0 4px;
}
.brand:hover { text-decoration: none; color: var(--accent); }

#navLinks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
#navLinks a {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 9px 12px;
  border-radius: 8px;
}
#navLinks a:hover { color: var(--accent); background: var(--paper-alt); text-decoration: none; }

.sidebar-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.nav-cta {
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 9px 14px !important;
  color: var(--ink) !important;
  text-align: center;
  font-weight: 600;
}
.nav-cta:hover { background: var(--ink); color: #fff !important; text-decoration: none; }

/* Mobile hamburger toggle (floats above content, shown only below the sidebar breakpoint) */
.nav-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 300;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Dims the page behind the sidebar drawer on mobile */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(27, 26, 23, 0.4);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

#main { margin-left: var(--sidebar-w); }
body.no-scroll { overflow: hidden; }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
  background:
    radial-gradient(60% 60% at 50% 0%, var(--accent-soft) 0%, rgba(244,227,216,0) 70%),
    var(--paper);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 14px;
}
.hero h1 {
  max-width: 820px;
  margin: 0 auto 14px;
  font-size: clamp(1.7rem, 1.15rem + 2.4vw, 2.55rem);
}
.tagline {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.tagline strong { color: var(--accent-dark); }

.authors {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 22px;
  padding: 0;
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 500;
}
.authors a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.authors a:hover {
  border-bottom-color: currentColor;
}
.affiliations {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 30px;
}
sup { font-size: 0.68em; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 46px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-ghost { color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.teaser {
  max-width: 880px;
  margin: 0 auto;
  padding: 0;
}
.teaser img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}
.teaser figcaption {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: left;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section.alt { background: var(--paper-alt); }
.section h2 { margin-bottom: 0.7em; }
.sub-h { margin-top: 2.2em; }

.abstract-text {
  font-family: 'Source Serif 4', serif;
  font-size: 1.08rem;
  color: var(--ink);
}

/* Stats */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 34px;
}
.stat-strip-mini { margin-top: 24px; margin-bottom: 8px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}
.stat-num {
  display: block;
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--accent-dark);
  line-height: 1.1;
}
.stat-label {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* Compare (problem section) — scroll-driven timeline reveal */
.compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 20px;
  margin: 34px 0;
  --flow-progress: 1;
}
.compare-col {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.compare-arrow {
  align-self: center;
  font-size: 1.6rem;
  color: var(--ink-soft);
}
.compare-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.tag-good { background: var(--good-soft); color: var(--good); }

/* A connector rail runs behind numbered step markers; its fill height
   tracks --flow-progress (0–1), which JS ties directly to how far this
   section has scrolled through the viewport. Scroll down, it fills;
   scroll back up, it retreats — no timers, so it replays every pass. */
.flow {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 2px 0 2px 36px;
  color: var(--ink-soft);
  counter-reset: flow-step;
}
.flow::before,
.flow::after {
  content: '';
  position: absolute;
  left: 11px;
  width: 2px;
  top: 12px;
  bottom: 12px;
  z-index: 0;
}
.flow::before { background: var(--line); }
.flow::after {
  background: var(--ink-soft);
  height: calc((100% - 24px) * var(--flow-progress));
  transition: height 0.1s linear;
}
.compare-col:first-of-type .flow::after { background: var(--bad); }
.compare-col:last-of-type .flow::after { background: var(--good); }

.flow li {
  position: relative;
  z-index: 1;
  margin-bottom: 22px;
  min-height: 26px;
  padding-top: 2px;
  font-size: 0.95rem;
}
.flow li:last-child { margin-bottom: 0; }
.flow li::before {
  counter-increment: flow-step;
  content: counter(flow-step);
  position: absolute;
  left: -36px; top: -1px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flow li:last-child::before { content: none; }
/* The rail's track runs the full height of the list; mask the segment
   that would dangle below the terminus marker with a strip in the card
   colour, so the line visually ends at the final node. */
.flow li:last-child::after {
  content: '';
  position: absolute;
  left: -26px; /* centred on the 2px rail */
  top: 22px;   /* tucks 2px under the marker so no rail stub shows */
  bottom: -12px;
  width: 4px;
  background: #fff;
}
.dead-end { color: var(--bad); font-weight: 600; }
.good-end { color: var(--good); font-weight: 600; }

/* Terminus markers are the punchline of each column, so they get the
   same solid treatment as the active numbered steps rather than a pale
   soft badge. Both carry a nabla — the gradient operator: struck through
   where no gradient flows, plain where it does. */
.flow-icon {
  position: absolute;
  left: -36px; top: -1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95em;
  line-height: 1;
  color: #fff;
}
.icon-nograd { background: var(--bad); }
.icon-grad { background: var(--good); }
/* Knockout slash through the "no gradient" nabla, painted in the
   circle's own fill colour so the white glyph reads as struck through
   (same negation-slash convention as ≠, ∉). */
.icon-nograd::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--bad);
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Step-by-step dimming only kicks in once JS confirms motion is welcome
   (see setupCompareTimeline in main.js). No-JS / reduced-motion users get
   the fully-visible, statically-filled timeline from the rules above. */
.flow-anim .flow li {
  opacity: 0.35;
  transform: translateX(-4px);
  color: var(--ink-soft);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}
.flow-anim .flow li::before {
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.flow-anim .flow-icon {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.flow-anim .flow li.is-active {
  opacity: 1;
  transform: none;
  color: var(--ink);
}
.flow-anim .flow li.is-active::before {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
  color: #fff;
}
.flow-anim .compare-col:first-of-type .flow li.is-active::before { background: var(--bad); border-color: var(--bad); }
.flow-anim .compare-col:last-of-type .flow li.is-active::before { background: var(--good); border-color: var(--good); }
.flow-anim .flow li.is-active .flow-icon {
  opacity: 1;
  transform: scale(1);
}
.flow-anim .flow li.is-active .icon-nograd { animation: icon-shake 0.5s ease 0.15s; }
.flow-anim .flow li.is-active .icon-grad { animation: icon-pulse 2s ease-in-out 0.3s infinite; }

@keyframes icon-shake {
  0% { transform: scale(1) translateX(0); }
  20% { transform: scale(1) translateX(-3px); }
  40% { transform: scale(1) translateX(3px); }
  60% { transform: scale(1) translateX(-2px); }
  80% { transform: scale(1) translateX(2px); }
  100% { transform: scale(1) translateX(0); }
}
@keyframes icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@keyframes tool-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* Method figure */
.fig-wide { margin: 32px 0; }
.fig-wide img {
  width: 100%;
  display: block;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
@media (max-width: 600px) {
  .fig-wide img { padding: 16px; }
}
.fig-wide figcaption, .fig-note {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* Grids / cards */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin: 28px 0;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0 28px;
}
.card, .reward-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  min-width: 0;
}
.card-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}
.card h3 { margin-bottom: 0.5em; }
.card p, .reward-card p { margin-bottom: 0.6em; font-size: 0.95rem; }
.reward-card h4 { color: var(--accent-dark); }

/* Task card demos — slide in on scroll, no click required to reveal.
   Default state (no JS / reduced motion) is fully visible; scroll-in.js
   arms `.demo-panel` with `.demo-anim` once and toggles `.is-visible`
   via IntersectionObserver as each card enters the viewport. */
.demo-panel.demo-anim {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.demo-panel.demo-anim.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.demo-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}
.demo-label:first-child { margin-top: 0; }
.demo-qa {
  margin: 0;
  padding-left: 1.1em;
  font-size: 0.88rem;
}
.demo-qa li { margin-bottom: 4px; }
.demo-more { color: var(--ink-soft); font-style: italic; }
.demo-code {
  background: #1e1c18;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  overflow-x: auto;
}
.demo-code pre { margin: 0; }
.demo-code code {
  background: none;
  color: #f1ece2;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1.55;
}
.demo-result {
  font-size: 0.88rem;
  color: var(--good);
  margin: 0;
}
.demo-question {
  font-family: 'Source Serif 4', serif;
  font-style: italic;
  font-size: 1rem;
  margin: 0;
}
.demo-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.demo-tool {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.demo-tool:hover { border-color: var(--accent); transform: translateY(-1px); }
.demo-tool-name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--accent-dark);
}
.demo-tool-desc { font-size: 0.85rem; color: var(--ink-soft); }
.demo-tool.is-correct {
  border-color: var(--good);
  background: var(--good-soft);
}
.demo-tool.is-correct .demo-tool-name { color: var(--good); }
.demo-tool.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  animation: tool-shake 0.4s ease;
}
.demo-tool:disabled { cursor: default; }
.demo-tool:disabled:hover { transform: none; }
.demo-feedback {
  min-height: 1.4em;
  margin: 10px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.demo-feedback.is-correct { color: var(--good); }
.demo-feedback.is-wrong { color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
  .demo-panel.demo-anim {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .demo-tool { transition: none; }
  .demo-tool.is-wrong { animation: none; }
}

.eq {
  font-size: 0.92rem;
  overflow-x: auto;
}
.eq-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 20px 0;
  overflow-x: auto;
}

.note-box {
  background: var(--accent-soft);
  border: 1px solid #e6c6ae;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
}
.note-box p { margin: 0; color: var(--ink); font-size: 0.95rem; }

/* Tables */
.table-scroll { overflow-x: auto; margin: 22px 0 10px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.86rem;
  min-width: 620px;
}
.data-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding-bottom: 10px;
}
.data-table th, .data-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: center;
}
.data-table th {
  background: var(--paper-alt);
  font-weight: 600;
}
.data-table td:first-child, .data-table th:first-child {
  text-align: left;
  font-weight: 500;
}
.data-table tr.tr-highlight td { background: var(--accent-soft); }
.data-table tr.tr-split td { border-top: 2px solid var(--ink); }
.data-table u { text-decoration: underline; text-decoration-color: var(--ink-soft); }
.cite { color: #a39d90; font-size: 0.85em; }

/* Bar chart */
.bar-chart { margin: 26px 0 8px; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 220px 1fr 52px; align-items: center; gap: 12px; }
.bar-label { font-size: 0.85rem; color: var(--ink-soft); text-align: right; }
.bar-track { background: var(--paper-alt); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: #c9c2b4; border-radius: 6px; }
.bar-fill-alt { background: #9a8f78; }
.bar-fill-hero { background: var(--accent); }
.bar-value { font-weight: 600; font-size: 0.88rem; }

/* Limitations */
.limit-box {
  background: #fff;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 22px 26px;
}
.limit-box p { font-size: 0.95rem; margin-bottom: 1em; }
.limit-box p:last-child { margin-bottom: 0; }

/* BibTeX */
.code-block {
  position: relative;
  background: #1e1c18;
  border-radius: var(--radius);
  padding: 22px;
  overflow-x: auto;
}
.code-block pre {
  margin: 0;
  color: #f1ece2;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,0.1);
  color: #f1ece2;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.copy-btn:hover { background: rgba(255,255,255,0.2); }
.copy-btn.copied { background: var(--accent); border-color: var(--accent); }

/* Footer */
.site-footer {
  background: var(--ink);
  color: #cfc9bd;
  padding: 44px 0 24px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
.footer-col .brand { color: #fff; }
.footer-col p { color: #a9a294; font-size: 0.88rem; margin: 8px 0 14px; }
.footer-col h4 {
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  color: #cfc9bd;
  font-size: 0.92rem;
  margin-bottom: 8px;
}
.footer-col a:hover { color: #fff; }
.footer-note {
  max-width: var(--max-w);
  margin: 30px auto 0;
  padding: 20px 24px 0;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.8rem;
  color: #8f8879;
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .compare-arrow { transform: rotate(90deg); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 44px; }
  .bar-label { font-size: 0.76rem; }
}

@media (max-width: 960px) {
  .nav-toggle { display: flex; }
  .sidebar {
    top: 0;
    width: min(280px, 84vw);
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
}
