/* UCIP documentation stylesheet — minimal navy + neutral palette matching
   the product's design language (Plus Jakarta Sans + IBM Plex Mono).

   Used by every .html doc under /docs (and any sub-path). Single file so
   restyling all docs is one edit. */

:root {
  /* YouNet Group ("The Measure Group") palette — product source of truth is
     packages/ui/src/styles.css. Navy #00084f, sky #1188ea, cyan #00aeef,
     indigo #3137aa, Plus Jakarta Sans. Light theme is the primary look:
     bright, airy surfaces with sky-blue accents. */

  /* Surfaces */
  --doc-bg: #f2f5fa;
  --doc-surface: #ffffff;
  --doc-surface-strong: #eef3fb;
  --doc-border: #e3e8f2;
  --doc-border-strong: #cfd6e6;

  /* Text */
  --doc-text: #0a1122;
  --doc-text-muted: #4a5578;
  --doc-text-dim: #6b7599;

  /* Brand — YouNet sky blue is the interactive accent; navy is deep emphasis;
     cyan is the secondary highlight. */
  --doc-accent: #1188ea;
  --doc-accent-strong: #00084f;
  --doc-accent-soft: #e6f1fc;
  --doc-accent-2: #00aeef;
  --doc-link: #0a5bbf;

  /* Code — YouNet navy field with sky/cyan syntax accents. */
  --doc-code-bg: #00084f;
  --doc-code-fg: #dbe4f5;
  --doc-code-string: #74f3ff;
  --doc-code-comment: #8183a6;
  --doc-code-keyword: #4aa3f0;

  /* Semantic (readable on light) */
  --doc-success: #12805a;
  --doc-warning: #9a5b00;
  --doc-danger: #c0322f;

  --doc-radius: 8px;
  --doc-radius-lg: 14px;
  --doc-shadow: 0 1px 2px rgba(0, 8, 79, 0.04), 0 8px 24px rgba(0, 8, 79, 0.06);

  /* Persistent left navigation (site shell) */
  --doc-sidebar-w: 288px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --doc-bg: #02062b;
    --doc-surface: #0a1140;
    --doc-surface-strong: #111a52;
    --doc-border: #1e2a63;
    --doc-border-strong: #2c3a7a;
    --doc-text: #e4e9f7;
    --doc-text-muted: #9aa1c8;
    --doc-text-dim: #737aa6;
    --doc-accent: #4aa3f0;
    --doc-accent-strong: #9db4ff;
    --doc-accent-soft: #10205a;
    --doc-accent-2: #35c6f4;
    --doc-link: #7cc0ff;
    --doc-code-bg: #050a30;
    --doc-code-fg: #cdd6ee;
    --doc-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme='dark'] {
  --doc-bg: #02062b;
  --doc-surface: #0a1140;
  --doc-surface-strong: #111a52;
  --doc-border: #1e2a63;
  --doc-border-strong: #2c3a7a;
  --doc-text: #e4e9f7;
  --doc-text-muted: #9aa1c8;
  --doc-text-dim: #737aa6;
  --doc-accent: #4aa3f0;
  --doc-accent-strong: #9db4ff;
  --doc-accent-soft: #10205a;
  --doc-accent-2: #35c6f4;
  --doc-link: #7cc0ff;
  --doc-code-bg: #050a30;
  --doc-code-fg: #cdd6ee;
  --doc-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--doc-bg);
  color: var(--doc-text);
  font-family:
    'Plus Jakarta Sans',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.doc-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* The reading column stays a comfortable measure even inside the wide shell. */
.doc-content {
  max-width: 1080px;
  min-width: 0;
  /* A bare URL or other unbroken token in prose wraps at the column edge
     instead of widening the page on a phone. */
  overflow-wrap: break-word;
}

/* ─── Header ─── */

.doc-header {
  border-bottom: 1px solid var(--doc-border);
  padding-bottom: 18px;
  margin-bottom: 28px;
}

.doc-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--doc-accent);
  margin-bottom: 8px;
}

.doc-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  color: var(--doc-accent-strong);
}

.doc-subtitle {
  font-size: 14px;
  color: var(--doc-text-muted);
  margin: 0;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--doc-text-dim);
}

.doc-meta a {
  color: var(--doc-link);
  text-decoration: none;
}

.doc-meta a:hover {
  text-decoration: underline;
}

/* ─── Content typography ─── */

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--doc-accent-strong);
}

.doc-content h1 {
  font-size: 26px;
  margin: 32px 0 12px;
}

.doc-content h2 {
  font-size: 20px;
  margin: 0;
}

.doc-content h3 {
  font-size: 16px;
  margin: 22px 0 8px;
  color: var(--doc-accent);
}

.doc-content h4 {
  font-size: 14px;
  margin: 18px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--doc-text-muted);
}

.doc-content p {
  margin: 10px 0;
}

/* Prose keeps a readable measure; tables, figures, cards and diagrams use the
   full column. */
.doc-content p,
.doc-content ul,
.doc-content ol {
  max-width: 78ch;
}

.doc-content a {
  color: var(--doc-link);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--doc-link), transparent 70%);
}

.doc-content a:hover {
  border-bottom-color: var(--doc-link);
}

.doc-content strong {
  color: var(--doc-accent-strong);
  font-weight: 600;
}

.doc-content em {
  font-style: italic;
}

/* ─── Collapsible sections ─── */

/* ─── Sections: a continuous page, the way reference docs read ─── */

.doc-section {
  margin: 0 0 12px;
  scroll-margin-top: 24px;
}

.doc-h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--doc-accent-strong);
  margin: 40px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--doc-border);
}

.doc-section:first-of-type .doc-h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 20px;
}

/* Hover anchor on every heading (the standard reference-docs affordance). */
.doc-anchor {
  margin-left: 8px;
  color: var(--doc-accent);
  text-decoration: none;
  opacity: 0;
  font-weight: 500;
  transition: opacity 120ms ease;
}

.doc-h2:hover .doc-anchor,
.doc-anchor:focus {
  opacity: 1;
}

/* ─── Lists ─── */

.doc-content ul,
.doc-content ol {
  padding-left: 22px;
  margin: 10px 0;
}

.doc-content li {
  margin: 4px 0;
}

.doc-content li > ul,
.doc-content li > ol {
  margin: 4px 0;
}

/* ─── Code ─── */

.doc-content code {
  font-family: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--doc-surface-strong);
  color: var(--doc-accent-strong);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--doc-border);
  /* A long path or identifier in prose wraps instead of widening the page
     (it pushed a 390px phone view to 557px). */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-content pre {
  background: var(--doc-code-bg);
  color: var(--doc-code-fg);
  padding: 16px 18px;
  border-radius: var(--doc-radius-lg);
  overflow-x: auto;
  font-family: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  margin: 14px 0;
}

.doc-content pre code {
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* Mermaid diagrams render an SVG into the <pre class="mermaid"> element
   itself — the dark code-block background/padding above would box the
   diagram in a mismatched panel, so strip them for this one case. */
/* Diagrams render as framed figures: centered on a white card (the mermaid
   theme colors are tuned for a light ground, so the card stays white in dark
   mode too). A wider-than-card diagram scrolls INSIDE the card.
   justify-content stays flex-start: centering an overflowing flex child clips
   its left edge beyond reach (the classic flex-center overflow bug — this
   exact bug shipped as a diagram spilling off the landing page). Centering is
   done with auto margins on the svg, which collapse to 0 on overflow. */
.doc-content pre.mermaid {
  display: flex;
  justify-content: flex-start;
  background: #ffffff;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius-lg);
  padding: 22px 14px;
  margin: 22px 0;
  overflow-x: auto;
  box-shadow: var(--doc-shadow, 0 1px 2px rgba(0, 8, 79, 0.05));
}

/* Dark mode keeps a light ground (the mermaid palette and classDef colours are
   authored for one) but tints it and frames it, so a figure reads as a framed
   plate instead of a white glare on navy. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .doc-content pre.mermaid {
    background: #e9eef8;
    border-color: var(--doc-border-strong);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--doc-surface), transparent 20%);
  }
}
:root[data-theme='dark'] .doc-content pre.mermaid {
  background: #e9eef8;
  border-color: var(--doc-border-strong);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--doc-surface), transparent 20%);
}

/* Natural size by default (useMaxWidth: false) so label text never shrinks
   below its 15px base. The mermaid runtime adds .fit to a diagram only
   slightly wider than its card, letting it scale down to fit instead of
   scrolling; genuinely wide diagrams keep natural size and scroll. */
.doc-content pre.mermaid svg {
  flex-shrink: 0;
  margin-inline: auto;
}

.doc-content pre.mermaid svg.fit {
  max-width: 100%;
  height: auto;
}

/* A diagram still wider than its card after the runtime's flip/fit pass
   (scripts/docs-to-html.ts, mermaidScriptTag) scrolls — and says so: edge
   shadows show there is more to either side, a thin always-visible scrollbar
   gives a grip, and a pinned "Scroll" chip names the gesture. Without them a
   clipped last node read as a rendering bug. */
.doc-content pre.mermaid.is-scrollable {
  --mermaid-ground: #ffffff;
  background:
    linear-gradient(to right, var(--mermaid-ground) 30%, transparent) left center / 40px 100%
      no-repeat local,
    linear-gradient(to left, var(--mermaid-ground) 30%, transparent) right center / 40px 100%
      no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 8, 79, 0.22), transparent) left center / 16px
      100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 8, 79, 0.22), transparent) right center /
      16px 100% no-repeat scroll,
    var(--mermaid-ground);
  scrollbar-width: thin;
  scrollbar-color: var(--doc-border-strong) transparent;
}

.doc-content pre.mermaid.is-scrollable::after {
  content: 'Scroll \2192';
  position: sticky;
  right: 0;
  align-self: flex-start;
  flex-shrink: 0;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--doc-accent-strong);
  color: #ffffff;
  font:
    600 11px/1.6 'Plus Jakarta Sans',
    sans-serif;
  letter-spacing: 0.02em;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .doc-content pre.mermaid.is-scrollable {
    --mermaid-ground: #e9eef8;
  }
  :root:not([data-theme='light']) .doc-content pre.mermaid.is-scrollable::after {
    background: #00084f;
  }
}
:root[data-theme='dark'] .doc-content pre.mermaid.is-scrollable {
  --mermaid-ground: #e9eef8;
}
:root[data-theme='dark'] .doc-content pre.mermaid.is-scrollable::after {
  background: #00084f;
}

/* ─── Tables ─── */

/* Every rendered table sits in this box (scripts/docs-to-html.ts wrapTables):
   cells wrap first; if the table still cannot fit, it scrolls inside the box
   and the page itself never scrolls sideways. */
.doc-table-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  -webkit-overflow-scrolling: touch;
}

.doc-table-wrap > table {
  margin: 0;
}

/*
 * Rationale: original implementation used `display:block; overflow-x:auto;
 * white-space:nowrap` which forced every cell to a single line. Wide tables
 * (architecture review, permission matrix) became horizontal-scroll
 * nightmares — operator opens the doc, sees clipped text, has to scroll
 * right with the trackpad. Fixed by removing the nowrap + going back to
 * native `display:table` with word-wrapping cells. Horizontal scroll is
 * still possible via the outer `.doc-table-wrap` ONLY when the natural
 * layout overflows the container — which is rare once cells wrap.
 */

.doc-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 14px;
  background: var(--doc-surface);
  border-radius: var(--doc-radius);
  border: 1px solid var(--doc-border);
  table-layout: auto;
}

.doc-content th,
.doc-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--doc-border);
  vertical-align: top;
  /* Long single tokens (URLs, paths, code identifiers) wrap instead of
   * blowing out the column. `overflow-wrap: anywhere` handles long
   * unbroken strings without breaking ordinary sentence flow. */
  /* break-word, not anywhere: `anywhere` lets the browser size a column to a
   * single character, so short words ("shipped", "2026-07") were split across
   * two lines. Long code paths still break (td code, below). */
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

/* A code token keeps its full width as the column minimum (break-word does not
   shrink min-content), so `decimal` or `brandProcedure` never splits; a table
   too wide for the column scrolls inside .doc-table-wrap instead. */
.doc-content td code {
  overflow-wrap: break-word;
  word-break: normal;
}

.doc-content td.doc-nowrap {
  white-space: nowrap;
  width: 1%;
}

.doc-content th {
  background: var(--doc-surface-strong);
  color: var(--doc-accent-strong);
  font-weight: 600;
  font-size: 13px;
  /* Headers are short words, never URLs: a squeezed column must not split
   * "Status" into "Sta/tus". */
  overflow-wrap: normal;
  word-break: keep-all;
}

/* First column = the row's LABEL (stream name, permission, endpoint group).
 * `overflow-wrap: anywhere` above is right for long URLs in the body cells but
 * shredded short labels mid-word ("orders" → "order/s") because the browser
 * gives column 1 the least width. Keep whole words intact here and let the
 * column claim the width it needs; body cells keep the aggressive wrapping. */
.doc-content td:first-child,
.doc-content th:first-child {
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
}

.doc-content tr:last-child td {
  border-bottom: none;
}

.doc-content tr:hover td {
  background: color-mix(in oklab, var(--doc-accent-soft), transparent 70%);
}

/* Boolean matrices (roles x capabilities): the generator's Yes / No / — cells
   render as a glyph plus a screen-reader word (wrapTables in
   scripts/docs-to-html.ts). Centered narrow columns, a strong check, a faint
   dash: the "no" cells are the ones a reader scans for. Role headers never
   break mid-word. */
.doc-content table.doc-bool-matrix th:not(:first-child) {
  text-align: center;
  overflow-wrap: normal;
  word-break: keep-all;
  white-space: nowrap;
}

.doc-content td.doc-bool {
  text-align: center;
  vertical-align: middle;
  width: 4.5rem;
  overflow-wrap: normal;
  font-size: 16px;
  line-height: 1;
}

.doc-content td.doc-bool.is-yes {
  color: var(--doc-success);
  font-weight: 700;
}

.doc-content td.doc-bool.is-no {
  color: var(--doc-text-dim);
  opacity: 0.6;
}

/* Visually hidden, still read aloud. */
.doc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Blockquotes ─── */

.doc-content blockquote {
  border-left: 3px solid var(--doc-accent);
  background: var(--doc-surface-strong);
  padding: 10px 16px;
  margin: 14px 0;
  border-radius: 0 var(--doc-radius) var(--doc-radius) 0;
  color: var(--doc-text-muted);
}

.doc-content blockquote p {
  margin: 6px 0;
}

/* ─── HR ─── */

.doc-content hr {
  border: 0;
  border-top: 1px solid var(--doc-border);
  margin: 28px 0;
}

/* ─── Images ─── */

.doc-content img {
  max-width: 100%;
  border-radius: var(--doc-radius-lg);
  border: 1px solid var(--doc-border);
  margin: 12px 0;
}

/* ─── Footer ─── */

.doc-footer {
  margin-top: 60px;
  padding-top: 18px;
  border-top: 1px solid var(--doc-border);
  font-size: 12px;
  color: var(--doc-text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
}

.doc-footer a {
  color: var(--doc-link);
  text-decoration: none;
}

.doc-footer a:hover {
  text-decoration: underline;
}

/* ─── "On this page" rail (right side, sticky, with scrollspy) ─── */

html {
  scroll-behavior: smooth;
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

@media (min-width: 1500px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr) 200px;
  }
}

.doc-toc-rail {
  display: none;
}

@media (min-width: 1500px) {
  .doc-toc-rail {
    display: block;
    /*
     * STRETCH, or the rail cannot stick.
     *
     * `.doc-layout` sets `align-items: start`, which shrinks every grid item to
     * its content height. A `position: sticky` child can only travel inside its
     * containing block, so a rail 220px tall scrolled away after 220px and the
     * reader lost the in-page menu for the rest of a long document — no way to
     * jump to another section, no indication of where they were. Stretching the
     * rail to the row height gives the sticky element the whole column to
     * travel in.
     */
    align-self: stretch;
  }
}

.doc-toc-sticky {
  position: sticky;
  top: 28px;
  /* A page with many sections has a rail taller than the window; it scrolls on
     its own rather than pushing entries out of reach. */
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.doc-toc-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--doc-text-dim);
  margin-bottom: 10px;
}

.doc-toc {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--doc-border);
}

.doc-toc-link {
  font-size: 13px;
  line-height: 1.35;
  color: var(--doc-text-muted);
  text-decoration: none;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  transition:
    color 120ms ease,
    border-color 120ms ease;
}

.doc-toc-link:hover {
  color: var(--doc-accent);
}

/*
 * The collapsed in-page menu, for a window too narrow for the rail. Same links,
 * same active marker; it simply lives above the article instead of beside it.
 */
.doc-toc-inline {
  margin: 0 0 28px;
  border: 1px solid var(--doc-border);
  border-radius: 10px;
  padding: 10px 14px;
}

.doc-toc-inline > summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--doc-text-dim);
  list-style: none;
}

.doc-toc-inline > summary::-webkit-details-marker {
  display: none;
}

.doc-toc-inline > summary::after {
  content: ' ▾';
}

.doc-toc-inline[open] > summary::after {
  content: ' ▴';
}

.doc-toc-inline > summary:focus-visible {
  outline: 2px solid var(--doc-accent);
  outline-offset: 3px;
}

.doc-toc-inline .doc-toc {
  margin-top: 10px;
}

/*
 * The inline copy lives INSIDE `.doc-content`, whose link rule underlines every
 * anchor. Applied to a full-width column of TOC entries that reads as a ruled
 * table, not a menu — so the rail's own left-marker treatment is restored here.
 */
.doc-toc-inline .doc-toc-link {
  border-bottom: none;
}

.doc-toc-inline .doc-toc-link:hover {
  border-bottom-color: transparent;
}

@media (min-width: 1500px) {
  /* The rail is on screen — a second copy above the article would be noise. */
  .doc-toc-inline {
    display: none;
  }
}

.doc-toc-link.active {
  color: var(--doc-accent);
  border-left-color: var(--doc-accent);
  font-weight: 600;
}

/* ─── Site shell: header bar + grouped sidebar (matches the in-app help) ─── */
/*
 * scripts/docs/site-shell.ts renders a sticky header bar (brand, search, VI/EN, theme)
 * and a fixed left sidebar on EVERY page. Sidebar: bold uppercase section heading
 * (a link to the section's landing page), a rule between sections, plain links on
 * a left guide line, the current page filled. Below 960px the sidebar is a drawer.
 */

:root {
  --doc-topbar-h: 56px;
  --doc-sidebar-w: 272px;
}

html[data-theme='dark'] {
  color-scheme: dark;
}
html[data-theme='light'] {
  color-scheme: light;
}

body {
  padding-left: var(--doc-sidebar-w);
  padding-top: var(--doc-topbar-h);
}

.doc-skip {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 80;
  padding: 8px 14px;
  border-radius: var(--doc-radius);
  background: var(--doc-accent-strong);
  color: var(--doc-surface);
  font-weight: 600;
  text-decoration: none;
}
.doc-skip:focus {
  top: 8px;
}

.doc-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--doc-topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--doc-surface);
  border-bottom: 1px solid var(--doc-border);
}

.doc-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  text-decoration: none;
  color: var(--doc-text);
  white-space: nowrap;
}
.doc-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.doc-brand-name {
  font-weight: 700;
}
.doc-brand-dot {
  color: var(--doc-text-dim);
}
.doc-brand-sub {
  font-weight: 600;
}

.doc-topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-lang {
  display: flex;
  padding: 2px;
  border: 1px solid var(--doc-border-strong);
  border-radius: var(--doc-radius);
}
.doc-lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--doc-text);
  text-decoration: none;
}
.doc-lang a:hover {
  background: var(--doc-surface-strong);
}
.doc-lang a[aria-current='true'] {
  background: var(--doc-accent-strong);
  color: var(--doc-surface);
}
:root:not([data-theme='dark']) .doc-lang a[aria-current='true'] {
  color: #ffffff;
}

.doc-theme-toggle,
.doc-nav-toggle,
.doc-nav-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  font: inherit;
  font-size: 18px;
  color: var(--doc-text);
  background: transparent;
  border: 0;
  border-radius: var(--doc-radius);
  cursor: pointer;
}
.doc-theme-toggle:hover,
.doc-nav-toggle:hover,
.doc-nav-close:hover {
  background: var(--doc-surface-strong);
}
.doc-nav-toggle,
.doc-nav-close {
  display: none;
}

.doc-sidebar {
  position: fixed;
  top: var(--doc-topbar-h);
  left: 0;
  bottom: 0;
  width: var(--doc-sidebar-w);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--doc-surface);
  border-right: 1px solid var(--doc-border);
  padding: 20px 12px 40px;
  z-index: 40;
}

.doc-nav {
  font-size: 14px;
}

.nav-section + .nav-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--doc-border);
}

.nav-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.nav-section-link {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doc-text);
  text-decoration: none;
}
.nav-section-link:hover {
  background: var(--doc-surface-strong);
}
.nav-section-link.active {
  background: var(--doc-accent-soft);
  color: var(--doc-accent-strong);
}

.nav-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--doc-text-dim);
  border-bottom: 2px solid var(--doc-text-dim);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}
.nav-section[data-open='true'] .nav-toggle::before {
  transform: rotate(45deg);
  top: 10px;
}
.nav-toggle:hover {
  background: var(--doc-surface-strong);
}

.nav-list {
  list-style: none;
  margin: 6px 0 0 8px;
  padding: 0 0 0 8px;
  border-left: 1px solid var(--doc-border-strong);
}
.nav-list-sub {
  margin: 2px 0 6px 6px;
}
.nav-section[data-open='false'] > .nav-list {
  display: none;
}

.nav-list li {
  margin: 1px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--doc-text-muted);
  text-decoration: none;
  line-height: 1.35;
}
.nav-link:hover {
  background: var(--doc-surface-strong);
  color: var(--doc-text);
}
.nav-link.active {
  background: var(--doc-accent-soft);
  color: var(--doc-accent-strong);
  font-weight: 700;
}

.nav-subhead {
  display: block;
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--doc-text);
}

.nav-en {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--doc-border-strong);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--doc-text-dim);
  line-height: 1.5;
}

/* Child list a landing or parent page appends for pages it does not link. */
.doc-children {
  margin-top: 28px;
}
.doc-children-group {
  margin: 18px 0 0;
  font-size: 15px;
  color: var(--doc-text);
}

/* Mobile menu overlay — hidden on desktop. */
.doc-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.45);
}
.doc-nav-overlay[hidden] {
  display: none;
}

.doc-kind {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--doc-link);
}

/* ─── Search (header bar; assets/search.js) ─── */

.doc-search {
  position: relative;
  flex: 1;
  max-width: 560px;
  min-width: 0;
}

.doc-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.doc-search-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--doc-text);
  background: var(--doc-bg);
  border: 1px solid var(--doc-border-strong);
  border-radius: var(--doc-radius);
  padding: 8px 34px 8px 12px;
  min-height: 40px;
}

.doc-search-input::placeholder {
  color: var(--doc-text-dim);
}

.doc-search-input:focus {
  outline: 2px solid var(--doc-accent);
  outline-offset: 1px;
  border-color: var(--doc-accent);
}

.doc-search-input::-webkit-search-cancel-button {
  display: none;
}

.doc-search-kbd {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1;
  color: var(--doc-text-dim);
  border: 1px solid var(--doc-border-strong);
  border-radius: 4px;
  padding: 3px 6px;
  pointer-events: none;
}

.doc-search-input:focus + .doc-search-kbd {
  display: none;
}

.doc-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  margin-top: 6px;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: var(--doc-surface);
  box-shadow: var(--doc-shadow);
}

.doc-search-hit {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--doc-border);
}

.doc-search-hit:last-child {
  border-bottom: none;
}

.doc-search-hit:hover,
.doc-search-hit[aria-selected='true'] {
  background: var(--doc-accent-soft);
}

.doc-search-hit-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doc-accent);
}

.doc-search-hit-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--doc-accent-strong);
  line-height: 1.35;
}

.doc-search-hit-detail {
  font-size: 12px;
  color: var(--doc-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-search-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--doc-text-muted);
}

.doc-search-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  margin: 0;
  font-size: 11px;
  color: var(--doc-text-dim);
  min-height: 0;
}

.doc-search-status:empty {
  display: none;
}

/* ─── Breadcrumbs (above the H1) ─── */

.doc-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  font-size: 12px;
  color: var(--doc-text-dim);
}

.doc-breadcrumbs li {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.doc-breadcrumbs li + li::before {
  content: '›';
  margin: 0 8px;
  color: var(--doc-text-dim);
}

.doc-breadcrumbs a {
  color: var(--doc-link);
  text-decoration: none;
}

.doc-breadcrumbs a:hover {
  text-decoration: underline;
}

.doc-breadcrumbs [aria-current='page'] {
  color: var(--doc-text-muted);
  font-weight: 500;
}

/* ─── Previous / next (foot of the article) ─── */

.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--doc-border);
}

.doc-content .doc-pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius-lg);
  background: var(--doc-surface);
  text-decoration: none;
  min-width: 0;
}

.doc-content .doc-pager-link:hover {
  border-color: var(--doc-accent);
}

.doc-pager-link.next {
  text-align: right;
  grid-column: 2;
}

.doc-pager-dir {
  font-size: 12px;
  color: var(--doc-text-dim);
}

.doc-pager-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--doc-link);
  overflow-wrap: anywhere;
}

.doc-pager-section {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--doc-text-dim);
}

/* ─── Mobile ─── */

@media (max-width: 720px) {
  body {
    padding-left: 0;
  }
  .doc-shell {
    padding: 20px 16px 60px;
  }
  .doc-title {
    font-size: 24px;
  }
  .doc-content details > .details-body {
    padding: 14px 16px 18px;
  }

  /* Phone tables: tighter cells, and the label column may wrap too — a
     keep-all first column was the widest thing on a 390px screen. */
  .doc-content table {
    font-size: 13px;
  }
  .doc-content th,
  .doc-content td {
    padding: 8px 10px;
  }
  .doc-content td:first-child,
  .doc-content th:first-child {
    overflow-wrap: break-word;
    word-break: normal;
  }
  /* A 4+ column table keeps a readable minimum width and scrolls inside its
     box (.doc-table-wrap) instead of breaking "shipped" or a code path one
     letter per line. Boolean matrices are exempt: their glyph columns fit. */
  .doc-content table[data-cols='4'] {
    min-width: 520px;
  }
  .doc-content table[data-cols='5'],
  .doc-content table[data-cols='6'],
  .doc-content table[data-cols='7'],
  .doc-content table[data-cols='8'] {
    min-width: 640px;
  }
  .doc-content table[data-cols] td,
  .doc-content table[data-cols] th {
    overflow-wrap: break-word;
  }
  .doc-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--doc-border-strong) transparent;
  }
  .doc-content td.doc-bool {
    width: 3.25rem;
    padding-inline: 4px;
  }
  .doc-content table.doc-bool-matrix th:not(:first-child) {
    padding-inline: 6px;
  }

  .doc-pager {
    grid-template-columns: 1fr;
  }
  .doc-pager-link.next {
    grid-column: 1;
  }
  .doc-pager > span:empty {
    display: none;
  }
}

/* Tablet and phone: the sidebar is a drawer behind the menu button. */
@media (max-width: 960px) {
  body {
    padding-left: 0;
    padding-top: calc(var(--doc-topbar-h) + 56px);
  }
  .doc-topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--doc-topbar-h);
    gap: 8px 10px;
    padding: 8px 12px;
  }
  .doc-nav-toggle {
    display: inline-flex;
  }
  .doc-brand-sub,
  .doc-brand-dot {
    display: none;
  }
  .doc-search {
    order: 5;
    flex: 1 0 100%;
    max-width: none;
  }
  .doc-lang a {
    min-width: 44px;
    min-height: 40px;
  }
  .doc-theme-toggle,
  .doc-nav-toggle {
    min-width: 44px;
    min-height: 44px;
  }
  .doc-sidebar {
    top: 0;
    width: min(320px, 86vw);
    transform: translateX(-100%);
    transition: transform 200ms ease;
    padding-top: 56px;
    z-index: 70;
  }
  body.nav-open .doc-sidebar {
    transform: translateX(0);
    box-shadow: 0 0 24px rgba(15, 23, 42, 0.25);
  }
  .doc-nav-close {
    display: flex;
    width: 44px;
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -48px 0 8px auto;
    min-width: 44px;
    min-height: 44px;
    font-size: 26px;
    background: var(--doc-surface);
  }
  .nav-link {
    min-height: 44px;
  }
  .doc-nav-overlay {
    z-index: 65;
  }
}

@media (prefers-reduced-motion: reduce) {
  .doc-sidebar,
  .nav-toggle::before {
    transition: none;
  }
}

/* ─── Landing page: role cards + document map ─── */

.landing-lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--doc-text);
  max-width: 62ch;
}

.role-grid,
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}

.role-card,
.map-card {
  border: 1px solid var(--doc-border);
  background: var(--doc-surface);
  border-radius: var(--doc-radius-lg);
  padding: 16px 18px;
}

.role-card h3,
.map-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--doc-accent);
}

.role-card p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--doc-text-muted);
}

.role-card ul,
.map-card ul {
  margin: 0;
  padding-left: 18px;
}

.role-card li,
.map-card li {
  font-size: 13px;
  margin: 3px 0;
}

.map-card a {
  font-weight: 500;
}

/* ─── Reading components (scripts/docs-to-html.ts) ─── */

/* Status pill in a table cell: `shipped` / `beta` / `planned` / `closed`. */
.doc-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  text-transform: capitalize;
  background: var(--doc-surface-strong);
  color: var(--doc-text-muted);
}
.doc-badge.is-shipped,
.doc-badge.is-live {
  background: color-mix(in oklab, var(--doc-success), transparent 86%);
  color: var(--doc-success);
}
.doc-badge.is-beta,
.doc-badge.is-partial {
  background: color-mix(in oklab, var(--doc-warning), transparent 86%);
  color: var(--doc-warning);
}
.doc-badge.is-planned {
  background: var(--doc-accent-soft);
  color: var(--doc-link);
}

/* ```cards — entry-point grid. */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}
.doc-content .doc-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius-lg);
  background: var(--doc-surface);
  color: var(--doc-text);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.doc-content a.doc-card:hover {
  border-color: var(--doc-accent);
  box-shadow: var(--doc-shadow);
  text-decoration: none;
}
.doc-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--doc-accent-strong);
}
a.doc-card .doc-card-title::after {
  content: ' →';
  color: var(--doc-accent);
}
.doc-card-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--doc-text-muted);
}

/* ```stats — structural facts as tiles. */
.doc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}
.doc-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--doc-radius-lg);
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
}
.doc-stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--doc-accent-strong);
}
.doc-stat-label {
  font-size: 13px;
  line-height: 1.4;
  color: var(--doc-text-muted);
}

/* > [!NOTE] / [!TIP] / [!IMPORTANT] / [!WARNING] / [!CAUTION], or > **Note** / > **Warning** */
.doc-callout {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--doc-accent);
  border-radius: 0 var(--doc-radius) var(--doc-radius) 0;
  background: var(--doc-accent-soft);
  max-width: 78ch;
}
.doc-callout p {
  margin: 4px 0;
}
.doc-callout-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doc-link);
}
.doc-callout.is-tip {
  border-left-color: var(--doc-success);
  background: color-mix(in oklab, var(--doc-success), transparent 90%);
}
.doc-callout.is-tip .doc-callout-label {
  color: var(--doc-success);
}
.doc-callout.is-warning,
.doc-callout.is-caution {
  border-left-color: var(--doc-warning);
  background: color-mix(in oklab, var(--doc-warning), transparent 90%);
}
.doc-callout.is-warning .doc-callout-label,
.doc-callout.is-caution .doc-callout-label {
  color: var(--doc-warning);
}

/* Inline-SVG figures (skills/diagram-authoring) and screenshots. */
.doc-content figure {
  margin: 20px 0 24px;
  padding: 0;
  border: 0;
  text-align: center;
}
.doc-content figure img {
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius-lg);
}
.doc-content figure svg,
.doc-content figure img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  margin: 0 auto;
  border: 0;
}
.doc-content figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: #4a5578;
  text-align: left;
}

/* Below 960px a 1000-unit house figure would shrink its 11px labels to ~4px;
   keep a legible minimum width and let the figure scroll inside itself.
   From 960px up the figure scales to its column and never scrolls. */
@media (max-width: 720px) {
  .doc-content figure {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .doc-content figure svg {
    min-width: 680px;
  }
}

/* Scroll hint: scripts/docs/site-shell.ts marks a figure or table box that is
   wider than its column; the chip stays pinned at the left edge while it scrolls. */
.doc-content figure.is-scrollable,
.doc-content .doc-table-wrap.is-scrollable {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--doc-border-strong) transparent;
}
.doc-content figure.is-scrollable::before,
.doc-content .doc-table-wrap.is-scrollable::before {
  content: 'Scroll \2192';
  display: block;
  position: sticky;
  left: 0;
  width: max-content;
  margin: 0 0 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--doc-accent-strong);
  color: #ffffff;
  font:
    600 11px/1.6 'Plus Jakarta Sans',
    sans-serif;
  letter-spacing: 0.02em;
}
.doc-content figure.is-scrollable {
  text-align: left;
}
.doc-content figure.is-scrollable svg {
  margin: 0;
}

.doc-content h3.doc-children-group {
  color: var(--doc-text);
}
