/* Agent Arena — AWS/Cloudscape-inspired Documentation Styling
 *
 * Modern, tech-focused, production-grade documentation design:
 * - Subtle Slate Navy, Crisp Surface, Modern Warm Amber CTA, Tech Blue
 * - Multi-font pairing: Inter (Headings & UI) + JetBrains Mono (Code, Data, Metrics)
 * - Zero layout leakage with strict table and code block scroll containment
 * - Responsive mobile drawer with backdrop overlay
 */

/* ---------------------------------------------------------------- tokens */

:root {
  --ground:        #f8fafc;
  --surface:       #ffffff;
  --surface-2:     #f1f5f9;
  --surface-3:     #e2e8f0;

  --ink:           #0f172a;
  --ink-2:         #475569;
  --ink-3:         #64748b;

  --line:          #e2e8f0;
  --line-strong:   #94a3b8;

  /* Subtle, modern warm amber/bronze & tech slate-blue */
  --accent:        #b45309;
  --accent-ink:    #92400e;
  --accent-soft:   rgba(180, 83, 9, 0.08);
  --accent-line:   rgba(180, 83, 9, 0.22);
  --on-accent:     #ffffff;

  --accent-blue:       #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-blue-soft:  rgba(37, 99, 235, 0.08);
  --accent-blue-line:  rgba(37, 99, 235, 0.22);

  --good:          #16a34a;
  --good-soft:     rgba(22, 163, 74, 0.08);
  --warn:          #d97706;
  --warn-soft:     rgba(217, 119, 6, 0.08);
  --bad:           #dc2626;
  --bad-soft:      rgba(220, 38, 38, 0.08);

  --topbar-bg:     #0f172a;
  --topbar-text:   #cbd5e1;
  --topbar-line:   rgba(255, 255, 255, 0.08);

  --radius-sm:     6px;
  --radius:        8px;
  --radius-lg:     12px;
  --radius-full:   9999px;

  --shadow-sm:     0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md:     0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg:     0 12px 32px -4px rgba(15, 23, 42, 0.12);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wide: 1440px;
  --measure: 84ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:        #090d16;
    --surface:       #111827;
    --surface-2:     #182234;
    --surface-3:     #0d131f;

    --ink:           #f1f5f9;
    --ink-2:         #94a3b8;
    --ink-3:         #64748b;

    --line:          #1e293b;
    --line-strong:   #334155;

    --accent:        #f59e0b;
    --accent-ink:    #fbbf24;
    --accent-soft:   rgba(245, 158, 11, 0.12);
    --accent-line:   rgba(245, 158, 11, 0.28);
    --on-accent:     #090d16;

    --accent-blue:       #60a5fa;
    --accent-blue-hover: #93c5fd;
    --accent-blue-soft:  rgba(96, 165, 250, 0.12);
    --accent-blue-line:  rgba(96, 165, 250, 0.28);

    --good:          #34d399;
    --good-soft:     rgba(52, 211, 153, 0.12);
    --warn:          #fbbf24;
    --warn-soft:     rgba(251, 191, 36, 0.12);
    --bad:           #f87171;
    --bad-soft:      rgba(248, 113, 113, 0.12);

    --topbar-bg:     #060a10;
    --topbar-text:   #cbd5e1;
    --topbar-line:   rgba(255, 255, 255, 0.07);

    --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md:     0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-lg:     0 12px 32px -4px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --ground:        #090d16;
  --surface:       #111827;
  --surface-2:     #182234;
  --surface-3:     #0d131f;

  --ink:           #f1f5f9;
  --ink-2:         #94a3b8;
  --ink-3:         #64748b;

  --line:          #1e293b;
  --line-strong:   #334155;

  --accent:        #f59e0b;
  --accent-ink:    #fbbf24;
  --accent-soft:   rgba(245, 158, 11, 0.12);
  --accent-line:   rgba(245, 158, 11, 0.28);
  --on-accent:     #090d16;

  --accent-blue:       #60a5fa;
  --accent-blue-hover: #93c5fd;
  --accent-blue-soft:  rgba(96, 165, 250, 0.12);
  --accent-blue-line:  rgba(96, 165, 250, 0.28);

  --good:          #34d399;
  --good-soft:     rgba(52, 211, 153, 0.12);
  --warn:          #fbbf24;
  --warn-soft:     rgba(251, 191, 36, 0.12);
  --bad:           #f87171;
  --bad-soft:      rgba(248, 113, 113, 0.12);

  --topbar-bg:     #060a10;
  --topbar-text:   #cbd5e1;
  --topbar-line:   rgba(255, 255, 255, 0.07);

  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md:     0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg:     0 12px 32px -4px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.nav-locked {
  overflow: hidden;
}

/* ------------------------------------------------------------ typography */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0 0 .5em;
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 700;
  color: var(--ink);
}
h1 { font-size: clamp(1.9rem, 1.35rem + 1.8vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + .9vw, 1.75rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 1.1em; }

a { color: var(--accent-blue); text-decoration: none; transition: color 0.15s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

code, kbd, samp, pre { font-family: var(--mono); font-size: .875em; }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .15em .4em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.6;
  margin: 0 0 1.4rem;
  tab-size: 2;
  box-shadow: var(--shadow-sm);
}
pre code { background: none; border: 0; padding: 0; white-space: pre; font-size: .85rem; }

blockquote {
  margin: 0 0 1.4rem;
  padding: .9rem 1.2rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: .94rem;
}
blockquote > :last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 1.2em; padding-left: 1.4rem; }
li { margin-bottom: .4em; }
li > ul, li > ol { margin-top: .4em; margin-bottom: .4em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0; top: -3rem; z-index: 100;
  background: var(--accent); color: #ffffff; padding: .6rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

.hero-grid > *, .split-2 > *, .cards > *, .shell > * { min-width: 0; }

/* ---------------------------------------------------------------- tables */

.md table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow: hidden;
}
.md th, .md td, .data-table th, .data-table td {
  border: 1px solid var(--line);
  padding: .65rem .95rem;
  text-align: left;
  vertical-align: top;
}
.md th, .data-table th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-2);
  white-space: nowrap;
}
.table-scroll { overflow-x: auto; margin-bottom: 1.4rem; max-width: 100%; }

/* ------------------------------------------------------------ chrome/nav */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-line);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: var(--wide); margin: 0 auto;
  display: flex; align-items: center; gap: 1.25rem;
  padding: .75rem 1.5rem;
  height: 3.75rem;
}
.brand {
  font-family: var(--font-display);
  display: inline-flex; align-items: center; gap: .65rem;
  color: #ffffff; font-weight: 700; letter-spacing: -.02em; font-size: 1.1rem;
}
.brand:hover { text-decoration: none; color: #ffffff; }
.brand-mark {
  width: 1.35rem; height: 1.35rem; flex: none;
  border: 2px solid var(--accent); position: relative;
  border-radius: 4px;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 2px 2px auto auto;
  width: .4rem; height: .4rem; background: var(--accent);
  border-radius: 2px;
}
.top-links { display: flex; gap: .35rem; margin-left: auto; align-items: center; }
.top-links a {
  color: var(--topbar-text); font-size: .88rem; font-weight: 550;
  padding: .4rem .75rem; border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}
.top-links a:hover, .top-links a.active {
  color: #ffffff; text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
}
.top-links a.active {
  color: var(--accent);
  font-weight: 650;
  background: var(--accent-soft);
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.15rem; height: 2.15rem; padding: 0;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--topbar-line);
  border-radius: var(--radius-sm);
  color: var(--topbar-text); cursor: pointer; font-size: .95rem; line-height: 1;
  transition: all 0.15s ease;
}
.icon-btn:hover { color: #ffffff; border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.15); }
.nav-toggle { display: none; }

/* Backdrop overlay for mobile drawer */
.nav-backdrop {
  display: none;
}

/* ------------------------------------------------------------- doc shell */

.shell {
  max-width: var(--wide); margin: 0 auto;
  display: grid; grid-template-columns: 15.5rem minmax(0, 1fr) 13.5rem;
  gap: 2.5rem; padding: 2.5rem 1.5rem 5rem;
  align-items: start;
}

.sidebar {
  position: sticky; top: 4.75rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  scrollbar-width: thin;
}
.mobile-only-drawer { display: none; }

.nav-group { margin-bottom: 1.6rem; }
.nav-group h4 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin-bottom: .6rem; font-weight: 700;
}
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group li { margin: 0; }
.nav-group a {
  display: block; padding: .35rem .75rem;
  color: var(--ink-2); font-size: .88rem; font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}
.nav-group a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-group a.active {
  color: var(--accent); background: var(--accent-soft);
  font-weight: 650; border-left: 3px solid var(--accent); border-top-left-radius: 2px; border-bottom-left-radius: 2px;
}

.doc { min-width: 0; }
.doc-head { border-bottom: 1px solid var(--line); padding-bottom: 1.25rem; margin-bottom: 2rem; }
.crumbs {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .02em;
  color: var(--ink-3); margin-bottom: .65rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
}
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent-blue); text-decoration: none; }
.crumbs .sep { opacity: .45; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent); margin-bottom: .5rem; font-weight: 700;
}
.doc-head h1 { margin-bottom: .35rem; }
.doc-head p { color: var(--ink-2); margin: 0; max-width: var(--measure); font-size: 1.05rem; }
.md { max-width: var(--measure); min-width: 0; overflow-wrap: break-word; }
.md > *, .code-wrap, .md pre { max-width: 100%; }
.md > h2 { margin-top: 2.6rem; padding-top: .4rem; border-top: 1px solid var(--line); }
.md > h3 { margin-top: 2rem; }
.md img { max-width: 100%; height: auto; border-radius: var(--radius); }
.md .headerlink { opacity: 0; margin-left: .35rem; color: var(--ink-3); font-weight: 400; transition: opacity 0.15s ease; }
.md .headerlink::after { content: "#"; }
.md h2:hover .headerlink, .md h3:hover .headerlink, .md .headerlink:focus { opacity: 1; }

.toc-col {
  position: sticky; top: 4.75rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto; font-size: .84rem;
  scrollbar-width: thin;
}
.toc-col.empty { display: none; }
.toc-col h4 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin-bottom: .6rem; font-weight: 700;
}
.toc-col ul { list-style: none; margin: 0; padding: 0; }
.toc-col ul ul { padding-left: .85rem; }
.toc-col li { margin: 0; }
.toc-col a {
  display: block; padding: .25rem 0 .25rem .75rem;
  color: var(--ink-2); border-left: 2px solid var(--line);
  transition: all 0.15s ease;
}
.toc-col a:hover { color: var(--ink); border-left-color: var(--line-strong); text-decoration: none; }
.toc-col a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 650; }
.toc-col .toctitle { display: none; }

.doc-foot { border-top: 1px solid var(--line); margin-top: 3.5rem; padding-top: 1.5rem; }
.edit-link { font-size: .85rem; color: var(--ink-3); }
.pager-row { display: flex; justify-content: space-between; gap: 1.25rem; margin-top: 1.5rem; }
.pager {
  display: block; max-width: 48%; padding: .85rem 1.15rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: .92rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.pager:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.pager span {
  display: block; font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 400;
  margin-bottom: .2rem;
}
.pager.next { text-align: right; margin-left: auto; }

/* ---------------------------------------------------------- landing page */

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; }

.hero { border-bottom: 1px solid var(--line); padding: 5rem 0 4rem; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3.25rem); margin-bottom: .65rem; text-wrap: balance; }
.wide-break { display: none; }
@media (min-width: 900px) { .wide-break { display: inline; } }
.hero .lede { font-size: 1.15rem; color: var(--ink-2); max-width: 48ch; margin-bottom: 1.75rem; line-height: 1.65; }
.hero .lede strong { color: var(--ink); }

.tagline {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  border-radius: var(--radius-full);
  padding: .3rem .8rem; margin-bottom: 1.4rem; font-weight: 650;
}

.cta-row { display: flex; flex-wrap: wrap; gap: .85rem; align-items: center; }
.btn {
  font-family: var(--font-display);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 40px; padding: 0 1.25rem; font-size: .92rem; font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.14s ease;
}
.btn:hover {
  background: var(--surface-2); text-decoration: none;
  border-color: var(--ink-3); transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent) !important;
}
.btn-primary:hover {
  background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent);
}

.install {
  display: flex; align-items: center; gap: .75rem;
  font-family: var(--mono); font-size: .85rem;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .65rem .95rem; margin-top: 1.75rem; max-width: min(28rem, 100%);
  box-shadow: var(--shadow-sm);
}
.install code {
  background: none; border: 0; padding: 0;
  white-space: nowrap; overflow-x: auto; min-width: 0;
}
.install .term-prompt, .install .copy { flex: none; }
.install .copy { margin-left: auto; }

/* the terminal card in the hero */
.term {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 0; max-width: 100%;
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: .55rem; overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  padding: .65rem .95rem; font-family: var(--mono); font-size: .74rem; color: var(--ink-3);
}
.term-dot {
  width: .65rem; height: .65rem; border-radius: 50%;
  background: var(--line-strong); display: inline-block;
}
.term-bar .term-dot:nth-child(1) { background: #ef4444; opacity: 0.75; }
.term-bar .term-dot:nth-child(2) { background: #f59e0b; opacity: 0.75; }
.term-bar .term-dot:nth-child(3) { background: #10b981; opacity: 0.75; }

.term-body {
  padding: 1.1rem 1.25rem; font-family: var(--mono); font-size: .78rem; line-height: 1.75;
  overflow-x: auto;
}
.term-body table { border-collapse: collapse; width: 100%; white-space: nowrap; }
.term-body td { padding: .25rem .75rem .25rem 0; }
.term-body .hdr td {
  color: var(--ink-3); text-transform: uppercase; font-size: .68rem; letter-spacing: .07em;
  border-bottom: 1px solid var(--line); padding-bottom: .45rem; font-weight: 700;
}
.term-body .win td { color: var(--ink); font-weight: 700; }
.term-body .out td { color: var(--ink-3); }
.term-prompt { color: var(--ink-3); }
.term-body .tag-ok, td.tag-ok { color: var(--good); font-weight: 700; }
.term-body .tag-dq, td.tag-dq { color: var(--bad); font-weight: 700; }
.term-note {
  border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .75rem;
  color: var(--ink-2); white-space: normal; line-height: 1.6;
}

/* generic sections */
.section { padding: 4rem 0; border-bottom: 1px solid var(--line); }
.section-head { max-width: 62ch; margin-bottom: 2.5rem; }
.section-head p { color: var(--ink-2); margin-bottom: 0; font-size: 1.05rem; }
.kicker {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent); margin-bottom: .6rem; font-weight: 700;
}

.cards { display: grid; gap: 1.35rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.card h3 { margin-bottom: .45rem; font-size: 1.15rem; }
.card p { color: var(--ink-2); margin-bottom: 0; font-size: .94rem; line-height: 1.6; }
.card .num {
  font-family: var(--mono); font-size: .72rem; color: var(--accent);
  letter-spacing: .1em; margin-bottom: .75rem; font-weight: 700;
}
a.card { color: inherit; display: block; }
a.card:hover {
  border-color: var(--accent); text-decoration: none;
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
a.card .more {
  display: inline-block; margin-top: 1rem; color: var(--accent-blue);
  font-size: .9rem; font-weight: 600;
  transition: transform 0.15s ease;
}
a.card:hover .more { transform: translateX(3px); }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; }
.panel {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 1.6rem;
  box-shadow: var(--shadow-sm);
}
.panel > :last-child { margin-bottom: 0; }
.panel h3 { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.panel .pill { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }

.pill {
  display: inline-block; padding: .18rem .55rem; border: 1px solid var(--line);
  border-radius: var(--radius-full);
  color: var(--ink-2); font-size: .72rem; font-family: var(--mono); font-weight: 600;
}
.pill.accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.pill.good { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.pill.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }

.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li { display: flex; gap: .75rem; padding: .85rem 0; border-bottom: 1px solid var(--line); margin: 0; }
.feature-list li:last-child { border-bottom: 0; }
.feature-list .mark { color: var(--accent); font-family: var(--mono); flex: none; font-weight: 700; }
.feature-list b { display: block; font-weight: 650; margin-bottom: .2rem; }
.feature-list span { color: var(--ink-2); font-size: .94rem; line-height: 1.6; }

.footer { padding: 3rem 0 4rem; color: var(--ink-3); font-size: .88rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem 1.75rem; align-items: center; }
.footer a { color: var(--ink-2); }
.footer a:hover { color: var(--accent-blue); }
.footer .spacer { margin-left: auto; }

/* copy-to-clipboard on code blocks */
.code-wrap { position: relative; }
.copy {
  font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: .25rem .55rem; cursor: pointer;
  transition: all 0.15s ease;
}
.copy:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }
.copy.done { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.code-wrap > .copy { position: absolute; top: .65rem; right: .65rem; opacity: 0; }
.code-wrap:hover > .copy, .code-wrap > .copy:focus { opacity: 1; }

/* ------------------------------------------------- pygments (both themes) */

.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: var(--ink-3); font-style: italic; }
.highlight .k, .highlight .kn, .highlight .kd, .highlight .kc, .highlight .kr, .highlight .kt { color: #8250df; font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se { color: #0a7d55; }
.highlight .n, .highlight .nx { color: var(--ink); }
.highlight .nf, .highlight .nd { color: #6639ba; }
.highlight .nc, .highlight .nn { color: #953800; }
.highlight .nt { color: #0550ae; }
.highlight .na { color: #0550ae; }
.highlight .m, .highlight .mi, .highlight .mf { color: #0550ae; }
.highlight .o, .highlight .ow, .highlight .p { color: var(--ink-2); }
.highlight .err { color: var(--bad); }
.highlight .gh, .highlight .gu { color: #0550ae; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .highlight .k,
  :root:not([data-theme="light"]) .highlight .kn,
  :root:not([data-theme="light"]) .highlight .kd,
  :root:not([data-theme="light"]) .highlight .kc,
  :root:not([data-theme="light"]) .highlight .kr,
  :root:not([data-theme="light"]) .highlight .kt { color: #d2a8ff; }
  :root:not([data-theme="light"]) .highlight .s,
  :root:not([data-theme="light"]) .highlight .s1,
  :root:not([data-theme="light"]) .highlight .s2,
  :root:not([data-theme="light"]) .highlight .sb,
  :root:not([data-theme="light"]) .highlight .sd,
  :root:not([data-theme="light"]) .highlight .se { color: #7ee2b8; }
  :root:not([data-theme="light"]) .highlight .nf,
  :root:not([data-theme="light"]) .highlight .nd { color: #d2a8ff; }
  :root:not([data-theme="light"]) .highlight .nc,
  :root:not([data-theme="light"]) .highlight .nn { color: #ffa657; }
  :root:not([data-theme="light"]) .highlight .nt,
  :root:not([data-theme="light"]) .highlight .na,
  :root:not([data-theme="light"]) .highlight .m,
  :root:not([data-theme="light"]) .highlight .mi,
  :root:not([data-theme="light"]) .highlight .mf,
  :root:not([data-theme="light"]) .highlight .gh,
  :root:not([data-theme="light"]) .highlight .gu { color: #79c0ff; }
}
:root[data-theme="dark"] .highlight .k,
:root[data-theme="dark"] .highlight .kn,
:root[data-theme="dark"] .highlight .kd,
:root[data-theme="dark"] .highlight .kc,
:root[data-theme="dark"] .highlight .kr,
:root[data-theme="dark"] .highlight .kt { color: #d2a8ff; }
:root[data-theme="dark"] .highlight .s,
:root[data-theme="dark"] .highlight .s1,
:root[data-theme="dark"] .highlight .s2,
:root[data-theme="dark"] .highlight .sb,
:root[data-theme="dark"] .highlight .sd,
:root[data-theme="dark"] .highlight .se { color: #7ee2b8; }
:root[data-theme="dark"] .highlight .nf,
:root[data-theme="dark"] .highlight .nd { color: #d2a8ff; }
:root[data-theme="dark"] .highlight .nc,
:root[data-theme="dark"] .highlight .nn { color: #ffa657; }
:root[data-theme="dark"] .highlight .nt,
:root[data-theme="dark"] .highlight .na,
:root[data-theme="dark"] .highlight .m,
:root[data-theme="dark"] .highlight .mi,
:root[data-theme="dark"] .highlight .mf,
:root[data-theme="dark"] .highlight .gh,
:root[data-theme="dark"] .highlight .gu { color: #79c0ff; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .shell { grid-template-columns: 14.5rem minmax(0, 1fr); gap: 2rem; }
  .toc-col { display: none; }
}

@media (max-width: 820px) {
  .hero-grid, .split-2 { grid-template-columns: 1fr; gap: 2.25rem; }
  .hero { padding: 3.5rem 0 2.75rem; }

  .nav-toggle { display: inline-grid; }
  .top-links { display: none; }

  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem; padding: 1.75rem 1.25rem 4rem;
  }

  /* Off-canvas mobile navigation drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 84vw);
    height: 100vh;
    max-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    padding: 4.5rem 1.25rem 2rem;
    overflow-y: auto;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only-drawer {
    display: block;
  }

  /* Backdrop overlay */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .pager { max-width: 100%; }
  .pager-row { flex-direction: column; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 1.15rem; }
  .topbar-inner { padding: .75rem 1.15rem; }
  .shell { padding: 1.5rem 1.15rem 3.5rem; }
  .cards { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .term-body { font-size: .74rem; padding: .75rem; }
}

@media print {
  .topbar, .sidebar, .toc-col, .doc-foot, .copy, .nav-backdrop { display: none; }
  .shell { display: block; max-width: none; }
  body { background: #fff; color: #000; }
}
