/*
 * GenAIRR — Theme Layer (Phase 1.5)
 *
 * Visual parity layer on top of MkDocs Material. Ports the
 * "bench-science palette v2" design language from the existing
 * hand-rolled site at website/styles.css.
 *
 * Sources:
 *   - website/styles.css — 3132-line canonical design system
 *     extracted by the Phase 1.5 inventory workflow.
 *   - docs/docs_mkdocs_migration_plan.md §5.2 — Phase 1.5
 *     contract.
 *
 * Goals (per docs_mkdocs_migration_plan.md §5.2.2):
 *   - Preserve IBM Plex triad (Sans / Mono / Serif).
 *   - Three-color semantic system: GREEN accent, COBALT info,
 *     PLUM archive — each with -ink (deep) + -soft (tint).
 *   - Paper-white background (#fafaf7), near-black ink (#0e0e10).
 *   - Hairline 1px borders as the primary structural device.
 *   - Square buttons + chips (border-radius 0 or 4px max).
 *   - Mono labels for eyebrows/tags/captions (the visual signature).
 *   - Editorial serif for hero headlines + scholarly callouts.
 *   - NOT generic MkDocs Material.
 *
 * Strict-build discipline: this file is loaded via mkdocs.yml's
 * `extra_css` block. No external CSS imports — fonts come from
 * Material's own font-loading via theme.font.
 */


/* ──────────────────────────────────────────────────────────────────
 * 1. DESIGN TOKENS — bench-science palette v2
 * ────────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --bg:           #fafaf7;
  --bg-soft:      #f1f1ec;
  --bg-card:      #ffffff;

  /* Ink */
  --ink:          #0e0e10;
  --ink-soft:     #3a3b40;
  --ink-muted:    #6f7079;

  /* Three-color semantic system */
  /* GREEN: V-segment, ground truth, primary CTA */
  --accent:       #1f8a4c;
  --accent-ink:   #145e34;
  --accent-soft:  #e0eee5;

  /* COBALT: links, interactive, D-segment */
  --info:         #1d4ed8;
  --info-ink:     #1535a3;
  --info-soft:    #e2e8fb;

  /* PLUM: learn track, J-segment, scholarly callouts */
  --archive:      #6e3a8e;
  --archive-ink:  #4e2664;
  --archive-soft: #efe6f5;

  /* Data hues (visualizers) */
  --data-cyan:    #0d7a8a;
  --data-slate:   #535560;
  --data-rust:    #9a3a3a;

  /* Structure */
  --rule:         #e4e4dd;
  --rule-strong:  #c8c8c0;
  --radius-sm:    3px;
  --radius:       6px;
  --radius-lg:    10px;

  /* Shadow language — minimal, editorial */
  --shadow-sm: 0 1px 0 rgba(14, 14, 16, 0.04);
  --shadow:    0 1px 0 rgba(14, 14, 16, 0.04),
               0 6px 18px -10px rgba(14, 14, 16, 0.12);
  --shadow-lg: 0 18px 50px -22px rgba(14, 14, 16, 0.22);

  /* Code window (dark by composition, not by theme switch) */
  --code-bg:      #0e0e10;
  --code-fg:      #d6d6d2;
  --code-head:    #16161a;
  --code-border:  #1c1c1f;

  /* Material variable overrides — make Material itself use our palette. */
  --md-primary-fg-color:        var(--ink);
  --md-primary-fg-color--light: var(--ink-soft);
  --md-primary-fg-color--dark:  var(--ink);
  --md-primary-bg-color:        var(--bg);
  --md-accent-fg-color:         var(--accent);
  --md-accent-bg-color:         var(--accent-soft);
  --md-default-bg-color:        var(--bg);
  --md-default-fg-color:        var(--ink);
  --md-default-fg-color--light: var(--ink-soft);
  --md-default-fg-color--lighter: var(--ink-muted);
  --md-typeset-color:           var(--ink);
  --md-typeset-a-color:         var(--info);
  --md-code-bg-color:           var(--code-bg);
  --md-code-fg-color:           var(--code-fg);
}


/* ──────────────────────────────────────────────────────────────────
 * 2. GLOBAL TYPOGRAPHY — IBM Plex triad
 * ────────────────────────────────────────────────────────────────── */

body,
.md-typeset {
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

code, kbd, pre, samp,
.md-typeset code,
.md-typeset pre {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Editorial-serif accents (hero, callouts, lesson intuition) */
.serif,
.md-typeset .serif {
  font-family: "IBM Plex Serif", Georgia, serif;
}

/* Headings: weight 400-500 (never bold), negative letter-spacing */
.md-typeset h1 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: clamp(2.0rem, 4.0vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.04;
  color: var(--ink);
  margin: 0 0 0.6em;
}

.md-typeset h2 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--ink);
  margin: 2.4em 0 0.7em;
}

.md-typeset h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--ink);
  margin: 2em 0 0.5em;
}

.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}

/* Body paragraphs — comfortable reading width */
.md-typeset p {
  color: var(--ink);
  max-width: 65ch;
}


/* ──────────────────────────────────────────────────────────────────
 * 3. CHROME — header, nav, sidebar
 * ────────────────────────────────────────────────────────────────── */

/* Top header: hairline border, paper-white background, no gradient. */
.md-header {
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  box-shadow: none;
}

.md-header[data-md-state="shadow"] {
  box-shadow: none;
}

.md-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4px 28px;
}

/* Brand mark + title in IBM Plex Mono, like the existing site */
.md-header__title,
.md-header__topic {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* Search input */
.md-search__input {
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: var(--radius);
}

.md-search__input::placeholder {
  color: var(--ink-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

/* Tabs (top-level nav) — mono labels, square underline accent.
 * The tab bar can hold many entries; on narrow viewports it
 * needs to scroll horizontally. We make the affordance visible
 * via a right-edge fade gradient so users see "there's more". */
.md-tabs {
  background: var(--bg);
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}

/* Right-edge gradient hint that the bar is scrollable. Only shows
 * when there's enough content to overflow the viewport. */
.md-tabs::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 36px;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(250, 250, 247, 0) 0%,
    var(--bg) 92%
  );
  opacity: 0.95;
}

.md-tabs__list {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

/* On wide screens (≥ 1280px) the full tab set typically fits, so
 * suppress the fade hint and let the bar sit flush. */
@media (min-width: 1280px) {
  .md-tabs::after {
    display: none;
  }
}

/* Mobile-friendly scroll-snap so tabs align as the user swipes. */
.md-tabs__item {
  scroll-snap-align: start;
}

.md-tabs__link {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 1;
  color: var(--ink-soft);
  margin: 0;
  padding: 0 18px;
  height: 44px;
  line-height: 44px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.md-tabs__link:hover {
  color: var(--ink);
}

.md-tabs__link--active {
  color: var(--ink);
  border-bottom: 2px solid var(--accent-ink);
}

/* Sidebar (nav drawer) */
.md-sidebar {
  background: var(--bg);
}

.md-nav__title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--bg);
}

.md-nav__link {
  font-size: 14px;
  color: var(--ink-soft);
  border-radius: 0;
  margin: 0;
  padding: 6px 12px;
}

.md-nav__link:hover {
  color: var(--ink);
  background: var(--bg-soft);
}

.md-nav__link--active,
.md-nav__item--active > .md-nav__link {
  color: var(--accent-ink);
  font-weight: 500;
}


/* ──────────────────────────────────────────────────────────────────
 * 4. CONTENT BLOCKS — admonitions, code, tables
 * ────────────────────────────────────────────────────────────────── */

/* Admonitions — hairline border + tinted background, NOT Material's
   boxy default. The accent stripe on the LEFT is the visual signature. */
.md-typeset .admonition,
.md-typeset details {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--info-ink);
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  box-shadow: none;
  padding: 14px 18px 14px 18px;
  margin: 1.6em 0;
}

.md-typeset .admonition > .admonition-title,
.md-typeset details > summary {
  background: transparent;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--info-ink);
  padding: 0 0 6px 0;
  margin: 0 0 6px 0;
  border-bottom: 1px solid var(--rule);
}

.md-typeset .admonition > .admonition-title::before,
.md-typeset details > summary::before {
  display: none;  /* drop Material's icon — eyebrow is the marker */
}

/* Note / Info — cobalt */
.md-typeset .admonition.note,
.md-typeset .admonition.info,
.md-typeset .admonition.todo {
  border-left-color: var(--info-ink);
  background: var(--info-soft);
}

.md-typeset .admonition.note > .admonition-title,
.md-typeset .admonition.info > .admonition-title,
.md-typeset .admonition.todo > .admonition-title {
  color: var(--info-ink);
}

/* Tip / Success — green */
.md-typeset .admonition.tip,
.md-typeset .admonition.success,
.md-typeset .admonition.hint,
.md-typeset .admonition.check {
  border-left-color: var(--accent-ink);
  background: var(--accent-soft);
}

.md-typeset .admonition.tip > .admonition-title,
.md-typeset .admonition.success > .admonition-title,
.md-typeset .admonition.hint > .admonition-title,
.md-typeset .admonition.check > .admonition-title {
  color: var(--accent-ink);
}

/* Warning / Danger — rust */
.md-typeset .admonition.warning,
.md-typeset .admonition.danger,
.md-typeset .admonition.error,
.md-typeset .admonition.bug,
.md-typeset .admonition.fail,
.md-typeset .admonition.caution {
  border-left-color: var(--data-rust);
  background: #f7e3e3;
}

.md-typeset .admonition.warning > .admonition-title,
.md-typeset .admonition.danger > .admonition-title,
.md-typeset .admonition.error > .admonition-title,
.md-typeset .admonition.bug > .admonition-title {
  color: var(--data-rust);
}

/* Example / Quote — plum (scholarly callout) */
.md-typeset .admonition.example,
.md-typeset .admonition.quote,
.md-typeset .admonition.cite,
.md-typeset .admonition.abstract,
.md-typeset .admonition.question {
  border-left-color: var(--archive-ink);
  background: var(--archive-soft);
}

.md-typeset .admonition.example > .admonition-title,
.md-typeset .admonition.quote > .admonition-title {
  color: var(--archive-ink);
}

/* Code blocks — dark mock-terminal */
.md-typeset pre > code {
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.75;
  border-radius: var(--radius);
  border: 1px solid var(--code-border);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

/* Inline code — light surface with hairline */
.md-typeset code {
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13.5px;
  padding: 1px 5px;
}

.md-typeset pre code {
  /* When inside a pre, suppress the inline-code border to avoid double-borders */
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
}

/* Tables — hairline rules, mono headers */
.md-typeset table:not([class]) {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-size: 14px;
}

.md-typeset table:not([class]) th {
  background: var(--bg-soft);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule-strong);
  padding: 10px 14px;
}

.md-typeset table:not([class]) td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
}

.md-typeset table:not([class]) tr:hover {
  background: var(--bg-soft);
}

/* Tabs (pymdownx.tabbed) — square mono labels */
.md-typeset .tabbed-set > input:checked + label {
  color: var(--accent-ink);
  border-bottom-color: var(--accent-ink);
}

.md-typeset .tabbed-set > label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-radius: 0;
}

/* Blockquotes — hairline left border in plum (scholarly) */
.md-typeset blockquote {
  border-left: 3px solid var(--archive-ink);
  background: var(--archive-soft);
  color: var(--ink);
  padding: 12px 18px;
  margin: 1.6em 0;
  border-radius: 0;
}


/* ──────────────────────────────────────────────────────────────────
 * 5. UTILITY CLASSES — for use in markdown via attr_list / md_in_html
 * ────────────────────────────────────────────────────────────────── */

/* Mono uppercase kicker label used above headings — the design's
   signature pattern. Use in markdown via:
   <p class="eyebrow">// Getting Started</p> */
.md-typeset .eyebrow {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--info-ink);
  margin: 0 0 12px 0;
}

.md-typeset .eyebrow.accent { color: var(--accent-ink); }
.md-typeset .eyebrow.archive { color: var(--archive-ink); }

/* Lead paragraph — slightly larger, serif italic */
.md-typeset .lead {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1.18rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 1.6em 0;
}

/* Square button utility */
.md-typeset .btn {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 11px 18px;
  border-radius: 4px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}

.md-typeset .btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.md-typeset .btn-primary:hover {
  background: var(--accent-ink);
  color: var(--bg);
}

.md-typeset .btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.md-typeset .btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}

/* Card grids — for hubs and capability strips */
.md-typeset .feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 2.4em 0;
}

.md-typeset .feat-grid > .feat {
  padding: 32px 28px;
  border-left: 1px solid var(--rule);
}

.md-typeset .feat-grid > .feat:first-child {
  border-left: none;
}

.md-typeset .feat .num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--info-ink);
  margin: 0 0 12px 0;
}

.md-typeset .feat h3 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0 0 8px 0;
}

.md-typeset .feat p {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}

@media (max-width: 880px) {
  .md-typeset .feat-grid {
    grid-template-columns: 1fr;
  }
  .md-typeset .feat-grid > .feat {
    border-left: none;
    border-top: 1px solid var(--rule);
  }
  .md-typeset .feat-grid > .feat:first-child {
    border-top: none;
  }
}

/* 6-card capabilities grid (3×2) */
.md-typeset .cap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 2.4em 0;
}

.md-typeset .cap-card {
  padding: 20px 22px 22px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.md-typeset .cap-card .cap-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 4px 0;
}

.md-typeset .cap-card.cap-recombine .cap-num { color: var(--accent-ink); }
.md-typeset .cap-card.cap-mutate    .cap-num { color: var(--data-cyan); }
.md-typeset .cap-card.cap-clone     .cap-num { color: var(--archive-ink); }
.md-typeset .cap-card.cap-corrupt   .cap-num { color: var(--data-rust); }
.md-typeset .cap-card.cap-constrain .cap-num { color: var(--ink); }
.md-typeset .cap-card.cap-replay    .cap-num { color: var(--info-ink); }

.md-typeset .cap-card h3 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.0rem;
  font-weight: 600;
  margin: 0 0 6px 0;
}

.md-typeset .cap-card p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
  max-width: none;
}

@media (max-width: 1024px) {
  .md-typeset .cap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .md-typeset .cap-grid {
    grid-template-columns: 1fr;
  }
}

/* CTA card row — for the "primary CTAs" block on the homepage */
.md-typeset .cta-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  margin: 2.4em 0;
}

.md-typeset .cta-row > .cta {
  display: block;
  padding: 28px 24px;
  border-left: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}

.md-typeset .cta-row > .cta:first-child {
  border-left: none;
}

.md-typeset .cta-row > .cta:hover {
  background: var(--bg-soft);
}

.md-typeset .cta-row .cta-eyebrow {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--info-ink);
  margin: 0 0 8px 0;
}

.md-typeset .cta-row .cta-title {
  display: block;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1.18rem;
  font-weight: 500;
  margin: 0 0 4px 0;
  color: var(--ink);
}

.md-typeset .cta-row .cta-sub {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0;
}

.md-typeset .cta-row .cta-arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform 0.15s;
}

.md-typeset .cta-row > .cta:hover .cta-arrow {
  transform: translateX(3px);
}

@media (max-width: 960px) {
  .md-typeset .cta-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .md-typeset .cta-row > .cta:nth-child(3) {
    border-left: none;
  }
}

@media (max-width: 640px) {
  .md-typeset .cta-row {
    grid-template-columns: 1fr;
  }
  .md-typeset .cta-row > .cta {
    border-left: none;
    border-top: 1px solid var(--rule);
  }
  .md-typeset .cta-row > .cta:first-child {
    border-top: none;
  }
}

/* Engine credibility strip — single-row stat band */
.md-typeset .engine-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px 24px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin: 2.4em 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.md-typeset .engine-strip .engine-tag {
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.md-typeset .engine-strip .sep {
  color: var(--rule-strong);
  user-select: none;
}

/* Install band */
.md-typeset .install-band {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 24px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--code-border);
  font-family: "IBM Plex Mono", monospace;
  margin: 2.4em 0;
}

.md-typeset .install-band code {
  background: transparent;
  border: none;
  color: var(--code-fg);
  font-size: 14px;
}

.md-typeset .install-band .mute {
  display: block;
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 12px;
}


/* ──────────────────────────────────────────────────────────────────
 * 6. FOOTER + MISC
 * ────────────────────────────────────────────────────────────────── */

.md-footer {
  background: var(--bg-soft);
  color: var(--ink-soft);
  border-top: 1px solid var(--rule-strong);
}

.md-footer-meta {
  background: transparent;
  color: var(--ink-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.md-footer-meta__inner {
  max-width: 1200px;
}

.md-footer__direction {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* Scrollbar — slim hairline */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--rule-strong);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-muted);
}

/* Selection */
::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

/* Migration-status banner: when a page carries the "Migration placeholder"
   admonition, give it a deliberate visual to signal "this isn't done yet"
   so users don't mistake it for finished content. */
.md-typeset .admonition.info:has(> .admonition-title:first-child) {
  /* Default styling is fine — the eyebrow label tells the story. */
}

/* ──────────────────────────────────────────────────────────────
 * Demo-page visuals. These replace Mermaid on the live-demo page
 * with responsive HTML diagrams that match the site theme.
 * ────────────────────────────────────────────────────────────── */

.md-typeset .demo-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.md-typeset .demo-hero-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.md-typeset .demo-hero h1 {
  margin-bottom: 0.48em;
}

.md-typeset .demo-hero .lead {
  margin-bottom: 18px;
}

.md-typeset .demo-qr {
  flex: 0 0 150px;
  width: 150px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--rule-strong);
  background: #ffffff;
  color: var(--ink);
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
  text-decoration: none;
}

.md-typeset .demo-qr:hover,
.md-typeset .demo-qr:focus-visible {
  border-color: var(--info-ink);
  color: var(--info-ink);
}

.md-typeset .demo-qr:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.28);
  outline-offset: 2px;
}

.md-typeset .demo-qr img {
  display: block;
  width: 118px;
  height: 118px;
  image-rendering: pixelated;
}

.md-typeset .demo-qr span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

.md-typeset .demo-actions {
  display: flex;
  align-items: center;
  margin: 0;
}

.md-typeset .demo-present-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.md-typeset .demo-present-button:hover,
.md-typeset .demo-present-button:focus-visible {
  border-color: var(--info-ink);
  color: var(--info-ink);
}

.md-typeset .demo-present-button:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.28);
  outline-offset: 2px;
}

.md-typeset .demo-present-button-icon {
  width: 15px;
  height: 15px;
  position: relative;
  display: inline-block;
  color: currentColor;
}

.md-typeset .demo-present-button-icon::before,
.md-typeset .demo-present-button-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid currentColor;
}

.md-typeset .demo-present-button-icon::before {
  clip-path: polygon(0 0, 42% 0, 42% 18%, 18% 18%, 18% 42%, 0 42%);
}

.md-typeset .demo-present-button-icon::after {
  clip-path: polygon(58% 0, 100% 0, 100% 42%, 82% 42%, 82% 18%, 58% 18%, 58% 82%, 82% 82%, 82% 58%, 100% 58%, 100% 100%, 58% 100%, 58% 82%, 42% 82%, 42% 100%, 0 100%, 0 58%, 18% 58%, 18% 82%, 42% 82%, 42% 18%, 18% 18%, 18% 42%, 0 42%, 0 0);
}

body.demo-presentation-mode .md-header,
body.demo-presentation-mode .md-tabs,
body.demo-presentation-mode .md-sidebar,
body.demo-presentation-mode .md-footer,
body.demo-presentation-mode .md-top {
  display: none !important;
}

body.demo-presentation-mode .md-container {
  padding-top: 0;
}

body.demo-presentation-mode .md-main__inner {
  display: block;
  max-width: min(1500px, calc(100vw - 64px));
  margin: 0 auto;
  padding: 34px 0 76px;
}

body.demo-presentation-mode .md-content {
  margin: 0;
}

body.demo-presentation-mode .md-content__inner {
  margin: 0;
  padding: 0;
}

body.demo-presentation-mode .md-content__inner::before {
  display: none;
}

body.demo-presentation-mode .md-typeset h1 {
  max-width: calc(100% - 230px);
}

body.demo-presentation-mode .md-typeset .lead {
  max-width: 72ch;
}

body.demo-presentation-mode .md-typeset .demo-qr {
  margin-top: 52px;
}

body.demo-presentation-mode .md-typeset .demo-actions {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  margin: 0;
}

body.demo-presentation-mode .md-typeset .demo-present-button {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

body.demo-presentation-mode .md-typeset .demo-present-button:hover,
body.demo-presentation-mode .md-typeset .demo-present-button:focus-visible {
  border-color: var(--info-ink);
  background: var(--info-ink);
  color: #ffffff;
}

.md-typeset .demo-run-card {
  margin: 22px 0 30px;
  padding: 18px;
  border: 1px solid var(--rule-strong);
  border-left: 4px solid var(--info-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(250, 250, 247, 0.96)),
    var(--bg-soft);
  box-shadow: var(--shadow-sm);
}

.md-typeset .demo-run-card .highlight {
  margin: 0 0 18px;
}

.md-typeset .demo-run-card .highlight:last-child {
  margin-bottom: 0;
}

.md-typeset .demo-run-card .highlight pre {
  margin: 0;
  padding: 14px 18px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: none;
}

.md-typeset .demo-run-card .highlight pre code {
  background: transparent;
  color: inherit;
}

.md-typeset .demo-cell-label {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  padding: 4px 8px;
  border: 1px solid var(--code-border);
  background: var(--code-head);
  color: var(--code-fg);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.md-typeset .demo-cell-label--output {
  border-color: rgba(31, 138, 76, 0.38);
  background: #ecfdf3;
  color: var(--accent-ink);
}

.md-typeset .demo-cell-label--output + .highlight pre {
  border-color: rgba(31, 138, 76, 0.34);
  background: #f0fbf4;
}

.md-typeset .demo-cell-label--output + .highlight pre code {
  color: var(--ink);
}

.md-typeset .demo-cell-label--output + .demo-bars {
  margin-top: 0;
}

.md-typeset .demo-run-card .demo-bars {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.md-typeset .demo-diagram {
  margin: 30px 0 34px;
  padding: 24px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(250, 250, 247, 0.94)),
    var(--bg-soft);
}

.md-typeset .demo-diagram-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.md-typeset .demo-diagram-title span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.md-typeset .demo-diagram-title small {
  font-size: 13px;
  color: var(--ink-muted);
  text-align: right;
}

.md-typeset .demo-replay-rail {
  display: grid;
  align-items: center;
  gap: 0;
}

.md-typeset .demo-arch-rail {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.9fr)
    32px
    minmax(170px, 1fr)
    32px
    minmax(190px, 1.1fr)
    32px
    minmax(210px, 1.15fr);
  align-items: stretch;
}

.md-typeset .demo-replay-rail {
  grid-template-columns:
    minmax(112px, 0.75fr)
    38px
    minmax(135px, 0.85fr)
    38px
    minmax(190px, 1fr)
    54px
    minmax(250px, 1.25fr);
}

.md-typeset .demo-node {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--rule-strong);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.md-typeset .demo-node--compact {
  min-height: 86px;
}

.md-typeset .demo-node-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
}

.md-typeset .demo-node strong {
  display: block;
  font-size: 16px;
  line-height: 1.32;
  color: var(--ink);
}

.md-typeset .demo-node small {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-muted);
}

.md-typeset .demo-node code {
  white-space: nowrap;
}

.md-typeset .demo-architecture-flow .demo-node code,
.md-typeset .demo-clone-tree .demo-node code {
  white-space: normal;
}

.md-typeset .demo-node--truth {
  border-color: #1f8a4c;
  background: #dcfce7;
}

.md-typeset .demo-node--record,
.md-typeset .demo-node--success {
  border-color: #1d4ed8;
  background: #dbeafe;
}

.md-typeset .demo-node--failure {
  border-color: #dc2626;
  background: #fee2e2;
}

.md-typeset .demo-node--neutral {
  border-color: var(--rule-strong);
  background: #ffffff;
}

.md-typeset .demo-flow-arrow {
  height: 2px;
  background: var(--rule-strong);
  position: relative;
  margin: 0 10px;
}

.md-typeset .demo-flow-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--rule-strong);
  transform: translateY(-50%);
}

.md-typeset .demo-record-lanes {
  display: grid;
  gap: 8px;
}

.md-typeset .demo-record-lanes > div {
  padding: 10px;
  border: 1px solid rgba(29, 78, 216, 0.24);
  background: rgba(255, 255, 255, 0.62);
}

.md-typeset .demo-record-lanes b {
  display: block;
  margin-bottom: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink);
}

.md-typeset .demo-airr-card {
  display: grid;
  gap: 16px;
}

.md-typeset .demo-airr-sequence {
  padding: 16px 18px;
  border: 1px solid #1d4ed8;
  background: #dbeafe;
}

.md-typeset .demo-airr-sequence code {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  border-color: rgba(29, 78, 216, 0.22);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.md-typeset .demo-airr-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.md-typeset .demo-airr-columns section {
  display: grid;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--rule-strong);
  background: #ffffff;
}

.md-typeset .demo-airr-columns section:nth-child(2) {
  border-color: #1f8a4c;
  background: #dcfce7;
}

.md-typeset .demo-airr-column-title {
  display: block;
  margin-bottom: 2px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

.md-typeset .demo-airr-columns div {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--rule);
  background: rgba(250, 250, 247, 0.82);
}

.md-typeset .demo-airr-columns b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-muted);
}

.md-typeset .demo-airr-columns code {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 600;
}

.md-typeset .demo-arch-badges,
.md-typeset .demo-arch-streams {
  display: grid;
  gap: 7px;
}

.md-typeset .demo-arch-badges span,
.md-typeset .demo-arch-streams span {
  display: block;
  padding: 7px 8px;
  border: 1px solid var(--rule);
  background: rgba(250, 250, 247, 0.88);
  font-size: 12px;
  line-height: 1.28;
}

.md-typeset .demo-arch-badges span {
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
}

.md-typeset .demo-arch-streams b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink);
}

.md-typeset .demo-arch-engine,
.md-typeset .demo-arch-record,
.md-typeset .demo-arch-compile {
  min-height: 188px;
}

.md-typeset .demo-architecture-flow .demo-node {
  justify-content: flex-start;
}

.md-typeset .demo-arch-codechips {
  display: grid;
  gap: 6px;
}

.md-typeset .demo-arch-codechips code {
  display: block;
  width: fit-content;
  max-width: 100%;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.28;
  white-space: nowrap;
}

.md-typeset .demo-architecture-flow .demo-arch-codechips code {
  white-space: nowrap;
}

.md-typeset .demo-splitter {
  height: 132px;
  position: relative;
}

.md-typeset .demo-splitter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  border-top: 2px solid var(--rule-strong);
}

.md-typeset .demo-splitter::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 24px;
  bottom: 24px;
  border-left: 2px solid var(--rule-strong);
}

.md-typeset .demo-splitter-line {
  position: absolute;
  left: 18px;
  right: 0;
  top: 24px;
  height: 2px;
  background: var(--rule-strong);
}

.md-typeset .demo-splitter-line::before,
.md-typeset .demo-splitter-line::after {
  content: "";
  position: absolute;
  right: -1px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--rule-strong);
  transform: translateY(-50%);
}

.md-typeset .demo-splitter-line::before {
  top: 50%;
}

.md-typeset .demo-splitter-line::after {
  top: 84px;
}

.md-typeset .demo-splitter-line {
  box-shadow: 0 84px 0 var(--rule-strong);
}

.md-typeset .demo-replay-results {
  display: grid;
  gap: 14px;
}

.md-typeset .demo-clone-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) 48px minmax(300px, 1.35fr) minmax(150px, 0.72fr);
  gap: 0;
  align-items: center;
}

.md-typeset .demo-clone-parent {
  min-height: 170px;
  padding: 18px;
  border: 1px solid #1f8a4c;
  background: #dcfce7;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.md-typeset .demo-clone-parent strong {
  font-size: 15px;
  line-height: 1.35;
}

.md-typeset .demo-clone-parent small {
  font-size: 12px;
  line-height: 1.38;
  color: var(--ink-muted);
}

.md-typeset .demo-clone-branches {
  position: relative;
  height: 196px;
}

.md-typeset .demo-clone-branches::before {
  content: "";
  position: absolute;
  left: 0;
  right: 13px;
  top: 50%;
  border-top: 2px solid var(--rule-strong);
}

.md-typeset .demo-clone-branches::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 24px;
  bottom: 24px;
  border-left: 2px solid var(--rule-strong);
}

.md-typeset .demo-clone-branches span {
  position: absolute;
  right: 0;
  top: 24px;
  width: 13px;
  height: 2px;
  background: var(--rule-strong);
  box-shadow:
    0 38px 0 var(--rule-strong),
    0 76px 0 var(--rule-strong),
    0 114px 0 var(--rule-strong),
    0 152px 0 var(--rule-strong);
}

.md-typeset .demo-clone-branches span::before,
.md-typeset .demo-clone-branches span::after {
  content: "";
  position: absolute;
  right: -1px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--rule-strong);
  transform: translateY(-50%);
}

.md-typeset .demo-clone-branches span::before {
  top: 0;
}

.md-typeset .demo-clone-branches span::after {
  top: 152px;
}

.md-typeset .demo-clone-descendants {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 10px;
}

.md-typeset .demo-clone-leaf,
.md-typeset .demo-clone-more {
  min-height: 70px;
  padding: 11px 12px;
  border: 1px solid rgba(31, 138, 76, 0.34);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.md-typeset .demo-clone-leaf b,
.md-typeset .demo-clone-more {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink);
}

.md-typeset .demo-clone-leaf span {
  font-size: 18px;
  font-weight: 600;
  color: #1f8a4c;
}

.md-typeset .demo-clone-leaf--warm {
  background: #fef9c3;
  border-color: #d9a441;
}

.md-typeset .demo-clone-leaf--hot {
  background: #ffedd5;
  border-color: #ea580c;
}

.md-typeset .demo-clone-leaf--hotter {
  background: #fee2e2;
  border-color: #dc2626;
}

.md-typeset .demo-clone-more {
  align-items: center;
  text-align: center;
  color: var(--ink-muted);
  background: var(--bg-soft);
}

.md-typeset .demo-clone-stack {
  display: grid;
  gap: 8px;
  margin-left: 18px;
}

.md-typeset .demo-clone-stack div {
  padding: 10px;
  border: 1px solid var(--rule);
  background: rgba(250, 250, 247, 0.82);
}

.md-typeset .demo-clone-stack b,
.md-typeset .demo-clone-stack span {
  display: block;
}

.md-typeset .demo-clone-stack b {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.md-typeset .demo-clone-stack span {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-muted);
}

.md-typeset .demo-clone-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.md-typeset .demo-clone-facts span {
  padding: 12px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  line-height: 1.35;
}

.md-typeset .demo-clone-facts b {
  font-family: "IBM Plex Mono", monospace;
}

/* Demo-page bar comparison (used in §2 to show productive %).
 * Two horizontal bars with label, track, fill, and numeric value.
 * Designed to read at projector distance: large numbers, strong
 * colour contrast, IBM Plex Mono for the percentage. */

.md-typeset .demo-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 28px 0;
  padding: 24px;
  border: 1px solid var(--rule);
  background: var(--bg-soft);
}

.md-typeset .demo-bar-row {
  display: grid;
  grid-template-columns: 220px 1fr 80px;
  gap: 16px;
  align-items: center;
}

.md-typeset .demo-bar-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--ink);
  text-align: right;
}

.md-typeset .demo-bar-track {
  height: 28px;
  background: var(--bg);
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}

.md-typeset .demo-bar-fill {
  height: 100%;
  transition: width 0.5s ease-out;
}

.md-typeset .demo-bar-fill--warn {
  background: #dc2626;
}

.md-typeset .demo-bar-fill--accent {
  background: #1f8a4c;
}

.md-typeset .demo-bar-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}

@media (max-width: 720px) {
  .md-typeset .demo-hero {
    display: block;
  }
  .md-typeset .demo-qr {
    width: 100%;
    margin: 22px 0 0;
    grid-template-columns: 72px 1fr;
    justify-items: start;
    align-items: center;
    text-align: left;
  }
  .md-typeset .demo-qr img {
    width: 72px;
    height: 72px;
  }
  body.demo-presentation-mode .md-typeset .demo-qr {
    margin-top: 22px;
  }
  body.demo-presentation-mode .md-main__inner {
    max-width: calc(100vw - 24px);
    padding: 24px 0 58px;
  }
  body.demo-presentation-mode .md-typeset h1 {
    max-width: calc(100% - 54px);
  }
  body.demo-presentation-mode .md-typeset .demo-actions {
    top: 10px;
    right: 10px;
  }
  body.demo-presentation-mode .md-typeset .demo-present-button {
    width: 38px;
    min-height: 38px;
    justify-content: center;
    padding: 0;
  }
  body.demo-presentation-mode .md-typeset .demo-present-button [data-demo-presentation-label] {
    display: none;
  }
  .md-typeset .demo-run-card {
    padding: 14px;
  }
  .md-typeset .demo-diagram {
    padding: 18px;
  }
  .md-typeset .demo-diagram-title {
    display: block;
  }
  .md-typeset .demo-diagram-title small {
    display: block;
    margin-top: 6px;
    text-align: left;
  }
  .md-typeset .demo-arch-rail,
  .md-typeset .demo-replay-rail {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .md-typeset .demo-flow-arrow {
    width: 2px;
    height: 28px;
    margin: 0;
    justify-self: center;
  }
  .md-typeset .demo-flow-arrow::after {
    right: auto;
    top: auto;
    bottom: -1px;
    left: 50%;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid var(--rule-strong);
    border-bottom: 0;
    transform: translateX(-50%);
  }
  .md-typeset .demo-splitter {
    display: none;
  }
  .md-typeset .demo-arch-engine,
  .md-typeset .demo-arch-record,
  .md-typeset .demo-arch-compile {
    min-height: auto;
  }
  .md-typeset .demo-airr-columns {
    grid-template-columns: 1fr;
  }
  .md-typeset .demo-clone-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .md-typeset .demo-clone-parent {
    min-height: auto;
  }
  .md-typeset .demo-clone-branches {
    display: none;
  }
  .md-typeset .demo-clone-descendants {
    grid-template-columns: 1fr;
  }
  .md-typeset .demo-clone-stack {
    margin-left: 0;
    grid-template-columns: repeat(2, 1fr);
  }
  .md-typeset .demo-clone-facts {
    grid-template-columns: 1fr;
  }
  .md-typeset .demo-bar-row {
    grid-template-columns: 1fr 80px;
  }
  .md-typeset .demo-bar-label {
    grid-column: 1 / -1;
    text-align: left;
  }
}
