/* ────────────────────────────────────────────────────────────────
   mcp-data-platform / docs · txn2 design system
   Ported from sister project mcp-datahub, which ports txn2/www's
   site.css plus the MkDocs Material chrome re-skin.
   See DESIGN.md for the canonical source and update workflow.
   ─────────────────────────────────────────────────────────────── */

/* Typography and metrics are scheme-independent; only colour has two schemes. */
:root {
  /* --serif carries the DISPLAY face used for headings. The direction
     moved off serif to a technical mono; the token name is kept so the
     shared txn2 design system stays parity-mapped across sister repos. */
  --serif:      "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans:       "Geist", -apple-system, "Helvetica Neue", sans-serif;
  --mono:       "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure:    64ch;
  --rail-h:     56px;
  --gutter:     clamp(20px, 4vw, 64px);

  /* The light scheme's ground, named here because it is needed in two rules:
     the light token block, and <html> itself, which carries no scheme
     attribute of its own. */
  --ground-light: #FBFCFD;
}

/* ──────────────────────────────────────────────────────────────
   COLOUR TOKENS · two schemes

   Every colour in this file resolves through the tokens below, so a scheme
   is defined once here instead of being duplicated across the rules that
   follow. The names carry the dark scheme this system was designed in, and
   keep their ROLE in both: --ink is always the page ground and --paper
   always the primary foreground, whichever way round the two sit.

   Material stamps data-md-color-scheme on <body>, not <html>. The dark set
   therefore also sits on bare :root — that is what the <html> element itself
   reads, and it is the fallback if the palette ever loses its toggle. A
   separate :has() rule below repaints <html> for the light scheme so an
   overscroll past the body does not expose a dark strip under a light page.
   Each of these is its own rule on purpose: one unsupported pseudo-class
   invalidates an entire selector list, so pairing :has() with the plain
   attribute selector would take the plain one down with it on an engine
   without :has() and leave every token undefined.
   ────────────────────────────────────────────────────────────── */

:root,
[data-md-color-scheme="slate"] {
  /* Graphite grey ground — lifted off near-black so it reads as grey, not black. */
  --ink:        #1E232A;
  --ink-2:      #262C34;
  --ink-3:      #2F3640;
  --rule:       #3A424C;
  --rule-2:     #47515C;

  /* Cool light foreground — replaces the cream "paper". */
  --paper:      #EDF1F5;
  --paper-dim:  #C4CCD4;
  --mute:       #8A95A0;
  --mute-2:     #5C6670;

  /* Single restrained accent (cyan) + code-syntax hues. --signal-rgb is the
     same colour as --signal, as bare channels, for the rgba() washes that
     need an alpha the token cannot carry. */
  --signal:     #4FC7E6;
  --signal-rgb: 79,199,230;
  --signal-2:   #7FD6EC;
  --acid:       #9BCB86;
  --cool:       #8FB6D6;

  /* Depth cues. On a dark ground light lifts a surface and the vignette is
     black; on a light ground both invert, so they are tokens, not literals. */
  --tint:        rgba(255,255,255,0.02);
  --vignette:    rgba(0,0,0,0.14);
  /* Translucent chrome (sticky rail, clipboard button, mermaid controls) is
     a scrim a shade past the ground, so it inverts with the scheme. Bare
     channels, because each site picks its own alpha. */
  --glass-rgb:   13,15,18;
  --grid-line:   rgba(199,204,212,0.04);
  --grain:       .08;
  --shadow-lg:   0 12px 36px rgba(0,0,0,0.4);
  --shadow-drop: 0 4px 24px rgba(0,0,0,0.5);
}

[data-md-color-scheme="default"] {
  /* Cool near-white ground, the same graphite family read from the top. */
  --ink:        var(--ground-light);
  --ink-2:      #F1F4F7;
  --ink-3:      #E4EAF0;
  --rule:       #D6DEE6;
  --rule-2:     #B9C4CF;

  /* Graphite foreground, contrast falling away from the ground in the same
     four steps the dark scheme uses. */
  --paper:      #1B2027;
  --paper-dim:  #39434E;
  --mute:       #667180;
  --mute-2:     #97A2AF;

  /* The accent darkens rather than brightens: the dark scheme's cyan is
     ~1.9:1 on white and unreadable as link text. --signal-2 stays the
     emphasis/hover variant, which on a light ground means darker still. */
  --signal:     #0E7490;
  --signal-rgb: 14,116,144;
  --signal-2:   #095A72;
  --acid:       #3F6B27;
  --cool:       #2F6491;

  --tint:        rgba(15,23,32,0.05);
  --vignette:    rgba(15,23,32,0.05);
  --glass-rgb:   250,251,252;
  --grid-line:   rgba(27,32,39,0.05);
  --grain:       .035;
  --shadow-lg:   0 12px 36px rgba(15,23,32,0.12);
  --shadow-drop: 0 4px 24px rgba(15,23,32,0.18);
}

/* <html> is outside the scheme attribute, so it keeps the dark ground unless
   it is repainted here. Its own rule: see the note above. Without :has() the
   only cost is the strip behind an overscroll on a light page. */
:root:has(> body[data-md-color-scheme="default"]) { background: var(--ground-light); }

/* ──────────────────────────────────────────────────────────────
   MATERIAL VARIABLE OVERRIDES
   One block for both schemes: it resolves through the colour tokens above,
   which are already scheme-aware. These re-skin every inner doc page.
   ────────────────────────────────────────────────────────────── */

[data-md-color-scheme="slate"],
[data-md-color-scheme="default"] {
  --md-default-bg-color:           var(--ink);
  --md-default-bg-color--light:    var(--ink-2);
  --md-default-bg-color--lighter:  var(--ink-3);
  --md-default-bg-color--lightest: var(--tint);

  --md-default-fg-color:           var(--paper);
  --md-default-fg-color--light:    var(--paper-dim);
  --md-default-fg-color--lighter:  var(--mute);
  --md-default-fg-color--lightest: var(--mute-2);

  --md-primary-fg-color:           var(--ink-2);
  --md-primary-fg-color--light:    var(--ink-3);
  --md-primary-fg-color--dark:     var(--ink);
  --md-primary-bg-color:           var(--paper);
  --md-primary-bg-color--light:    var(--paper-dim);

  --md-accent-fg-color:            var(--signal);
  --md-accent-fg-color--transparent: rgba(var(--signal-rgb),0.10);
  --md-accent-bg-color:            var(--ink);
  --md-accent-bg-color--light:     var(--ink-2);

  --md-typeset-color:              var(--paper);
  --md-typeset-a-color:            var(--signal);
  --md-typeset-mark-color:         rgba(var(--signal-rgb),0.25);
  --md-typeset-kbd-color:          var(--ink-3);
  --md-typeset-kbd-accent-color:   var(--rule-2);
  --md-typeset-kbd-border-color:   var(--rule);

  --md-code-bg-color:              var(--ink-2);
  --md-code-fg-color:              var(--paper);
  --md-code-hl-color:              rgba(var(--signal-rgb),0.15);
  --md-code-hl-color--light:       rgba(var(--signal-rgb),0.08);
  --md-code-hl-name-color:         var(--paper);
  --md-code-hl-keyword-color:      var(--signal);
  --md-code-hl-string-color:       var(--acid);
  --md-code-hl-number-color:       var(--cool);
  --md-code-hl-comment-color:      var(--mute);
  --md-code-hl-special-color:      var(--signal-2);
  --md-code-hl-function-color:     var(--paper);
  --md-code-hl-constant-color:     var(--cool);
  --md-code-hl-operator-color:     var(--paper-dim);
  --md-code-hl-punctuation-color:  var(--paper-dim);

  --md-text-font:                  var(--sans);
  --md-code-font:                  var(--mono);

  --md-footer-bg-color:            var(--ink-2);
  --md-footer-bg-color--dark:      var(--ink);
  --md-footer-fg-color:            var(--paper);
  --md-footer-fg-color--light:     var(--paper-dim);
  --md-footer-fg-color--lighter:   var(--mute);

  --md-shadow-z1: 0 1px 0 var(--tint);
  --md-shadow-z2: 0 1px 0 var(--tint);
  --md-shadow-z3: 0 1px 0 var(--tint);

  /* Mermaid theme variables consumed by MkDocs Material's
     Mermaid integration. Mirrors the txn2 DESIGN.md Mermaid block. */
  --md-mermaid-font-family:                 var(--mono);
  --md-mermaid-edge-color:                  var(--mute);
  --md-mermaid-node-bg-color:               var(--ink-3);
  --md-mermaid-node-fg-color:               var(--paper);
  --md-mermaid-label-bg-color:              var(--ink-3);
  --md-mermaid-label-fg-color:              var(--paper);
  --md-mermaid-sequence-actor-bg-color:     var(--ink-3);
  --md-mermaid-sequence-actor-fg-color:     var(--paper);
  --md-mermaid-sequence-actor-border-color: var(--rule-2);
  --md-mermaid-sequence-actor-line-color:   var(--rule-2);
  --md-mermaid-sequence-actorman-bg-color:  var(--ink-3);
  --md-mermaid-sequence-actorman-line-color: var(--mute);
  --md-mermaid-sequence-box-bg-color:       var(--ink-2);
  --md-mermaid-sequence-box-fg-color:       var(--paper);
  --md-mermaid-sequence-label-bg-color:     var(--ink-2);
  --md-mermaid-sequence-label-fg-color:     var(--mute);
  --md-mermaid-sequence-loop-bg-color:      var(--ink-2);
  --md-mermaid-sequence-loop-fg-color:      var(--paper);
  --md-mermaid-sequence-loop-border-color:  var(--rule-2);
  --md-mermaid-sequence-message-fg-color:   var(--paper-dim);
  --md-mermaid-sequence-message-line-color: var(--mute);
  /* Soft filled label, not a hard-bordered box: mermaid under-sizes note
     rects (text can exceed the rect by ~20px), and a crisp cyan border makes
     that overflow read as broken. Border matches the fill so there is no hard
     edge for text to cross. */
  --md-mermaid-sequence-note-bg-color:      var(--ink-3);
  --md-mermaid-sequence-note-fg-color:      var(--paper);
  --md-mermaid-sequence-note-border-color:  var(--ink-3);
  --md-mermaid-sequence-number-bg-color:    var(--signal);
  --md-mermaid-sequence-number-fg-color:    var(--ink);
}

/* ──────────────────────────────────────────────────────────────
   GLOBAL BASE
   ────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body, .md-container, .md-main {
  background: var(--ink);
}

body {
  font-family: var(--sans);
  color: var(--paper);
  font-feature-settings: "ss01", "ss02", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--signal); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

img { max-width: 100%; display: block; }

em.serif { font-family: var(--serif); font-style: normal; font-weight: 500; }

/* Skip-to-content link */
.skiplink {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 200;
  background: var(--signal);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  transition: top .15s ease;
}
.skiplink:focus,
.skiplink:focus-visible {
  top: 12px;
  color: var(--ink);
  outline: 2px solid var(--paper);
  outline-offset: 2px;
}

/* ──────────────────────────────────────────────────────────────
   FILM GRAIN + VIGNETTE / fixed viewport overlays, page-wide
   z-index 1: above the page background, below the rail (z 50),
   skiplink (z 200), and any interactive Material chrome. The
   grain uses overlay blend so it stays subtle even over text;
   the vignette only dims the corners.
   ────────────────────────────────────────────────────────────── */

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
body::before {
  opacity: var(--grain);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(/asset?u=https%3A%2F%2Fmcp-data-platform.txn2.com%2Fstylesheets%2F%2523n)'/></svg>");
}
body::after {
  background: radial-gradient(ellipse at center, transparent 65%, var(--vignette) 100%);
}

/* Flat cool gradient behind the canvas — no colored glow. */
.md-container,
.page--home {
  background-image:
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
}

/* ──────────────────────────────────────────────────────────────
   HOMEPAGE PAGE WRAPPER & BLUEPRINT
   ────────────────────────────────────────────────────────────── */

.page--home {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--paper);
}

.blueprint {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.blueprint__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(180deg, transparent, black 12%, black 88%, transparent);
          mask-image: linear-gradient(180deg, transparent, black 12%, black 88%, transparent);
}
.blueprint__crosshair { position: absolute; width: 28px; height: 28px; }
.blueprint__crosshair span { position: absolute; background: var(--mute-2); }
.blueprint__crosshair span:nth-child(1) { top: 50%; left: 0; right: 0; height: 1px; }
.blueprint__crosshair span:nth-child(2) { left: 50%; top: 0; bottom: 0; width: 1px; }
.blueprint__crosshair--tl { top: 24px; left: 24px; }
.blueprint__crosshair--tr { top: 24px; right: 24px; }
.blueprint__crosshair--bl { bottom: 24px; left: 24px; }
.blueprint__crosshair--br { bottom: 24px; right: 24px; }

/* ──────────────────────────────────────────────────────────────
   TOP RAIL (replaces Material header on homepage)
   ────────────────────────────────────────────────────────────── */

.md-header.rail,
header.rail {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px var(--gutter);
  background: rgba(var(--glass-rgb),0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  box-shadow: none;
  height: auto;
  color: var(--paper);
}
header.rail a { color: inherit; text-decoration: none; }
a.rail__brand,
.rail__brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  color: inherit;
}
a.rail__brand:hover .rail__name { color: var(--signal); }
a.rail__brand:hover .rail__sub  { color: var(--paper-dim); }
a.rail__brand:focus-visible { outline-offset: 4px; }
.rail__nav a[aria-current="page"] { color: var(--signal); font-weight: 700; }
.rail__mark {
  display: inline-flex;
  width: 20px;
  height: 20px;
  transform: translateY(-1px);
  animation: spin 24s linear infinite;
}
.rail__mark svg { width: 100%; height: 100%; display: block; }
.rail__mark__ring { fill: var(--paper-dim); }
.rail__mark__sq   { fill: var(--signal); }
.rail__name {
  font-family: var(--mono);
  font-style: normal;
  font-size: 15px;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  color: var(--paper);
  font-weight: 600;
}
.rail__sep { color: var(--rule-2); }
.rail__sub { color: var(--mute); }

.rail__meta {
  justify-self: center;
  color: var(--mute);
  display: flex; gap: 12px; align-items: center;
}
.rail__meta .rail__dot { color: var(--rule-2); font-size: 8px; }
.rail__rel {
  color: var(--signal);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rail__org {
  color: var(--paper-dim);
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.rail__org em.serif {
  color: var(--paper);
  font-style: normal;
  font-family: var(--serif);
}
.rail__org:hover { color: var(--signal); border-bottom-color: var(--signal); }
.rail__org:hover em.serif { color: var(--signal); }

.rail__nav {
  justify-self: end;
  display: flex; gap: 22px; align-items: center;
}
.rail__nav a { color: var(--paper-dim); transition: color .2s; }
.rail__nav a:hover { color: var(--signal); }
.rail__cta {
  color: var(--ink) !important;
  background: var(--signal);
  padding: 6px 12px;
  border-radius: 2px;
  font-weight: 700;
}
.rail__cta:hover { background: var(--signal-2) !important; color: var(--ink) !important; }

@keyframes spin { from { transform: rotate(0deg) translateY(-1px); } to { transform: rotate(360deg) translateY(-1px); } }

@media (max-width: 1080px) {
  header.rail { grid-template-columns: 1fr auto; gap: 16px; }
  .rail__meta { display: none; }
}
@media (max-width: 720px) {
  .rail__sep, .rail__sub { display: none; }
  .rail__nav { gap: 16px; }
}
@media (max-width: 540px) {
  header.rail { padding: 12px 16px; gap: 10px; }
  .rail__brand { gap: 6px; min-width: 0; }
  .rail__name { font-size: 14px; }
  .rail__mark { width: 17px; height: 17px; }
  .rail__nav { gap: 12px; font-size: 11px; }
  .rail__cta { padding: 5px 8px; }
}
@media (max-width: 380px) {
  .rail__nav a:not(.rail__cta) { display: none; }
}

/* Rail search + drawer controls.
   The labels reuse Material's .md-header__button so Material's responsive
   show/hide (menu icon below the sidebar breakpoint, search box vs. magnify
   icon by viewport) applies automatically; we only retint them for the rail. */
.rail__nav .rail__icon.md-header__button {
  color: var(--paper-dim);
  margin: 0;
  padding: 4px;
  height: auto;
  line-height: 0;
}
.rail__nav .rail__icon.md-header__button:hover { color: var(--signal); }
.rail__nav .rail__icon.md-header__button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}
/* Keep the inline search box from stretching the rail's nav cell. */
.rail__nav .md-search { display: flex; align-items: center; }
.rail__nav .md-search__form { background: var(--ink); }

/* Palette toggle (light / dark).
   partials/palette.html renders one radio per scheme plus a label per
   toggle, and Material's bundle unhides the label for the scheme that is
   NOT active — so exactly one icon shows and clicking it advances to the
   next scheme. The form is a bare flex item here; only the label needs the
   rail's icon treatment, which it gets by reusing the same declarations as
   the search and drawer controls. */
.rail__nav [data-md-component="palette"] {
  display: flex;
  align-items: center;
}
.rail__nav [data-md-component="palette"] > label.md-header__button {
  color: var(--paper-dim);
  margin: 0;
  padding: 4px;
  height: auto;
  line-height: 0;
  cursor: pointer;
}
.rail__nav [data-md-component="palette"] > label.md-header__button:hover { color: var(--signal); }
.rail__nav [data-md-component="palette"] > label.md-header__button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

/* ──────────────────────────────────────────────────────────────
   HERO
   All rules scoped under .page--home so component classes never
   leak into Material-rendered inner pages.
   ────────────────────────────────────────────────────────────── */

.page--home .hero {
  position: relative;
  padding: clamp(60px, 12vh, 140px) var(--gutter) clamp(80px, 14vh, 160px);
  max-width: 1500px;
  margin: 0 auto;
}

.page--home .hero__stamp {
  position: absolute;
  top: clamp(40px, 8vh, 90px);
  right: var(--gutter);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: right;
  border-right: 1px solid var(--signal);
  padding-right: 14px;
  animation: rise 1.1s .1s both ease-out;
  z-index: 2;
}
.page--home .hero__stamp__line { line-height: 1.7; }
.page--home .hero__stamp__line--ok { color: var(--signal); }

/* Hero main: symbol mark on the left, typographic display on the right.
   The symbol is a large unboxed glyph that visually anchors the hero.
   The accent path (orange platform hub) pulses on a slow breath. */
.page--home .hero__main {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  margin-bottom: 56px;
  animation: rise 1.1s .15s both ease-out;
}
.page--home .hero__mark {
  display: block;
  width: clamp(144px, 20vw, 288px);
  height: clamp(144px, 20vw, 288px);
  flex: 0 0 auto;
  text-decoration: none;
  transition: transform .45s ease;
}
.page--home .hero__mark:hover { transform: rotate(-8deg) scale(1.03); }
.page--home .hero__mark:focus-visible { outline-offset: 6px; }
.page--home .hero__mark__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.page--home .hero__mark__path--base   { fill: var(--paper); }
.page--home .hero__mark__path--accent {
  fill: var(--signal);
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: mark-breath 6s ease-in-out infinite;
}
.page--home .hero__mark:hover .hero__mark__path--accent {
  animation-duration: 2.2s;
}

/* The mcp-data-platform accent is an offset square (bottom-right quadrant),
   not a centered disc. transform-origin defaults to its own bounding box
   centroid via transform-box: fill-box, so the breath scales in place. */
@keyframes mark-breath {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.page--home .hero__display {
  /* Hug the title to its own width (do not grow to fill the row) so the
     right-pinned hero__stamp keeps a clear gutter instead of colliding with
     the display type on wide screens. */
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--serif);
  font-weight: 500;
  /* Mono display runs ~1.5x wider than the former optical serif, so the
     17-character name overflowed at the old 100px ceiling. Cap lower to keep
     row 1 on a single line beside the left mark and the right hero__stamp. */
  font-size: clamp(24px, 3.4vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
}
.page--home .hero__row--1 em.serif,
.page--home .hero__row--3 em.serif { white-space: nowrap; }
.page--home .hero__row {
  display: flex; align-items: baseline; gap: clamp(12px, 2vw, 36px);
  flex-wrap: wrap;
}
.page--home .hero__row--1 { animation: rise 1.1s .25s both ease-out; }
.page--home .hero__row--2 { animation: rise 1.1s .4s both ease-out; }
.page--home .hero__row--3 { animation: rise 1.1s .55s both ease-out; }
.page--home .hero__row em.serif {
  font-style: normal;
  color: var(--paper);
}
.page--home .outline {
  -webkit-text-stroke: 1.5px var(--paper);
  color: transparent;
  font-style: normal;
  font-weight: 400;
  font-family: var(--serif);
}
.page--home .hero__chip {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--mute);
  background: var(--ink-3);
  border: 1px solid var(--rule);
  padding: 6px 12px;
  border-radius: 2px;
  text-transform: uppercase;
  align-self: center;
  transform: translateY(-12px);
  white-space: nowrap;
}

.page--home .hero__intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 5vw, 80px);
  max-width: 1200px;
  margin-left: auto;
  margin-right: 0;
  margin-top: 48px;
  padding-left: clamp(20px, 14vw, 240px);
  animation: rise 1.1s .8s both ease-out;
}
.page--home .hero__lede {
  font-size: clamp(15px, 1.1vw, 18px);
  line-height: 1.6;
  color: var(--paper-dim);
  max-width: 48ch;
}
.page--home .hero__lede strong { color: var(--paper); font-weight: 600; }
.page--home .hero__lede a { color: var(--signal); border-bottom: 1px solid var(--rule); }
.page--home .hero__lede a:hover { color: var(--signal-2); border-color: var(--signal-2); }
.page--home .hero__lede code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--signal-2);
  background: rgba(var(--signal-rgb),0.08);
  border-radius: 2px;
  padding: 1px 5px;
}
.page--home .hero__lede--muted { color: var(--mute); }

/* Hero sponsor block. Sits under the two ledes, inside the hero so the
   sponsors and the hosted offering are the first things read after the
   pitch rather than being buried in the coda. Shares the hero__intro
   left inset so it lines up with the lede columns above it. */
.page--home .hero__sponsor {
  max-width: 1200px;
  margin: 28px 0 0 auto;
  padding-left: clamp(20px, 14vw, 240px);
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  animation: rise 1.1s 1s both ease-out;
}
.page--home .hero__sponsor__line {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}
.page--home .hero__sponsor__line a { color: var(--paper-dim); }
.page--home .hero__sponsor__line a:hover { color: var(--signal); }
.page--home .hero__sponsor__hosted {
  margin-top: 8px;
  font-size: clamp(14px, 1vw, 16px);
  line-height: 1.6;
  color: var(--paper-dim);
  max-width: 62ch;
}
.page--home .hero__sponsor__hosted a {
  color: var(--signal);
  border-bottom: 1px solid var(--rule);
}
.page--home .hero__sponsor__hosted a:hover { color: var(--signal-2); border-color: var(--signal-2); }

@media (max-width: 760px) {
  .page--home .hero__sponsor { padding-left: 0; }
}


@media (max-width: 880px) {
  .page--home .hero__main {
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
  }
  .page--home .hero__mark { width: clamp(108px, 25vw, 180px); height: clamp(108px, 25vw, 180px); }
}

@media (max-width: 760px) {
  .page--home .hero__stamp {
    position: static; text-align: left;
    border-right: 0;
    border-left: 1px solid var(--signal);
    padding-right: 0; padding-left: 14px;
    margin-bottom: 36px;
  }
  .page--home .hero__intro { grid-template-columns: 1fr; padding-left: 0; }
  .page--home .hero__chip { display: none; }
}

/* Ticker */
.page--home .hero__ticker {
  margin-top: 80px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 14px 0;
  overflow: hidden;
  position: relative;
  animation: rise 1.1s 1s both ease-out;
}
.page--home .ticker { overflow: hidden; }
.page--home .ticker__track {
  display: flex; gap: 30px;
  white-space: nowrap;
  animation: ticker 60s linear infinite;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--mute);
  text-transform: lowercase;
}
.page--home .ticker__track span { color: var(--paper-dim); }
.page--home .ticker__track span:nth-child(even) { color: var(--signal); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────────────────────
   GENERIC SECTION
   ────────────────────────────────────────────────────────────── */

.page--home .section {
  position: relative;
  padding: clamp(64px, 11vh, 130px) var(--gutter);
  max-width: 1500px;
  margin: 0 auto;
}

.page--home .section__head {
  max-width: 1100px;
  margin-bottom: 64px;
}
.page--home .section__index {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.page--home .section__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 3.8vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--paper);
  margin-bottom: 24px;
}
.page--home .section__title em.serif { color: var(--signal); font-style: normal; }
.page--home .section__lede {
  color: var(--paper-dim);
  max-width: 64ch;
  font-size: 17px;
  line-height: 1.6;
}
.page--home .section__lede code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--signal-2);
  background: rgba(var(--signal-rgb),0.08);
  border-radius: 2px;
  padding: 1px 5px;
}

/* ──────────────────────────────────────────────────────────────
   FLAGSHIP CARDS
   ────────────────────────────────────────────────────────────── */

.page--home .flagship {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 980px) {
  .page--home .flagship { grid-template-columns: 1fr; }
}

.page--home .flagship__card {
  position: relative;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 36px 36px 28px;
  overflow: hidden;
  transition: border-color .35s ease, transform .35s ease;
}
.page--home .flagship__card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 56px; height: 1px;
  background: var(--signal);
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.page--home .flagship__card:hover { border-color: var(--rule-2); transform: translateY(-3px); }
.page--home .flagship__card:hover::before { width: 100%; }

.page--home .flagship__head { margin-bottom: 18px; }
.page--home .flagship__id {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 14px;
}
.page--home .flagship__url {
  color: var(--signal);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, color .2s;
  text-transform: lowercase;
  letter-spacing: 0.06em;
}
.page--home .flagship__url:hover { color: var(--signal-2); border-bottom-color: var(--signal-2); }
.page--home .flagship__name {
  font-family: var(--serif);
  font-weight: 600;
  font-style: normal;
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--paper);
  margin-bottom: 12px;
}
.page--home .flagship__tag {
  font-family: var(--sans);
  color: var(--paper-dim);
  font-size: 18px;
  line-height: 1.4;
  max-width: 40ch;
}
.page--home .flagship__tag code {
  font-size: .92em;
  color: var(--signal);
  background: rgba(var(--signal-rgb),0.08);
  padding: 1px 6px;
  border-radius: 2px;
}
.page--home .flagship__body p {
  color: var(--paper-dim);
  line-height: 1.6;
  margin: 18px 0 26px;
  max-width: 52ch;
  font-size: 15.5px;
}
.page--home .flagship__body code {
  color: var(--signal-2);
  background: rgba(var(--signal-rgb),0.07);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: .9em;
  font-family: var(--mono);
}
.page--home .flagship__body em.serif { color: var(--paper); }

.page--home .flagship__demo { margin: 8px 0 28px; }

.page--home .flagship__foot {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding-top: 22px;
  border-top: 1px dashed var(--rule);
}

.page--home .flagship__card--server { background: var(--ink-2); }
.page--home .flagship__card--lib {
  background:
    linear-gradient(135deg, rgba(var(--signal-rgb),0.025), transparent 60%),
    var(--ink-2);
}

/* Terminal (homepage demo block; .terminal is a common name so scope it).
   Deliberately dark in BOTH schemes -- a terminal is a terminal -- so its
   ground is a literal, and therefore EVERY colour on it has to be one too.
   These --term-* values are the dark scheme's own, pinned here rather than
   inherited: read through the scheme tokens, the light scheme dropped the
   body text to #39434E on #0A0A07, which is 1.97:1 and unreadable. Anything
   added to this block takes a --term-* value, never a scheme token. */
.page--home .terminal {
  --term-fg:     #C4CCD4;
  --term-mute:   #8A95A0;
  --term-signal: #4FC7E6;
  --term-ok:     #9BCB86;
  --term-rule:   #3A424C;
  background: #0A0A07;
  border: 1px solid var(--term-rule);
  border-radius: 4px;
  overflow: hidden;
  font-family: var(--mono);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,0.02);
}
.page--home .terminal__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: linear-gradient(180deg, #161410, #0E0D0A);
  border-bottom: 1px solid var(--term-rule);
  position: relative;
}
.page--home .terminal__bar span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2A2A22;
}
.page--home .terminal__bar span:nth-child(1) { background: #FF5F56; }
.page--home .terminal__bar span:nth-child(2) { background: #FFBD2E; }
.page--home .terminal__bar span:nth-child(3) { background: #27C93F; }
.page--home .terminal__bar em {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-style: normal;
  font-size: 11px;
  color: var(--term-mute);
  letter-spacing: 0.04em;
  font-family: var(--mono);
}
.page--home .terminal__body {
  padding: 18px 18px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--term-fg);
  white-space: pre;
  overflow-x: auto;
  margin: 0;
  background: transparent;
}
.page--home .t-prompt { color: var(--term-signal); margin-right: 8px; }
.page--home .t-ok     { color: var(--term-ok); }
.page--home .t-mute   { color: var(--term-mute); }

/* ──────────────────────────────────────────────────────────────
   ARCHITECTURE SCHEMA (mermaid composition diagram on homepage)
   ────────────────────────────────────────────────────────────── */

.page--home .schema {
  margin-top: 12px;
  padding: 28px;
  background: var(--ink-3);
  border: 1px dashed var(--rule);
  border-radius: 2px;
}
.page--home .schema__title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 18px;
}
.page--home .schema .mermaid {
  background: transparent;
  border: 0;
  padding: 0;
  text-align: center;
  font-family: var(--mono);
  overflow-x: auto;
}
.page--home .schema .mermaid svg { max-width: 100%; height: auto; display: inline-block; }

/* ──────────────────────────────────────────────────────────────
   STACK LIST (features list, hover-shifts)
   ────────────────────────────────────────────────────────────── */

.page--home .stack {
  list-style: none;
  border-top: 1px solid var(--rule);
  margin: 0;
  padding: 0;
}
.page--home .stack__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 24px 8px;
  border-bottom: 1px solid var(--rule);
  transition: background .25s, padding .25s;
  cursor: default;
}
.page--home .stack__row:hover {
  background: var(--ink-2);
  padding-left: 22px;
  padding-right: 22px;
}
.page--home .stack__row:hover .stack__name { color: var(--signal); }
.page--home .stack__row:hover .stack__year { color: var(--signal); transform: translateX(4px); }
.page--home .stack__name {
  display: block;
  font-family: var(--serif);
  font-style: normal;
  font-weight: 600;
  font-size: clamp(22px, 2.2vw, 30px);
  color: var(--paper);
  line-height: 1.1;
  transition: color .25s;
  margin-bottom: 6px;
  text-decoration: none;
}
.page--home .stack__desc {
  color: var(--paper-dim);
  font-size: 14.5px;
  max-width: 70ch;
  line-height: 1.5;
}
.page--home .stack__desc code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--signal-2);
  background: rgba(var(--signal-rgb),0.08);
  border-radius: 2px;
  padding: 1px 5px;
}
.page--home .stack__year {
  font-family: var(--mono);
  color: var(--mute);
  text-align: right;
  transition: transform .25s, color .25s;
  font-size: 18px;
}
.page--home .stack__row--more .stack__name {
  font-style: normal;
  font-family: var(--sans);
  font-size: 18px;
  color: var(--paper-dim);
}

@media (max-width: 760px) {
  .page--home .stack__row { grid-template-columns: 1fr auto; }
}

/* ──────────────────────────────────────────────────────────────
   CODA
   ────────────────────────────────────────────────────────────── */

.page--home .section--coda { padding-top: 80px; padding-bottom: 140px; }
.page--home .coda {
  max-width: 1000px;
  margin: 0 auto;
  text-align: left;
  border-left: 1px solid var(--signal);
  padding-left: clamp(28px, 5vw, 60px);
}
.page--home .coda__kicker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--mute);
  margin-bottom: 24px;
}
.page--home .coda__big {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(14px, 1.05vw, 16px);
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--paper);
  margin-bottom: 28px;
  max-width: 72ch;
}
.page--home .coda__big a { color: inherit; }
.page--home .coda__big em.serif { color: var(--signal); }
.page--home .coda__cta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 28px;
  border-top: 1px dashed var(--rule);
}

/* ──────────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────────── */

.page--home a.btn,
a.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--paper);
  padding: 12px 20px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: transparent;
  text-decoration: none;
  transition: all .25s ease;
  cursor: pointer;
  line-height: 1;
  font-weight: 700;
}
.page--home a.btn:hover,
a.btn:hover {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--paper);
}
.page--home a.btn--accent,
a.btn--accent {
  background: var(--signal);
  color: var(--ink);
  border-color: var(--signal);
}
.page--home a.btn--accent:hover,
a.btn--accent:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.page--home a.btn--big,
a.btn--big {
  font-size: 13px;
  padding: 18px 28px;
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
  font-weight: 700;
}
.page--home a.btn--big:hover,
a.btn--big:hover { background: var(--signal); color: var(--ink); border-color: var(--signal); }

a.btn:focus-visible { outline-offset: 4px; }

/* ──────────────────────────────────────────────────────────────
   HOMEPAGE FOOTER
   Renamed from .footer to .home-footer to avoid collision with
   any markdown that uses class="footer".
   ────────────────────────────────────────────────────────────── */

.home-footer {
  position: relative;
  z-index: 1;
  background: var(--ink);
  border-top: 1px solid var(--rule);
  padding: 60px var(--gutter) 28px;
  margin-top: 60px;
}
.home-footer__rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-2), transparent);
  margin-bottom: 50px;
}
.home-footer__inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1.1fr;
  gap: 32px;
  margin-bottom: 60px;
}
@media (max-width: 1180px) {
  .home-footer__inner { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 720px) {
  .home-footer__inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .home-footer__inner { grid-template-columns: 1fr; gap: 28px; }
}
.home-footer__col { min-width: 0; }
.home-footer__label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--signal);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.home-footer__text {
  color: var(--paper-dim);
  font-size: 14px;
  line-height: 1.55;
  max-width: 50ch;
  margin: 0;
}
.home-footer__text a {
  color: var(--paper);
  border-bottom: 1px solid var(--rule-2);
  text-decoration: none;
  transition: color .2s, border-color .2s;
}
.home-footer__text a:hover { color: var(--signal); border-color: var(--signal); }
.home-footer__links {
  list-style: none;
  font-family: var(--mono);
  font-size: 13px;
  margin: 0;
  padding: 0;
}
.home-footer__links li { padding: 4px 0; }
.home-footer__links a {
  color: var(--paper-dim);
  text-decoration: none;
  transition: color .2s;
}
.home-footer__links a:hover { color: var(--signal); }
.home-footer__links__sub {
  color: var(--mute);
  font-style: normal;
  font-family: var(--mono);
  font-size: 12.5px;
  margin-left: 4px;
}
.home-footer__col--meta .home-footer__mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  line-height: 1.7;
  margin: 0;
}
.home-footer__col--meta .dot { color: var(--rule-2); margin: 0 4px; }

.home-footer__base {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.04em;
}
.home-footer__base p { margin: 0; }
.home-footer__base__tag { color: var(--signal); }

/* ──────────────────────────────────────────────────────────────
   INNER PAGES / Material chrome restyle
   These rules apply to all non-homepage pages. They re-skin
   Material's components against the txn2 tokens.
   ────────────────────────────────────────────────────────────── */

/* Header (kept on inner pages, rail-styled) */
.md-header {
  background: rgba(var(--glass-rgb),0.86);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--rule);
  box-shadow: none !important;
  color: var(--paper);
}
.md-header[data-md-state="shadow"] { box-shadow: none; }
.md-header__title {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--paper);
}
.md-header__title .md-header__topic {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 600;
  color: var(--paper);
  transition: color .2s ease;
}
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  filter: brightness(1.05);
  transition: transform .25s ease, opacity .25s ease;
}
a.md-header__button.md-logo:hover img,
a.md-header__button.md-logo:hover svg { transform: rotate(8deg); opacity: 0.85; }
a.md-header__button.md-logo:hover ~ .md-header__title .md-header__topic,
.md-header__title a:hover .md-header__topic { color: var(--signal); }

/* Make the active tab visually loud so users can find Home from any page. */
.md-tabs__link[href="."],
.md-tabs__link[href="./"] {
  color: var(--signal);
  font-weight: 700;
}
.md-tabs__link[href="."]::before,
.md-tabs__link[href="./"]::before {
  content: "◐ ";
  color: var(--signal);
  margin-right: 4px;
}

/* Tabs */
.md-tabs {
  background: var(--ink);
  border-bottom: 1px solid var(--rule);
  color: var(--paper-dim);
}
.md-tabs__link {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  opacity: 1;
  color: var(--paper-dim);
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
}
.md-tabs__link:hover { color: var(--signal); }
.md-tabs__link--active { color: var(--signal); font-weight: 700; }

/* Search */
.md-search__form {
  background: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.md-search__form:hover { background: var(--ink-3); border-color: var(--rule-2); }
[data-md-toggle="search"]:checked ~ .md-header .md-search__form {
  background: var(--ink-3);
  border-color: var(--signal);
}
.md-search__input {
  font-family: var(--mono);
  color: var(--paper);
}
.md-search__input::placeholder { color: var(--mute); }
.md-search__icon { color: var(--mute); }
.md-search-result__meta {
  background: var(--ink-2);
  color: var(--mute);
  font-family: var(--mono);
  text-transform: lowercase;
  letter-spacing: 0.08em;
}
.md-search-result__article { background: var(--ink); }
.md-search-result__teaser { color: var(--paper-dim); }
.md-search-result__link:hover { background: var(--ink-2); }

/* Sidebar nav.
   The title is position:sticky (Material's own rule) and this override
   shrinks it to a single 11px line, so it must carry the sidebar's ground:
   left transparent, the nav items that scroll up behind it stayed visible
   through it and collided with the label. */
.md-nav__title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  background: var(--ink);
  padding-bottom: 10px;
  box-shadow: none;
}
.md-nav__link {
  color: var(--paper-dim);
  font-size: 14px;
  font-family: var(--sans);
}
.md-nav__link:hover { color: var(--signal); }
.md-nav__link--active,
.md-nav__link--active code { color: var(--signal) !important; font-weight: 700; }

.md-nav--secondary .md-nav__title {
  background: var(--ink);
  box-shadow: none;
  color: var(--mute);
}

/* Inner-page typography — headings in the technical mono display face,
   body in the sans. Non-italic: the direction moved off the italic serif. */
.md-content { background: transparent; color: var(--paper); }
.md-typeset { color: var(--paper); font-family: var(--sans); }

.md-typeset h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-style: normal;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--paper);
  margin: 0 0 0.6em;
}
.md-typeset h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-style: normal;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--paper);
  margin: 1.6em 0 0.5em;
}
/* h3 and h4 are usually subsections / technical labels.
   Use sans-serif so endpoint names and reference text stay readable. */
.md-typeset h3 {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 700;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--paper);
  margin: 1.6em 0 0.4em;
  padding-top: 0.4em;
  border-top: 1px solid var(--rule);
}
.md-typeset h3:first-of-type { border-top: 0; padding-top: 0; }

.md-typeset h4 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: -0.005em;
  margin: 1.4em 0 0.3em;
}
.md-typeset h5 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper);
}
.md-typeset h6 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
}

/* Headings that contain inline code switch to mono entirely so the
   technical reference reads as code, not as italic display text.
   :has() is supported in Firefox 121+ (Dec 2023) and Safari 15.4+. */
.md-typeset h1:has(code),
.md-typeset h2:has(code),
.md-typeset h3:has(code),
.md-typeset h4:has(code) {
  font-family: var(--mono);
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
  font-size: clamp(16px, 1.4vw, 20px);
}
.md-typeset h2:has(code) { font-size: clamp(20px, 1.8vw, 26px); }
.md-typeset h1:has(code) { font-size: clamp(24px, 2.2vw, 32px); }
.md-typeset h1:has(code) code,
.md-typeset h2:has(code) code,
.md-typeset h3:has(code) code,
.md-typeset h4:has(code) code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--signal);
  font-size: 1em;
}

/* Fallback for browsers without :has() support: code inside any heading
   gets the mono+signal treatment even if the heading itself stays in
   Fraunces. Less ideal but still readable. */
@supports not selector(:has(*)) {
  .md-typeset h1 code,
  .md-typeset h2 code,
  .md-typeset h3 code,
  .md-typeset h4 code {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--signal);
    font-family: var(--mono);
    font-weight: 700;
    font-style: normal;
    font-size: 0.92em;
  }
}

/* Image headings (banner-style h1 with embedded img). Strip default
   heading margins so the banner sits flush at the top of the page. */
.md-typeset h1:has(img) {
  margin: 0 0 0 0;
  padding: 0;
}
.md-typeset h1:has(img) .headerlink { display: none; }

/* Mermaid: container + a couple of element-level overrides for things
   Material's variables don't fully cover. */
.md-typeset .mermaid {
  background: var(--ink-3);
  border: 1px dashed var(--rule);
  border-radius: 2px;
  padding: 18px 20px;
  margin: 1.4em 0;
  font-family: var(--mono);
  text-align: center;
  overflow-x: auto;
}
.md-typeset .mermaid svg { max-width: 100%; height: auto; display: inline-block; }
.md-typeset .mermaid .edgeLabel {
  background: var(--ink-3) !important;
  color: var(--paper-dim) !important;
  padding: 2px 6px !important;
}
.md-typeset .mermaid .cluster rect { fill: var(--ink-2) !important; stroke: var(--rule) !important; }

/* Heading anchor link */
.md-typeset .headerlink {
  color: var(--mute-2);
  border: none;
}
.md-typeset h1:hover .headerlink,
.md-typeset h2:hover .headerlink,
.md-typeset h3:hover .headerlink,
.md-typeset h4:hover .headerlink,
.md-typeset h5:hover .headerlink,
.md-typeset h6:hover .headerlink { color: var(--signal); }

.md-typeset p, .md-typeset li { color: var(--paper); }
.md-typeset strong { color: var(--paper); font-weight: 700; }
.md-typeset em { font-family: var(--sans); font-style: italic; }

.md-typeset a {
  color: var(--signal);
  border-bottom: 1px solid rgba(var(--signal-rgb),0.25);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.md-typeset a:hover { color: var(--signal-2); border-bottom-color: var(--signal-2); }
.md-typeset a.md-button { border-bottom: none; }

/* Inline code */
.md-typeset code {
  background: var(--ink-2);
  color: var(--signal-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1em 0.4em;
  font-size: 0.88em;
  font-family: var(--mono);
}

/* Code blocks: single source of border + background, tight padding */
.md-typeset .highlight,
.md-typeset .highlighttable {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  margin: 0.6em 0 1.2em;
  position: relative;
}
.md-typeset pre {
  background: transparent;
  border: 0;
  margin: 0;
  border-radius: 0;
}
.md-typeset .highlight pre,
.md-typeset .highlighttable pre {
  background: transparent;
  border: 0;
  margin: 0;
  border-radius: 0;
}
.md-typeset pre > code,
.md-typeset .highlight pre > code,
.md-typeset .highlighttable pre > code {
  background: transparent;
  border: 0;
  padding: 14px 16px;
  display: block;
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--mono);
}
.md-typeset .highlight .filename {
  background: var(--ink-3);
  color: var(--mute);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule);
}
.md-clipboard {
  color: var(--mute);
  background: rgba(var(--glass-rgb),0.6);
  border-radius: 2px;
}
.md-clipboard:hover { color: var(--signal); }

/* Tighten paragraph→code spacing so labels read with their commands */
.md-typeset p + .highlight,
.md-typeset p + .highlighttable,
.md-typeset p + pre {
  margin-top: 0.4em;
}
.md-typeset .highlight + p,
.md-typeset .highlighttable + p,
.md-typeset pre + p {
  margin-top: 1.4em;
}

/* Tighten paragraph spacing inside the typeset prose */
.md-typeset p { margin: 0 0 1em; line-height: 1.6; }

/* Admonitions */
.md-typeset .admonition,
.md-typeset details {
  --adm: var(--signal);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: none;
  font-size: 14.5px;
  color: var(--paper-dim);
}
/* Type is signalled by the title + icon color, not an accent left rail. */
.md-typeset .admonition-title,
.md-typeset summary {
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--adm);
  border-bottom: 1px solid var(--rule);
}
.md-typeset .admonition-title::before,
.md-typeset summary::before { background-color: var(--adm); }

.md-typeset .admonition.note,
.md-typeset details.note { --adm: var(--cool); }
.md-typeset .admonition.warning,
.md-typeset details.warning { --adm: var(--signal); }
.md-typeset .admonition.danger,
.md-typeset details.danger { --adm: var(--signal); }
.md-typeset .admonition.tip,
.md-typeset details.tip { --adm: var(--acid); }
.md-typeset .admonition.success,
.md-typeset details.success { --adm: var(--acid); }

/* Material ships per-type border + icon colors as 3-class selectors
   (e.g. `.md-typeset .admonition.warning { border-color: #ff9100 }`) that
   outrank the neutral base rule above and reintroduce amber/blue boxes.
   Match that specificity with `[class]` so every admonition keeps a neutral
   border and takes its title + icon color only from --adm — no colored box. */
.md-typeset .admonition[class],
.md-typeset details[class] { border-color: var(--rule); }
.md-typeset .admonition[class] > .admonition-title::before,
.md-typeset details[class] > summary::before { background-color: var(--adm); }

/* Tables */
.md-typeset table:not([class]) {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
  font-size: 14px;
}
.md-typeset table:not([class]) th {
  background: var(--ink-2);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule-2);
}
.md-typeset table:not([class]) td {
  border-top: 1px solid var(--rule);
  color: var(--paper-dim);
}
.md-typeset table:not([class]) tr:hover { background: var(--ink-2); }

/* Tabbed content: no outer box, just a label row underline. The code blocks
   inside each tab are the visual content; a wrapping box makes nested
   rectangles. */
.md-typeset .tabbed-set {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 1.2em 0 1.6em;
  padding: 0;
}
.md-typeset .tabbed-labels {
  border-bottom: 1px solid var(--rule);
  background: transparent;
  margin-bottom: 18px;
}
.md-typeset .tabbed-labels > label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  padding: 12px 18px;
  margin: 0;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.md-typeset .tabbed-labels > label:hover { color: var(--paper); }
.md-typeset .tabbed-set > input:checked + label {
  color: var(--signal);
  border-color: var(--signal);
}
.md-typeset .tabbed-content {
  padding: 0;
}
.md-typeset .tabbed-block {
  padding: 0;
}
.md-typeset .tabbed-block > p:first-child { margin-top: 0; }
.md-typeset .tabbed-block > p {
  color: var(--paper-dim);
  font-size: 15px;
  margin: 1.1em 0 0.4em;
}
.md-typeset .tabbed-block > p:first-of-type { margin-top: 0; }

/* Material grid cards (used by some inner pages). Re-skin to match the
   flagship card aesthetic without relying on the homepage scope. */
.md-typeset .grid.cards > ul > li,
.md-typeset .grid.cards > :not(ul) {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: none;
  transition: border-color .25s, transform .25s;
}
.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid.cards > :not(ul):hover {
  border-color: var(--signal);
  transform: translateY(-2px);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink-2); }
::-webkit-scrollbar-thumb { background: var(--rule-2); border: 2px solid var(--ink-2); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--mute-2); }

/* Material footer (inner pages) */
.md-footer {
  background: var(--ink-2);
  border-top: 1px solid var(--rule);
}
.md-footer-meta {
  background: var(--ink);
  border-top: 1px solid var(--rule);
}
.md-footer-meta__inner {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.md-copyright,
.md-copyright a { color: var(--mute); font-size: 11px; }
.md-copyright a:hover { color: var(--signal); }
.md-social a { color: var(--mute); }
.md-social a:hover { color: var(--signal); }
.md-footer__inner { padding: 8px 0; gap: 12px; }
.md-footer__link { color: var(--paper-dim); padding: 20px 16px; border-radius: 6px; transition: background .2s, color .2s; opacity: 1; }
.md-footer__link:hover { color: var(--signal); background: var(--ink-3); }
.md-footer__title { background: transparent; color: var(--paper); font-weight: 500; line-height: 1.3; }
.md-footer__direction {
  color: var(--mute);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 1;
}
.md-footer__button { color: var(--mute); transition: color .2s; }
.md-footer__link:hover .md-footer__button { color: var(--signal); }

/* Hide Material's default content button on homepage */
.page--home .md-content__button { display: none; }

/* ──────────────────────────────────────────────────────────────
   MERMAID FULLSCREEN VIEWER
   Re-skinned against txn2 tokens; behavior unchanged.
   ────────────────────────────────────────────────────────────── */

.mermaid-wrapper { position: relative; }

.mermaid-expand-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: rgba(var(--glass-rgb),0.85);
  color: var(--mute);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}
.mermaid-wrapper:hover .mermaid-expand-btn { opacity: 1; }
.mermaid-expand-btn:hover {
  background: var(--signal);
  color: var(--ink);
  border-color: var(--signal);
}

.mermaid-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}

.mermaid-fs-viewport {
  cursor: grab;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
}
.mermaid-fs-viewport svg {
  max-width: 90vw;
  max-height: 85vh;
  filter: drop-shadow(var(--shadow-drop));
}

.mermaid-fs-toolbar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.25rem;
  padding: 0.375rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: rgba(var(--glass-rgb),0.92);
  backdrop-filter: blur(8px);
  font-family: var(--mono);
}

.mermaid-fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.75rem;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: var(--paper-dim);
  font-size: 0.8rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mermaid-fs-btn:hover {
  background: rgba(var(--signal-rgb),0.12);
  color: var(--signal);
}

.mermaid-fs-close {
  margin-left: 0.25rem;
  color: var(--signal);
}
.mermaid-fs-close:hover {
  background: rgba(var(--signal-rgb),0.16);
  color: var(--signal);
}

/* ──────────────────────────────────────────────────────────────
   REDUCED MOTION
   ────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
  .ticker__track { animation: none; }
  .rail__mark { animation: none; }
  .hero__mark__path--accent { animation: none; }
}

/* ──────────────────────────────────────────────────────────────
   IMAGE LIGHTBOX
   Screenshots are 1440x900 captures rendered into a content column a
   third that wide, so clicking one opens it at the size it was taken.
   Styled against the same tokens as the mermaid viewer above, so both
   full-screen surfaces read as one thing in either scheme.
   ────────────────────────────────────────────────────────────── */

.md-typeset img.img-zoomable,
.md-content img.img-zoomable {
  cursor: zoom-in;
  transition: box-shadow .15s ease, transform .15s ease;
}
.md-typeset img.img-zoomable:hover,
.md-content img.img-zoomable:hover {
  box-shadow: var(--shadow-lg);
}
.md-typeset img.img-zoomable:focus-visible,
.md-content img.img-zoomable:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

body.img-lightbox-open { overflow: hidden; }

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 56px);
  background: rgba(var(--glass-rgb), 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.img-lightbox[hidden] { display: none; }

.img-lightbox__figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.img-lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  cursor: default;
}
.img-lightbox__caption {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--paper-dim);
  text-align: center;
  max-width: 80ch;
}
.img-lightbox__close {
  position: absolute;
  top: clamp(12px, 2vw, 24px);
  right: clamp(12px, 2vw, 24px);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
}
.img-lightbox__close:hover { color: var(--signal); border-color: var(--signal); }
.img-lightbox__close:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .md-typeset img.img-zoomable,
  .md-content img.img-zoomable { transition: none; }
}
