:root {
  color-scheme: light;
  --bg: #F0E9D6;
  --bg-panel: #E8DFC6;
  --bg-card: #F5EFE0;
  --ink: #2B2A26;
  --ink-muted: #6B6659;
  --ink-faint: #9A9484;
  --rule: #D9CFB4;
  --code-bg: #1F1E1A;
  --code-fg: #E8DFC6;
  --code-comment: #9A9484;
  --accent-rust: #B8742A;
  --accent-forest: #3E6B5C;
  --accent-slate: #5E7A9B;
  --accent-amber: #C97A3A;
  --accent-lagoon: #2F7D8C;
  --accent-plum: #735C9D;
  --accent-rose: #B85D6A;
  --sidebar-width: 248px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.62;
}

a {
  color: inherit;
}

.site-header {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: var(--sidebar-width);
  padding: 24px 0;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  background: var(--bg-panel);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  width: 100%;
  padding: 0 18px 20px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 154px;
  height: auto;
}

.nav {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 18px;
  gap: 16px;
  color: var(--ink-muted);
  font-size: 14px;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section:has(.nav-sub-item) {
  gap: 0;
}

.nav-title {
  padding: 0 18px 4px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 7px 18px;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--ink-muted);
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.nav a:hover,
.nav a.active {
  background: var(--bg-card);
  color: var(--ink);
}

.nav a.active {
  border-left-color: var(--accent-forest);
}

.nav a.nav-sub-item {
  width: 100%;
  min-height: 32px;
  padding: 7px 18px 7px 34px;
  border-left: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--bg-card) 44%, transparent);
  font-size: 13px;
}

.nav a.nav-sub-item:hover,
.nav a.nav-sub-item.active {
  background: color-mix(in srgb, var(--bg-card) 78%, white);
  box-shadow: inset 3px 0 0 var(--accent-forest);
}

.summary-list a:hover strong {
  color: var(--accent-forest);
}

main,
.site-footer {
  margin-left: var(--sidebar-width);
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  justify-content: flex-end;
  width: min(1120px, calc(100% - 44px));
  margin: 0 auto;
  padding: 12px 0 0;
  background: linear-gradient(var(--bg) 76%, transparent);
}

.language-control {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  gap: 9px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-panel);
}

.language-control span {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.language-switcher button {
  min-width: 58px;
  min-height: 28px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.language-switcher button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.language-panel {
  display: none;
}

body[data-language="csharp"] .language-panel[data-language="csharp"],
body[data-language="python"] .language-panel[data-language="python"] {
  display: block;
}

.language-note {
  margin: 10px 0 0;
  font-size: 14px;
}

.page-hero,
.doc-section,
.api-hero,
.api-reference-layout {
  width: min(1120px, calc(100% - 44px));
  margin: 0 auto;
}

.page-hero {
  padding: 50px 0 34px;
}

.page-hero.compact {
  padding-bottom: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(420px, 0.78fr);
  gap: 34px;
  align-items: center;
}

.hero-graph {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-card);
}

.hero-graph p {
  margin: 18px 0 0;
  font-size: 14px;
}

.install-card {
  position: relative;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-card);
}

.install-card-header {
  display: block;
  min-height: 34px;
  padding-right: 220px;
  margin-bottom: 14px;
}

.install-card-header .language-control {
  position: absolute;
  top: 20px;
  right: 20px;
}

.install-card h2 {
  margin-bottom: 0;
}

.install-methods {
  display: grid;
  gap: 10px;
}

.install-methods article {
  min-width: 0;
}

.install-methods h3 {
  margin-bottom: 6px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.install-methods pre {
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.install-methods pre code {
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.preview-card img {
  display: block;
  width: 100%;
  object-fit: cover;
  object-position: top center;
}

.graph-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 30px;
}

.graph-row span:first-child {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent-forest);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

h1 {
  max-width: 850px;
  margin-bottom: 16px;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.12;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}

.install-card h2,
.diagram-card h3,
.card-grid article h3,
.code-grid article h3,
.wide-example h3,
.comparison-list article h3 {
  font-size: 18px;
  font-weight: 760;
  line-height: 1.25;
}

p,
li,
.lead,
.summary-list span,
.api-member p,
.member-table td,
.use-case-list p {
  color: var(--ink-muted);
}

.lead {
  max-width: 800px;
  margin-bottom: 22px;
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.button.secondary {
  background: var(--bg-card);
}

.doc-section {
  padding: 42px 0;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 22px;
}

.diagram-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.diagram-card,
.card-grid article,
.capability-list div,
.code-grid article,
.wide-example,
.comparison-list article,
.summary-list a,
.use-case-list article,
.hard-example-list article,
.api-tree,
.api-member {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-card);
}

.diagram-card {
  padding: 20px;
}

.card-grid {
  display: grid;
  gap: 14px;
}

.card-grid.four {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card-grid article {
  padding: 20px;
}

.state-diagram {
  display: grid;
  gap: 8px;
  margin: 20px 0 18px;
}

.quick-timeline {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--rule) 88%, var(--ink));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 86%, white), var(--bg-card));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 54%, transparent),
    0 10px 24px color-mix(in srgb, var(--ink) 5%, transparent);
}

.quick-row {
  position: relative;
  display: grid;
  grid-template-columns: 100px minmax(220px, 1fr) 150px;
  gap: 10px;
  align-items: center;
}

.quick-row.annotated-quick-row {
  min-height: 46px;
}

.quick-row > span:first-child,
.quick-row > span:last-child {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-track {
  position: relative;
  height: 26px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--rule) 72%, var(--ink));
  border-radius: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 12%, transparent) 1px, transparent 1px) 0 0 / 20% 100%,
    linear-gradient(90deg, transparent 0 99%, color-mix(in srgb, var(--ink) 18%, transparent) 99% 100%) 0 0 / 10% 100%,
    color-mix(in srgb, var(--bg-panel) 72%, var(--bg-card));
  box-shadow: none;
}

.quick-track::before {
  position: absolute;
  top: 50%;
  right: 9px;
  left: 9px;
  height: 1px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  content: "";
}

.quick-window {
  position: absolute;
  top: 5px;
  z-index: 2;
  height: 16px;
  min-width: 8px;
  border: 1px solid color-mix(in srgb, var(--ink) 26%, transparent);
  border-radius: 0;
  box-shadow: none;
}

.quick-window::before,
.quick-window::after {
  position: absolute;
  top: -7px;
  bottom: -22px;
  width: 0;
  border-left: 1px dotted color-mix(in srgb, var(--ink-muted) 72%, transparent);
  content: "";
}

.quick-window::before {
  left: -1px;
}

.quick-window::after {
  right: -1px;
}

.quick-window.target {
  background: var(--accent-slate);
}

.quick-window.compare,
.quick-window.overlap {
  background: var(--accent-forest);
}

.quick-window.residual {
  background: var(--accent-amber);
}

.quick-note {
  position: absolute;
  top: 29px;
  z-index: 3;
  padding: 0 2px;
  color: var(--ink-muted);
  font-size: 0.66rem;
  font-weight: 680;
  line-height: 1.05;
  opacity: 0.88;
  transform: translateX(-50%);
  white-space: nowrap;
}

.quick-note::before {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 0;
  height: 8px;
  border-left: 1px dotted color-mix(in srgb, var(--ink-muted) 70%, transparent);
  content: "";
  transform: translateX(-50%);
}

.quick-note.note-residual {
  color: var(--ink-muted);
}

.quick-note.note-overlap {
  color: var(--ink-muted);
}

.state-row {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: start;
  min-height: 24px;
  gap: 8px;
}

.state-row.annotated-row {
  min-height: 46px;
}

.row-label,
.mini-graph .label {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline {
  position: relative;
  height: 18px;
  align-self: start;
  margin-top: 3px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--rule) 72%, var(--ink));
  border-radius: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 11%, transparent) 1px, transparent 1px) 0 0 / 25% 100%,
    color-mix(in srgb, var(--bg-panel) 72%, var(--bg-card));
  box-shadow: none;
}

.timeline::before {
  position: absolute;
  top: 50%;
  right: 7px;
  left: 7px;
  height: 1px;
  background: color-mix(in srgb, var(--ink) 17%, transparent);
  content: "";
}

.lane-note,
.timeline-note {
  position: absolute;
  top: calc(100% + 8px);
  z-index: 3;
  min-height: 16px;
  max-width: min(138px, calc(100% - 10px));
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.66rem;
  font-weight: 680;
  line-height: 1.05;
  opacity: 0.88;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}

.lane-note::before,
.timeline-note::before {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 0;
  height: 8px;
  border-left: 1px dotted color-mix(in srgb, var(--ink-muted) 70%, transparent);
  content: "";
  transform: translateX(-50%);
}

.timeline-note.note-residual {
  color: var(--ink);
}

.timeline-note.note-overlap {
  color: var(--ink);
}

.timeline-note.note-missing {
  color: var(--ink);
}

.window,
.point,
.horizon {
  position: absolute;
  z-index: 2;
}

.window {
  top: 2px;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--ink) 26%, transparent);
  border-radius: 0;
  box-shadow: none;
}

.window::before,
.window::after {
  position: absolute;
  top: -9px;
  bottom: -34px;
  z-index: 1;
  width: 0;
  border-left: 1px dotted color-mix(in srgb, var(--ink-muted) 76%, transparent);
  content: "";
}

.window::before {
  left: -1px;
}

.window::after {
  right: -1px;
}

.window.target,
.bar.target {
  background: var(--accent-slate);
}

.window.compare,
.bar.compare {
  background: var(--accent-forest);
}

.window.warn,
.bar.residual {
  background: var(--accent-rust);
}

.window.residual {
  background: var(--accent-amber);
}

.window.overlap {
  background: var(--accent-forest);
}

.bar.overlap {
  background: var(--accent-forest);
}

.bar.hot {
  background: var(--accent-rust);
}

.window.missing,
.bar.missing {
  background: var(--accent-amber);
}

.window.dashed {
  border: 2px dashed var(--accent-slate);
  background: color-mix(in srgb, var(--accent-slate) 16%, transparent);
}

.window.plum { background: var(--accent-plum); }
.window.lagoon { background: var(--accent-lagoon); }
.window.rose { background: var(--accent-rose); }
.window.residual-amber { background: var(--accent-amber); }

.point {
  top: 1px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--bg-card);
  border-radius: 50%;
  background: var(--accent-rust);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent);
}

.point.ok {
  background: var(--accent-forest);
}

.horizon,
.mini-graph .marker {
  width: 2px;
  height: 24px;
  background: var(--ink);
}

.horizon {
  top: -4px;
}

/* Diagram kit — used across concept pages for consistent, labeled visuals. */

.diagram-panel {
  padding: 18px 20px 22px;
  border: 1px solid color-mix(in srgb, var(--rule) 88%, var(--ink));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 90%, white), var(--bg-card));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 54%, transparent),
    0 10px 24px color-mix(in srgb, var(--ink) 4%, transparent);
}

.diagram-panel .state-diagram {
  margin: 6px 0 0;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 70%, white);
}

.legend-row .legend-title {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 680;
}

.legend-chip::before {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1px solid color-mix(in srgb, var(--ink) 26%, transparent);
  content: "";
}

.legend-chip.target::before { background: var(--accent-slate); }
.legend-chip.compare::before { background: var(--accent-forest); }
.legend-chip.overlap::before { background: var(--accent-forest); }
.legend-chip.residual::before { background: var(--accent-rust); }
.legend-chip.residual-amber::before { background: var(--accent-amber); }
.legend-chip.missing::before { background: var(--accent-amber); }
.legend-chip.open::before {
  background: color-mix(in srgb, var(--accent-slate) 16%, transparent);
  border: 2px dashed var(--accent-slate);
  height: 12px;
}
.legend-chip.horizon::before {
  width: 2px;
  height: 14px;
  border: 0;
  background: var(--ink);
}
.legend-chip.plum::before { background: var(--accent-plum); }
.legend-chip.lagoon::before { background: var(--accent-lagoon); }
.legend-chip.rose::before { background: var(--accent-rose); }

/* Axis ticks below a timeline lane */
.axis-row {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  margin-top: 22px;
}

.axis-row .row-label {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
}

.axis {
  position: relative;
  height: 18px;
  margin-top: 2px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 32%, transparent);
}

.axis .tick {
  position: absolute;
  top: -1px;
  width: 1px;
  height: 6px;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  transform: translateX(-50%);
}

.axis .tick-label {
  position: absolute;
  top: 6px;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}

/* Measurement bracket rendered below a lane to show a span value. */
.measure-row {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  margin-top: 16px;
  min-height: 26px;
}

.measure-row .row-label {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
}

.measure-track {
  position: relative;
  height: 22px;
}

.measure {
  position: absolute;
  top: 0;
  height: 12px;
  border-top: 2px solid var(--ink-muted);
  border-right: 2px solid var(--ink-muted);
  border-left: 2px solid var(--ink-muted);
  border-bottom: 0;
  pointer-events: none;
}

.measure .measure-label {
  position: absolute;
  top: 14px;
  left: 50%;
  padding: 0 6px;
  background: var(--bg-card);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
}

.measure.overlap { border-color: var(--accent-forest); }
.measure.overlap .measure-label { color: var(--accent-forest); }
.measure.residual { border-color: var(--accent-rust); }
.measure.residual .measure-label { color: var(--accent-rust); }
.measure.missing { border-color: var(--accent-amber); }
.measure.missing .measure-label { color: var(--accent-amber); }
.measure.gap { border-color: var(--accent-plum); border-style: dashed; }
.measure.gap .measure-label { color: var(--accent-plum); }

/* Inline value reading over a window (e.g. a numeric sample). */
.window-value {
  position: absolute;
  top: -16px;
  z-index: 3;
  padding: 0 4px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translateX(-50%);
}

/* Threshold reference line across the whole timeline. */
.threshold {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 1;
  height: 0;
  border-top: 1.5px dashed var(--accent-rose);
  pointer-events: none;
}

.threshold-label {
  position: absolute;
  top: -14px;
  right: 0;
  color: var(--accent-rose);
  font-size: 10px;
  font-weight: 800;
}

/* Narrative caption read aloud: sits below a diagram as plain-English hint. */
.diagram-caption {
  margin: 18px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.5;
}

.diagram-caption strong { color: var(--ink); font-weight: 780; }

/* Source matrix — compact labeled grid for directional pairwise comparisons. */
.matrix-grid {
  display: grid;
  grid-template-columns: 88px repeat(4, minmax(0, 1fr));
  gap: 3px;
  margin: 6px 0 0;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-panel) 60%, var(--bg-card));
}

.matrix-grid .mx-corner,
.matrix-grid .mx-col-head,
.matrix-grid .mx-row-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.matrix-grid .mx-row-head {
  justify-content: flex-end;
  padding-right: 10px;
}

.matrix-grid .mx-cell {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 8px 6px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--ink);
  text-align: center;
}

.matrix-grid .mx-cell .mx-ratio {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.matrix-grid .mx-cell .mx-hint {
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 700;
}

.matrix-grid .mx-cell.diag {
  background: color-mix(in srgb, var(--ink-faint) 14%, var(--bg-card));
  color: var(--ink-faint);
}

.matrix-grid .mx-cell.good {
  border-color: color-mix(in srgb, var(--accent-forest) 45%, var(--rule));
  background: color-mix(in srgb, var(--accent-forest) 9%, var(--bg-card));
}

.matrix-grid .mx-cell.warn {
  border-color: color-mix(in srgb, var(--accent-rust) 50%, var(--rule));
  background: color-mix(in srgb, var(--accent-rust) 10%, var(--bg-card));
}

.matrix-grid .mx-cell.bad {
  border-color: color-mix(in srgb, var(--accent-rose) 60%, var(--rule));
  background: color-mix(in srgb, var(--accent-rose) 13%, var(--bg-card));
}

/* Parent/child explanation connectors (hierarchy page). */
.explain-link {
  position: absolute;
  top: 100%;
  z-index: 1;
  height: 12px;
  border-top: 0;
  border-right: 1px dashed color-mix(in srgb, var(--accent-forest) 65%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, var(--accent-forest) 65%, transparent);
  border-left: 1px dashed color-mix(in srgb, var(--accent-forest) 65%, transparent);
  pointer-events: none;
}

.explain-link.unexplained {
  border-color: color-mix(in srgb, var(--accent-rose) 70%, transparent);
}

/* Compact formula panel shown next to a diagram (advanced analytics). */
.formula {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 78%, white);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

.formula .formula-label {
  color: var(--ink-muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.formula em {
  color: var(--ink-muted);
  font-style: normal;
}

.formula .operator { color: var(--ink-muted); }
.formula .target { color: var(--accent-slate); }
.formula .compare { color: var(--accent-forest); }
.formula .result { color: var(--accent-plum); font-weight: 700; }

/* Sequence of diagram stages with arrows between them. */
.stage-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 10px 0 0;
}

.stage-flow .stage-card {
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-card);
}

.stage-flow .stage-card .stage-kicker {
  margin: 0 0 8px;
  color: var(--accent-forest);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stage-flow .stage-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.25;
}

.stage-flow .stage-card p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-list.grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-list a {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 20px;
  text-decoration: none;
}

.summary-list strong {
  color: var(--ink);
}

.preview-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.preview-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-card);
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.preview-card:hover {
  border-color: color-mix(in srgb, var(--accent-lagoon) 54%, var(--rule));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent-lagoon) 12%, transparent);
  transform: translateY(-2px);
}

.preview-card img {
  aspect-ratio: 1.4 / 1;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-panel);
}

.preview-card:nth-child(1) img {
  border-top: 3px solid var(--accent-forest);
}

.preview-card:nth-child(2) img {
  border-top: 3px solid var(--accent-lagoon);
}

.preview-card:nth-child(3) img {
  border-top: 3px solid var(--accent-plum);
}

.preview-card:nth-child(4) img {
  border-top: 3px solid var(--accent-amber);
}

.preview-card strong,
.preview-card span {
  padding-right: 16px;
  padding-left: 16px;
}

.preview-card strong {
  padding-top: 15px;
  color: var(--ink);
}

.preview-card span {
  padding-bottom: 16px;
  color: var(--ink-muted);
}

.link-line {
  margin: 18px 0 0;
}

.link-line a {
  color: var(--accent-forest);
  font-weight: 800;
}

.capability-list {
  display: grid;
  gap: 10px;
}

.capability-list div {
  display: grid;
  grid-template-columns: minmax(230px, 0.38fr) minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
}

.capability-list strong {
  color: var(--ink);
}

.capability-list span {
  color: var(--ink-muted);
}

.code-strip {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.code-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.code-grid article,
.hard-example-list article,
.wide-example {
  min-width: 0;
  padding: 20px;
}

.wide-example {
  margin-top: 14px;
}

.expected-output {
  display: grid;
  gap: 14px;
}

.stacked-code {
  margin-top: 14px;
}

.hard-example-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

pre {
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-fg);
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
}

pre code {
  display: block;
  padding: 18px;
  line-height: 1.55;
}

pre .comment,
pre .hljs-comment {
  color: var(--code-comment);
}

.hljs-keyword,
.hljs-built_in,
.hljs-type,
.hljs-literal {
  color: #F1C27D;
}

.hljs-title,
.hljs-title.function_,
.hljs-title.class_,
.hljs-name,
.hljs-selector-tag {
  color: #9CCFD8;
}

.hljs-string,
.hljs-attr,
.hljs-attribute,
.hljs-meta .hljs-string {
  color: #B7D29A;
}

.hljs-number,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable {
  color: #D8A0A6;
}

.hljs-comment,
.hljs-quote {
  color: var(--code-comment);
  font-style: italic;
}

.hljs-meta,
.hljs-tag,
.hljs-punctuation {
  color: #CFC6AA;
}

.hljs-params,
.hljs-property,
.hljs-subst {
  color: var(--code-fg);
}

.use-case-list {
  display: grid;
  gap: 14px;
}

.use-case-list article {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1fr);
  gap: 22px;
  min-width: 0;
  padding: 20px;
}

.use-case-list article > div {
  min-width: 0;
}

.mini-graph {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 34px;
  align-self: center;
  width: 100%;
  min-width: 0;
  padding: 18px 18px 30px;
  border: 1px solid color-mix(in srgb, var(--rule) 88%, var(--ink));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 86%, white), var(--bg-card));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 54%, transparent),
    0 10px 24px color-mix(in srgb, var(--ink) 5%, transparent);
}

.mini-graph .label {
  min-height: 20px;
  align-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-track {
  position: relative;
  min-width: 0;
  height: 26px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--rule) 72%, var(--ink));
  border-radius: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 12%, transparent) 1px, transparent 1px) 0 0 / 20% 100%,
    linear-gradient(90deg, transparent 0 99%, color-mix(in srgb, var(--ink) 18%, transparent) 99% 100%) 0 0 / 10% 100%,
    color-mix(in srgb, var(--bg-panel) 72%, var(--bg-card));
  box-shadow: none;
}

.mini-track::before {
  position: absolute;
  top: 50%;
  right: 9px;
  left: 9px;
  height: 1px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  content: "";
}

.mini-track .bar {
  position: absolute;
  top: 5px;
  z-index: 2;
  height: 16px;
  min-width: 8px;
  border: 1px solid color-mix(in srgb, var(--ink) 26%, transparent);
  border-radius: 0;
  box-shadow: none;
}

.mini-track .bar::before,
.mini-track .bar::after {
  position: absolute;
  top: -7px;
  bottom: -22px;
  width: 0;
  border-left: 1px dotted color-mix(in srgb, var(--ink-muted) 72%, transparent);
  content: "";
}

.mini-track .bar::before {
  left: -1px;
}

.mini-track .bar::after {
  right: -1px;
}

.mini-track .lane-note {
  top: 29px;
  max-width: min(160px, calc(100% - 14px));
  pointer-events: none;
}

.mini-track .lane-note::before {
  top: -10px;
  height: 8px;
}

.mini-track .bar[data-label]::after {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: calc(100% - 8px);
  overflow: hidden;
  color: var(--bg);
  content: attr(data-label);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px color-mix(in srgb, var(--ink) 25%, transparent);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.mini-graph .marker {
  position: absolute;
  top: 2px;
  z-index: 2;
  width: 2px;
  height: 24px;
  background: var(--ink);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bg-card) 55%, transparent);
}

.mini-graph .phase {
  background: var(--ink-faint);
}

.mini-graph .phase.alt {
  background: var(--ink-muted);
}

.comparison-list {
  display: grid;
  gap: 12px;
}

.comparison-list article {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
}

.visualiser-frame {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-card);
}

.visualiser-frame iframe {
  display: block;
  width: 100%;
  height: clamp(880px, 92vh, 1100px);
  min-height: 880px;
  border: 0;
  background: var(--bg-card);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 30px;
  padding: 24px max(22px, calc((100vw - 1120px) / 2));
  border-top: 1px solid var(--rule);
  color: var(--ink-muted);
}

.site-footer span {
  color: var(--ink);
  font-weight: 800;
}

.api-hero {
  padding: 58px 0 24px;
}

.api-hero p {
  max-width: 780px;
  color: var(--ink-muted);
}

.api-hero pre {
  max-width: 560px;
  margin-top: 20px;
}

.api-reference-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0 60px;
}

.api-tree {
  position: sticky;
  top: 68px;
  align-self: start;
  max-height: calc(100vh - 90px);
  overflow: auto;
  padding: 14px;
}

.api-tree-title {
  margin-bottom: 10px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.api-tree details {
  border-top: 1px solid var(--rule);
  padding: 8px 0;
}

.api-tree details:first-of-type {
  border-top: 0;
}

.api-tree summary {
  cursor: pointer;
  font-weight: 800;
}

.api-tree a {
  display: block;
  padding: 5px 0 5px 16px;
  color: var(--ink-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.api-tree a:hover {
  color: var(--accent-forest);
}

.api-tree .type-link {
  color: var(--ink);
  font-weight: 760;
}

.api-tree .member-link {
  padding-left: 30px;
  color: var(--ink-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
}

.api-reference-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.api-member {
  min-width: 0;
  padding: 22px;
}

.api-member h2 {
  font-size: 28px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.member-kind {
  margin-bottom: 6px;
  color: var(--accent-forest) !important;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.member-table {
  width: 100%;
  margin-top: 14px;
  table-layout: fixed;
  border-collapse: collapse;
}

.member-table th,
.member-table td {
  padding: 10px 8px;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.member-table th:first-child,
.member-table td:first-child {
  width: 38%;
}

.member-table code {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .hero-grid,
  .diagram-grid,
  .card-grid.four,
  .quick-row,
  .two-col,
  .code-strip,
  .code-grid,
  .capability-list div,
  .comparison-list article,
  .use-case-list article,
  .summary-list.grid,
  .preview-card-grid,
  .api-reference-layout {
    grid-template-columns: 1fr;
  }

  .api-tree {
    position: static;
    max-height: none;
  }

  .quick-row {
    grid-template-columns: 1fr;
  }

  .matrix-grid {
    grid-template-columns: 70px repeat(4, minmax(0, 1fr));
    padding: 8px;
  }

  .matrix-grid .mx-cell {
    padding: 6px 2px;
  }

  .matrix-grid .mx-cell .mx-ratio { font-size: 12px; }
  .matrix-grid .mx-cell .mx-hint { font-size: 9px; }

  .axis-row,
  .measure-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

/* Burger button — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
}

@media (max-width: 760px) {
  .site-header {
    position: sticky;
    top: 0;
    bottom: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 56px;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    overflow: visible;
  }

  .brand {
    width: auto;
    padding: 0;
    border-bottom: 0;
  }

  .brand img {
    width: 130px;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--ink);
    cursor: pointer;
  }

  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 14px;
    left: auto;
    z-index: 19;
    width: min(360px, calc(100vw - 28px));
    max-height: calc(100dvh - 74px);
    margin-top: 0;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-card) 92%, white);
    box-shadow: 0 18px 42px color-mix(in srgb, var(--ink) 18%, transparent);
  }

  .site-header.nav-open .nav {
    display: grid;
    gap: 10px;
  }

  .nav-section {
    display: grid;
    gap: 3px;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--rule) 82%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-panel) 52%, transparent);
  }

  .nav-section:has(.nav-sub-item) {
    gap: 0;
  }

  .nav-title {
    display: block;
    padding: 2px 8px 4px;
  }

  .nav a {
    min-height: 40px;
    padding: 9px 10px;
    border-left: 0;
    border-radius: 6px;
    background: transparent;
  }

  .nav a.nav-sub-item {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px 9px 24px;
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-card) 58%, transparent);
  }

  .nav a.active {
    border-bottom: 0;
    background: color-mix(in srgb, var(--accent-forest) 12%, var(--bg-card));
    box-shadow: inset 3px 0 0 var(--accent-forest);
  }

  main,
  .site-footer {
    margin-left: 0;
  }

  .content-header {
    justify-content: flex-start;
  }

  .page-hero,
  .doc-section,
  .api-hero,
  .api-reference-layout {
    width: min(1120px, calc(100% - 28px));
  }

  .page-hero {
    padding-top: 38px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 25px;
  }

  .install-card h2,
  .diagram-card h3,
  .card-grid article h3,
  .code-grid article h3,
  .wide-example h3,
  .comparison-list article h3 {
    font-size: 17px;
  }

  .hero-grid .install-card {
    display: none;
  }

  .state-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .mini-graph {
    grid-template-columns: 86px minmax(0, 1fr);
    row-gap: 34px;
    padding: 18px 16px 30px;
  }

  .install-card-header {
    padding-right: 0;
  }

  .install-card-header .language-control {
    position: static;
    margin-top: 10px;
  }

  .use-case-list article {
    padding: 20px;
  }

  .graph-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .mini-track .bar[data-label]::after {
    font-size: 9px;
  }

  .visualiser-frame iframe {
    min-height: 760px;
    height: 760px;
  }

  .api-member {
    padding: 18px;
  }

  .api-member h2 {
    font-size: 24px;
  }

  .member-table th:first-child,
  .member-table td:first-child {
    width: auto;
  }

  .member-table,
  .member-table tbody,
  .member-table tr,
  .member-table th,
  .member-table td {
    display: block;
    width: 100%;
  }

  .member-table tr {
    border-top: 1px solid var(--rule);
    padding: 8px 0;
  }

  .member-table th,
  .member-table td {
    border-top: 0;
    padding: 4px 0;
  }
}
