/* print-bench — the Modernist design system, applied to the static site.
 *
 * From the "Site Wireframes" design export: flat and architectural, set
 * entirely in Archivo — ink on a warm light ground with one red accent, a
 * visible grid, zero corner radius, strong 2px rules doing the organising,
 * labels flush left (buttons included), photography printed grayscale.
 *
 * One stylesheet, no framework. The Modernist source system is light-only;
 * the dark palette below is derived from it (same ink/ground discipline,
 * accent lifted one ramp step for contrast) so the existing theme toggle
 * keeps working: dark is the @media default with a [data-theme] override
 * that outranks it either way.
 */

/* Archivo, variable 400–800 — vendored (site/assets/fonts/, OFL 1.1); the
   served output references nothing external. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* Modernist light — the tokens from the design system's styles.css. */
  --ink: #201e1d;
  --ink-soft: #57534e;
  --ink-faint: #8a857f;
  --paper: #f3f2f2;
  --panel: #ffffff;
  --rule: #201e1d;                /* strong rules are drawn in ink here */
  --rule-soft: #d8d5cf;
  --accent: #ec3013;
  --accent-deep: #ae1800;         /* accent-700: body-size accent text */
  --accent-soft: #fff2ef;         /* accent-100: tinted fills */
  --warn-bg: #fff2ef;
  --warn-rule: #ec3013;
  --warn-ink: #ae1800;

  --shadow: 0 1px 3px rgb(32 30 29 / 8%);
  --viewer-bg: #eae9e9;
  --radius: 0px;                  /* Modernist: no corner is rounded */

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 68ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

/* Derived dark — same discipline, inverted ground, accent one step lighter. */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceae6;
    --ink-soft: #b5aea8;
    --ink-faint: #8a857f;
    --paper: #191716;
    --panel: #211f1e;
    --rule: #eceae6;
    --rule-soft: #3a3735;
    --accent: #ff563c;
    --accent-deep: #ffc4b8;
    --accent-soft: #3a1c15;
    --warn-bg: #3a1c15;
    --warn-rule: #ff563c;
    --warn-ink: #ffc4b8;
    --shadow: 0 1px 3px rgb(0 0 0 / 40%);
    --viewer-bg: #14100e;
  }
}

:root[data-theme="light"] {
  --ink: #201e1d;
  --ink-soft: #57534e;
  --ink-faint: #8a857f;
  --paper: #f3f2f2;
  --panel: #ffffff;
  --rule: #201e1d;
  --rule-soft: #d8d5cf;
  --accent: #ec3013;
  --accent-deep: #ae1800;
  --accent-soft: #fff2ef;
  --warn-bg: #fff2ef;
  --warn-rule: #ec3013;
  --warn-ink: #ae1800;
  --shadow: 0 1px 3px rgb(32 30 29 / 8%);
  --viewer-bg: #eae9e9;
}

:root[data-theme="dark"] {
  --ink: #eceae6;
  --ink-soft: #b5aea8;
  --ink-faint: #8a857f;
  --paper: #191716;
  --panel: #211f1e;
  --rule: #eceae6;
  --rule-soft: #3a3735;
  --accent: #ff563c;
  --accent-deep: #ffc4b8;
  --accent-soft: #3a1c15;
  --warn-bg: #3a1c15;
  --warn-rule: #ff563c;
  --warn-ink: #ffc4b8;
  --shadow: 0 1px 3px rgb(0 0 0 / 40%);
  --viewer-bg: #14100e;
}

* { box-sizing: border-box; }

/* .btn and .card set display, which outranks the plain `hidden` attribute —
   without this the configurator's Download button is visible (and hrefless)
   before anything has been rendered. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

img, video { max-width: 100%; height: auto; }

/* Modernist prints photography in black and white. */
.grayscale, .prose img, .card-media img { filter: grayscale(1) contrast(1.05); }

code, kbd, samp, pre { font-family: var(--mono); font-size: 0.88em; }

code {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  padding: 0.12em 0.36em;
  border-radius: 0;
}

pre {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  padding: 1rem;
  border-left: 2px solid var(--rule);
  overflow-x: auto;
  line-height: 1.5;
}

pre code { background: none; padding: 0; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- shell ---------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-head {
  border-bottom: 2px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 56px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.brand .brand-mark { color: var(--accent); }

.site-nav { display: flex; gap: 1.1rem; margin-left: auto; align-items: center; }

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

.theme-toggle {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 0;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.site-foot {
  border-top: 2px solid var(--rule);
  margin-top: 4rem;
  padding: 1.25rem 0 2.5rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.site-foot .wrap { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }

/* ---------- hero ---------- */

.hero {
  padding: clamp(2rem, 6vw, 3.75rem) 0 2rem;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.hero p {
  max-width: 52ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

/* ---------- decision queue (index) ---------- */

/* A maintainer-facing alert: the autonomy pipeline parked these for a human.
   Accent-tinted with an accent left rule so it reads as "needs you" without
   abandoning the flat, 2px-rule Modernist discipline. Absent entirely (no DOM)
   when the queue is empty or the fetch was skipped — so this never renders a
   hollow panel on a local/CI build. */
.decisions {
  border: 2px solid var(--rule);
  border-left: 6px solid var(--accent);
  background: var(--accent-soft);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  margin: 0 0 2rem;
}

.decisions h2 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
}

.decisions > p {
  max-width: 60ch;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0 0 0.85rem;
}

.dec-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  border-top: 1px solid var(--rule-soft);
}

.dec-list li {
  border-bottom: 1px solid var(--rule-soft);
}

.dec-list li a {
  display: block;
  padding: 0.5rem 0;
  color: var(--ink);
  text-decoration: none;
}

.dec-list li a:hover {
  color: var(--accent);
}

.dec-num {
  font-family: var(--mono);
  color: var(--ink-faint);
  margin-right: 0.45rem;
}

.dec-kind {
  display: inline-block;
  margin-left: 0.45rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.dec-search {
  margin: 0;
  font-size: 0.9rem;
}

.dec-search a {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- gallery ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding-bottom: 1rem;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.card:hover { border-color: var(--accent); }

.card-media {
  display: block;
  background: color-mix(in srgb, var(--ink) 5%, var(--panel));
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }

.card-body h2 { margin: 0; font-size: 1.05rem; }

.card-body h2 a { color: var(--ink); text-decoration: none; }

.card-body h2 a:hover { color: var(--accent); }

.card-body p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }

.card-foot {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

/* The pair credit — "Shai with Vera" — from the design's committed roster. */
.card-credit {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 0.35rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.15em 0.5em;
  border-radius: 0;
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--accent);
  white-space: nowrap;
}

.tag-plain { border-color: var(--ink-faint); color: var(--ink-faint); background: transparent; }

.tag-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-rule); }

/* ---------- gallery card media (the media rework, PR #159) ---------- */

/* Grayscale at rest per the imagery rule; color (and, when the design ships
   a turntable GIF, motion) on hover/focus. The GIF frame is pre-rendered
   markup revealed by CSS — display:none + lazy keeps it unfetched until the
   first hover, and no script ever writes an image URL. */
.card-media { position: relative; }
.card:hover .card-media img,
.card:focus-within .card-media img { filter: none; }
.card-media .card-spin {
  display: none;
  position: absolute;
  inset: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .card:hover .card-media .card-spin,
  .card:focus-within .card-media .card-spin { display: block; }
}
.media-chip {
  position: absolute;
  right: 0;
  bottom: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35em 0.6em;
}
.media-chip-spin {
  bottom: 1.85em;
  background: var(--accent);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card:hover .media-chip-spin,
.card:focus-within .media-chip-spin { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .media-chip-spin { display: none; }
}

/* ---------- product-page media stage (the media rework, PR #159) ---------- */

.media-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  border: 1px solid var(--rule);
  background: var(--panel);
  margin-bottom: 1.6rem;
}
.stage-main { border-right: 1px solid var(--rule); min-width: 0; }
.media-stage-solo { grid-template-columns: 1fr; }
.media-stage-solo .stage-main { border-right: 0; }
.stage-frame {
  background: var(--viewer-bg);
  display: grid;
  place-items: center;
  height: min(56vh, 540px);
  overflow: hidden;
}
/* The stage shows the shot as shipped — in color; the grayscale imagery rule
   stays on the rail thumbs and gallery cards where media is texture, not the
   subject. All views share the frame's grid cell; site.js toggles `hidden`. */
.stage-frame img {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: min(56vh, 540px);
  object-fit: contain;
}
.stage-cap {
  border-top: 1px solid var(--rule);
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stage-cap p { margin: 0; }
.stage-cap-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.stage-count { color: var(--ink-faint); font-family: var(--mono); font-size: 0.75rem; }
.stage-alt { color: var(--ink-soft); font-size: 0.85rem; }
.stage-disclosure {
  border-left: 3px solid var(--warn-rule);
  padding: 0.25rem 0 0.25rem 0.6rem;
  color: var(--warn-ink);
  font-size: 0.8rem;
  font-style: italic;
  max-width: var(--measure);
}
.stage-rail {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(min(56vh, 540px) + 7rem);
}
.stage-thumb {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stage-thumb:last-child { border-bottom: 0; }
.stage-thumb img {
  width: 72px;
  height: 54px;
  object-fit: cover;
  background: var(--viewer-bg);
  border: 1px solid var(--rule-soft);
  filter: grayscale(1);
}
.stage-thumb.sel {
  background: color-mix(in srgb, var(--ink) 5%, var(--panel));
  box-shadow: inset 3px 0 0 var(--accent);
}
.stage-thumb.sel img,
.stage-thumb:hover img { filter: none; }
.stage-thumb-label { display: block; font-size: 0.8rem; font-weight: 700; line-height: 1.25; }
.stage-thumb-kind {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stage-ai-mark { color: var(--warn-ink); }

@media (max-width: 860px) {
  .media-stage { grid-template-columns: 1fr; }
  .stage-main { border-right: 0; }
  .stage-rail {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    border-top: 1px solid var(--rule);
  }
  .stage-thumb {
    grid-template-columns: 64px;
    grid-template-rows: auto auto;
    border-bottom: 0;
    border-right: 1px solid var(--rule-soft);
    min-width: 8rem;
  }
  .stage-thumb img { width: 64px; height: 48px; }
  .stage-thumb.sel { box-shadow: inset 0 3px 0 var(--accent); }
}

/* ---------- derivative cards ---------- */

/* A derivative sits directly after the design it reuses: red inset border,
   ↳ lead-in, and the credit line — the credit is the load-bearing one when
   the grid reflows to one column. */
.card-derived {
  margin-left: calc(var(--lineage-depth, 1) * 1.1rem);
  border-left: 3px solid var(--accent);
}

.lineage-mark { color: var(--accent); font-weight: 400; }

.card-lineage {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-deep);
}

.card-lineage a { color: inherit; }

.rail-note { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--ink-faint); }

/* ---------- design page head ---------- */

.design-head { padding: 1.75rem 0 1.25rem; }

.design-head h1 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.4rem;
}

.design-sub { margin: 0; color: var(--ink-soft); max-width: 52ch; }

/* The lineage strip: the parent chain as ruled nodes, current node filled. */
.lineage-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  margin: 0;
}

.lineage-node {
  border: 1px solid var(--rule);
  padding: 0.15em 0.55em;
  color: var(--ink-soft);
  text-decoration: none;
}

a.lineage-node:hover { color: var(--accent); border-color: var(--accent); }

.lineage-node-current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.lineage-arrow { color: var(--accent); font-weight: 700; }

/* ---------- tabs (wireframe 1d: one concern on screen at a time) ---------- */

.design-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  margin-top: 1.25rem;
}

.design-tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--rule-soft);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.55rem 0.9rem;
  text-align: left;
  cursor: pointer;
}

.design-tab:first-child { border-left: 0; }

.design-tab:hover { color: var(--accent); }

.design-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* Without JavaScript every panel stays visible, stacked, each opening with
   its own ruled heading — closed ≠ hidden, and nothing is unreachable. The
   tab bar itself is progressive enhancement: site.js unhides it and starts
   hiding the unselected panels. */
.design-tabs[hidden] { display: none; }

.tab-panel { padding-top: 1.5rem; }

.tab-panel > .panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  border-top: 2px solid var(--rule);
  padding-top: 0.5rem;
  margin: 0 0 1rem;
}

/* Once JS is driving the tabs, panels hide/show and the fallback labels go. */
.tabs-live .tab-panel[hidden] { display: none !important; }
.tabs-live .tab-panel > .panel-label { display: none; }

/* ---------- design page layout ---------- */

.design-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}

@media (min-width: 940px) {
  .design-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 3rem; }
  .rail { position: sticky; top: 80px; align-self: start; }
}

.rail { font-size: 0.9rem; }

.rail h3 {
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
  font-weight: 700;
  border-top: 2px solid var(--rule);
  padding-top: 0.5rem;
}

.rail + .rail, .rail-block + .rail-block { margin-top: 1.5rem; }

.rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }

.rail a { color: var(--ink-soft); text-decoration: none; }

.rail a:hover { color: var(--accent); text-decoration: underline; }

/* Release download rows (issue #139). */
.downloads .dl-meta {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.toc a { display: block; padding: 0.1rem 0; border-left: 2px solid var(--rule-soft); padding-left: 0.7rem; }

.toc a:hover { border-left-color: var(--accent); }

.toc .toc-h3 { padding-left: 1.4rem; font-size: 0.86rem; }

/* ---------- prose (rendered markdown) ---------- */

.prose { max-width: var(--measure); }

.prose > * + * { margin-top: 1.1rem; }

.prose a { color: var(--accent-deep); }
.prose a:hover { color: var(--accent); }

.prose h1 { font-size: clamp(1.9rem, 4.5vw, 2.5rem); line-height: 1.1; margin: 0 0 0.5rem; }

.prose h2 {
  font-size: 1.35rem;
  margin-top: 2.6rem;
  padding-top: 0.6rem;
  border-top: 2px solid var(--rule);
  scroll-margin-top: 80px;
}

.prose h3 { font-size: 1.08rem; margin-top: 1.8rem; scroll-margin-top: 80px; }

.prose h4 { font-size: 0.95rem; margin-top: 1.4rem; color: var(--ink-soft); }

.prose img {
  border-radius: 0;
  border: 1px solid var(--rule);
  background: var(--panel);
  display: block;
}

.prose figure { margin: 1.6rem 0; }

.prose figcaption { color: var(--ink-faint); font-size: 0.85rem; margin-top: 0.5rem; text-align: left; }

.prose ul, .prose ol { padding-left: 1.35rem; }

.prose li + li { margin-top: 0.35rem; }

.prose li > ul, .prose li > ol { margin-top: 0.35rem; }

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  background: transparent;
  border-radius: 0;
  color: var(--ink-soft);
}

.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }

/* GitHub-style admonition blockquotes: > [!IMPORTANT] etc. */
.prose blockquote.admonition {
  background: var(--warn-bg);
  border-left-color: var(--warn-rule);
  color: var(--warn-ink);
  padding: 0.9rem 1.1rem;
}

.prose blockquote .admonition-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.table-scroll { overflow-x: auto; margin: 1.5rem 0; }

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
  min-width: 30rem;
}

.prose th, .prose td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

.prose th {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 2px solid var(--rule);
}

.prose tbody tr:last-child td { border-bottom: none; }

.prose hr { border: none; border-top: 2px solid var(--rule); margin: 2.5rem 0; }

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

.notice {
  border: 1px solid var(--warn-rule);
  border-left-width: 3px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 0;
  padding: 0.9rem 1.1rem;
  font-size: 0.92rem;
  margin: 1.5rem 0;
}

.notice strong { color: inherit; }

.notice > :first-child { margin-top: 0; }
.notice > :last-child { margin-bottom: 0; }

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

/* Modernist buttons: square, flush-left labels — a button wider than its
   label starts the text at the left padding edge, never centered. */
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 0;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding-right: 1.9rem;
}

.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* ---------- misc ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip-link:focus { left: 0; }

.lede { font-size: 1.05rem; color: var(--ink-soft); max-width: var(--measure); }

.muted { color: var(--ink-faint); }

.mono { font-family: var(--mono); }

/* ---------- configurator ---------- */

.cfg {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rule);
  max-width: var(--measure);
}

.cfg h2 { margin-top: 0; border-top: none; padding-top: 0; font-size: 1.35rem; }

.cfg-caveat {
  border: 1px solid var(--warn-rule);
  border-left-width: 3px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 0;
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
}

.cfg-panel { margin-top: 1.5rem; }

.cfg-section {
  border: 1px solid var(--rule-soft);
  border-radius: 0;
  padding: 1rem 1.15rem 1.15rem;
  margin: 0 0 1rem;
}

.cfg-section legend {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  padding: 0 0.4rem;
}

.cfg-field { margin-bottom: 0.9rem; }
.cfg-field:last-child { margin-bottom: 0; }

.cfg-field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.cfg-field input[type="number"],
.cfg-field input[type="text"],
.cfg-field select {
  width: 100%;
  max-width: 16rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--ink-faint);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.cfg-field input:focus, .cfg-field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cfg-field-bool { display: flex; align-items: center; gap: 0.6rem; }
.cfg-field-bool label { margin-bottom: 0; order: 2; }
.cfg-field-bool input { order: 1; width: auto; accent-color: var(--accent); }
.cfg-field-bool .cfg-help { order: 3; flex-basis: 100%; }

.cfg-help {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.45;
}

.cfg-limits {
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.cfg-limits h4 { margin: 0 0 0.5rem; font-size: 0.92rem; }
.cfg-limits ul { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); }
.cfg-limits li + li { margin-top: 0.25rem; }

.cfg-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.cfg-status { margin: 0.9rem 0 0; font-size: 0.92rem; color: var(--ink-soft); min-height: 1.2em; }
.cfg-status.cfg-ok { color: var(--accent-deep); font-weight: 600; }
.cfg-status.cfg-error { color: var(--warn-ink); font-weight: 600; }

.cfg-diagnostics {
  margin-top: 0.8rem;
  border: 1px solid var(--rule-soft);
  border-radius: 0;
  overflow: hidden;
}

.cfg-diag {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule-soft);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.cfg-diag:last-child { border-bottom: none; }

.cfg-diag-error { background: var(--warn-bg); color: var(--warn-ink); }

.cfg-foot { margin-top: 1rem; font-size: 0.85rem; }

/* ---------- member profiles (issue #124) ---------- */

.profile-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.profile-card { padding: 1.25rem 1.35rem 1.4rem; overflow: visible; }

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* The identity mark: a DiceBear avatar where one is committed (square,
   printed grayscale — notionists for humans, bottts for agents), otherwise
   the kind-coded initials monogram. Both share the .monogram box. */
.monogram {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 0;
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  border: 1px solid var(--rule);
}

img.monogram { filter: grayscale(1); background: var(--paper); object-fit: cover; }

.monogram-human { background: var(--accent); color: #fff; border-color: var(--accent); }
.monogram-agent { background: color-mix(in srgb, var(--ink) 7%, var(--panel)); color: var(--ink-soft); }

img.monogram-human, img.monogram-agent { background: var(--paper); }

/* ---------- avatar studio (People page) ---------- */

.avatar-slot { position: relative; display: inline-block; flex: none; }

/* The recycle glyph, bottom-right on the avatar. Ships hidden; site.js
   reveals it (the studio is JS-only by nature). */
.avatar-reroll {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 20px;
  height: 20px;
  padding: 2px;
  display: inline-grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink-soft);
  cursor: pointer;
}
.avatar-reroll:hover { color: var(--accent); border-color: var(--accent); }
.avatar-reroll svg { width: 12px; height: 12px; }

.avatar-studio {
  border: 2px solid var(--rule);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 1.1rem 1.25rem 1.25rem;
  max-width: min(30rem, 90vw);
  box-shadow: var(--shadow);
}
.avatar-studio::backdrop { background: rgb(32 30 29 / 45%); }
.avatar-studio-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 0.5rem; }
.avatar-studio-head .eyebrow { margin: 0; }
.avatar-studio-close {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  width: 24px;
  height: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.avatar-studio-close:hover { color: var(--accent); border-color: var(--accent); }
.avatar-studio-note { margin: 0 0 0.9rem; font-size: 0.85rem; color: var(--ink-soft); }
.avatar-studio-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; margin-bottom: 0.9rem; }
.avatar-studio-row:last-child { margin-bottom: 0; }
.avatar-studio-row label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); display: flex; flex-direction: column; gap: 0.25rem; }
.avatar-studio-row select {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--ink-faint);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}
.avatar-studio-config {
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
}

.profile-id { min-width: 0; }

.profile-name { margin: 0; font-size: 1.1rem; }

.profile-handle {
  font-size: 0.75rem;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid var(--rule-soft);
  margin-left: 0.3rem;
}

.profile-role { margin: 0.15rem 0 0; color: var(--ink-soft); font-size: 0.92rem; }

.profile-pills { margin-left: auto; display: flex; gap: 0.35rem; flex-wrap: wrap; }

.pill {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22em 0.6em;
  border-radius: 0;
  border: 1px solid var(--rule-soft);
  white-space: nowrap;
}

.pill-human { border-color: var(--accent); color: var(--accent-deep); }
.pill-agent { color: var(--ink-soft); }
.pill-shared { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }

.profile section { margin-top: 1.1rem; }

.profile h4 {
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.45rem;
  font-weight: 700;
  border-top: 2px solid var(--rule);
  padding-top: 0.45rem;
}

.profile-mandate p { margin: 0 0 0.4rem; font-size: 0.93rem; line-height: 1.55; }

.mandate-summary { color: var(--ink); font-weight: 600; }

.mandate-source { font-size: 0.82rem; }

.mandate-source a { color: var(--ink-soft); }

.profile-teams p { margin: 0; display: flex; gap: 0.4rem; flex-wrap: wrap; }

.work-scope { color: var(--ink-faint); text-transform: none; letter-spacing: normal; }

.work-list { list-style: none; margin: 0; padding: 0; }

.work-list li {
  display: flex;
  gap: 0.7rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.work-date { flex: none; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); padding-top: 0.15em; }

.work-text { color: var(--ink-soft); }

.work-artifact { font-size: 0.85em; }

.work-empty { margin: 0; font-size: 0.9rem; }

/* ---------- in-browser 3D viewer (issue #100) ---------- */

.viewer {
  margin-top: 1.5rem;
  max-width: var(--measure);
}

.viewer h2 { margin-top: 0; font-size: 1.35rem; }

.viewer-stage { margin-top: 1.25rem; }

.viewer-canvas {
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 300px;
  border: 1px solid var(--rule);
  border-radius: 0;
  overflow: hidden;
  background: var(--viewer-bg);
}

.viewer-canvas canvas { display: block; width: 100%; height: 100%; }

.viewer-status {
  margin: 0.9rem 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  min-height: 1.2em;
}
.viewer-status.viewer-error { color: var(--warn-ink); font-weight: 600; }

.viewer-foot { margin-top: 1rem; font-size: 0.85rem; }

.viewer noscript img {
  display: block;
  max-width: 100%;
  margin-top: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 0;
}

/* ---------- product page: team contributions (issue #122, revised) -------- */

/* In the design header the block sits between the description and the
   action row (preview-review feedback on PR #151): compact cards, capped
   width so the header keeps its column rhythm. */
.design-head .contributions-team { margin: 1rem 0 0.25rem; max-width: 44rem; }
.design-head .contributions-team .eyebrow { margin-bottom: 0.35rem; }
.design-head .contributor { flex: 0 1 auto; padding: 0.5rem 0.8rem; }
.design-head .reviewed-by { margin-top: 0.75rem; }

.contributor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.6rem;
}
.contributor {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 min(18rem, 100%);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: inherit;
}
.contributor:hover { border-color: var(--accent); color: inherit; }
.contributor .monogram { width: 34px; height: 34px; font-size: 0.8rem; flex: 0 0 auto; }
.contributor-id { display: flex; flex-direction: column; line-height: 1.35; }
.contributor-name { color: var(--ink); font-weight: 600; }
.contributor-name code { font-family: var(--mono); font-size: 0.8rem; font-weight: 400; color: var(--ink-faint); }
.contributor-role { font-size: 0.85rem; }

.reviewed-by { margin: 1.25rem 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.reviewed-by a { color: var(--ink-soft); text-decoration: underline; }
.reviewed-by a:hover { color: var(--accent); }
.reviewed-all { margin-left: 0.5rem; font-family: var(--mono); font-size: 0.82rem; }

.team-history { margin-top: 2rem; }
.history-empty { margin: 0; max-width: var(--measure); }

/* The timeline: a strong ruled rail, square accent markers (the Modernist
   wireframe's ink rail + red pips), avatars beside each attributed event. */
.timeline {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--rule);
  max-width: var(--measure);
}
.timeline-event { position: relative; padding: 0 0 1.5rem 0.5rem; }
.timeline-event:last-child { padding-bottom: 0; }
.timeline-event::before {
  content: "";
  position: absolute;
  left: calc(-1.25rem - 1px - 3px);
  top: 0.3rem;
  width: 7px;
  height: 7px;
  border-radius: 0;
  background: var(--accent);
}
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}
.timeline-date { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-faint); }
.timeline-source { font-size: 0.72rem; }
.timeline-text { margin: 0.25rem 0 0; color: var(--ink); }
.timeline-detail { margin: 0.15rem 0 0; font-size: 0.9rem; max-width: var(--measure); }
.timeline-who {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.timeline-who .monogram { width: 1.4rem; height: 1.4rem; font-size: 0.7rem; }
.timeline-who-name { font-size: 0.85rem; color: var(--ink-soft); }
.timeline-who-name code { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); }

/* ---------- how it works (behind-the-scenes page) ---------- */

/* Same Modernist vocabulary as the rest of the site — flat panels, 2px rules,
   square corners, one red accent, mono uppercase labels — reusing the shared
   tokens so it themes light/dark with everything else. */

.how-hero .statrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 1.75rem;
  border: 2px solid var(--rule);
  max-width: 52rem;
}
.how-hero .stat {
  flex: 1 1 12rem;
  padding: 0.9rem 1.1rem;
  border-left: 1px solid var(--rule-soft);
}
.how-hero .stat:first-child { border-left: 0; }
.how-hero .stat-n {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--accent);
}
.how-hero .stat-l {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.how-sec { margin: 3rem 0; scroll-margin-top: 80px; }

.how-sec > .panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  border-top: 2px solid var(--rule);
  padding-top: 0.5rem;
  margin: 0 0 0.7rem;
}
.how-sec > h2 {
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
  max-width: 34ch;
}
.how-sec > p { max-width: var(--measure); color: var(--ink-soft); }
.how-sec > p code, .how-card p code, .how-lede code { color: var(--ink); }
.how-lede {
  font-size: 1.05rem;
  color: var(--ink-soft) !important;
  max-width: var(--measure);
  margin: 0 0 1.5rem;
}
.how-more { font-size: 0.9rem; color: var(--ink-faint) !important; margin-top: 1.4rem; }

/* The two-layer stack diagram. */
.layerstack { display: flex; flex-direction: column; margin: 1.5rem 0; max-width: 52rem; }
.layer {
  border: 2px solid var(--rule);
  background: var(--panel);
  padding: 1.1rem 1.25rem 1.25rem;
}
.layer h3 { margin: 0.15rem 0 0.5rem; font-size: 1.2rem; }
.layer > p { margin: 0 0 0.9rem; color: var(--ink-soft); font-size: 0.95rem; max-width: 60ch; }
.layer-platform { border-left: 4px solid var(--accent); }
.layer-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink-faint);
}
.layer-platform .layer-tag { color: var(--accent-deep); }

/* The seams connector between the two layers. */
.seams {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-left: 2px solid var(--rule);
  border-right: 2px solid var(--rule);
  background: color-mix(in srgb, var(--ink) 4%, var(--panel));
}
.seams-tag {
  align-self: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  flex: 0 0 auto;
}
.seam {
  flex: 1 1 10rem;
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--accent);
  padding: 0.45rem 0.7rem;
  background: var(--panel);
}
.seam b { display: block; font-size: 0.85rem; }
.seam span { display: block; font-size: 0.78rem; color: var(--ink-soft); line-height: 1.35; }

/* Chip rows — reused for the layer contents and the routine list. */
.chiprow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.2em 0.6em;
  border: 1px solid var(--ink-faint);
  color: var(--ink-soft);
  white-space: nowrap;
}

/* The gate-stack stepper. */
.steplist { list-style: none; margin: 1.5rem 0; padding: 0; max-width: var(--measure); }
.step {
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--rule-soft);
}
.step:first-child { border-top: 0; }
.step-n {
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
}
.step-body { min-width: 0; }
.step-body h4 { margin: 0.1rem 0 0.25rem; font-size: 0.98rem; }
.step-body h4 code { background: none; padding: 0; font-size: 1em; }
.step-body p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }

/* Three-up explainer cards (regenerate section). */
.how-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.how-card {
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 0.9rem 1.05rem 1.05rem;
}
.how-card h4 {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border-top: 2px solid var(--rule);
  padding-top: 0.45rem;
}
.how-card p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); line-height: 1.5; }

/* Tables reuse the .prose table styling; just trim the wrapper margins. */
.how-table { margin: 1.5rem 0; max-width: 52rem; }
.how-table .table-scroll { margin: 0; }

/* The closing "read the source" links. */
.how-source {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0;
  border: 2px solid var(--rule);
  margin-top: 1.5rem;
  max-width: 52rem;
}
.how-source-link {
  display: block;
  padding: 0.8rem 1rem;
  border-left: 1px solid var(--rule-soft);
  border-top: 1px solid var(--rule-soft);
  text-decoration: none;
  color: var(--ink);
}
.how-source-link:first-child { border-top: 0; }
.how-source-link:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); color: var(--ink); }
.how-source-k {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}
.how-source-v {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}

@media (min-width: 620px) {
  .how-source-link { border-top: 0; }
  .how-source-link:first-child { border-left: 0; }
}

/* ---------- inline SVG diagrams (site/lib/diagrams.mjs) ---------- */

/* Every colour is a token, so the diagrams theme with the page. Dense ones
   carry a min-width and their figure scrolls horizontally rather than shrinking
   labels to nothing on a phone. */
.diagram { margin: 1.9rem 0; max-width: 66rem; }
.diagram-hold {
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 1.1rem 1.2rem;
  /* Any diagram wider than its hold scrolls inside the hold — the page body
     itself never scrolls sideways, whatever a diagram's min-width is. */
  overflow-x: auto;
}
.diagram-scroll .diagram-hold { overflow-x: auto; }
.diagram figcaption {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin-top: 0.6rem;
  max-width: var(--measure);
}
.diagram-svg { display: block; width: 100%; height: auto; }
.diagram-mid { min-width: 720px; }
.diagram-wide { min-width: 940px; }
.diagram-narrow { max-width: 440px; margin: 0 auto; min-width: 260px; }

/* text */
.diagram-svg text { font: 500 15px var(--sans); fill: var(--ink); }
.diagram-svg .t-bold { font-weight: 700; }
.diagram-svg .t-title { font-weight: 800; font-size: 18px; }
.diagram-svg .t-sub { fill: var(--ink-soft); font-size: 13px; }
.diagram-svg .t-muted { fill: var(--ink-faint); }
.diagram-svg .t-mono { font-family: var(--mono); font-size: 13.5px; }
.diagram-svg .t-accent { fill: var(--accent-deep); }
.diagram-svg .t-on { fill: #fff; }
.diagram-svg .t-lane {
  font-family: var(--mono);
  font-size: 13px;
  fill: var(--ink-faint);
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* boxes and rules */
.diagram-svg .box { fill: var(--panel); stroke: var(--rule); stroke-width: 1.6; }
.diagram-svg .box-soft { fill: var(--panel); stroke: var(--rule-soft); stroke-width: 1.4; }
.diagram-svg .box-accent { fill: var(--accent); stroke: var(--accent); }
.diagram-svg .box-accent-line { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }
.diagram-svg .box-tint { fill: color-mix(in srgb, var(--accent) 9%, var(--panel)); stroke: var(--accent); stroke-width: 1.4; }
.diagram-svg .node-ring { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.diagram-svg .rule { stroke: var(--rule); stroke-width: 2; fill: none; }
.diagram-svg .rule-soft { stroke: var(--rule-soft); stroke-width: 1.3; fill: none; }
.diagram-svg .seam { stroke: var(--accent); stroke-width: 1.5; }
.diagram-svg .band-platform { fill: color-mix(in srgb, var(--ink) 6%, var(--panel)); stroke: var(--rule); stroke-width: 1.6; }
.diagram-svg .band-domain { fill: var(--accent-soft); stroke: var(--rule); stroke-width: 1.6; }
.diagram-svg .ring { stroke: var(--rule-soft); stroke-width: 1.5; }
.diagram-svg .loop { stroke: var(--accent); stroke-width: 1.5; fill: none; stroke-dasharray: 5 4; }
.diagram-svg .loop-arc { stroke: var(--accent); stroke-width: 2; fill: none; }

/* arrowheads */
.diagram-svg .arrow { fill: var(--rule); }
.diagram-svg .arrow-soft { fill: var(--ink-faint); }
.diagram-svg .arrow-accent { fill: var(--accent); }

/* pictographs */
.diagram-svg .ic rect,
.diagram-svg .ic line,
.diagram-svg .ic path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.diagram-svg .ic .ic-fill { fill: var(--ink); stroke: none; }
.diagram-svg .ic .ic-accent { fill: var(--accent); stroke: var(--accent); }
.diagram-svg .ic .ic-check { stroke: var(--accent); stroke-width: 3.4; }

/* ---------- pipeline carousel (How-it-works "pipeline" tab) ---------- */

.carousel {
  border: 1px solid var(--rule);
  background: var(--panel);
  margin: 1.5rem 0;
  max-width: 60rem;
}
.carousel-track { list-style: none; margin: 0; padding: 0; }
.carousel-slide {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  padding: 1.2rem 1.3rem;
}
/* Fallback (no JS): slides stack, ruled apart, all reachable. */
.carousel:not(.carousel-live) .carousel-slide + .carousel-slide {
  border-top: 2px solid var(--rule);
}
@media (min-width: 780px) {
  .carousel-slide {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: center;
  }
}
.carousel-hold {
  background: var(--viewer-bg);
  border: 1px solid var(--rule-soft);
  display: grid;
  place-items: center;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}
.diagram-slide { display: block; width: 100%; height: auto; max-width: 620px; min-width: 440px; }
.diagram-slide text { font-size: 16px; }
.diagram-slide .t-title { font-size: 18px; }
.diagram-slide .t-sub { font-size: 14px; }
.diagram-slide .t-mono { font-size: 14.5px; }
.carousel-cap .carousel-step {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.carousel-cap h4 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.carousel-cap p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; }

.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.7rem 1rem 0.9rem;
  border-top: 1px solid var(--rule-soft);
}
.carousel-btn {
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  flex: none;
}
.carousel-btn:hover { color: var(--accent); border-color: var(--accent); }
.carousel-dots { display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center; }
.carousel-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 1px solid var(--ink-faint);
  background: transparent;
  cursor: pointer;
  border-radius: 0;
}
.carousel-dot:hover { border-color: var(--accent); }
.carousel-dot.sel { background: var(--accent); border-color: var(--accent); }

/* The how-sec sections sit inside tab panels here; trim the first one's top gap
   so it tucks under the tab bar cleanly. */
.tab-panel > .how-sec:first-of-type { margin-top: 1.75rem; }
