/* ==========================================================================
   NASDANK docs — the whole stylesheet.

   Dark by default because the product is dark-only, but a documentation site
   is read for twenty minutes at a time in daylight, so light is a first-class
   theme rather than an inverted afterthought: both palettes are written out in
   full and every colour in the sheet is a token.

   Tokens are named by ROLE (--bg, --fg, --edge, --accent), never by value, so
   the light theme is a token swap and nothing else. There is not one hard-coded
   hex below the palette blocks.
   ========================================================================== */

/* ---------- palette ------------------------------------------------------- */

:root {
  /* Brand constants — identical in both themes. */
  --lime: #a3e635;
  --lime-br: #c6ff3d;
  --violet: #a855f7;
  --up: #22c55e;
  --down: #ff5a4e;
  --warn: #f5b23d;

  /* Dark (default). Mirrors web/app/globals.css. */
  --bg: #000000;
  --bg-1: #0b0e0a;
  --bg-2: #111511;
  --bg-3: #171c16;
  --fg: #f1f5ec;
  --fg-1: #c3cfc2;
  --fg-2: #93a08c;
  --fg-3: #6d7a68;
  --edge: rgba(255, 255, 255, 0.065);
  --edge-2: rgba(255, 255, 255, 0.11);
  /* --color-line in the app. Every CONTROL border resolves to this, not to
     --edge: globals.css carries an unlayered `* { border-color: var(--color-line) }`
     which beats `.ctl`'s own layered `border: 1px solid var(--color-edge)`, at rest
     AND on hover, on primary and secondary alike. Measured on the live site
     rather than read off the stylesheet, because the stylesheet's stated
     intent and the computed result disagree. */
  --line: rgba(255, 255, 255, 0.055);
  --accent: #b8f24a;
  /* Not #0a0c0a. These are the app's own values from globals.css — the ink a
     primary button prints in, and the sink it drops to on :active. */
  --accent-ink: #0b0f0a;
  --accent-sink: #1d241c;
  --accent-wash: rgba(184, 242, 74, 0.10);
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  --sel: rgba(184, 242, 74, 0.22);

  /* Geometry. */
  --rail: 268px;
  --toc: 210px;
  --bar: 52px;      /* --topbar in the app */
  --measure: 720px;
  --r-sm: 8px;
  --r-pill: 999px;  /* every control in the app is fully rounded */
  --r: 12px;
  --r-lg: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 170ms;

  --font-ui: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-ui);
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-1: #fbfcfa;
  --bg-2: #f4f6f1;
  --bg-3: #ecefe7;
  --fg: #14180f;
  --fg-1: #3c4436;
  --fg-2: #6b7563;
  --fg-3: #8d977f;
  --edge: rgba(20, 24, 15, 0.10);
  --edge-2: rgba(20, 24, 15, 0.18);
  --line: rgba(20, 24, 15, 0.09);
  /* The lime that carries a black background is illegible on white. The light
     theme drops to an olive of the same hue with a real contrast ratio. */
  --accent: #4d7a12;
  --accent-ink: #ffffff;
  --accent-sink: #e8efdc;
  --accent-wash: rgba(77, 122, 18, 0.09);
  --shadow: 0 20px 44px -26px rgba(20, 24, 15, 0.28);
  --sel: rgba(77, 122, 18, 0.18);
  color-scheme: light;
}

/* The BNB reading mode. Docs carry two chains, and the address tables switch
   between them; the accent follows so it is never ambiguous which chain's
   numbers are on screen. */
:root[data-chain="bnb"] {
  --accent: #f0b90b;
  --accent-ink: #0b0e11;
  --accent-sink: #241d09;
  --lime-br: #ffcf3d;
  --accent-wash: rgba(240, 185, 11, 0.12);
  --sel: rgba(240, 185, 11, 0.22);
}
:root[data-theme="light"][data-chain="bnb"] {
  --accent: #8a6a00;
  --accent-ink: #ffffff;
  --accent-sink: #f2ead0;
  --accent-wash: rgba(138, 106, 0, 0.10);
}

/* ---------- reset --------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets must clear the sticky bar, or every in-page link lands with
     its own heading hidden behind the chrome. */
  scroll-padding-top: calc(var(--bar) + 24px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--sel); }

img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

/* The app shows focus by brightening a control's own border and lifting its
   fill — no ring drawn outside the box. Elements with no border of their own
   still need something, so they keep an outline. */
:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.ctl:focus-visible, .search-btn:focus-visible, .chainpick button:focus-visible {
  outline: none;
  background-color: rgba(255, 255, 255, 0.09);
}
:root[data-theme="light"] .ctl:focus-visible,
:root[data-theme="light"] .search-btn:focus-visible { background-color: rgba(20, 24, 15, 0.08); }
.ctl-primary:focus-visible { background-color: var(--accent); border-color: var(--fg); }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600;
  transition: top var(--dur) var(--ease);
}
.skip:focus { top: 8px; }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ------------------------------------------------------- */

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  height: var(--bar);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--edge);
}

/* Reading progress. One hairline, the width of what is left to read — the
   cheapest orientation cue a long page can carry. */
.bar::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 2px;
  width: var(--progress, 0%);
  background: var(--accent);
  transition: width 90ms linear;
}

/* The app's Wordmark, matched: the four-point star in the accent, then
   NASDANK at 15px / 500 with 0.22em tracking in the UI face — NOT the display
   face, and not bold. The star turns on hover exactly as it does in the rail. */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  flex-shrink: 0; line-height: 0; color: var(--accent);
  transition: transform 500ms var(--ease);
}
.brand:hover .brand-mark { transform: rotate(180deg); }
.brand-name {
  font-family: var(--font-ui);
  font-size: 15px; font-weight: 500; letter-spacing: 0.22em;
  color: var(--fg); white-space: nowrap;
}
.brand-sub {
  font-size: 11.5px; font-weight: 450; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fg-2); padding-left: 10px; border-left: 1px solid var(--edge-2);
}
@media (max-width: 640px) { .brand-sub { display: none; } }

.bar-spacer { flex: 1; }

/* The search trigger. It is a button, not an input: the palette it opens is a
   dialog, and a fake input that cannot be typed into is a lie about focus. */
.search-btn {
  display: flex; align-items: center; gap: 8px;
  height: 34px; min-width: 220px; padding: 0 6px 0 14px;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-pill); color: var(--fg-2);
  font-size: 12.5px; letter-spacing: -0.008em; cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.search-btn:hover { background: rgba(255, 255, 255, 0.045); color: var(--fg-1); }
:root[data-theme="light"] .search-btn:hover { background: rgba(20, 24, 15, 0.05); }
.search-btn .k {
  margin-left: auto; display: flex; gap: 2px;
}
kbd {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500; line-height: 1;
  padding: 3px 6px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.045); border: 1px solid var(--edge); color: var(--fg-2);
}
:root[data-theme="light"] kbd { background: rgba(20, 24, 15, 0.05); }
@media (max-width: 900px) {
  .search-btn { min-width: 0; width: 34px; padding: 0; justify-content: center; }
  .search-btn .lbl, .search-btn .k { display: none; }
}

/* Transcribed from the app's globals.css. The two that were wrong before and
   are the reason the chrome read as a different product: every control here is
   a PILL, and a secondary control is TRANSPARENT — not a filled grey box. */
.ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 15px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--fg-1);
  font-size: 12.5px; font-weight: 500; letter-spacing: -0.008em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.ctl:hover { background: rgba(255, 255, 255, 0.045); color: var(--fg); }
.ctl:active { background: rgba(255, 255, 255, 0.02); }
:root[data-theme="light"] .ctl:hover { background: rgba(20, 24, 15, 0.05); }
:root[data-theme="light"] .ctl:active { background: rgba(20, 24, 15, 0.025); }
.ctl-icon { width: 34px; padding: 0; }

/* The app's primary INVERTS on hover — filled goes to outlined — rather than
   brightening. That inversion is most of its character. */
/* Border stays --line even here: at rest the accent fill hides it, and on
   hover the app really does show a transparent pill with accent text and a
   faint neutral edge. */
.ctl-primary {
  background: var(--accent); border-color: var(--line);
  color: var(--accent-ink); font-weight: 600; padding: 0 18px;
}
.ctl-primary:hover { background: transparent; color: var(--accent); }
.ctl-primary:active { background: var(--accent-sink); color: var(--lime-br); }
@media (max-width: 760px) { .ctl-app { display: none; } }

/* The chain pill. Two segments, one live. */
/* A segmented control in the app's language: a pill holding pills, the
   selected one filled with the accent. */
.chainpick {
  display: flex; align-items: center; gap: 2px;
  height: 34px; padding: 3px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid var(--line);
}
.chainpick button {
  height: 26px; padding: 0 12px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--fg-2);
  font-size: 12px; font-weight: 500; letter-spacing: -0.008em;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chainpick button:hover { color: var(--fg); }
.chainpick button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
@media (max-width: 1000px) { .chainpick { display: none; } }

.menu-btn { display: none; }
@media (max-width: 1060px) { .menu-btn { display: inline-flex; } }

/* ---------- layout -------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--toc);
  max-width: 1560px;
  margin: 0 auto;
  padding-top: var(--bar);
}
@media (max-width: 1240px) { .shell { grid-template-columns: var(--rail) minmax(0, 1fr); } }
@media (max-width: 1060px) { .shell { grid-template-columns: minmax(0, 1fr); } }

/* ---------- sidebar ------------------------------------------------------- */

.rail {
  position: sticky; top: var(--bar);
  height: calc(100dvh - var(--bar));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 12px 28px 18px;
  border-right: 1px solid var(--edge);
  scrollbar-width: thin; scrollbar-color: var(--edge-2) transparent;
}
.rail::-webkit-scrollbar { width: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--edge-2); border-radius: 4px; }

.rail-group + .rail-group { margin-top: 20px; }
.rail-h {
  display: block; padding: 0 10px 8px;
  font-size: 11.5px; font-weight: 450; letter-spacing: -0.004em;
  color: var(--fg-2);
}
.rail a {
  position: relative; display: block;
  padding: 6px 10px; margin-bottom: 1px;
  border-radius: 10px;
  font-size: 13px; font-weight: 450; color: var(--fg-2); text-decoration: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.rail a:hover { color: var(--fg); background: var(--bg-2); }
/* The app marks the selected row with a 10px-radius block in --color-surface-2
   and turns only the LABEL accent. It does not paint an accent wash and it does
   not draw a bar in the gutter — the accent is rationed to one thing per state,
   which is why it still reads. */
.rail a[aria-current="page"] {
  color: var(--accent); font-weight: 550;
  background: var(--bg-3); border-radius: 10px;
}

/* Mobile drawer. */
@media (max-width: 1060px) {
  .rail {
    position: fixed; inset: var(--bar) auto 0 0; z-index: 70;
    width: 288px; height: calc(100dvh - var(--bar));
    background: var(--bg);
    translate: -100% 0;
    transition: translate var(--dur) var(--ease);
    box-shadow: var(--shadow);
  }
  :root[data-nav="open"] .rail { translate: 0 0; }
  .scrim {
    position: fixed; inset: var(--bar) 0 0 0; z-index: 65;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur) var(--ease);
  }
  :root[data-nav="open"] .scrim { opacity: 1; pointer-events: auto; }
}
@media (min-width: 1061px) { .scrim { display: none; } }

/* ---------- article ------------------------------------------------------- */

.doc { min-width: 0; padding: 40px 44px 96px; }
@media (max-width: 760px) { .doc { padding: 28px 20px 72px; } }

.crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 14px;
}
.crumb .sep { opacity: 0.5; }
.crumb .cur { color: var(--accent); }

.doc h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 750; line-height: 1.06; letter-spacing: -0.028em;
  max-width: var(--measure);
}
.lede {
  margin-top: 14px; max-width: var(--measure);
  font-size: 17px; line-height: 1.6; color: var(--fg-1);
}

.body { max-width: var(--measure); margin-top: 34px; }
.body > * + * { margin-top: 18px; }

.body h2 {
  font-family: var(--font-display);
  font-size: 23px; font-weight: 700; letter-spacing: -0.018em; line-height: 1.2;
  margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--edge);
}
.body h3 {
  font-size: 16.5px; font-weight: 650; letter-spacing: -0.008em;
  margin-top: 34px;
}
.body h4 {
  font-size: 13px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--fg-2); margin-top: 26px;
}
.body p { color: var(--fg-1); }
.body strong { color: var(--fg); font-weight: 650; }

/* Anchor affordance. Present always at low opacity rather than appearing on
   hover: a control that only exists on hover does not exist on a touch screen. */
.body :is(h2, h3) { position: relative; }
.anchor {
  position: absolute; left: -22px; top: 50%; translate: 0 -50%;
  width: 18px; text-align: center;
  color: var(--fg-3); text-decoration: none; opacity: 0; font-weight: 400;
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
}
.body :is(h2, h3):hover .anchor, .anchor:focus-visible { opacity: 1; color: var(--accent); }
@media (max-width: 900px) { .anchor { display: none; } }

.body a:not(.ctl):not(.card):not(.anchor) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color var(--dur) var(--ease);
}
.body a:not(.ctl):not(.card):not(.anchor):hover { text-decoration-color: var(--accent); }

.body ul, .body ol { padding-left: 22px; color: var(--fg-1); }
.body li + li { margin-top: 7px; }
.body li::marker { color: var(--fg-3); }
.body ul.tight li + li { margin-top: 3px; }

.body hr { border: 0; border-top: 1px solid var(--edge); margin: 34px 0; }

blockquote {
  border-left: 2px solid var(--edge-2);
  padding-left: 16px; color: var(--fg-2); font-style: normal;
}

/* ---------- inline code + blocks ------------------------------------------ */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-2);
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 1.5px 5px;
  color: var(--fg);
  word-break: break-word;
}
:root[data-theme="light"] code { background: var(--bg-2); }

.code {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  overflow: hidden;
}
.code-h {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--edge);
  background: var(--bg-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-3);
}
.code pre {
  margin: 0; padding: 15px 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 12.75px; line-height: 1.72;
  color: var(--fg-1);
  scrollbar-width: thin;
}
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.copy {
  margin-left: auto; height: 24px; padding: 0 9px;
  background: var(--bg-3); border: 1px solid var(--edge); border-radius: 6px;
  color: var(--fg-2); font-size: 11px; font-weight: 600; cursor: pointer;
  letter-spacing: 0.04em; text-transform: uppercase;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.copy:hover { color: var(--fg); border-color: var(--edge-2); }
.copy[data-done="1"] { color: var(--accent); border-color: var(--accent); }

/* Syntax colours. Deliberately four roles, not twelve: keyword, string, number,
   comment. More than that in a doc block is decoration. */
.t-key { color: var(--violet); }
.t-str { color: var(--accent); }
.t-num { color: var(--warn); }
.t-com { color: var(--fg-3); font-style: italic; }
.t-fn  { color: var(--fg); }
:root[data-theme="light"] .t-key { color: #7c3aed; }
:root[data-theme="light"] .t-str { color: #3d6b0a; }
:root[data-theme="light"] .t-num { color: #a4700a; }

/* ---------- tables -------------------------------------------------------- */

.tw { overflow-x: auto; border: 1px solid var(--edge); border-radius: var(--r); scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  position: sticky; top: 0;
  text-align: left; padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--edge);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--fg-2); white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--edge); color: var(--fg-1); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg-1); }
td code, th code { white-space: nowrap; }
td.num { text-align: right; font-family: var(--font-mono); }

/* An address cell: monospace, truncating, one-click copy. */
.addr {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px;
}
.addr button {
  border: 0; background: none; padding: 2px; cursor: pointer; color: var(--fg-3);
  border-radius: 4px; line-height: 0;
  transition: color var(--dur) var(--ease);
}
.addr button:hover { color: var(--accent); }
.addr button[data-done="1"] { color: var(--accent); }

/* ---------- callouts ------------------------------------------------------ */

.note {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--edge); border-left: 2px solid var(--fg-3);
  border-radius: var(--r);
  background: var(--bg-1);
  font-size: 14px; color: var(--fg-1);
}
.note > svg { margin-top: 3px; color: var(--fg-2); }
.note p + p { margin-top: 8px; }
.note-t { display: block; font-weight: 650; color: var(--fg); margin-bottom: 3px; }
.note.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, var(--bg-1)); }
.note.warn > svg { color: var(--warn); }
.note.danger { border-left-color: var(--down); background: color-mix(in srgb, var(--down) 8%, var(--bg-1)); }
.note.danger > svg { color: var(--down); }
.note.good { border-left-color: var(--accent); background: var(--accent-wash); }
.note.good > svg { color: var(--accent); }

/* ---------- cards + grids ------------------------------------------------- */

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.c2, .grid.c3 { grid-template-columns: minmax(0, 1fr); } }

.card {
  display: block; padding: 16px 17px;
  background: var(--bg-1); border: 1px solid var(--edge); border-radius: var(--r);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--bg-2); }
.card-t { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 650; color: var(--fg); }
.card-d { margin-top: 5px; font-size: 13px; line-height: 1.55; color: var(--fg-2); }
.card-k {
  display: inline-block; margin-bottom: 9px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent);
}

/* A run of read-only facts. Label above value, no box each. */
.facts { display: grid; gap: 16px 26px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.fact-k { font-size: 11.5px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--fg-3); }
.fact-v { margin-top: 3px; font-size: 19px; font-weight: 650; font-family: var(--font-display); letter-spacing: -0.015em; }
.fact-v.accent { color: var(--accent); }
.fact-n { margin-top: 2px; font-size: 12.5px; color: var(--fg-2); }

/* Numbered steps down a spine. */
.steps { list-style: none; padding: 0; counter-reset: s; }
.steps li {
  position: relative; padding-left: 44px; padding-bottom: 22px;
  counter-increment: s;
}
.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 750; font-family: var(--font-mono);
}
.steps li::after {
  content: ""; position: absolute; left: 13.5px; top: 32px; bottom: 2px; width: 1px;
  background: var(--edge-2);
}
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.steps li + li { margin-top: 0; }
.step-t { display: block; font-weight: 650; color: var(--fg); font-size: 15px; }
.step-b { display: block; margin-top: 3px; color: var(--fg-1); font-size: 14px; }

/* A figure: diagram plus its caption. */
figure { margin: 0; }
figure svg { width: 100%; height: auto; }
figcaption { margin-top: 10px; font-size: 12.5px; color: var(--fg-3); }
.frame {
  padding: 22px; background: var(--bg-1);
  border: 1px solid var(--edge); border-radius: var(--r);
}

/* ---------- chain-scoped content ------------------------------------------ */

[data-for-chain] { display: none; }
:root[data-chain="robinhood"] [data-for-chain="robinhood"],
:root[data-chain="bnb"] [data-for-chain="bnb"] { display: revert; }
:root[data-chain="robinhood"] tr[data-for-chain="robinhood"],
:root[data-chain="bnb"] tr[data-for-chain="bnb"] { display: table-row; }

/* ---------- fee calculator ------------------------------------------------ */

.calc { padding: 20px; background: var(--bg-1); border: 1px solid var(--edge); border-radius: var(--r-lg); }
.calc-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.calc-f { flex: 1 1 150px; min-width: 0; }
.calc-f > label { display: block; font-size: 11.5px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 7px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-3); border: 1px solid var(--edge); border-radius: var(--r-sm); }
.seg button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent;
  color: var(--fg-2); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.calc input[type="range"] { width: 100%; accent-color: var(--accent); }
.calc input[type="number"], .calc input[type="text"] {
  width: 100%; height: 34px; padding: 0 11px;
  background: var(--bg-3); border: 1px solid var(--edge); border-radius: var(--r-sm);
  color: var(--fg); font-family: var(--font-mono); font-size: 13px;
}
.calc-out {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--edge);
  display: grid; gap: 16px 24px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.calc-note { margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--fg-2); }
.calc-note:empty { display: none; }

/* The split bar — 100% of the fee, shown as one rule. */
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-3); margin-top: 4px; }
.split span { display: block; transition: width var(--dur) var(--ease); }
.split-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--fg-2); }
.split-key i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; font-style: normal; }

/* ---------- pager --------------------------------------------------------- */

/* Two .ctl pills on one line, pushed to the edges. No cards, no titles — the
   pills inherit every button rule above, so the pager cannot drift away from
   the rest of the product's controls. */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--edge);
}
.pager .next { margin-left: auto; }

.foot {
  margin-top: 52px; padding-top: 20px; border-top: 1px solid var(--edge);
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  font-size: 12.5px; color: var(--fg-3);
}
.foot a { color: var(--fg-2); text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* ---------- table of contents --------------------------------------------- */

.toc {
  position: sticky; top: var(--bar);
  height: calc(100dvh - var(--bar));
  overflow-y: auto; padding: 40px 20px 40px 8px;
  scrollbar-width: thin;
}
@media (max-width: 1240px) { .toc { display: none; } }
.toc-h {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 12px;
}
.toc a {
  display: block; padding: 4px 0 4px 12px;
  border-left: 1px solid var(--edge);
  font-size: 12.5px; line-height: 1.45; color: var(--fg-3); text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.toc a:hover { color: var(--fg-1); }
.toc a.lv3 { padding-left: 24px; }
.toc a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }

/* ---------- ⌘K palette ---------------------------------------------------- */

.pal[hidden] { display: none; }
.pal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: start center;
  padding: max(9vh, 60px) 16px 16px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}
.pal-box {
  width: min(660px, 100%); max-height: min(560px, 78dvh);
  display: flex; flex-direction: column;
  background: var(--bg-1); border: 1px solid var(--edge-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  overflow: hidden;
}
.pal-in { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--edge); }
.pal-in svg { color: var(--fg-3); flex-shrink: 0; }
.pal-in input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15.5px; }
.pal-in input::placeholder { color: var(--fg-3); }
.pal-list { overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.pal-sec {
  padding: 10px 12px 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3);
}
.pal-item {
  display: block; padding: 9px 12px; border-radius: var(--r-sm);
  text-decoration: none; cursor: pointer;
}
.pal-item[data-on="1"] { background: var(--accent-wash); }
.pal-item[data-on="1"] .pal-t { color: var(--accent); }
.pal-t { font-size: 14px; font-weight: 600; color: var(--fg); }
.pal-p { margin-top: 2px; font-size: 12.5px; color: var(--fg-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pal-p mark { background: var(--sel); color: var(--fg); border-radius: 2px; padding: 0 1px; }
.pal-w { padding: 8px 12px; font-size: 11px; color: var(--fg-3); }
.pal-foot {
  display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--edge);
  font-size: 11.5px; color: var(--fg-3);
}
.pal-empty { padding: 30px 16px; text-align: center; color: var(--fg-2); font-size: 14px; }

/* ---------- landing ------------------------------------------------------- */

.hero { padding: 60px 44px 0; max-width: 1100px; }
@media (max-width: 760px) { .hero { padding: 34px 20px 0; } }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 7vw, 68px); font-weight: 780; line-height: 1.0; letter-spacing: -0.035em;
  max-width: 15ch;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: clamp(17px, 2.1vw, 20px); max-width: 620px; margin-top: 20px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
/* No size override. The app never scales .ctl up — not on its hero, not
   anywhere — so a 40px/14px "hero" variant here is a control that exists in
   the docs and nowhere else in the product. One control, one size. */

/* ---------- the rail's own chain switch ------------------------------------
   Only reachable when the top bar's copy is not. Both are the same control and
   both write the same preference; this one exists because the contracts page
   is unusable on a phone without a way to change chain. */
.rail-chain { display: none; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--edge); }
.rail-chain .chainpick { width: 100%; }
.rail-chain .chainpick button { flex: 1; }
@media (max-width: 1000px) {
  /* Ordered to the TOP of the drawer, not the bottom. It is a global control
     and the rail is a long scroller — at the foot of twenty-three links it is
     below the fold and effectively undiscoverable. */
  .rail { display: flex; flex-direction: column; }
  .rail-chain {
    display: block; order: -1;
    margin: 0 0 10px; padding: 0 0 14px;
    border-top: 0; border-bottom: 1px solid var(--edge);
  }
  /* The blanket `.chainpick { display:none }` above is what hides the top
     bar's copy at this width, and it hid this one too. Re-show it here — a
     control that is in the DOM, laid out, and display:none on its own child
     is exactly the kind of dead UI a screenshot of the drawer would not
     reveal. Caught by asserting the drawer's switch is clickable at 390. */
  .rail-chain .chainpick, .body .chainpick { display: flex; }
}
