html, body { overflow-x: hidden; }
:root {
  --c-bg:           oklch(0.985 0.005 85);
  --c-bg-elev:      oklch(0.965 0.008 85);
  --c-bg-card:      oklch(1    0     0);
  --c-bg-paper:     oklch(0.97  0.013 85);
  --c-fg:           oklch(0.20 0.010 250);
  --c-fg-soft:      oklch(0.34 0.010 250);
  --c-fg-dim:       oklch(0.46 0.010 250);
  --c-fg-faint:     oklch(0.58 0.010 250);
  --c-rule:         oklch(0.88 0.006 250);
  --c-rule-strong:  oklch(0.78 0.008 250);
  --c-accent:       oklch(0.52 0.16 150);
  --c-accent-soft:  oklch(0.92 0.05 150);
  --c-flag:         oklch(0.62 0.16 65);
  --c-short:        oklch(0.55 0.20 25);
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; padding: 0; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-fg);
  font-feature-settings: "tnum", "ss01";
  -webkit-font-smoothing: antialiased;
}
.tabular-nums { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in oklab, var(--c-accent) 28%, transparent); color: var(--c-fg); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--c-rule-strong); border-radius: 0; }
::-webkit-scrollbar-track { background: transparent; }

/* Markdown rendering ─────────────────────────────────────────── */
.md-prose { color: var(--c-fg); font-size: 14px; line-height: 1.6; max-width: 820px; }
.md-prose h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 14px; }
.md-prose h2 { font-size: 18px; font-weight: 700; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--c-rule); }
.md-prose h3 { font-size: 15px; font-weight: 700; margin: 18px 0 6px; }
.md-prose h4 { font-size: 14px; font-weight: 700; margin: 14px 0 4px; }
.md-prose p { margin: 8px 0; }
.md-prose ul, .md-prose ol { padding-left: 22px; margin: 6px 0; }
.md-prose li { margin: 2px 0; }
.md-prose blockquote { border-left: 3px solid var(--c-accent); padding: 4px 14px; margin: 10px 0;
                       background: var(--c-bg-paper); color: var(--c-fg-soft); font-style: italic; }
.md-prose blockquote p { margin: 4px 0; }
.md-prose code { background: oklch(0.96 0.005 85); padding: 1px 5px; border-radius: 3px;
                 font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; }
.md-prose pre { background: oklch(0.18 0.012 250); color: oklch(0.96 0.01 250);
                padding: 12px 14px; border-radius: 6px; overflow-x: auto; margin: 10px 0;
                font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.55; }
.md-prose pre code { background: transparent; padding: 0; color: inherit; font-size: 12.5px; }
.md-prose a { color: var(--c-accent); text-decoration: none; }
.md-prose a:hover { text-decoration: underline; }
.md-prose hr { border: 0; border-top: 1px solid var(--c-rule); margin: 18px 0; }

.md-prose table { border-collapse: collapse; margin: 12px 0; font-size: 12.5px; line-height: 1.4; }
.md-prose .table-wrap { overflow-x: auto; max-width: 100%; }
.md-prose th, .md-prose td { border: 1px solid var(--c-rule); padding: 6px 10px;
                              text-align: left; vertical-align: top; }
.md-prose th { background: var(--c-bg-elev); font-weight: 600; }
.md-prose tr:hover td { background: oklch(0.98 0.005 85); }

/* Hamburger + scrim — must be position:fixed at all widths so they don't
   pollute the desktop grid. Display-control happens via media query below. */
.menu-btn {
  display: none;
  position: fixed; top: 10px; left: 10px; z-index: 30;
  width: 36px; height: 36px; padding: 0;
  background: var(--c-bg-card); border: 1px solid var(--c-rule-strong);
  border-radius: 6px; cursor: pointer; line-height: 1;
  font-family: inherit; font-size: 18px; color: var(--c-fg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.scrim {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transition: opacity 200ms ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }

/* Mobile: sidebar becomes an off-canvas drawer */
@media (max-width: 768px) {
  .app-grid { grid-template-columns: 1fr !important; }
  .menu-btn { display: block; }
  aside.sidebar {
    position: fixed !important; top: 0; left: 0; height: 100vh !important;
    width: 86vw !important; max-width: 320px;
    z-index: 25; transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 2px 0 18px rgba(0,0,0,0.18);
  }
  aside.sidebar.open { transform: translateX(0); }
  main { padding-top: 8px; }
  .breadcrumb-fix { padding-left: 56px !important; }
  .md-prose { padding: 16px 18px 48px !important; max-width: 100% !important; font-size: 14.5px; }
  .md-prose h1 { font-size: 21px; }
  .md-prose h2 { font-size: 17px; }
  .md-prose .table-wrap { font-size: 12px; }
  /* Hide the TOC on mobile */
  .toc-rail { display: none !important; }
  /* Single-column grids on landing */
  .landing-hero { grid-template-columns: 1fr !important; }
  .landing-row3, .landing-row4 { grid-template-columns: 1fr !important; }
  .landing-archive { grid-template-columns: 1fr !important; }
  .landing-stack { grid-template-rows: auto auto !important; }
  .landing-page { padding: 18px 16px 60px !important; }
  .landing-page h1 { font-size: 24px !important; }
}

/* Print: hide chrome, just the prose. */
@media print {
  aside, .toc-rail, .menu-btn, [data-no-print] { display: none !important; }
  main { display: block !important; }
  .md-prose { max-width: none !important; padding: 0 !important; }
  .md-prose pre { background: #f6f8fa; color: #0d1117; }
  body::before { display: none; }
}
