/* ox docs site (/docs and its pages). Loaded after styles.css, only there.
   The primitives (.docs-grid, .docs-nav, .prose, .code) live in styles.css;
   this file lays out the three columns (pages, the page, "On this page"),
   the Docs menu on a narrow screen, the cards, the pager, and the search
   dialog. The per-block copy button lives beside .code in styles.css, which
   the blog posts share. */

/* ---------- Three columns ---------- */
.docs-grid { grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 4vw, 56px); padding-top: clamp(32px, 4vw, 48px); padding-bottom: clamp(72px, 9vw, 128px); }
.docs-side { position: sticky; top: 92px; display: grid; gap: 18px; max-height: calc(100dvh - 112px); overflow-y: auto; }
.docs-side .docs-nav { position: static; max-height: none; overflow: visible; }
.docs-main { min-width: 0; max-width: 720px; }
.docs-menu { display: none; }
.docs-toc { display: none; position: sticky; top: 92px; max-height: calc(100dvh - 112px); overflow-y: auto; font-size: 13.5px; }
.docs-toc ul { display: grid; gap: 2px; border-left: 1px solid var(--line); }
.docs-toc li a { display: block; margin-left: -1px; padding: 4px 0 4px 14px; border-left: 1px solid transparent; color: var(--subtle); text-decoration: none; transition: color 150ms ease, border-color 150ms ease; }
.docs-toc li.docs-toc-sub a { padding-left: 26px; font-size: 13px; }
@media (hover: hover) { .docs-toc li a:hover { color: var(--ink); } }
/* Scroll-spy: the section you're reading is marked. */
.docs-toc li a.is-here { color: var(--ink); border-left-color: var(--ink); }
@media (min-width: 1180px) {
  .docs-grid { grid-template-columns: 220px minmax(0, 720px) minmax(0, 200px); }
  .docs-toc { display: block; }
}

/* ---------- The sidebar: every page, by group ---------- */
.docs-nav-group-label { display: block; margin: 20px 0 7px; font: 500 12px/16px var(--sans); color: var(--subtle); letter-spacing: .02em; }
.docs-nav-group a { display: flex !important; align-items: center; gap: 8px; }
.docs-nav-group a .ic { width: 15px; height: 15px; flex: none; color: var(--subtle); transition: color 150ms ease; }
.docs-nav-group a span { overflow-wrap: anywhere; }
.docs-nav-group a[aria-current] .ic { color: var(--ink); }
@media (hover: hover) { .docs-nav-group a:hover .ic { color: var(--ink); } }
.docs-nav-group a[aria-current] { color: var(--ink); font-weight: 500; border-left-color: var(--ink); }
.docs-nav-child a { padding-left: 28px !important; }

/* ---------- Search button in the sidebar ---------- */
.docs-search-open { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--subtle); font: 400 14px/1 var(--sans); cursor: pointer; transition: border-color 150ms ease, color 150ms ease; }
@media (hover: hover) { .docs-search-open:hover { color: var(--ink); border-color: color-mix(in srgb, var(--subtle) 45%, var(--line)); } }
.docs-search-open .ic { width: 15px; height: 15px; flex: none; }
.docs-search-open span { flex: 1; text-align: left; }
.docs-search-open kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); font: 500 11px/1.3 var(--mono); color: var(--subtle); }

/* ---------- Page head ---------- */
.docs-title { font: 600 clamp(36px, 4.2vw, 50px)/1.06 var(--display); letter-spacing: -0.028em; color: var(--ink); }
.docs-lede { margin-top: 14px; max-width: 620px; font-size: 18px; line-height: 1.55; color: var(--subtle); text-wrap: pretty; }
.docs-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.docs-actions .btn { height: 40px; padding: 0 15px; font-size: 14.5px; border-radius: 999px; }
.docs-updated { display: flex; align-items: center; gap: 7px; margin-top: 16px; font-size: 13.5px; color: var(--subtle); }
.docs-updated .ic { width: 14px; height: 14px; }
.docs-head + .prose > h2:first-child { margin-top: 44px; }
.docs-head + .prose > p:first-child { margin-top: 40px; }

/* ---------- Section heading icons ---------- */
.prose h2.docs-h, .prose h3[id] { display: flex; align-items: center; gap: 10px; }
.prose h2.docs-h .ic, .prose h3[id] .ic { width: 20px; height: 20px; flex: none; color: var(--ink); }

/* ---------- Copy feedback ---------- */
#copy-ox-skill.is-copied { background: var(--ok); }
#copy-ox-skill:disabled { opacity: 1; cursor: default; }
.docs-copy-page.is-copied { color: var(--ok); border-color: var(--ok); }

/* ---------- Cards: the home's Start here, and an index page's pages ---------- */
.prose .docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; padding: 0; list-style: none; }
.docs-cards li::marker { content: none; }
.docs-cards a { display: grid; grid-template-columns: 20px 1fr; gap: 4px 12px; height: 100%; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); text-decoration: none; transition: border-color 150ms ease, transform 150ms var(--ease); }
@media (hover: hover) { .docs-cards a:hover { border-color: color-mix(in srgb, var(--subtle) 45%, var(--line)); transform: translateY(-1px); } }
.docs-cards .ic { grid-row: 1 / 3; width: 20px; height: 20px; margin-top: 2px; color: var(--ink); }
.docs-cards strong { font: 600 16px/1.35 var(--display); }
.docs-cards span { font-size: 14.5px; line-height: 1.5; color: var(--subtle); }

/* ---------- CLI list ---------- */
.docs-cli { display: grid; gap: 4px 0; }
.docs-cli dt { margin-top: 12px; }
.docs-cli dt code { overflow-wrap: anywhere; }
.docs-cli dd { margin: 0; padding-left: 2px; color: var(--subtle); }

/* ---------- Previous and next ---------- */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.docs-pager a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; transition: border-color 150ms ease; }
@media (hover: hover) { .docs-pager a:hover { border-color: color-mix(in srgb, var(--subtle) 45%, var(--line)); } }
.docs-pager span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--subtle); }
.docs-pager .ic { width: 13px; height: 13px; }
.docs-pager strong { font: 600 16px/1.35 var(--display); color: var(--ink); }
.docs-next { grid-column: 2; text-align: right; justify-items: end; }

/* ---------- Search dialog ---------- */
.docs-search { width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - 96px)); margin: clamp(48px, 12vh, 120px) auto auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .35); overflow: hidden; }
.docs-search[open] { display: flex; flex-direction: column; }
.docs-search::backdrop { background: rgba(10, 10, 9, .38); }
.docs-search-bar { display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--line); }
.docs-search-bar > .ic { width: 18px; height: 18px; flex: none; color: var(--subtle); }
.docs-search-bar input { flex: 1; min-width: 0; height: 54px; border: 0; outline: 0; background: none; color: var(--ink); font: 400 16.5px/1 var(--sans); }
.docs-search-bar input::-webkit-search-cancel-button { display: none; }
.docs-search-close { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--subtle); cursor: pointer; }
@media (hover: hover) { .docs-search-close:hover { background: var(--stage); color: var(--ink); } }
.docs-search-close .ic { width: 16px; height: 16px; }
.docs-search-results { flex: 1; overflow-y: auto; padding: 6px; list-style: none; }
.docs-search-results:empty { display: none; }
.docs-search-results a { display: grid; gap: 2px; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.docs-search-results [aria-selected="true"] a { background: var(--stage); }
.docs-search-results b { font: 500 14.5px/1.35 var(--sans); color: var(--ink); }
.docs-search-results small { font-size: 12px; color: var(--subtle); }
.docs-search-results span { font-size: 13.5px; line-height: 1.45; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-search-count { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--subtle); }

/* Without JS there is no search: the box and the copy-page button hide,
   and the sidebar still reaches every page. */
html:not(.js) [data-docs-search], html:not(.js) .docs-copy-page { display: none; }

/* ---------- Narrow screens: the Docs menu and search ---------- */
/* The sidebar opens as a bottom sheet from the Docs menu (the Mobile system
   in styles.css has the sheet parts), with a search button beside it, and
   search fills the screen. */
.docs-bar { display: none; }
@media (max-width: 880px) {
  .docs-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; }
  .docs-side { display: none; }
  /* The bar stays under the top bar while reading, so the pages and search
     are one tap away; it rises over the top bar while its sheet is open. */
  .docs-bar { position: sticky; top: calc(68px + env(safe-area-inset-top)); z-index: 45; display: flex; gap: 8px; margin-block: -8px; padding-block: 8px; background: var(--bg); }
  .docs-bar:has(.docs-menu[open]) { z-index: 80; }
  .prose h2, .prose h3 { scroll-margin-top: 148px; }
  .docs-menu { display: block; flex: 1; min-width: 0; }
  .docs-menu > summary { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font: 500 15px/1.3 var(--sans); color: var(--ink); cursor: pointer; list-style: none; }
  .docs-menu > summary::-webkit-details-marker { display: none; }
  .docs-menu > summary:active, .docs-bar-search:active { background: var(--stage); }
  .docs-menu > summary .ic { width: 18px; height: 18px; flex: none; }
  .docs-menu-here { margin-left: auto; min-width: 0; color: var(--subtle); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .docs-bar-search { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; }
  .docs-bar-search .ic { width: 20px; height: 20px; }
  .docs-menu[open] > .docs-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; max-height: 82dvh; padding: 0 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--sheet-r) var(--sheet-r) 0 0; background: var(--card); box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .35); animation: sheet-up 280ms var(--ease) both; }
  .docs-menu[open] + .sheet-scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(10, 10, 9, .38); animation: scrim-in 200ms ease both; }
  .docs-sheet .docs-nav { padding: 0; border: 0; border-radius: 0; background: none; }
  .docs-sheet .docs-nav ul { grid-template-columns: 1fr; }
  .docs-sheet .docs-nav-group-label { margin: 18px 0 4px; font-size: 13.5px; }
  .docs-sheet .docs-nav li a { min-height: var(--tap); padding: 0 0 0 12px !important; border-left: 2px solid transparent; font-size: 16px; }
  .docs-sheet .docs-nav li a:active { background: var(--stage); }
  .docs-sheet .docs-nav-child a { padding-left: 30px !important; }
  .docs-actions .btn { height: var(--tap); }
  .docs-updated { font-size: 14px; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-next { grid-column: 1; }

  .docs-search { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); border: 0; border-radius: 0; box-shadow: none; }
  .docs-search-bar { padding: 0 6px 0 16px; }
  .docs-search-bar input { height: 60px; font-size: 17px; }
  .docs-search-close { width: var(--tap); height: var(--tap); }
  .docs-search-close .ic { width: 20px; height: 20px; }
  .docs-search-results a { padding: 12px 14px; }
  .docs-search-results b { font-size: 16px; }
  .docs-search-results small, .docs-search-results span, .docs-search-count { font-size: 14px; }
}

/* ===== C illustrations (editorial line art) ===== */
/* Figures on the docs pages: an aria-hidden stage holding two drawings of the
   same scene, a wide one and a narrow one for phones. The line-art styles live
   in styles.css. docs.js adds .is-in the first time a figure is on screen;
   until then its motion holds on the first frame. With reduced motion every
   figure shows its final frame. */
.doc-fig { margin-top: 26px; }
.prose .doc-fig + * { margin-top: 26px; }
.doc-fig > figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--subtle); text-wrap: pretty; }
.doc-fig > figcaption code { font-size: .84em; }
.doc-fig-stage { display: grid; place-items: center; padding: clamp(14px, 3vw, 24px); border: 1px solid var(--line); border-radius: 14px; background: var(--stage); overflow: hidden; }
.doc-fig-stage .ln-svg { width: 100%; }
.doc-fig-stage .ln-n { display: none; }
@media (max-width: 600px) {
  .doc-fig-stage .ln-w { display: none; }
  .doc-fig-stage .ln-n { display: block; max-width: 400px; }
}
.js .doc-fig:not(.is-in) .ln-svg, .js .doc-fig:not(.is-in) .ln-svg * { animation-play-state: paused; }

/* ===== Stack guide figures ===== */
/* The generated stack guides (stack_guides.go) and the Stacks hub. The
   figure itself is .doc-fig line art; these are the proof badges, the plan
   table, the sidebar fold and the hub's filter, which works with no script:
   each chip links to a fixed, empty target and :has(:target) hides the
   other languages. */
.sg-proof { display: grid; grid-template-columns: 20px 1fr; gap: 2px 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 15px; line-height: 1.5; }
.sg-proof .ic { grid-row: 1 / 3; width: 20px; height: 20px; margin-top: 2px; }
.sg-proof span { color: var(--subtle); }
.sg-proof-t .ic { color: var(--ok); }
.sg-proof-d .ic { color: var(--blue); }
.sg-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.sg-plan { width: 100%; border-collapse: collapse; font-size: 14px; }
.sg-plan th { padding: 9px 12px; text-align: left; font: 500 12.5px/1.3 var(--sans); color: var(--subtle); border-bottom: 1px solid var(--line); }
.sg-plan td { padding: 8px 12px; vertical-align: top; border-top: 1px solid var(--line); }
.sg-plan tr:nth-child(2) td { border-top: 0; }
.sg-plan td code { background: none; padding: 0; overflow-wrap: anywhere; }
.sg-plan td:first-child code, .sg-plan td:last-child code { color: var(--subtle); white-space: nowrap; }
.sg-hints code { overflow-wrap: anywhere; }
.sg-badge { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 999px; font: 500 12px/1.4 var(--sans); font-style: normal; }
.sg-badge-t { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: color-mix(in srgb, var(--ok) 70%, var(--ink)); }
.sg-badge-d { background: color-mix(in srgb, var(--blue) 12%, var(--card)); color: color-mix(in srgb, var(--blue) 70%, var(--ink)); }
.docs-cards .sg-badge { grid-column: 2; justify-self: start; }
.sg-others .sg-badge { margin: 0 0 0 6px; }
.sg-fold > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.sg-fold > summary::-webkit-details-marker { display: none; }
.sg-fold > summary span { font-size: 11.5px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; }
.sg-filter ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.sg-filter li { margin: 0; }
.prose .sg-filter a.chip { text-decoration: none; }
.sg-kind > h3 { margin-top: 30px; }
.sg-kind > h3 + p { margin: 6px 0 16px; }
.sg-hub:has(#lang-js:target) .chip[data-lang="js"],
.sg-hub:has(#lang-python:target) .chip[data-lang="python"],
.sg-hub:has(#lang-ruby:target) .chip[data-lang="ruby"],
.sg-hub:has(#lang-php:target) .chip[data-lang="php"],
.sg-hub:has(#lang-java:target) .chip[data-lang="java"],
.sg-hub:has(#lang-dotnet:target) .chip[data-lang="dotnet"],
.sg-hub:has(#lang-elixir:target) .chip[data-lang="elixir"],
.sg-hub:has(#lang-rust:target) .chip[data-lang="rust"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.prose .sg-hub:has(.filter-target[id^="lang-"]:not(#lang-all):target) .chip-all { background: var(--card); border-color: var(--line); color: var(--text); }
.sg-hub:has(#lang-js:target) .sg-cards li:not([data-lang="js"]),
.sg-hub:has(#lang-python:target) .sg-cards li:not([data-lang="python"]),
.sg-hub:has(#lang-ruby:target) .sg-cards li:not([data-lang="ruby"]),
.sg-hub:has(#lang-php:target) .sg-cards li:not([data-lang="php"]),
.sg-hub:has(#lang-java:target) .sg-cards li:not([data-lang="java"]),
.sg-hub:has(#lang-dotnet:target) .sg-cards li:not([data-lang="dotnet"]),
.sg-hub:has(#lang-elixir:target) .sg-cards li:not([data-lang="elixir"]),
.sg-hub:has(#lang-rust:target) .sg-cards li:not([data-lang="rust"]),
.sg-hub:has(#lang-js:target) .sg-kind:not(:has(li[data-lang="js"])),
.sg-hub:has(#lang-python:target) .sg-kind:not(:has(li[data-lang="python"])),
.sg-hub:has(#lang-ruby:target) .sg-kind:not(:has(li[data-lang="ruby"])),
.sg-hub:has(#lang-php:target) .sg-kind:not(:has(li[data-lang="php"])),
.sg-hub:has(#lang-java:target) .sg-kind:not(:has(li[data-lang="java"])),
.sg-hub:has(#lang-dotnet:target) .sg-kind:not(:has(li[data-lang="dotnet"])),
.sg-hub:has(#lang-elixir:target) .sg-kind:not(:has(li[data-lang="elixir"])),
.sg-hub:has(#lang-rust:target) .sg-kind:not(:has(li[data-lang="rust"])) { display: none; }
@media (max-width: 600px) {
  .sg-filter .chip { height: var(--tap); }
  .sg-plan tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
  .sg-plan tr:first-child { display: none; }
  .sg-plan tr:nth-child(2) { border-top: 0; }
  .sg-plan td { padding: 0; border: 0; }
  .sg-plan td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .sg-plan td:last-child { text-align: right; }
  .sg-plan td:last-child code { white-space: normal; overflow-wrap: anywhere; }
}

/* ===== Docs figures v2 ===== */
/* The figures of the hand-written docs pages (docs_figures*.go). Line art
   uses the .ln- styles; these add the example tag, the status pills, and the
   two lit fragments (the log explorer and the service cards), drawn like
   the landing scenes: lit from the top, tinted shadows, theme tokens only.
   Every motion runs once, holds until docs.js marks the figure .is-in, and
   reduced motion shows the last frame. */
.df-ex rect { fill: var(--ln-paper); stroke: var(--ln-pen); stroke-width: 1; stroke-dasharray: 2 2; }
.df-ex text { font: 400 9px/1 var(--ln-mono); fill: var(--ln-pen); text-anchor: middle; }
.df-pill rect { fill: color-mix(in srgb, var(--df-c) 13%, var(--ln-paper)); stroke: color-mix(in srgb, var(--df-c) 60%, var(--ln-paper)); stroke-width: 1; }
.df-pill text { font: 500 10.5px/1 var(--ln-mono); fill: color-mix(in srgb, var(--df-c) 72%, var(--ln-ink)); }
.df-ok { --df-c: var(--ln-ok); }
.df-bad { --df-c: var(--ln-bad); }
.df-pen { --df-c: var(--ln-pen); }
.df-dim { --df-c: var(--ln-ink2); }

.df-lit .doc-fig-stage {
  --df-tint: 30,41,59; --df-tint-a: .55; --df-hi: rgba(255,255,255,.95); --df-top: rgba(255,255,255,0);
  background: var(--stage);
}
:root[data-theme="dark"] .df-lit .doc-fig-stage { --df-tint: 1,3,12; --df-tint-a: 1; --df-hi: rgba(255,255,255,.07); --df-top: rgba(255,255,255,.035); }
.df-ui { position: relative; width: min(620px, 100%); display: grid; gap: 10px; padding: 14px; border: 1px solid color-mix(in srgb, var(--ink) 8%, var(--line)); border-radius: 12px;
  background: linear-gradient(180deg, var(--df-top), transparent 40%), var(--card); color: var(--text); font: 400 12px/1.45 var(--mono); text-align: left;
  box-shadow: inset 0 1px 0 var(--df-hi), 0 1px 2px rgba(var(--df-tint), calc(.22 * var(--df-tint-a))), 0 8px 18px -6px rgba(var(--df-tint), calc(.42 * var(--df-tint-a))), 0 26px 44px -18px rgba(var(--df-tint), calc(.55 * var(--df-tint-a))); }
.df-tag { position: absolute; top: -9px; right: 14px; padding: 1px 8px; border: 1px dashed color-mix(in srgb, var(--blue) 60%, var(--line)); border-radius: 999px; background: var(--card); font: 400 10px/1.5 var(--mono); color: color-mix(in srgb, var(--blue) 72%, var(--ink)); }
.df-ui b { font-weight: 500; }
.df-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.df-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.df-seg b { padding: 3px 10px; color: var(--subtle); }
.df-seg b + b { border-left: 1px solid var(--line); }
.df-seg b.on { background: color-mix(in srgb, var(--ink) 7%, var(--card)); color: var(--ink); }
.df-live { display: inline-flex; align-items: center; gap: 6px; color: var(--subtle); }
.df-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.df-q { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--stage); color: var(--ink); }
.df-q kbd { padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 11px; color: var(--subtle); }
.df-ui .lv-error { --lv: var(--danger-border); }
.df-ui .lv-warn { --lv: var(--warn); }
.df-ui .lv-info { --lv: var(--blue); }
.df-ui .lv-debug { --lv: var(--subtle); }
.df-ui .lv-unknown { --lv: var(--faint); }
.df-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--subtle); font-size: 11px; }
.df-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; background: var(--lv); }
.df-plot { position: relative; height: 64px; margin-top: 22px; border-bottom: 1px solid var(--line); }
.df-plot svg { display: block; width: 100%; height: 64px; }
.df-plot path { fill: var(--lv); opacity: .8; transform-origin: 50% 100%; animation: df-grow .9s var(--ease) .2s backwards; }
.df-plot path.lv-error { opacity: 1; }
.df-inc { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--danger-soft); outline: 1px solid var(--danger-border); animation: df-fade .6s var(--ease) 1.2s backwards; }
.df-inc span { position: absolute; right: 0; bottom: 100%; margin-bottom: 4px; white-space: nowrap; padding: 1px 6px; border-radius: 4px; background: var(--danger-bg); font-size: 11px; color: var(--danger-fg); }
.df-tbl { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.df-th, .df-tr { display: grid; grid-template-columns: 112px 56px 58px minmax(0, 1fr); gap: 8px; padding: 5px 10px; align-items: center; }
.df-th { color: var(--subtle); font-size: 11px; background: color-mix(in srgb, var(--ink) 3%, var(--card)); }
.df-tr { border-top: 1px solid var(--line); animation: df-fade .5s var(--ease) backwards; }
.df-tr:nth-child(2) { animation-delay: 1.5s; } .df-tr:nth-child(3) { animation-delay: 1.65s; } .df-tr:nth-child(4) { animation-delay: 1.8s; } .df-tr:nth-child(5) { animation-delay: 1.95s; }
.df-tr > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.df-tr.on { background: color-mix(in srgb, var(--blue) 10%, var(--card)); box-shadow: inset 2px 0 0 var(--blue); }
.df-lv { justify-self: start; padding: 0 6px; border-radius: 4px; font-size: 10px; background: color-mix(in srgb, var(--lv) 16%, transparent); color: color-mix(in srgb, var(--lv) 75%, var(--ink)); }
.df-detail { position: relative; display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--ink) 2%, var(--card)); animation: df-fade .6s var(--ease) 2.3s backwards; }
.df-dh { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--subtle); }
.df-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.df-chip { padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--subtle); }
.df-chip.on { border-color: color-mix(in srgb, var(--blue) 60%, var(--line)); color: color-mix(in srgb, var(--blue) 75%, var(--ink)); background: color-mix(in srgb, var(--blue) 9%, var(--card)); }
.df-msg { color: var(--ink); overflow-wrap: anywhere; }
.df-hand { justify-self: start; margin: -2px 0 0 4px; font: 500 19px/1 var(--hand); color: color-mix(in srgb, var(--blue) 72%, var(--ink)); rotate: -3deg; animation: df-fade .6s var(--ease) 2.8s backwards; }

.df-svcs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0; border: 0; background: none; box-shadow: none; }
.df-card { display: grid; gap: 10px; padding: 14px; border: 1px solid color-mix(in srgb, var(--ink) 8%, var(--line)); border-radius: 12px; background: linear-gradient(180deg, var(--df-top), transparent 40%), var(--card);
  box-shadow: inset 0 1px 0 var(--df-hi), 0 1px 2px rgba(var(--df-tint), calc(.22 * var(--df-tint-a))), 0 10px 22px -8px rgba(var(--df-tint), calc(.45 * var(--df-tint-a))); animation: df-fade .6s var(--ease) .2s backwards; }
.df-card + .df-card { animation-delay: .5s; }
.df-ch { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.df-ch b { display: block; font: 600 14px/1.3 var(--sans); color: var(--ink); }
.df-ch small { color: var(--subtle); font-size: 11px; }
.df-pill-ok { padding: 1px 8px; border-radius: 999px; font-size: 11px; background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: color-mix(in srgb, var(--ok) 70%, var(--ink)); }
.df-card dl { display: grid; gap: 4px; margin: 0; }
.df-card dl div { display: flex; justify-content: space-between; gap: 8px; }
.df-card dt { color: var(--subtle); }
.df-card dd { margin: 0; color: var(--ink); }
.df-card dd i { font-style: normal; color: var(--subtle); }
.df-conn { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; background: var(--stage); }
.df-btn { display: inline-block; padding: 3px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: color-mix(in srgb, var(--ink) 3%, var(--card)); }
@keyframes df-grow { from { transform: scaleY(0); } }
@keyframes df-fade { from { opacity: 0; translate: 0 4px; } }
.js .doc-fig:not(.is-in) .df-ui, .js .doc-fig:not(.is-in) .df-ui * { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .df-ui, .df-ui * { animation: none !important; } }
@media (max-width: 600px) {
  .df-ui { padding: 12px; font-size: 11px; }
  .df-th, .df-tr { grid-template-columns: 92px 50px minmax(0, 1fr); gap: 6px; padding: 5px 8px; }
  .df-th > :nth-child(3), .df-tr > :nth-child(3) { display: none; }
  .df-svcs { grid-template-columns: minmax(0, 1fr); }
}
