/* Margin Rescue: a tool built on dreamDEX, in dreamDEX's dark, computational family but with
   its own identity. Warm graphite instead of the venue's neutral black, rescue orange instead
   of its periwinkle, Martian Mono headlines in sentence case, Geist for reading. dreamDEX's
   own colour appears only where dreamDEX itself is named. */

@font-face { font-family: "Martian Mono"; src: url("fonts/martian-mono-latin.woff2") format("woff2"); font-weight: 100 800; font-stretch: 75% 112.5%; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --display: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font: var(--sans);

  /* warm graphite */
  --bg: #0c0a09;
  --surface: #151210;
  --raised: #1e1a17;
  --elevated: #2a2420;
  --well: #100d0c;
  --line: #221d1a;
  --line-2: #332c27;
  --line-3: #4a413a;
  --ink: #f6f1ec;
  --text: #d9d1ca;
  --text-2: #b0a69d;
  --text-3: #8f857c;

  /* rescue orange: actions, the phrase that matters, the mark */
  --rescue: #ff6a1f;
  --rescue-lit: #ff8240;
  --rescue-ink: #ff9a63;
  --on-rescue: #160b04;
  --rescue-wash: rgb(255 106 31 / 0.12);

  /* state */
  --up: #00fa89;
  --up-ink: #3ee69c;
  --down: #dc0b4a;
  --down-ink: #f0708f;
  --wait: #f5b400;
  --wait-ink: #ffc94a;

  /* dreamDEX, only where dreamDEX is referenced */
  --dd: #6e6eed;
  --dd-ink: #a8a8f4;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --gutter: clamp(16px, 4vw, 48px);
  --wide: 1240px;
  --edge: max(var(--gutter), calc((100% - var(--wide)) / 2 + var(--gutter)));
  --r: 14px;
  --r-sm: 8px;
}

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

html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; scrollbar-color: #3a322c transparent; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; font-synthesis: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

::selection { background: rgb(255 106 31 / 0.4); color: #fff; }
input, textarea { caret-color: var(--rescue); }
img, svg { display: block; }
.icon { display: inline-block; width: 18px; height: 18px; flex: none; vertical-align: -3px; }

a { color: var(--ink); text-decoration-color: rgb(255 106 31 / 0.6); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color 0.15s, text-decoration-color 0.15s; }
a:hover { color: var(--rescue-ink); text-decoration-color: var(--rescue); }

h1, h2, h3, h4 { margin: 0; color: var(--ink); text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
b, strong { color: var(--ink); font-weight: 600; }
ol, ul { margin: 0; }

:focus-visible { outline: 2px solid var(--rescue-ink); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--r-sm); background: var(--rescue); color: var(--on-rescue); text-decoration: none; transition: top 0.2s var(--ease); }
.skip:focus { top: 12px; }
.skip:hover, .skip:focus { color: var(--on-rescue); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.num, .n { font-variant-numeric: tabular-nums; }
.neg { color: var(--down-ink); }
.pos { color: var(--up-ink); }
.ok-ink { color: var(--up-ink); }
.bad-ink { color: var(--down-ink); }
.wait-ink { color: var(--wait-ink); }
.muted { color: var(--text-2); }

/* ---- buttons ---- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-sm); background: var(--rescue); color: var(--on-rescue); font-family: var(--display); font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s var(--ease); }
.btn:hover { background: var(--rescue-lit); color: var(--on-rescue); }
.btn:active { transform: scale(0.98); }
.btn .icon { width: 17px; height: 17px; transition: transform 0.3s var(--ease); }
.btn:hover .icon { transform: translateX(3px); }
.btn.secondary { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.secondary:hover { background: var(--elevated); color: var(--ink); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }

.link { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; text-decoration-color: rgb(255 106 31 / 0.6); text-decoration-thickness: 1px; text-underline-offset: 4px; cursor: pointer; }
.link:hover { color: var(--rescue-ink); text-decoration-color: var(--rescue); }

.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; transition: color 0.15s, background-color 0.15s; }
.icon-btn:hover { color: var(--ink); background: var(--raised); }
.icon-btn .icon { width: 15px; height: 15px; }
.icon-btn .i-play, .icon-btn[aria-pressed="true"] .i-pause { display: none; }
.icon-btn[aria-pressed="true"] .i-play { display: inline-block; }

/* ---- status ---- */

.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 4px 10px; border-radius: 999px; background: rgb(255 255 255 / 0.04); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-2); font-family: var(--display); font-size: 11.5px; font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; white-space: nowrap; }
.badge .icon { width: 14px; height: 14px; }
.badge.met { color: var(--up-ink); background: rgb(0 250 137 / 0.08); box-shadow: inset 0 0 0 1px rgb(0 250 137 / 0.3); }
.badge.call { color: var(--down-ink); background: rgb(220 11 74 / 0.12); box-shadow: inset 0 0 0 1px rgb(220 11 74 / 0.42); }
.badge.wait { color: var(--wait-ink); background: rgb(245 180 0 / 0.09); box-shadow: inset 0 0 0 1px rgb(245 180 0 / 0.34); }
.badge.info { color: var(--rescue-ink); background: var(--rescue-wash); box-shadow: inset 0 0 0 1px rgb(255 106 31 / 0.36); }
.badge.big { min-height: 32px; padding: 6px 13px; font-size: 12.5px; }
.motion .badge.pop { animation: pop 0.6s var(--ease) both; }
@keyframes pop { 0% { opacity: 0; transform: translateY(8px) scale(0.92); } 60% { opacity: 1; transform: translateY(-2px) scale(1.03); } 100% { opacity: 1; transform: none; } }

.ping { position: relative; display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ping::after { content: ""; position: absolute; inset: -5px; border: 1px solid currentColor; border-radius: 50%; opacity: 0; animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { 0% { opacity: 0.85; transform: scale(0.35); } 70% { opacity: 0; transform: scale(1.5); } 100% { opacity: 0; } }

.blink { display: inline-block; flex: none; width: 7px; height: 13px; background: var(--rescue); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }


/* ---- the co-branded lockup: our mark and name, then dreamDEX's own logo, unmodified ---- */

.cobrand { display: inline-flex; align-items: center; gap: 12px; }
.cobrand .sep { width: 1px; height: 22px; background: var(--line-3); }
.built-on { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; color: var(--text-2); font-size: 13px; white-space: nowrap; text-decoration: none; }
.built-on img { height: 20px; width: auto; margin: 6px; }
a.built-on:hover { color: var(--text); }

/* ---- copyable hashes ---- */

.hash { position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 1px 5px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font-family: var(--code); font-size: 0.92em; font-weight: 500; text-decoration: underline dotted rgb(246 241 236 / 0.35); text-underline-offset: 4px; white-space: nowrap; cursor: copy; transition: background-color 0.15s, color 0.15s; }
.hash:hover { background: var(--rescue-wash); color: var(--ink); }
.hash::after { content: "copied"; position: absolute; left: 50%; bottom: calc(100% + 6px); padding: 3px 7px; border-radius: 6px; background: var(--raised); box-shadow: 0 0 0 1px var(--line-2); color: var(--up-ink); font-size: 11px; opacity: 0; transform: translate(-50%, 4px); transition: opacity 0.15s, transform 0.2s var(--ease); pointer-events: none; }
.hash[data-copied]::after { opacity: 1; transform: translate(-50%, 0); }

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

.table-wrap { overflow-x: auto; scrollbar-width: thin; }
.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data caption { caption-side: top; padding: 0 0 10px; color: var(--text-2); font-size: 12.5px; text-align: left; }
.data th { padding: 9px 12px; border-bottom: 1px solid var(--line-2); color: var(--text-3); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: top; }
.data th:first-child, .data td:first-child { padding-left: 0; }
.data th:last-child, .data td:last-child { padding-right: 0; }
.data .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data .sym { color: var(--ink); font-weight: 600; }
.data tbody tr { transition: background-color 0.15s; }
.data tbody tr:hover { background: rgb(255 255 255 / 0.025); }
.data tr.chosen { background: var(--rescue-wash); }
.data tr.chosen:hover { background: rgb(255 106 31 / 0.16); }
.data tr:last-child td { border-bottom: 0; }
.data td .icon { width: 15px; height: 15px; margin-right: 5px; vertical-align: -3px; }
.tag { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: rgb(255 106 31 / 0.16); color: var(--rescue-ink); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }

.motion .stagger > * { animation: rise 0.55s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.tick-draw path { stroke-dasharray: 24; stroke-dashoffset: 0; }
.motion .tick-draw path { animation: draw 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 150ms); }
@keyframes draw { from { stroke-dashoffset: 24; } }

/* ---- header ---- */

.site-head { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px var(--edge); transition: background-color 0.3s, box-shadow 0.3s; }
.site-head.scrolled { background: rgb(12 10 9 / 0.88); box-shadow: 0 1px 0 var(--line); -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px); }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--display); font-size: 15.5px; font-weight: 600; font-stretch: 100%; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.mark { width: 30px; height: 30px; flex: none; }
.mark .fill { transform-box: fill-box; transform-origin: left center; }
.motion .mark .fill { animation: mark-fill 1.4s var(--ease) 0.2s both; }
.motion .brand:hover .mark .fill { animation: mark-fill 1.1s var(--ease) both; }
@keyframes mark-fill { 0%, 45% { transform: scaleX(0.35); fill: var(--down); } 100% { transform: scaleX(1); fill: var(--rescue); } }

.site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.site-nav a { position: relative; padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-size: 14.5px; font-weight: 500; text-decoration: none; transition: color 0.15s, background-color 0.15s; }
.site-nav a:not(.action):hover { color: var(--ink); background: rgb(255 255 255 / 0.03); }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 4px; background: var(--rescue); }
.site-nav .action { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; background: var(--rescue); color: var(--on-rescue); font-family: var(--display); font-size: 13px; font-weight: 600; }
.site-nav .action:hover { background: var(--rescue-lit); color: var(--on-rescue); }
.site-nav .action[aria-current="page"]::after { display: none; }
.site-nav .action .icon { width: 15px; height: 15px; transition: transform 0.3s var(--ease); }
.site-nav .action:hover .icon { transform: translateX(3px); }

.menu-btn { display: none; align-items: center; gap: 8px; height: 38px; margin-left: auto; padding: 0 12px; border: 0; border-radius: 8px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer; }
.menu-btn .bars { position: relative; width: 14px; height: 10px; }
.menu-btn .bars::before, .menu-btn .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; transition: transform 0.3s var(--ease), top 0.3s var(--ease); }
.menu-btn .bars::before { top: 1px; }
.menu-btn .bars::after { top: 7.5px; }
.site-head[data-open] .menu-btn .bars::before { top: 4.25px; transform: rotate(45deg); }
.site-head[data-open] .menu-btn .bars::after { top: 4.25px; transform: rotate(-45deg); }

body.work .site-head, body.doc .site-head { top: 6px; min-height: 60px; margin: 6px 6px 0; padding: 10px max(12px, calc(var(--edge) - 6px)); border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
body.work .site-head.scrolled, body.doc .site-head.scrolled { background: rgb(21 18 16 / 0.94); box-shadow: inset 0 0 0 1px var(--line-2), 0 12px 32px -16px rgb(0 0 0 / 0.7); }

@media (max-width: 1180px) {
  .site-head .built-on, .site-head .cobrand .sep { display: none; }
}
@media (max-width: 920px) {
  .js .menu-btn { display: inline-flex; }
  .js .site-nav { position: absolute; top: calc(100% + 6px); left: var(--gutter); right: var(--gutter); flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 24px 48px -16px rgb(0 0 0 / 0.8); clip-path: inset(0 0 100% 0 round 12px); opacity: 0; visibility: hidden; transition: clip-path 0.4s var(--ease), opacity 0.2s, visibility 0s 0.4s; }
  .js .site-head[data-open] .site-nav { clip-path: inset(0 0 0 0 round 12px); opacity: 1; visibility: visible; transition: clip-path 0.45s var(--ease), opacity 0.2s, visibility 0s; }
  .js .site-nav a { padding: 13px 12px; font-size: 15px; }
  .js .site-nav a[aria-current="page"]::after { left: 0; right: auto; top: 12px; bottom: 12px; width: 2px; height: auto; }
  .js .site-nav .action { margin: 6px 0 0; justify-content: center; }
  .js .site-head[data-open] .site-nav a { animation: rise 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + 60ms); }
  body.work .site-nav, body.doc .site-nav { left: 0; right: 0; }
  .site-head { gap: 10px; }
  html:not(.js) .site-head { flex-wrap: wrap; }
  html:not(.js) .site-nav { flex-wrap: wrap; margin-left: 0; }
}
@media (max-width: 420px) {
  .brand { font-size: 14.5px; gap: 8px; }
}

/* ---- footer ---- */

.site-foot { padding: 64px var(--edge) 36px; border-top: 1px solid var(--line); background: var(--bg); }
.foot-grid { display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); gap: 32px; }
.foot-brand .cobrand { flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 18px; }
.foot-brand .cobrand .sep { display: none; }
.foot-brand .built-on img { height: 22px; margin: 7px; }
.foot-brand p { max-width: 36ch; margin: 0 0 10px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.foot-title { margin: 0 0 14px; color: var(--ink); font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.foot-grid a, .foot-grid span.foot-item { display: block; padding: 5px 0; color: var(--text-2); font-size: 14px; text-decoration: none; }
.foot-grid .brand, .foot-grid .built-on { display: inline-flex; color: var(--ink); }
.foot-grid .built-on { color: var(--text-2); font-size: 13px; }
.foot-grid a:hover { color: var(--ink); }
.foot-note { margin: 44px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }
body.work .site-foot, body.doc .site-foot { margin-top: 48px; }
@media (max-width: 860px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
  .foot-brand { grid-column: 1 / -1; }
}

/* ---- chart tooltip ---- */

.tip { position: absolute; z-index: 20; min-width: 120px; padding: 8px 10px; border-radius: 8px; background: var(--raised); box-shadow: 0 0 0 1px var(--line-2), 0 14px 28px -10px rgb(0 0 0 / 0.75); color: var(--text-2); font-size: 12px; line-height: 1.4; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 8px)) translateY(4px); transition: opacity 0.15s, transform 0.2s var(--ease); }
.tip.on { opacity: 1; transform: translate(-50%, calc(-100% - 8px)); }
.tip b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- reveal on scroll: content is visible unless the motion script is running ---- */

.motion [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.motion [data-reveal].is-in { opacity: 1; transform: none; }
.motion [data-reveal="wake"] { transform: translateY(14px) scale(0.975); }
.motion [data-reveal="wake"].is-in { transform: none; }

/* ---- reading pages ---- */

.read-progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 2px; background: var(--rescue); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; pointer-events: none; }

.doc-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 64px; max-width: 1240px; margin: 0 auto; padding: 44px var(--gutter) 40px; }
.doc-side { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; scrollbar-width: none; }
.side-label { margin: 0 0 8px; color: var(--text-3); font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.side-group + .side-group { margin-top: 26px; }
.side-links { position: relative; margin: 0; padding: 0; list-style: none; }
.side-links a { position: relative; z-index: 1; display: block; padding: 6px 12px; color: var(--text-2); font-size: 13.5px; line-height: 1.4; text-decoration: none; transition: color 0.15s; }
.side-links a:hover { color: var(--ink); }
.side-links a[aria-current] { color: var(--ink); }
.side-links .out { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-links .out .icon { width: 14px; height: 14px; color: var(--text-3); }
.side-ink { position: absolute; left: 0; top: 0; z-index: 0; width: 100%; height: var(--h, 0); border-radius: 0 6px 6px 0; background: var(--rescue-wash); box-shadow: inset 2px 0 0 var(--rescue); transform: translateY(var(--y, 0)); opacity: var(--o, 0); transition: transform 0.4s var(--ease), height 0.4s var(--ease), opacity 0.2s; pointer-events: none; }

.doc-main { min-width: 0; max-width: 780px; }
.doc-title h1 { font-family: var(--display); font-size: clamp(28px, 3.2vw, 38px); font-weight: 700; font-stretch: 87.5%; line-height: 1.15; letter-spacing: -0.02em; }
.doc-lede { max-width: 66ch; margin: 18px 0 0; color: var(--text); font-size: 17px; line-height: 1.65; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.doc-chips li { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 5px 10px; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); font-size: 12.5px; }
.doc-chips .ping { color: var(--up); }
.doc-chips .built-on { padding: 0; }

.doc-main section { padding-top: 48px; }
.doc-main h2 { position: relative; margin: 0 0 16px; font-family: var(--display); font-size: 21px; font-weight: 650; font-stretch: 87.5%; line-height: 1.3; letter-spacing: -0.01em; scroll-margin-top: 100px; }
.doc-main h2 .anchor { position: absolute; left: -26px; top: 0; padding: 0 6px; color: var(--text-3); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity 0.15s; }
.doc-main h2:hover .anchor, .doc-main h2 .anchor:focus-visible { opacity: 1; }
.doc-main h3 { margin: 28px 0 10px; font-size: 17px; font-weight: 600; }
.doc-main p, .doc-main li, .doc-main dd { max-width: 68ch; color: var(--text); font-size: 16px; line-height: 1.7; }
.doc-main ul { padding-left: 1.2em; }
.doc-main ul li { margin: 6px 0; padding-left: 4px; }
.doc-main ul li::marker { color: var(--text-3); }
.doc-main :not(pre) > code { padding: 0.12em 0.38em; border-radius: 4px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); font-family: var(--code); font-size: 0.86em; }
.doc-main .table-wrap { margin: 20px 0; padding: 10px 18px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.doc-main .data caption { padding-top: 6px; }
.doc-main .data td { font-size: 14px; }
.doc-main .data td code { white-space: nowrap; }
.doc-main .kv th { width: 30%; color: var(--text-2); font-size: 13.5px; font-weight: 500; white-space: normal; vertical-align: top; }
.doc-main .kv th, .doc-main .kv td { border-bottom: 1px solid var(--line); }
.doc-main .addr { font-size: 12.5px; word-break: break-all; }

.code { position: relative; margin: 20px 0; border-radius: 12px; background: #0a0807; box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }
.code pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; color: var(--text); font-family: var(--code); font-size: 13px; line-height: 1.75; tab-size: 2; scrollbar-width: thin; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-family: var(--sans); font-size: 12.5px; cursor: pointer; transition: color 0.15s, background-color 0.15s; }
.copy-btn:hover { color: var(--ink); background: var(--raised); }
.copy-btn .icon { width: 14px; height: 14px; }
.copy-btn[data-copied] { color: var(--up-ink); }

.callout { margin: 20px 0; padding: 14px 16px; border-radius: 12px; background: var(--rescue-wash); box-shadow: inset 0 0 0 1px rgb(255 106 31 / 0.3); color: var(--text); font-size: 15px; }
.callout b { color: var(--ink); }
.callout.warn { background: rgb(245 180 0 / 0.08); box-shadow: inset 0 0 0 1px rgb(245 180 0 / 0.32); }

/* Technology: a packet travels the pipeline, lighting each stage */
.route { position: relative; margin: 24px 0 8px; padding: 0; list-style: none; }
.route::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 1px; background: var(--line-2); }
.route .runner { position: absolute; left: 8px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--rescue); transform: translateY(var(--ry, 0)); transition: transform 0.7s var(--ease-io); }
.route li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 0 12px 40px; border-bottom: 1px solid var(--line); }
.route li:last-child { border-bottom: 0; }
.route li::before { content: ""; position: absolute; left: 6px; top: 17px; width: 11px; height: 11px; border-radius: 4px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-3); transition: background-color 0.3s, box-shadow 0.3s; }
.route li.lit::before { background: var(--rescue); box-shadow: inset 0 0 0 1px var(--rescue-ink); }
.route li.done::before { background: rgb(0 250 137 / 0.18); box-shadow: inset 0 0 0 1px rgb(0 250 137 / 0.6); }
.route b { color: var(--ink); font-size: 15.5px; font-weight: 600; }
.route span { grid-column: 1; color: var(--text); font-size: 14.5px; line-height: 1.6; }
.route code { grid-column: 2; grid-row: 1 / span 2; align-self: start; color: var(--text-2); font-family: var(--code); font-size: 12px; white-space: nowrap; }
.formula { margin: 20px 0; }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 -8px; }
.route-head .muted { font-size: 13.5px; }

/* Guide: numbered step rails that fill as the reader passes them */
.steps { position: relative; margin: 22px 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 22px 48px; counter-increment: step; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-3); color: var(--text-2); font-family: var(--display); font-size: 12px; font-weight: 600; transition: background-color 0.35s, color 0.35s, box-shadow 0.35s; }
.steps > li::after { content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 2px; width: 1px; background: linear-gradient(var(--rescue), var(--rescue)) 0 0 / 100% var(--fill, 0%) no-repeat, var(--line-2); transition: background-size 0.6s var(--ease); }
.steps > li:last-child::after { display: none; }
.steps > li.passed::before { background: var(--rescue); box-shadow: none; color: var(--on-rescue); }
.steps > li.passed { --fill: 100%; }
.steps > li .code { margin: 12px 0 2px; }

.faq dt { margin: 22px 0 6px; color: var(--ink); font-size: 16px; font-weight: 600; }
.faq dd { margin: 0; }

.doc-next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.doc-next a { display: block; padding: 16px 18px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); font-size: 13px; text-decoration: none; transition: box-shadow 0.2s, transform 0.2s var(--ease); }
.doc-next a b { display: block; margin-top: 4px; color: var(--ink); font-family: var(--display); font-size: 15px; font-weight: 600; font-stretch: 87.5%; }
.doc-next a:hover { box-shadow: inset 0 0 0 1px var(--line-3); transform: translateY(-2px); }
.doc-next a.next { text-align: right; }

@media (max-width: 980px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 28px; }
  .doc-side { position: static; max-height: none; overflow: visible; padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
  .doc-side details > summary { display: flex; align-items: center; justify-content: space-between; color: var(--ink); font-weight: 500; list-style: none; cursor: pointer; }
  .doc-side details > summary::-webkit-details-marker { display: none; }
  .doc-side details[open] > summary { margin-bottom: 14px; }
  .doc-side details[open] > summary .icon { transform: rotate(180deg); }
  .side-ink { display: none; }
  .side-links a[aria-current] { box-shadow: inset 2px 0 0 var(--rescue); }
}
@media (min-width: 981px) {
  .doc-side details > summary { display: none; }
}
@media (max-width: 560px) {
  .doc-main p, .doc-main li, .doc-main dd { font-size: 15.5px; }
  .doc-main .table-wrap { padding: 8px 12px; }
  .doc-main h2 .anchor { display: none; }
  .route code { grid-column: 1; grid-row: auto; }
  .doc-next { grid-template-columns: 1fr; }
  .data th, .data th.n { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .motion [data-reveal], .motion [data-reveal="wake"] { transform: none; transition: opacity 0.4s; }
  .ping::after, .blink, .motion .badge.pop { animation: none; }
  .motion .mark .fill { animation: none; }
  .route .runner { transition: none; }
  .route-head .icon-btn, #guard-demo .demo-cap .icon-btn { display: none; }
}
