/* KIWI styles, on tokens.css. The 5 Nov redesign
   (~/Docs/kiwi/redesign-vercel/PLAN.md): rhea's palette in a quiet,
   border-led system synthesised from Vercel, Linear, Stripe, Mintlify,
   Cloudflare and Material for MkDocs. Hairlines rather than shadows, one sans
   and one mono, colour-only hover, a solid focus ring everywhere, and every
   component usable without JavaScript. */

/* ── Fonts: self-hosted, SIL OFL 1.1 (fonts/LICENSE-OFL.txt) ──────────── */

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ── Base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body)/var(--lh-body) var(--ff-sans);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--sp-12);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
  scroll-margin-top: calc(var(--bar-h) + var(--sp-16));
}
h1 { font-size: var(--fs-h1); line-height: 1.15; letter-spacing: -.025em; }
h2 { font-size: var(--fs-h2); letter-spacing: -.02em; }
h3 { font-size: var(--fs-h3); line-height: 1.4; letter-spacing: -.01em; }
h4 { font-size: var(--fs-body); }

/* Links are underlined everywhere: colour alone does not mark a link. */
a {
  color: var(--link);
  text-decoration: underline 1px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: .18em;
  transition: color var(--dur-fast) var(--ease), text-decoration-color var(--dur-fast) var(--ease);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

code, kbd, pre { font-family: var(--ff-mono); }
code {
  padding: .1em .35em;
  border-radius: 5px;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font-size: .875em;
}
/* In tertiary captions the tint takes text-3 under 4.5:1 (4.39), so code
   there steps up to text-2. */
:is(.meta, .card-p, .label, .chip-n, .count) code { color: var(--text-2); }

/* One ring, on every control: solid, 2px, outside. The transparent base
   outline keeps it visible in forced-colours mode. */
:focus-visible { outline: var(--bw-thick) solid var(--focus); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

.icon { flex: none; vertical-align: -.15em; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    animation-duration: .01ms !important;
    /* Or an infinite animation would flicker between its ends. */
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ── Frame ────────────────────────────────────────────────────────────── */

.frame {
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.page { padding-block: var(--sp-32) var(--sp-64); }

.skip {
  position: absolute;
  bottom: 100%;
  left: var(--gutter);
  z-index: calc(var(--z-header) + 1);
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--r-sm);
  background: var(--action);
  color: var(--on-action);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: var(--sp-8); bottom: auto; }

/* ── Header: one solid 56px row with a hairline ───────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: var(--bw) solid var(--border);
  background: var(--bg);
}
.bar {
  display: flex;
  align-items: center;
  gap: var(--sp-24);
  height: var(--bar-h);
}

.brand { position: relative; display: block; flex: none; padding-block: 6px; color: var(--text); line-height: 0; }
.brand svg { display: block; width: auto; height: 20px; transition: opacity var(--dur) var(--ease); }
.brand-dot { fill: var(--accent); }
/* Off the top of the page, "KIWI." crossfades to "K." and back. The wordmark
   keeps the box, so neither the link nor the bar moves. */
.brand-mono { position: absolute; top: 6px; left: 0; opacity: 0; }
.is-scrolled .brand-full { opacity: 0; }
.is-scrolled .brand-mono { opacity: 1; }
/* kiwi.js watches this to set html.is-scrolled. */
.scroll-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.site-nav { align-self: stretch; }
.site-nav ul { display: flex; height: 100%; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--sp-12);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { color: var(--text); }
/* The current section: its text and a 2px brand underline on the bar's edge. */
.site-nav li.is-current > a { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav a:focus-visible { outline-offset: -4px; }

.bar-end { display: flex; align-items: center; gap: var(--sp-8); margin-left: auto; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* Theme: three buttons in one hairline group. The pressed one is filled. */
.theme {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 2px;
  border: var(--bw) solid var(--border);
  border-radius: 8px;
}
.theme .icon-btn { width: 28px; height: 28px; }
.theme .icon-btn[aria-pressed="true"] { background: var(--selected); color: var(--accent-ink); }

/* Narrow: a native disclosure holds the nav, so the menu needs no script. */
.menu { display: none; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu .icon-x { display: none; }
.menu[open] .icon-x { display: block; }
.menu[open] .icon-menu { display: none; }
.menu-panel {
  position: absolute;
  inset: var(--bar-h) 0 auto;
  padding: var(--sp-8) var(--gutter) var(--sp-16);
  border-bottom: var(--bw) solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-md);
}
.menu-panel ul { margin: 0; padding: 0; list-style: none; }
.menu-panel a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--sp-12);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-body);
  font-weight: 500;
  text-decoration: none;
}
.menu-panel a:hover { background: var(--hover); }
.menu-panel li.is-current > a { background: var(--selected); color: var(--accent-ink); box-shadow: inset 2px 0 0 var(--accent); }

@media (max-width: 839.98px) {
  .site-nav { display: none; }
  .menu { display: block; }
  .bar { gap: var(--sp-12); }
}

/* ── Page head ────────────────────────────────────────────────────────── */

.page-head { margin-bottom: var(--sp-32); }
.page-head > :last-child { margin-bottom: 0; }
.page-head h1 { margin-bottom: var(--sp-8); }
.lede { max-width: 60ch; margin: 0 0 var(--sp-12); color: var(--text-2); font-size: 1.125rem; line-height: 1.6; text-wrap: pretty; }
.meta { margin: 0; color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-ui); }
.meta code { font-size: .9em; }
.meta a { white-space: nowrap; }

.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); margin: 0 0 var(--sp-16); padding: 0; list-style: none; font-size: var(--fs-xs); }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--sp-4); color: var(--text-3); }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--text); }

/* ── Overview hero ────────────────────────────────────────────────────
   After docs.pdcoe.dev's home hero (aaaem-platform-docs theme.css, section
   9), converted from its 20px root: a faded grid and a slow two-colour glow
   behind a centred badge, title, lede and key metrics. */

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-bottom: var(--bw) solid var(--border);
  background: var(--bg);
}
/* The grid, faded out towards the bottom. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 40%, transparent 100%);
}
/* The same two blobs as docs.pdcoe.dev, on a box wide enough that neither is
   clipped: there, the left blob starts outside its box and shows a hard edge. */
.hero-glow {
  position: absolute;
  z-index: -1;
  top: -17.5rem;
  left: 50%;
  width: 110rem;
  height: 40rem;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side, var(--hero-a), transparent 70%) 2.5rem 2.5rem / 50rem 37.5rem no-repeat,
    radial-gradient(closest-side, var(--hero-b), transparent 70%) 45rem 7.5rem / 45rem 32.5rem no-repeat;
  filter: blur(8px);
  animation: hero-drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes hero-drift {
  from { transform: translateX(-52%) translateY(0); }
  to   { transform: translateX(-48%) translateY(1.875rem); }
}
.hero-inner { padding-block: 6rem 4.5rem; text-align: center; }

/* The context badge, with a dot for data freshness. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  margin: 0 0 var(--sp-24);
  padding: 5px var(--sp-16);
  border: var(--bw) solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-ok { background: var(--done-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--done-strong) 20%, transparent); }
.dot-wait { background: var(--wait-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wait-strong) 20%, transparent); }

.hero h1 {
  max-width: 17em;
  margin: 0 auto;
  font-size: clamp(2.375rem, 1.375rem + 3.4vw, 4.25rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.hero .lede {
  max-width: 45rem;
  margin: 1.375rem auto 0;
  font-size: clamp(1rem, .9rem + .35vw, 1.225rem);
}

/* Key metrics: the number over its label, no tiles. */
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem 3rem; margin: 2.5rem 0 0; }
.hero-stat { display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; }
.hero-stat dt { color: var(--text-3); font-size: .775rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.hero-stat dd { margin: 0; color: var(--text); font-size: 1.3125rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-stat a { color: inherit; text-decoration: none; }
.hero-stat a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .2em; }
.stat-of { color: var(--text-3); font-size: var(--fs-sm); font-weight: 400; }
.hero .meta { margin-top: var(--sp-24); }
.hero + .page { padding-top: var(--sp-48); }

/* Four metrics wrap 3 + 1 on a phone, so they go two by two there. */
@media (max-width: 719.98px) {
  .hero-inner { padding-block: 3.75rem 3rem; }
  .hero-stats { display: grid; grid-template-columns: repeat(2, auto); gap: 1rem 2rem; }
}

/* The glow is wider than narrow screens; clip, not hidden, so nothing becomes
   a scroll container and sticky headers still stick. */
main { overflow-x: clip; }

/* ── Section text ─────────────────────────────────────────────────────── */

.page > h2, .section-t { margin: var(--sp-48) 0 var(--sp-16); }
.page-head + h2, .page > h2:first-child { margin-top: 0; }
.sub { color: var(--text-2); font-size: var(--fs-sm); }
.label { margin: 0; color: var(--text-3); font-size: var(--fs-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.intro-text { max-width: 80ch; margin: 0 0 var(--sp-16); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; }
.count { margin: var(--sp-16) 0 var(--sp-8); color: var(--text-3); font-size: var(--fs-xs); }
.empty { padding: var(--sp-32); border: var(--bw) dashed var(--border-strong); border-radius: var(--r); color: var(--text-2); text-align: center; }

/* ── Callouts: snapshot caveats, docs admonitions, dialog notes ────────── */

.callout, .adm, .note {
  --tone-strong: var(--info-strong);
  --tone-surface: var(--info-surface);
  margin: var(--sp-16) 0;
  padding: var(--sp-12) var(--sp-16);
  border: var(--bw) solid color-mix(in srgb, var(--tone-strong) 25%, transparent);
  border-radius: var(--r);
  background: var(--tone-surface);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.callout > *, .adm > *, .note > * { margin: 0; }
.callout > * + *, .adm > * + *, .note > * + * { margin-top: var(--sp-6); }
.callout-t, .adm-t, .note-t {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  color: var(--tone-strong);
  font-weight: 600;
}
.callout-wait, .adm-warning, .note-wait { --tone-strong: var(--wait-strong); --tone-surface: var(--wait-surface); }
.callout-stop, .adm-caution, .note-stop { --tone-strong: var(--stop-strong); --tone-surface: var(--stop-surface); }
.adm-tip, .note-done { --tone-strong: var(--done-strong); --tone-surface: var(--done-surface); }
.note-none { --tone-strong: var(--none-on); --tone-surface: var(--none-surface); }

/* ── Footer ───────────────────────────────────────────────────────────── */

.site-footer { border-top: var(--bw) solid var(--border); background: var(--bg-subtle); padding-block: var(--sp-24); }
.site-footer .frame { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-16); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-16); margin: 0; padding: 0; list-style: none; }
.site-footer a { display: inline-block; padding-block: 4px; color: var(--text-2); font-size: var(--fs-xs); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer .fine { margin: 0; color: var(--text-3); font-size: var(--fs-label); }

/* ── Overview: finding rows ───────────────────────────────────────────── */

.rows { margin: 0; padding: 0; list-style: none; border: var(--bw) solid var(--border); border-radius: var(--r); background: var(--surface); }
.rows li + li { border-top: var(--bw) solid var(--border); }
.row {
  display: grid;
  grid-template-columns: 7rem minmax(10rem, 14rem) minmax(0, 1fr) 3rem;
  align-items: baseline;
  gap: var(--sp-16);
  padding: var(--sp-12) var(--sp-16);
  color: var(--text);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease);
}
.row:hover { background: var(--hover); color: var(--text); }
.row:focus-visible { outline-offset: -2px; }
.row > .tag, .row-code { justify-self: start; }
.row-desc { color: var(--text-2); line-height: 1.5; }
.row-n { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 719.98px) {
  .row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .row-desc { grid-column: 1 / -1; grid-row: 2; }
}

/* ── Tags, pills, flags ───────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 2px var(--sp-8) 2px var(--sp-6);
  border-radius: var(--r-full);
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.tag-done { background: var(--done-container); color: var(--done-on); }
.tag-wait { background: var(--wait-container); color: var(--wait-on); }
.tag-stop { background: var(--stop-container); color: var(--stop-on); }
.tag-none { background: var(--none-container); color: var(--none-on); }
.tag-iac { background: var(--iac-container); color: var(--iac-on); }

.pill {
  display: inline-block;
  padding: 1px var(--sp-6);
  border-radius: 5px;
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.p-ok { background: var(--done-container); color: var(--done-on); }
.p-bad { background: var(--stop-container); color: var(--stop-on); }
.p-warn { background: var(--wait-container); color: var(--wait-on); }
.p-none { background: var(--none-container); color: var(--none-on); }
a > .pill { text-decoration: underline 1px; text-underline-offset: .18em; }
/* An output directory that is not the workflow default needs an explicit
   output-dir input, and a wrong one publishes the wrong directory. */
code.odd { background: var(--wait-container); color: var(--wait-on); font-weight: 600; }
.yes, .no { display: inline-flex; align-items: center; }
.yes { color: var(--done-strong); }
.no { color: var(--stop-strong); font-weight: 600; }
.dash { color: var(--text-3); }

/* ── Tables ───────────────────────────────────────────────────────────── */

.tw { overflow-x: auto; margin: 0 0 var(--sp-16); border: var(--bw) solid var(--border); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: var(--lh-ui); }
th, td { padding: var(--sp-8) var(--sp-12); border-top: var(--bw) solid var(--border); text-align: start; vertical-align: top; }
thead th {
  border-top: 0;
  border-bottom: var(--bw) solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-3);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
tbody tr:first-child > * { border-top: 0; }
tbody tr { transition: background-color var(--dur-fast) var(--ease); }
tbody tr:hover > * { background: var(--hover); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tw a:focus-visible { outline-offset: 1px; }

/* Long lists: no frame, row rules only, and a header that sticks under the
   bar. (A scrolling wrapper would stop it sticking, so there is none.) */
table.dense { margin-bottom: var(--sp-16); }
table.dense thead th { position: sticky; top: var(--bar-h); z-index: 1; }
/* Narrow: each row becomes a block of label-value pairs. */
@media (max-width: 599.98px) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack tr { display: block; padding: var(--sp-8) 0; border-top: var(--bw) solid var(--border); }
  table.stack td { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: var(--sp-8); padding: var(--sp-4) 0; border: 0; }
  table.stack td::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-label); font-weight: 600; }
}

/* ── Platform tabs ────────────────────────────────────────────────────── */

.tabs { display: flex; gap: var(--sp-24); margin: 0 0 var(--sp-16); border-bottom: var(--bw) solid var(--border); }
.tabs a { padding: var(--sp-8) 0 var(--sp-12); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.tab-n { margin-left: var(--sp-4); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── Filter chips ─────────────────────────────────────────────────────── */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8) var(--sp-12); margin: 0 0 var(--sp-20); }
.filters fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); min-width: 0; margin: 0; padding: 0; border: 0; }
.filters legend { float: left; margin-right: var(--sp-4); }
.chip-list { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin: 0; padding: 0; list-style: none; }
.chip {
  --tone-strong: var(--none-strong);
  --tone-container: var(--none-container);
  --tone-on: var(--none-on);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-6);
  height: 32px;
  padding: 0 var(--sp-12) 0 var(--sp-10);
  border: var(--bw) solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--border-control); color: var(--text); }
.chip .icon { color: var(--tone-strong); }
.chip-n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip-done { --tone-strong: var(--done-strong); --tone-container: var(--done-container); --tone-on: var(--done-on); }
.chip-wait { --tone-strong: var(--wait-strong); --tone-container: var(--wait-container); --tone-on: var(--wait-on); }
.chip-stop { --tone-strong: var(--stop-strong); --tone-container: var(--stop-container); --tone-on: var(--stop-on); }
.chip-iac { --tone-strong: var(--iac-strong); --tone-container: var(--iac-container); --tone-on: var(--iac-on); }
/* The native checkbox stays in the tab order, unseen; the chip shows its
   state with fill, border and weight, not colour alone. */
.chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip:has(input:checked), .chip[aria-current] {
  border-color: var(--tone-strong);
  background: var(--tone-container);
  color: var(--tone-on);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--tone-strong);
}
.chip:has(input:checked) .icon, .chip[aria-current] .icon, .chip:has(input:checked) .chip-n, .chip[aria-current] .chip-n { color: inherit; }
.chip:has(input:focus-visible) { outline: var(--bw-thick) solid var(--focus); outline-offset: 2px; }
.filters-clear { font-size: var(--fs-xs); }
/* With script, a change applies the filter at once, so Apply goes. */
.js .filters-apply { display: none; }

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  height: 32px;
  margin: 0;
  padding: 0 var(--sp-12);
  border: var(--bw) solid transparent;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font: 500 var(--fs-sm)/1 var(--ff-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:hover { color: var(--text); }
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { background: var(--action-hover); color: var(--on-action); }
.btn-ghost { border-color: var(--border-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--border-control); background: var(--hover); }
/* Tonal: the card's status container, so the button reads as part of the card. */
.btn-tonal { background: var(--tone-container, var(--none-container)); color: var(--tone-on, var(--none-on)); }
.btn-tonal:hover { background: color-mix(in srgb, var(--tone-on, var(--none-on)) 10%, var(--tone-container, var(--none-container))); color: var(--tone-on, var(--none-on)); }

/* ── Catalog cards ────────────────────────────────────────────────────────
   Status colours are the owner's palettes, as before: the card takes its
   status's surface, a 1px inset outline in its strong colour, and its
   container for the tonal button. Shape, type and spacing are the redesign's. */

.pcards { display: grid; gap: var(--sp-16); margin: 0; padding: 0; list-style: none; }
@media (min-width: 768px) { .pcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .pcards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pcard { display: grid; }

.proj {
  --tone-surface: var(--none-surface);
  --tone-container: var(--none-container);
  --tone-on: var(--none-on);
  --tone-strong: var(--none-strong);
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
  min-width: 0;
  padding: var(--sp-16);
  border-radius: var(--r);
  background: var(--tone-surface);
  box-shadow: inset 0 0 0 1px var(--tone-strong);
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
  transition: box-shadow var(--dur) var(--ease);
}
.proj:hover, .proj:focus-within { box-shadow: inset 0 0 0 1px var(--tone-strong), var(--shadow-md); }
.proj-done { --tone-surface: var(--done-surface); --tone-container: var(--done-container); --tone-on: var(--done-on); --tone-strong: var(--done-strong); }
.proj-wait { --tone-surface: var(--wait-surface); --tone-container: var(--wait-container); --tone-on: var(--wait-on); --tone-strong: var(--wait-strong); }
.proj-stop { --tone-surface: var(--stop-surface); --tone-container: var(--stop-container); --tone-on: var(--stop-on); --tone-strong: var(--stop-strong); }
.proj-iac { --tone-surface: var(--iac-surface); --tone-container: var(--iac-container); --tone-on: var(--iac-on); --tone-strong: var(--iac-strong); }

.proj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-8); }
.proj-name { min-width: 0; }
.proj-name > * { margin: 0; }
.proj-title { font-size: var(--fs-body); line-height: 1.35; letter-spacing: -.01em; overflow-wrap: anywhere; }
/* Links inside a tinted card take the text colour: link blue on the dark
   green surface is only 4.26:1. The underline still marks them. */
.proj a:not(.btn) { color: var(--text); }
.proj a:not(.btn):hover { color: var(--text); text-decoration-color: currentColor; }
.proj-host { margin-top: 2px; color: var(--text-3); font: 400 var(--fs-label)/1.4 var(--ff-mono); overflow-wrap: anywhere; }
.proj-alert { display: flex; align-items: center; gap: var(--sp-6); margin: 0; color: var(--stop-strong); font-size: var(--fs-xs); font-weight: 600; }
.proj-actions { display: flex; justify-content: flex-end; margin-top: auto; padding-top: var(--sp-4); }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-6) var(--sp-12); align-items: baseline; margin: 0; }
.kv > div { display: contents; }
.kv dt { color: var(--text-3); font-size: var(--fs-label); font-weight: 500; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: break-word; }
.doms { margin: 0; padding: 0; list-style: none; }
.doms a { overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-16); margin: 0; }

/* ── Details dialog ───────────────────────────────────────────────────────
   Native <dialog>: modal, Escape closes it, and kiwi.js closes it on a scrim
   click. Only the body scrolls; a divider marks an edge with more beyond it
   (kiwi.js sets has-above and has-below). */

.dlg {
  width: min(560px, 100% - 32px);
  max-width: none;
  max-height: min(640px, 100% - 48px);
  padding: 0;
  overflow: hidden;
  border: var(--bw) solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
}
.dlg[open] { display: flex; flex-direction: column; }
.dlg::backdrop { background: var(--scrim); }
.dlg-head { flex: none; padding: var(--sp-20) var(--sp-24) 0; }
.dlg-head > * { margin: 0; }
.dlg-title { font-size: var(--fs-h3); overflow-wrap: anywhere; }
.dlg-sub { margin-top: var(--sp-4); font: 400 var(--fs-xs)/1.4 var(--ff-mono); overflow-wrap: anywhere; }
.dlg-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-16);
  min-height: 0;
  margin-top: var(--sp-16);
  padding: 0 var(--sp-24);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-block: var(--bw) solid transparent;
}
.dlg-body .note { margin: 0; }
.dlg.is-scrolling .dlg-body { padding-block: var(--sp-16); }
.dlg.has-above .dlg-body { border-top-color: var(--border); }
.dlg.has-below .dlg-body { border-bottom-color: var(--border); }
.dlg-actions { flex: none; display: flex; justify-content: flex-end; gap: var(--sp-8); margin: 0; padding: var(--sp-16) var(--sp-24) var(--sp-20); }

/* Open: a short fade and settle; close is instant where `overlay` can't
   transition. Reduced motion removes it. */
.dlg, .dlg::backdrop {
  opacity: 0;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), overlay var(--dur) allow-discrete, display var(--dur) allow-discrete;
}
.dlg { transform: translateY(8px); }
.dlg[open], .dlg[open]::backdrop { opacity: 1; transform: none; }
@starting-style {
  .dlg[open], .dlg[open]::backdrop { opacity: 0; }
  .dlg[open] { transform: translateY(8px); }
}

/* The page behind a modal dialog does not scroll. Where the page has a
   classic scrollbar (kiwi.js sets has-scrollbar), its gutter is kept so the
   page does not shift sideways as it disappears. */
html:has(.dlg:modal) { overflow: hidden; }
html.has-scrollbar:has(.dlg:modal) { scrollbar-gutter: stable; }

/* Without kiwi.js nothing can open a dialog, so each card's details show
   inline under it, minus the parts that repeat the card. */
html:not(.js) .proj-actions,
html:not(.js) .dlg-head,
html:not(.js) .dlg-actions { display: none; }
html:not(.js) .dlg {
  position: static;
  display: block;
  width: auto;
  max-height: none;
  margin: var(--sp-8) 0 0;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: none;
  opacity: 1;
  transform: none;
}
html:not(.js) .dlg-body { margin: 0; padding: var(--sp-16); }

/* ── Pagination ───────────────────────────────────────────────────────── */

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin: var(--sp-24) 0 0; font-size: var(--fs-sm); }
.pager ol { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin: 0; padding: 0; list-style: none; }
.pager-range { margin: 0 auto 0 0; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.pager-page { min-width: 32px; padding: 0 var(--sp-8); font-variant-numeric: tabular-nums; }
.pager-page:hover { background: var(--hover); }
.pager-page[aria-current] { background: var(--selected); color: var(--accent-ink); font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn[aria-disabled="true"] { color: var(--text-3); opacity: .55; cursor: default; pointer-events: none; }

/* ── Docs ─────────────────────────────────────────────────────────────── */

/* Prose in column one, the contents rail in column two from 1024px. The rail
   is first in the DOM, so on narrow screens it sits above the prose. */
.doc-layout { display: grid; gap: var(--sp-24); }
.doc { min-width: 0; }
@media (min-width: 1024px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr) 15rem; gap: var(--sp-48); align-items: start; }
  .doc-layout > .doc { grid-column: 1; grid-row: 1; }
  .doc-layout > .toc {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--bar-h) + var(--sp-32));
    max-height: calc(100vh - var(--bar-h) - var(--sp-64));
    overflow-y: auto;
  }
}

/* Reading: a 68-character measure; code, tables and callouts take the
   column. Styled through what markdown.ts emits, which its tests pin. */
.doc > :is(p, ul, ol, blockquote, h2, h3, h4) { max-width: var(--measure); }
.doc > :is(p, ul, ol, blockquote, .tw, .adm, figure, .codetabs) { margin: 0 0 var(--sp-16); }
.doc > :first-child { margin-top: 0; }
.doc > h2 { margin: var(--sp-48) 0 var(--sp-12); }
.doc > :is(h3, h4) { margin: var(--sp-32) 0 var(--sp-8); }
.doc :is(ul, ol) { padding-left: 1.4em; }
.doc li + li { margin-top: var(--sp-6); }
.doc blockquote { padding-left: var(--sp-16); border-left: var(--bw-thick) solid var(--border-strong); color: var(--text-2); }
.doc hr { margin: var(--sp-32) 0; border: 0; border-top: var(--bw) solid var(--border); }
.doc img { max-width: 100%; }
.doc .tw table { font-size: var(--fs-sm); }
/* Heading anchors: visible on hover and on focus. */
.anchor { color: inherit; text-decoration: none; }
.anchor:hover { text-decoration: underline; text-decoration-color: var(--border-strong); }

.toc { font-size: var(--fs-xs); }
.toc summary { color: var(--text-3); font-size: var(--fs-label); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.toc ul { margin: var(--sp-8) 0 0; padding: 0; list-style: none; border-left: var(--bw) solid var(--border); }
.toc a {
  display: block;
  margin-left: -1px;
  padding: var(--sp-4) 0 var(--sp-4) var(--sp-12);
  border-left: var(--bw-thick) solid transparent;
  color: var(--text-3);
  line-height: 1.4;
  text-decoration: none;
}
.toc a:hover { color: var(--text); }
.toc a:focus-visible { outline-offset: -2px; }
.toc li.d3 a { padding-left: var(--sp-24); }
.toc a.is-active { border-left-color: var(--accent); color: var(--text); font-weight: 500; }
@media (max-width: 1023.98px) {
  .toc { padding: var(--sp-8) var(--sp-16); border: var(--bw) solid var(--border); border-radius: var(--r); }
}
@media (min-width: 1024px) {
  .js .toc summary { pointer-events: none; list-style: none; }
  .js .toc summary::-webkit-details-marker { display: none; }
}

/* Docs index: whole-card links. The title's ::after covers the card, and the
   focus ring moves to the card. */
.doclist { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-16); margin: 0; padding: 0; list-style: none; }
.card {
  position: relative;
  padding: var(--sp-20);
  border: var(--bw) solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card:has(a:focus-visible) { outline: var(--bw-thick) solid var(--focus); outline-offset: 2px; }
.card a:focus-visible { outline: none; }
.card-t { display: flex; align-items: center; gap: var(--sp-8); margin: 0 0 var(--sp-8); font-size: var(--fs-body); }
.card-t .icon { color: var(--accent); }
.card-t a { color: var(--text); text-decoration: none; }
.card-t a::after { content: ""; position: absolute; inset: 0; }
.card-b { margin: 0 0 var(--sp-12); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.55; }
.card-p { margin: 0; color: var(--text-3); font-size: var(--fs-label); }

/* Numbered steps: a CSS counter in a hairline circle. */
.steps { margin: 0 0 var(--sp-16); padding: 0; list-style: none; counter-reset: step; max-width: var(--measure); }
.steps li { position: relative; padding: 0 0 var(--sp-16) 40px; counter-increment: step; }
.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: var(--bw) solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.steps li:not(:last-child)::after { content: ""; position: absolute; top: 30px; bottom: 4px; left: 12.5px; border-left: var(--bw) solid var(--border); }

/* ── Code ─────────────────────────────────────────────────────────────── */

.code { margin: 0 0 var(--sp-16); overflow: hidden; border: var(--bw) solid var(--border); border-radius: var(--r); background: var(--bg-subtle); }
.code-head { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 0 var(--sp-6) 0 var(--sp-12); border-bottom: var(--bw) solid var(--border); }
.code-lang { color: var(--text-3); font: 500 var(--fs-label)/1 var(--ff-mono); }
.code pre { margin: 0; padding: var(--sp-12) var(--sp-16); overflow-x: auto; font-size: var(--fs-sm); line-height: 1.65; tab-size: 2; }
.code pre code { padding: 0; border-radius: 0; background: none; font-size: inherit; }
.code pre:focus-visible { outline-offset: -2px; }
.copy { width: 26px; height: 26px; }
.copy[data-copied] { color: var(--done-strong); }
.hl-c { color: var(--text-3); font-style: italic; }
.hl-s { color: var(--done-strong); }
.hl-v { color: var(--link); }
.hl-f { color: var(--wait-strong); }
.hl-k { color: var(--accent); font-weight: 500; }
.hl-n { color: var(--wait-strong); }
.hl-x { font-weight: 500; }

/* Example tabs: radio inputs, so they switch with CSS alone. */
.codetabs { margin: 0 0 var(--sp-16); }
.codetabs > input { position: absolute; opacity: 0; pointer-events: none; }
.codetabs > label {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin: 0 var(--sp-4) var(--sp-8) 0;
  padding: 0 var(--sp-10);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
}
.codetabs > label:hover { background: var(--hover); color: var(--text); }
.codetabs > input:checked + label { background: var(--selected); color: var(--accent-ink); font-weight: 600; }
.codetabs > input:focus-visible + label { outline: var(--bw-thick) solid var(--focus); outline-offset: 2px; }
.codetab { display: none; }
.codetab .code { margin: 0; }
.codetabs > input:nth-of-type(1):checked ~ .codetab:nth-of-type(1),
.codetabs > input:nth-of-type(2):checked ~ .codetab:nth-of-type(2),
.codetabs > input:nth-of-type(3):checked ~ .codetab:nth-of-type(3) { display: block; }

/* ── API reference ────────────────────────────────────────────────────── */

.api .endpoint { margin-top: var(--sp-48); }
.api h2 { margin: 0 0 var(--sp-12); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); font-size: var(--fs-h3); }
.api h2 code { padding: 0; background: none; font-size: .95em; }
.method { padding: 2px var(--sp-6); border-radius: 5px; font: 600 var(--fs-label)/1.4 var(--ff-mono); letter-spacing: .02em; }
.method-get { background: var(--done-container); color: var(--done-on); }
.method-post { background: var(--wait-container); color: var(--wait-on); }
.api .label { margin: var(--sp-16) 0 var(--sp-8); }
.api .label code { text-transform: none; letter-spacing: 0; }
.fields { margin: 0; border-top: var(--bw) solid var(--border); font-size: var(--fs-sm); }
.fields > div { display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: var(--sp-16); padding: var(--sp-8) 0; border-bottom: var(--bw) solid var(--border); }
.fields dt code { background: none; padding: 0; }
.fields dd { margin: 0; color: var(--text-2); }
@media (max-width: 599.98px) { .fields > div { grid-template-columns: 1fr; gap: var(--sp-2); } }

/* ── 404 ──────────────────────────────────────────────────────────────── */

.page ul.links { display: block; padding-left: 1.2em; }
