/* ===========================================================================
   Swivel Tech — external customer documentation
   Built on the Swivel Design System.

   Brand-supplied: Portal Yellow, Amber Gold, Signal Black, White,
   Digital Light Grey; Space Grotesk + Host Grotesk.
   Derived (marked below): the neutral ramp, shadows, semantic aliases.

   Fonts load from Google Fonts here. For production, swap to the
   self-hosted WOFF2 cuts from the design system's assets/fonts/.
   =========================================================================== */

:root {
  /* --- brand palette (supplied) --- */
  --portal-yellow: #fff927;
  --amber-gold: #ffc600;
  --signal-black: #000000;
  --white: #ffffff;
  --grey-050: #f2f2f2; /* Digital Light Grey */

  /* --- neutral ramp (derived, pure grey — no tint at any step) --- */
  --grey-100: #e6e6e6;
  --grey-200: #d9d9d9;
  --grey-300: #b0b0b0;
  --grey-500: #757575;
  --grey-700: #404040;
  --grey-900: #1f1f1f;
  --grey-950: #141414;

  /* --- semantic, light --- */
  --surface-page: var(--white);
  --surface-sunken: var(--grey-050);
  --surface-raised: var(--white);
  --surface-inverse: var(--signal-black);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --text-primary: var(--signal-black);
  --text-secondary: var(--grey-700);
  --text-muted: var(--grey-500);
  --text-on-inverse: var(--white);
  --border-hairline: var(--grey-200);
  --border-strong: var(--signal-black);
  --link: var(--signal-black);

  /* --- type --- */
  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Host Grotesk", "Helvetica Neue", Arial, sans-serif;

  --track-display: -0.03em;
  --track-label: 0.06em;
  --track-eyebrow: 0.14em;

  /* --- space (4px base) --- */
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;
  --space-9: 64px;
  --space-10: 96px;
  --space-11: 128px;

  --container: 1280px;
  --gutter: 24px;
  --section-y: 96px;
  --measure: 68ch;

  /* --- radius --- */
  --r-control: 8px;
  --r-card: 16px;
  --r-pill: 999px;

  /* --- elevation (derived; neutral black only, never tinted) --- */
  --shadow-none: none;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.14);

  /* --- motion --- */
  --ease-snap: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 120ms;
  --t-mid: 180ms;
  --press-scale: 0.985;
}

@media (min-width: 60rem) {
  :root {
    --gutter: 48px;
    --section-y: 128px;
  }
}

[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* placeholder so the cascade below reads consistently */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-page: var(--signal-black);
    --surface-sunken: var(--grey-950);
    --surface-raised: var(--grey-950);
    --surface-inverse: var(--grey-900);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --text-primary: var(--white);
    --text-secondary: var(--grey-300);
    --text-muted: var(--grey-300);
    --border-hairline: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.24);
    --link: var(--portal-yellow);
  }
}

[data-theme="dark"] {
  --surface-page: var(--signal-black);
  --surface-sunken: var(--grey-950);
  --surface-raised: var(--grey-950);
  --surface-inverse: var(--grey-900);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --text-primary: var(--white);
  --text-secondary: var(--grey-300);
  --text-muted: var(--grey-300);
  --border-hairline: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.24);
  --link: var(--portal-yellow);
}

/* ---------- base ---------- */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

:focus-visible {
  outline: 2px solid var(--portal-yellow);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--signal-black);
  border-radius: 2px;
}
@media (prefers-color-scheme: dark) {
  :focus-visible {
    box-shadow: 0 0 0 4px var(--white);
  }
}

p {
  max-width: var(--measure);
}
ul,
ol {
  padding-left: 20px;
}
li {
  margin-bottom: var(--space-2);
  max-width: var(--measure);
}
strong {
  font-weight: 700;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: var(--space-3);
  z-index: 10;
  background: var(--portal-yellow);
  color: var(--signal-black);
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--r-control);
}

/* ---------- masthead: full-bleed Signal Black, radius 0 ---------- */

.masthead {
  background: var(--signal-black);
  color: var(--white);
  padding: var(--space-9) var(--gutter) var(--space-8);
  border-radius: 0;
}

/* on a black page the black masthead needs an edge to read as a band */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .masthead {
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  }
}
[data-theme="dark"] .masthead {
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.masthead__inner {
  max-width: var(--container);
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--portal-yellow);
  margin: 0 0 var(--space-6);
  max-width: none;
}

.eyebrow__back {
  color: var(--portal-yellow);
}
.eyebrow__back:hover {
  color: var(--amber-gold);
}

.masthead h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.75rem, 1.6rem + 5vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: var(--track-display);
  text-transform: uppercase;
  margin: 0 0 var(--space-6);
}

.standfirst {
  max-width: 60ch;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.5;
  color: var(--grey-300);
  margin: 0 0 var(--space-8);
}

.factbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-8);
  margin: 0;
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.factbar div {
  margin: 0 0 var(--space-4);
}
.factbar dt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--grey-300);
}
.factbar dd {
  margin: var(--space-3) 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0;
  color: var(--white);
}

/* ---------- headings ---------- */

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem);
  line-height: 1.02;
  letter-spacing: var(--track-display);
  text-transform: uppercase;
  margin: 0 0 var(--space-5);
}

.h2__mark {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

h3,
.sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  margin: var(--space-7) 0 var(--space-4);
}

h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  margin: 0 0 var(--space-3);
}

/* ---------- section rail ---------- */

.rail {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-9) var(--gutter) var(--space-10);
}

.rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: var(--space-10);
  left: calc(var(--gutter) + 7px);
  width: 1px;
  background: var(--border-hairline);
}

.block {
  position: relative;
  padding-left: var(--space-8);
  padding-bottom: var(--section-y);
}
.block:last-child {
  padding-bottom: 0;
}

/* circle motif, 2px stroke — used only as a section marker */
.rail__node {
  position: absolute;
  left: 0;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--surface-page);
  border: 2px solid var(--text-primary);
}

/* ---------- klaxon: the one Portal Yellow moment on the page ---------- */

.klaxon {
  background: var(--portal-yellow);
  color: var(--signal-black);
  padding: var(--space-7);
  border-radius: var(--r-card);
  margin-bottom: var(--space-8);
}

.klaxon__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  margin: 0 0 var(--space-4);
  max-width: none;
}

.klaxon__text {
  margin: 0;
  max-width: 60ch;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem);
  line-height: 1.45;
}

/* ---------- do / don't columns ---------- */

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: var(--space-6);
}

.col {
  background: var(--surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  padding: var(--space-6);
}
.col--yes {
  border-color: var(--border-strong);
}
.col--no {
  background: var(--surface-sunken);
}

.col h3 {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-hairline);
}
.col ul {
  margin: 0;
}
.col--no li {
  color: var(--text-secondary);
}

/* ---------- setup steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  margin: var(--space-7) 0;
  counter-reset: step;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: var(--space-8);
  margin-bottom: var(--space-6);
}
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: var(--track-label);
  color: var(--text-muted);
}
.steps > li > p {
  margin: 0;
}

/* portal link block — the one thing a reader must be able to find in a hurry */
.portal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3) var(--space-5);
  max-width: none;
  margin: var(--space-6) 0 var(--space-5);
  padding: var(--space-6);
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
}

.portal__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.portal__url {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  letter-spacing: 0;
  word-break: break-all;
}

.url {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--track-label);
  word-break: break-all;
}

.aside {
  border-left: 2px solid var(--text-primary);
  padding-left: var(--space-5);
  color: var(--text-secondary);
}

/* ---------- form field reference ---------- */

.fields {
  margin: var(--space-7) 0 var(--space-6);
  border-top: 1px solid var(--border-hairline);
}

.field {
  border-bottom: 1px solid var(--border-hairline);
  padding: var(--space-6) 0;
}

.field__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
  max-width: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.req,
.opt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--r-pill);
}
.req {
  background: var(--signal-black);
  color: var(--white);
}
.opt {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-hairline);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .req {
    background: var(--white);
    color: var(--signal-black);
  }
}
[data-theme="dark"] .req {
  background: var(--white);
  color: var(--signal-black);
}

.field p {
  margin: 0 0 var(--space-4);
}
.field ul {
  margin: var(--space-3) 0 0;
}

.pair {
  margin: var(--space-5) 0 0;
  max-width: var(--measure);
}
.pair p {
  margin: 0 0 var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-sunken);
  border-left: 2px solid var(--text-primary);
  border-radius: 0 var(--r-control) var(--r-control) 0;
  font-size: 0.9375rem;
  line-height: 1.45;
}
.pair span {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.pair__bad {
  border-left-color: var(--border-hairline) !important;
  color: var(--text-muted);
}

.checklist {
  list-style: none;
  padding: 0;
}
.checklist li {
  position: relative;
  padding-left: var(--space-6);
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  background: var(--text-primary);
}

.brands {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 0;
  margin: var(--space-5) 0 0;
}
.brands li {
  margin: 0;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: var(--track-label);
}

.send {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: 0;
}

/* ---------- the routing chain ---------- */

.chain {
  list-style: none;
  padding: 0;
  margin: var(--space-7) 0 0;
  counter-reset: hop;
}

.chain li {
  position: relative;
  margin: 0;
  padding: var(--space-5) 0 var(--space-5) var(--space-8);
  max-width: var(--measure);
}

.chain li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-hairline);
}
.chain li:first-child::before {
  top: 24px;
}
.chain li:last-child::before {
  bottom: auto;
  height: 24px;
}

.chain li::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 20px;
  width: 11px;
  height: 11px;
  border-radius: var(--r-pill);
  border: 2px solid var(--text-primary);
  background: var(--surface-page);
}
/* terminal hop is filled, not yellow — the klaxon is this page's one yellow element */
.chain li:last-child::after {
  background: var(--text-primary);
}

.chain__where {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.chain__what {
  margin: 0;
  color: var(--text-secondary);
}

/* ---------- hub / picker ---------- */

.hub {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-9) var(--gutter) var(--space-10);
}

.hub__section {
  margin-bottom: var(--section-y);
}
.hub__section:last-child {
  margin-bottom: 0;
}

.hub__heading {
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-strong);
}

.hub__note {
  color: var(--text-secondary);
}

.index {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr));
  gap: var(--space-6);
}
.index li {
  margin: 0;
  max-width: none;
}

.entry {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 17rem;
  padding: var(--space-7);
  background: var(--surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-none);
  transition:
    border-color var(--t-fast) var(--ease-snap),
    box-shadow var(--t-fast) var(--ease-snap),
    transform var(--t-fast) var(--ease-snap);
}
.entry:hover,
.entry:focus-visible {
  color: inherit;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.entry:active {
  transform: scale(var(--press-scale));
}

.entry__tag {
  margin: 0 0 var(--space-5);
  max-width: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.entry__title {
  margin: 0 0 var(--space-5);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.4rem + 1.1vw, 2.375rem);
  line-height: 1;
  letter-spacing: var(--track-display);
  text-transform: uppercase;
}

.entry__desc {
  margin: 0 0 var(--space-7);
  max-width: 48ch;
  font-size: 1rem;
  color: var(--text-secondary);
}

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: auto 0 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-hairline);
  max-width: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.entry__go {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-primary);
}
.entry__go svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: butt;
}

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

.foot {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-6) var(--gutter) var(--space-9);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.foot p {
  margin: 0;
  max-width: none;
}

/* ---------- small screens ---------- */

@media (max-width: 34rem) {
  .rail::before,
  .rail__node {
    display: none;
  }
  .block {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entry {
    transition: none;
  }
  .entry:hover,
  .entry:focus-visible,
  .entry:active {
    transform: none;
  }
}

@media print {
  .masthead {
    background: none;
    color: var(--signal-black);
    border-bottom: 2px solid var(--signal-black);
  }
  .masthead h1,
  .factbar dd {
    color: var(--signal-black);
  }
  .standfirst,
  .factbar dt {
    color: var(--grey-700);
  }
  .rail::before,
  .rail__node {
    display: none;
  }
}

/* ===========================================================================
   PART 2 — LONG-FORM DOCUMENT SYSTEM
   Components for reference documents that need real wayfinding: many
   sections, several parallel categories, and repeated structural units.

   The system encodes meaning on four independent axes so a reader can tell
   at a glance what a block is, which category it belongs to, and how loud
   it is meant to be:

     1. CHANNEL   categorical colour, drawn only from the brand palette
     2. ICON      a 2px-stroke glyph, same drawing rules as .entry__go
     3. ENCLOSURE panel / callout / tile / strip — what kind of unit this is
     4. WEIGHT    hairline → washed → filled — how loud it is

   Brand discipline: the only chromatic values below are Portal Yellow and
   Amber Gold. Everything else is the neutral ramp. No new hues.
   =========================================================================== */

/* ---------------------------------------------------------------------------
   1 · CHANNELS
   Every categorical component reads --ch-line / --ch-fill / --ch-ink /
   --ch-wash. Set one channel class on a container and its children inherit,
   so a whole section can be recoloured with a single class.
   --------------------------------------------------------------------------- */

:root {
  /* neutral is the default channel — nothing opts in, everything falls back */
  --ch-line: var(--border-strong);
  --ch-fill: var(--surface-inverse);
  --ch-ink: var(--text-on-inverse);
  --ch-wash: var(--surface-sunken);
}

/* Batch / scheduled — the solid, slow, once-a-night channel. Signal Black. */
.ch-batch {
  --ch-line: var(--border-strong);
  --ch-fill: var(--surface-inverse);
  --ch-ink: var(--text-on-inverse);
  --ch-wash: var(--surface-sunken);
}

/* Events / real time — the loud channel. Portal Yellow. */
.ch-event {
  --ch-line: var(--amber-gold);
  --ch-fill: var(--portal-yellow);
  --ch-ink: var(--signal-black);
  --ch-wash: rgba(255, 249, 39, 0.14);
}

/* Campaigns / output — Amber Gold, a half-step quieter than Portal Yellow. */
.ch-campaign {
  --ch-line: var(--amber-gold);
  --ch-fill: var(--amber-gold);
  --ch-ink: var(--signal-black);
  --ch-wash: rgba(255, 198, 0, 0.12);
}

/* Reference / supporting material — recedes on purpose. */
.ch-quiet {
  --ch-line: var(--border-hairline);
  --ch-fill: var(--surface-sunken);
  --ch-ink: var(--text-secondary);
  --ch-wash: var(--surface-sunken);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ch-fill: var(--white);
    --ch-ink: var(--signal-black);
  }
  :root:not([data-theme="light"]) .ch-batch {
    --ch-fill: var(--white);
    --ch-ink: var(--signal-black);
  }
  :root:not([data-theme="light"]) .ch-event {
    --ch-wash: rgba(255, 249, 39, 0.1);
  }
  :root:not([data-theme="light"]) .ch-campaign {
    --ch-wash: rgba(255, 198, 0, 0.1);
  }
  :root:not([data-theme="light"]) .ch-quiet {
    --ch-fill: var(--grey-900);
    --ch-ink: var(--white);
  }
}
[data-theme="dark"] {
  --ch-fill: var(--white);
  --ch-ink: var(--signal-black);
}
[data-theme="dark"] .ch-batch {
  --ch-fill: var(--white);
  --ch-ink: var(--signal-black);
}
[data-theme="dark"] .ch-event {
  --ch-wash: rgba(255, 249, 39, 0.1);
}
[data-theme="dark"] .ch-campaign {
  --ch-wash: rgba(255, 198, 0, 0.1);
}
[data-theme="dark"] .ch-quiet {
  --ch-fill: var(--grey-900);
  --ch-ink: var(--white);
}

/* ---------------------------------------------------------------------------
   2 · ICONS
   One sprite, referenced with <svg class="i"><use href="#i-bolt"/></svg>.
   Same drawing rules as the .entry__go arrow: no fill, 2px stroke, butt caps.
   Icons take currentColor, so they inherit whatever context they sit in.
   --------------------------------------------------------------------------- */

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.i {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  vertical-align: -0.125em;
}
.i--lg {
  width: 1.5em;
  height: 1.5em;
  stroke-width: 1.75;
}

/* ---------------------------------------------------------------------------
   3 · ENCLOSURES
   --------------------------------------------------------------------------- */

/* --- PANEL: a self-contained unit with a channel-coloured header bar.
       The header bar is the strongest "this is one thing" signal in the
       system — use it wherever a reader must not mistake where a unit ends. */

.panel {
  margin: var(--space-6) 0;
  background: var(--surface-raised);
  border: 1px solid var(--ch-line);
  border-radius: var(--r-card);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--ch-fill);
  color: var(--ch-ink);
}

.panel__head .i {
  width: 1.125rem;
  height: 1.125rem;
}

.panel__title {
  margin: 0;
  max-width: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
/* a code-shaped panel title (an event name, a field name) keeps its casing */
.panel__title--mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0;
  text-transform: none;
}

.panel__note {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  opacity: 0.72;
  text-align: right;
}

.panel__body {
  padding: var(--space-6);
}
.panel__body > :first-child {
  margin-top: 0;
}
.panel__body > :last-child {
  margin-bottom: 0;
}
.panel__body p,
.panel__body li {
  font-size: 0.9375rem;
}

/* a washed panel body ties the whole unit to its channel without shouting */
.panel--washed .panel__body {
  background: var(--ch-wash);
}

/* --- CALLOUT: an interruption. Icon in a filled chip, label, then body.
       Three weights: quiet (hairline), loud (channel wash + rule),
       and the klaxon above, which stays the page's one Portal Yellow slab. */

.callout {
  display: flex;
  gap: var(--space-5);
  max-width: var(--measure);
  margin: var(--space-6) 0;
  padding: var(--space-5) var(--space-6);
  background: var(--surface-sunken);
  border-left: 3px solid var(--ch-line);
  border-radius: 0 var(--r-control) var(--r-control) 0;
}
.callout > :last-child {
  margin-bottom: 0;
}

.callout__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-control);
  background: var(--ch-fill);
  color: var(--ch-ink);
}
.callout__icon .i {
  width: 1rem;
  height: 1rem;
}

.callout__main {
  min-width: 0;
}
.callout__main > :last-child {
  margin-bottom: 0;
}

.callout__label {
  display: block;
  margin: 0 0 var(--space-2);
  max-width: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.callout p {
  margin: 0 0 var(--space-3);
  max-width: none;
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* the loud one: full channel wash, heavier rule, dark label */
.callout--loud {
  background: var(--ch-wash);
  border: 2px solid var(--ch-line);
  border-radius: var(--r-control);
  padding: var(--space-6);
}
.callout--loud .callout__label {
  color: var(--text-primary);
}

/* --- TILE: a compact card led by an icon badge. For grids of parallel
       items — data sets, rules, gotchas — where each needs a face. */

.tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
}
.tile > :last-child {
  margin-bottom: 0;
}
.tile--marked {
  border-color: var(--ch-line);
}

.tile__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: var(--space-5);
  border-radius: var(--r-control);
  background: var(--ch-fill);
  color: var(--ch-ink);
}
.tile__badge .i {
  width: 1.25rem;
  height: 1.25rem;
}

/* an outlined badge instead of a filled one — quieter, for long grids */
.tile__badge--hollow {
  background: none;
  color: var(--text-primary);
  border: 2px solid var(--ch-line);
}

.tile__title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.tile__title--mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  text-transform: none;
}

.tile__sub {
  margin: 0 0 var(--space-4);
  max-width: none;
  font-size: 0.8125rem;
  letter-spacing: var(--track-label);
  color: var(--text-muted);
}

.tile p {
  font-size: 0.9375rem;
}
.tile ul,
.tile ol {
  font-size: 0.9375rem;
}

/* --- STRIP: a full-width labelled band that opens a group of cards.
       This is the "category header" device — it makes group boundaries
       unmistakable in a long scroll. */

.strip {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin: var(--space-9) 0 var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--ch-fill);
  color: var(--ch-ink);
  border-radius: var(--r-control);
}
.strip .i {
  width: 1.25rem;
  height: 1.25rem;
}

.strip__eyebrow {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  opacity: 0.7;
}
.strip__title {
  margin: 0;
  max-width: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.strip__meta {
  margin-left: auto;
  text-align: right;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  opacity: 0.75;
}

@media (max-width: 40rem) {
  .strip {
    flex-wrap: wrap;
  }
  .strip__meta {
    margin-left: 0;
    text-align: left;
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   4 · GRIDS
   --------------------------------------------------------------------------- */

.deck {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: var(--space-6);
  margin: var(--space-6) 0 var(--space-7);
  padding: 0;
}
.deck--wide {
  grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr));
}
.deck--tight {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-5);
}
.deck > li,
.deck > div {
  margin: 0;
  max-width: none;
}

/* ---------------------------------------------------------------------------
   5 · BADGES, MARKERS, LEGENDS
   --------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--ch-line);
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-secondary);
}
.badge .i {
  width: 0.75rem;
  height: 0.75rem;
}

/* filled — for the one badge in a row that must win */
.badge--fill {
  background: var(--ch-fill);
  border-color: var(--ch-fill);
  color: var(--ch-ink);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* legend for a diagram or a colour-coded group */
.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  margin: var(--space-5) 0;
  padding: 0;
}
.legend li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  max-width: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.legend .swatch {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 3px;
  background: var(--ch-fill);
  border: 1px solid var(--ch-line);
}

/* ---------------------------------------------------------------------------
   6 · VERDICT LISTS — yes / no / caution, with a glyph per row.
   Replaces bare bullets wherever the reader must sort good from bad fast.
   --------------------------------------------------------------------------- */

.verdicts {
  list-style: none;
  padding: 0;
  margin: var(--space-5) 0;
}
.verdicts li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin: 0 0 var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.verdicts li:last-child {
  border-bottom: 0;
}
.verdicts .i {
  margin-top: 0.2em;
  width: 1rem;
  height: 1rem;
  flex: none;
}

.v-yes .i {
  color: var(--text-primary);
}
.v-no {
  color: var(--text-muted);
}
.v-no .i {
  color: var(--text-muted);
}
.v-warn .i {
  color: var(--amber-gold);
  stroke-width: 2.25;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .v-warn .i {
    color: var(--portal-yellow);
  }
}
[data-theme="dark"] .v-warn .i {
  color: var(--portal-yellow);
}

/* ---------------------------------------------------------------------------
   7 · CODE
   --------------------------------------------------------------------------- */

code,
.mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  letter-spacing: 0;
  word-break: break-word;
}

code {
  padding: 1px 5px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: 4px;
}

.code {
  margin: var(--space-5) 0;
  background: var(--surface-inverse);
  color: var(--text-on-inverse);
  border-radius: var(--r-control);
  overflow: hidden;
}

.code__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--grey-300);
}
.code__head .i {
  width: 0.875rem;
  height: 0.875rem;
}
.code__head span:last-child {
  margin-left: auto;
}

.code pre {
  margin: 0;
  padding: var(--space-5);
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  tab-size: 2;
}
.code code {
  padding: 0;
  background: none;
  border: 0;
  font-size: inherit;
  color: inherit;
}
.code--tall pre {
  max-height: 20rem;
}

/* payload key colouring — the one place a tint earns its keep, because a
   JSON blob is unreadable as a flat wall of text */
.code .k {
  color: var(--portal-yellow);
}
.code .c {
  color: var(--grey-500);
  font-style: italic;
}

/* ---------------------------------------------------------------------------
   8 · CHIPS — dense runs of field or attribute names
   --------------------------------------------------------------------------- */

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  margin: var(--space-3) 0 var(--space-5);
}
.chips li {
  margin: 0;
  max-width: none;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-control);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
}
.chips--words li {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: var(--track-label);
  border-radius: var(--r-pill);
}
.chips--marked li {
  border-color: var(--ch-line);
  border-width: 1px;
}
.chips--washed li {
  background: var(--ch-wash);
  border-color: var(--ch-line);
}

.chips__label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.chips__label .i {
  width: 0.875rem;
  height: 0.875rem;
}
.chips__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-hairline);
}

/* ---------------------------------------------------------------------------
   9 · LEDGER — key/value rows. The workhorse for scenario specs.
   --------------------------------------------------------------------------- */

.ledger {
  margin: var(--space-5) 0 0;
  border-top: 1px solid var(--border-hairline);
}
.ledger div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-hairline);
}
.ledger dt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 2px;
}
.ledger dt .i {
  width: 0.875rem;
  height: 0.875rem;
}
.ledger dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}

@media (max-width: 34rem) {
  .ledger div {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

/* --------------------------------------------------------------------------
   10 · MATRIX — comparison table
   -------------------------------------------------------------------------- */

.scroller {
  overflow-x: auto;
  margin: var(--space-7) 0;
}

.matrix {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.matrix th,
.matrix td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-5) var(--space-6) var(--space-5) 0;
  border-bottom: 1px solid var(--border-hairline);
}
.matrix thead th {
  border-bottom: 2px solid var(--border-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}
.matrix thead th .i {
  width: 0.875rem;
  height: 0.875rem;
  margin-right: var(--space-2);
}
.matrix tbody th {
  width: 13rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.matrix tbody tr:hover {
  background: var(--surface-hover);
}

/* --------------------------------------------------------------------------
   11 · FLOW — a numbered left-to-right sequence with an icon per stop
   -------------------------------------------------------------------------- */

.flow {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-5);
  margin: var(--space-7) 0;
  padding: 0;
  counter-reset: hop;
}
.flow li {
  counter-increment: hop;
  position: relative;
  margin: 0;
  max-width: none;
  padding-top: var(--space-5);
  border-top: 3px solid var(--ch-line);
}
.flow__top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  color: var(--text-muted);
}
.flow__top::before {
  content: counter(hop, decimal-leading-zero);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: var(--track-label);
}
.flow__top .i {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--text-primary);
}
.flow h4 {
  margin-bottom: var(--space-3);
}
.flow p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: none;
}

/* --------------------------------------------------------------------------
   12 · SCENARIO — the repeated unit in the scenario catalogue
   -------------------------------------------------------------------------- */

.scenario .panel__head {
  align-items: baseline;
}

.scenario__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: var(--track-label);
  opacity: 0.65;
}

.scenario .badges {
  margin-left: auto;
  align-self: center;
}
.scenario .panel__head .badge {
  border-color: currentColor;
  color: inherit;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   13 · ON-PAGE CONTENTS — a sticky rail down the left of the document

   .shell puts the contents beside the article on wide screens and stacks
   it above the article on narrow ones.
   -------------------------------------------------------------------------- */

.shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-7);
  align-items: start;
}

/* the article gives up its own centring once it sits inside the shell */
.shell > .rail {
  max-width: none;
  margin: 0;
  padding: var(--space-8) 0 var(--space-10);
}
.shell > .rail::before {
  left: 7px;
}

@media (min-width: 64rem) {
  .shell {
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: var(--space-7);
  }
  .toc {
    position: sticky;
    top: var(--space-6);
    max-height: calc(100vh - var(--space-9));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.toc {
  max-width: none;
  margin: 0;
  padding: var(--space-8) 0 0;
}

.toc__label {
  display: block;
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  margin: 0;
  max-width: none;
  counter-increment: toc;
}

.toc a {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-snap);
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none;
  color: var(--text-muted);
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--text-primary);
}

/* the section currently in view */
.toc a[aria-current] {
  color: var(--text-primary);
  box-shadow: inset 2px 0 0 var(--portal-yellow);
  padding-left: var(--space-4);
}

.toc a .i {
  width: 0.875rem;
  height: 0.875rem;
  flex: none;
  align-self: center;
  color: var(--text-muted);
}
.toc a:hover .i,
.toc a[aria-current] .i {
  color: var(--text-primary);
}

/* on narrow screens the contents becomes a horizontal chip row */
@media (max-width: 63.99rem) {
  .toc ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  .toc a {
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--border-hairline);
    border-radius: var(--r-pill);
  }
  .toc a[aria-current] {
    box-shadow: none;
    border-color: var(--border-strong);
    padding-left: var(--space-5);
  }
}

/* --------------------------------------------------------------------------
   14 · SECTION HEADING with a channel icon plate
   -------------------------------------------------------------------------- */

.h2-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.h2-row h2 {
  margin: 0;
}

.h2-plate {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-top: 0.1em;
  border-radius: var(--r-control);
  background: var(--ch-fill);
  color: var(--ch-ink);
}
.h2-plate .i {
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 34rem) {
  .h2-plate {
    width: 2.25rem;
    height: 2.25rem;
  }
  .h2-plate .i {
    width: 1.125rem;
    height: 1.125rem;
  }
}

h3 .i,
h4 .i {
  width: 0.9375rem;
  height: 0.9375rem;
  margin-right: var(--space-3);
}

/* --------------------------------------------------------------------------
   15 · MISC
   -------------------------------------------------------------------------- */

.lead {
  max-width: 62ch;
  font-size: clamp(1rem, 0.96rem + 0.25vw, 1.125rem);
  color: var(--text-secondary);
  margin: 0 0 var(--space-7);
}

.h3--spaced {
  margin-top: var(--space-9);
}

.divider {
  margin: var(--space-8) 0;
  border: 0;
  border-top: 1px solid var(--border-hairline);
}

/* two-up comparison, inherited from .cols but each side can carry a channel */
.cols--compare .col {
  border-color: var(--ch-line);
  border-width: 1px;
}

@media print {
  .toc,
  .strip {
    break-inside: avoid;
  }
  .panel,
  .tile,
  .callout {
    break-inside: avoid;
  }
  .panel__head,
  .strip,
  .h2-plate,
  .tile__badge,
  .callout__icon {
    background: none !important;
    color: var(--signal-black) !important;
    border: 1px solid var(--signal-black);
  }
}

/* ---------------------------------------------------------------------------
   LEVELS REFERENCE PAGE
   Components carried over from the levels-system source document, restyled
   onto Swivel tokens. Vocabulary kept as-is (card / note / pill / journey /
   split / tablewrap) so the ported content needed no rewriting.
   --------------------------------------------------------------------------- */

/* --- masthead colour key --- */

.keyline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  max-width: none;
  margin: 0 0 var(--space-7);
}
.keyline__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--grey-300);
}
.masthead .pill--you,
.masthead .pill--auto {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--white);
}

/* --- pill: an inline status tag inside prose and table cells --- */

.pill {
  display: inline-block;
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-secondary);
}
.pill--risk {
  background: var(--portal-yellow);
  border-color: var(--portal-yellow);
  color: var(--signal-black);
}
.pill--you {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* --- note: an aside that interrupts the reading line.
       risk = yellow tag, the page's running "watch out" signal. --- */

.note {
  margin: var(--space-6) 0;
  padding: var(--space-6);
  border: 1px solid var(--border-hairline);
  border-left: 2px solid var(--text-primary);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  background: var(--surface-sunken);
}
.note > :last-child {
  margin-bottom: 0;
}
.note p {
  margin: 0 0 var(--space-4);
}

.note__tag {
  display: inline-block;
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.note--risk .note__tag {
  background: var(--portal-yellow);
  border-color: var(--portal-yellow);
  color: var(--signal-black);
}
.note--you .note__tag {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--surface-page);
}
.note--auto {
  background: transparent;
  border-left-color: var(--border-hairline);
}
.note--auto .note__tag {
  border-color: var(--border-hairline);
  color: var(--text-muted);
}

/* --- card grids: parallel definitions read side by side --- */

.grid {
  display: grid;
  gap: var(--space-5);
  margin: var(--space-6) 0;
}
.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}
.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.card {
  padding: var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
}
.card > :last-child {
  margin-bottom: 0;
}
.card h4 {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
}
.card p {
  margin: 0 0 var(--space-4);
  max-width: none;
  color: var(--text-secondary);
}
.card__tag {
  display: block;
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- tables --- */

.tablewrap {
  margin: var(--space-6) 0;
  overflow-x: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
}

.tablewrap table {
  width: 100%;
  min-width: 40rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.tablewrap th {
  padding: var(--space-5) var(--space-5);
  text-align: left;
  vertical-align: bottom;
  background: var(--surface-inverse);
  color: var(--text-on-inverse);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}

.tablewrap td {
  padding: var(--space-5);
  vertical-align: top;
  border-top: 1px solid var(--border-hairline);
  color: var(--text-secondary);
}
.tablewrap tbody tr:nth-child(even) td {
  background: var(--surface-sunken);
}
.tablewrap td strong {
  color: var(--text-primary);
}
.tablewrap .num {
  font-family: var(--font-display);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.tablewrap th.num {
  text-align: right;
}

/* --- diagrams: authored on a Signal Black plate, which is the only ground
       Portal Yellow is legible on. Same in both themes on purpose. --- */

figure {
  margin: var(--space-7) 0;
}

.svgwrap {
  --diag-ground: var(--signal-black);
  --diag-surface: #1f1f1f;
  --diag-line: #757575;
  --diag-text: #ffffff;
  --diag-muted: #b0b0b0;
  --brass: var(--portal-yellow);
  --teal: #ffffff;
  --clay: var(--amber-gold);
  --ink-muted: var(--diag-muted);

  padding: var(--space-6);
  background: var(--diag-ground);
  border-radius: var(--r-card);
  overflow-x: auto;
  color: var(--diag-line);
}
.svgwrap svg {
  display: block;
  width: 100%;
  min-width: 34rem;
  height: auto;
}

figcaption {
  margin-top: var(--space-5);
  max-width: var(--measure);
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
figcaption b {
  color: var(--text-primary);
}

/* svg primitives from the source document */
.s-label,
.s-eyebrow {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  fill: var(--diag-muted);
}
.s-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 12px;
  fill: var(--diag-text);
}
.s-num {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 11px;
  fill: var(--diag-text);
}
.s-fill-surface {
  fill: var(--diag-surface);
}
.s-fill-plain {
  fill: none;
}
.s-stroke {
  stroke: var(--diag-line);
  fill: none;
}
.s-rule {
  stroke: var(--diag-line);
  fill: none;
}
.s-brass-f {
  fill: var(--brass);
}
.s-brass-s {
  stroke: var(--brass);
  fill: none;
}
.s-teal-f {
  fill: var(--teal);
}
.s-teal-s {
  stroke: var(--teal);
  fill: none;
}
.s-clay-f {
  fill: var(--clay);
}
.s-clay-s {
  stroke: var(--clay);
  fill: none;
}

/* --- journey: a named worked example, steps then outcome --- */

.journey {
  margin: var(--space-6) 0;
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  overflow: hidden;
}

.journey__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--surface-inverse);
  color: var(--text-on-inverse);
}
.journey__who {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.journey__tag {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--grey-300);
}

.journey .steps {
  margin: 0;
  padding: var(--space-6) var(--space-6) var(--space-5);
}
.journey .steps > li:last-child {
  margin-bottom: 0;
}

.outcome {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-hairline);
  background: var(--surface-sunken);
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.outcome b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-primary);
}

/* --- split: enforced vs not enforced, read as two columns --- */

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--space-5);
  margin: var(--space-6) 0;
}

.split__col {
  padding: var(--space-6);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
}
.split__col h3 {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-hairline);
}
.split__col ul {
  margin: 0;
}
.split__col--good {
  border-color: var(--border-strong);
}
.split__col--gap {
  background: var(--surface-sunken);
}

/* ---------------------------------------------------------------------------
   DIRECTORY — the landing page's list of guides

   Replaces the tall .entry cards: every guide is one compact row, so the
   whole set is readable without scrolling and stays that way as guides are
   added. .hub__section / .index below are kept for grouped listings.
   --------------------------------------------------------------------------- */

.masthead--compact {
  padding: var(--space-7) var(--gutter) var(--space-6);
}
.masthead--compact h1 {
  font-size: clamp(2.25rem, 1.4rem + 3.5vw, 4rem);
  margin-bottom: var(--space-5);
}
.masthead--compact .standfirst {
  margin-bottom: 0;
}

.directory {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-strong);
}
.directory > li {
  margin: 0;
  max-width: none;
}

.card-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-hairline);
  color: inherit;
  text-decoration: none;
  transition:
    background-color var(--t-fast) var(--ease-snap),
    padding-left var(--t-fast) var(--ease-snap);
}
.card-link:hover,
.card-link:focus-visible {
  color: inherit;
  background: var(--surface-hover);
  padding-left: var(--space-6);
}
.card-link:active {
  transform: scale(var(--press-scale));
}

.card-link__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  color: var(--text-primary);
}
.card-link__icon .i {
  width: 1.125rem;
  height: 1.125rem;
}
.card-link:hover .card-link__icon,
.card-link:focus-visible .card-link__icon {
  background: var(--portal-yellow);
  border-color: var(--portal-yellow);
  color: var(--signal-black);
}

.card-link__body {
  display: block;
  min-width: 0;
}

.card-link__tag {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-link__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1.1;
  letter-spacing: var(--track-display);
  text-transform: uppercase;
}

.card-link__desc {
  display: block;
  margin-top: var(--space-3);
  max-width: 68ch;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.card-link__go {
  display: grid;
  place-items: center;
  height: 40px;
  color: var(--text-muted);
}
.card-link__go .i {
  width: 1.125rem;
  height: 1.125rem;
}
.card-link:hover .card-link__go,
.card-link:focus-visible .card-link__go {
  color: var(--text-primary);
}

@media (max-width: 34rem) {
  .card-link {
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-4);
  }
  .card-link__go {
    display: none;
  }
  .card-link__desc {
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-link {
    transition: none;
  }
  .card-link:hover,
  .card-link:focus-visible {
    padding-left: var(--space-4);
  }
  .card-link:active {
    transform: none;
  }
}
