@charset "utf-8";
/* ==========================================================================
   page-demo-knowledge-assistant — page-scoped styles
   Demo: internal knowledge assistant. Approved sources, visible citations,
   one named owner for the gap.

   Contents
     1.  Page shell / local tokens
     2.  Hero  (.ka-hero)
     3.  Hero figure + .ka-field diagram
     4.  The operating rule strip (.ka-rule)
     5.  The run: rail + stage (.ka-run)
     6.  Stage panel + thread (.ka-panel / .ka-thread / .ka-msg)
     7.  Approved source set + chips (.ka-src / .ka-chips / .ka-chip)
     8.  Split of labour + run controls (.ka-meta / .ka-controls)
     9.  Two answers (.ka-two)
     10. Same shape, two cases (.ka-shape / .ka-case)
     11. Manual vs connected (.ka-ways) + never automated (.ka-never)
     12. More demonstrations (.ka-more)
     13. Closing CTA (.ka-cta)
     14. Shared micro-label (.ka-k)
     15. Responsive — 1080 / 900 / 640 / 420
     16. Reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Page shell / local tokens
   -------------------------------------------------------------------------- */

.ka-hero,
.ka-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Shared plate recipe: one hairline, one surface, one elevation step. */
.ka-rule,
.ka-never,
.ka-two__card,
.ka-msg,
.ka-case__gap {
  --ka-plate-radius: var(--r-xl);
}

/* --------------------------------------------------------------------------
   14. Shared micro-label (.ka-k) — declared early, used all over
   -------------------------------------------------------------------------- */

.ka-k {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.ka-k::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 1px;
  background: currentColor;
  opacity: .55;
}

/* Blue key — --accent is cyan on dark, deep blue on light, legible on both. */
.ka-k--blue {
  color: var(--accent);
}

.ka-k--blue::before {
  opacity: 1;
  height: 2px;
}

/* Human key — amber is the attention colour, but amber TEXT fails contrast on
   light bands, so the amber lives in the marker and the text stays ink. */
.ka-k--human {
  color: var(--ink);
}

.ka-k--human::before {
  background: var(--amber-bright);
  opacity: 1;
  height: 2px;
}

/* --------------------------------------------------------------------------
   2. Hero
   -------------------------------------------------------------------------- */

.ka-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  align-items: center;
  gap: clamp(2.5rem, 5vw, var(--s-20));
}

.ka-hero__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 34rem;
}

.ka-hero__copy > * {
  margin: 0;
}

.ka-hero__title {
  margin-top: var(--s-5);
  font-size: var(--t-display-2);
  line-height: 1.03;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.ka-hero__title-accent {
  display: inline;
  color: var(--accent);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .ka-hero__title-accent {
    background-image: linear-gradient(104deg, var(--ink) 2%, var(--accent) 62%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.ka-hero__lead {
  margin-top: var(--s-6);
  max-width: 44ch;
}

.ka-hero__cta {
  margin-top: var(--s-8);
  flex-wrap: wrap;
  align-items: center;
}

.ka-hero__fine {
  margin-top: var(--s-5);
  font-family: var(--font-mono);
  letter-spacing: .02em;
}

/* ---- The one synthetic-data notice --------------------------------------
   Three notices saying the same thing read as nerves, not candour, so the page
   carries exactly one — set with the run it describes, which is the first
   screen a visitor could mistake for a client record. It is a quiet grey
   footnote rule, not an amber slab: amber is left to mean exactly one thing on
   this page, that a person is now involved. */
#main .synthetic-note {
  display: block;
  margin-top: var(--s-8);
  padding: var(--s-4) 0 0;
  max-width: 84ch;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  line-height: 1.65;
  letter-spacing: .02em;
  color: var(--muted);
}

#main .synthetic-note::before,
#main .synthetic-note::after {
  content: none;
}

#main .synthetic-note > span {
  display: block;
  color: inherit;
}

#main .synthetic-note strong {
  color: var(--body);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* It sits between the section head and the run, so it needs a foot as well as
   a head of space. */
.ka-run__note {
  margin-bottom: var(--s-8);
}

/* Owner initials sit on the type floor at 375px. Hold them above it — the
   avatar is a circle sized in ems, so it grows with the type. */
#main .owner__avatar {
  font-size: 11.5px;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   3. Hero figure + .ka-field diagram
   -------------------------------------------------------------------------- */

.ka-hero__figure {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: var(--s-4) 0;
}

/* The hero band is LIGHT now, and glow never appears on light. The figure sits
   on a white plate with a soft shadow instead — depth by elevation, not light. */
.ka-hero__figure-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(
      168deg,
      color-mix(in srgb, var(--accent) 7%, var(--paper-card)),
      var(--paper-card) 62%
    );
  box-shadow: var(--shadow-lift);
  pointer-events: none;
}

.ka-hero__figure {
  display: block;
  padding: clamp(1.15rem, 2.4vw, var(--s-8));
}

/* Legend: the figure has to say what its two colours mean, and amber has to be
   named as the human gate rather than left to read as decoration. */
.ka-legend {
  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--s-3);
  margin: var(--s-6) 0 0;
  padding: var(--s-5) 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.ka-legend__item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  gap: var(--s-4);
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--body);
  text-wrap: pretty;
}

.ka-legend__item--human {
  color: var(--ink);
}

.ka-legend__mark {
  margin-top: .5em;
  height: 3px;
  border-radius: 2px;
}

.ka-legend__mark--cited {
  background: var(--accent);
}

.ka-legend__mark--human {
  background: repeating-linear-gradient(
    90deg,
    var(--amber-bright) 0 5px,
    transparent 5px 9px
  );
}

.ka-field {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  overflow: visible;
  color: var(--rf-label);
}

/* Two cuts of each figure, one drawing at a time. The wide cut is the default;
   the narrow cut — vertical, fewer elements, shorter labels — takes over under
   560px, where scaling the wide one would push its labels under the legibility
   floor. See the swap in §15.

   Doubled class on purpose: .ka-route sets `display: block` further down the
   file (§9), which at equal specificity would win and leave BOTH cuts of the
   routing diagram on screen at desktop widths. Two-class selectors here and in
   §15 keep exactly one drawing visible at every width. */
.ka-field.ka-field--narrow,
.ka-route.ka-route--narrow {
  display: none;
}

/* One label family for the whole figure — geometry contract §4. */
.ka-field__labels text,
.ka-field__docid,
.ka-field__chip text,
.ka-field__initials {
  font-family: var(--font-mono);
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* The figure is load-bearing, not decoration: labels are set well above the
   10.5px floor so they read from a metre away, and every stroke is heavier
   than the hairline minimum. */
.ka-field__labels text {
  font-size: 13.5px;
  font-weight: 500;
  fill: var(--rf-label);
}

.ka-field__labels text.ka-field__labels--accent { fill: var(--accent); }
.ka-field__labels text.ka-field__labels--human  { fill: var(--amber); }

/* The closed set of approved documents. */
.ka-field__set {
  fill: color-mix(in srgb, var(--accent) 6%, transparent);
  stroke: var(--rf-ring);
  stroke-width: 2.2;
  stroke-dasharray: 7 6;
}

/* Approved-document plates. */
.ka-field__doc > rect:first-child {
  fill: var(--bg-card);
  stroke: var(--line-strong);
  stroke-width: 1.8;
}

.ka-field__doc--hit > rect:first-child {
  stroke: var(--accent);
  stroke-width: 2.8;
}

.ka-field__docid {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  fill: var(--accent);
}

.ka-field__line {
  fill: var(--rf-label);
  opacity: .55;
}

.ka-field__line--soft { opacity: .3; }

/* Retrieval rings around the answer node — 32 and 44 per the contract. */
.ka-field__halo {
  fill: none;
  stroke: var(--rf-ring);
  stroke-width: 1.6;
  opacity: .5;
}

.ka-field__ring {
  fill: none;
  stroke: var(--rf-ring);
  stroke-width: 2.4;
  opacity: .7;
  transform-box: fill-box;
  transform-origin: center;
  animation: ka-ring 3.6s var(--e-inout) infinite;
}

@keyframes ka-ring {
  0%,
  100% { opacity: .35; transform: scale(.94); }
  50%  { opacity: .9;  transform: scale(1.04); }
}

/* Citation chips inside the diagram. */
.ka-field__chip rect {
  fill: var(--bg-card);
  stroke: color-mix(in srgb, var(--accent) 62%, transparent);
  stroke-width: 2;
}

.ka-field__chip text {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .6px;
  text-transform: none;
  fill: var(--accent);
}

/* The human branch — amber, 2px, dashed 4 4. Decorative amber uses the bright
   token; amber TEXT uses --amber, which light bands darken to #8A5D05. */
.ka-field__human {
  fill: none;
  stroke: var(--amber-bright);
  stroke-width: 3;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
}

.ka-field__person {
  fill: color-mix(in srgb, var(--amber-bright) 18%, transparent);
  stroke: var(--amber-bright);
  stroke-width: 2.4;
}

.ka-field__initials {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .8px;
  fill: var(--amber);
}

/* --------------------------------------------------------------------------
   4. The operating rule strip
   -------------------------------------------------------------------------- */

.ka-rule {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
  align-items: start;
  gap: clamp(1.5rem, 4vw, var(--s-16));
  padding-top: var(--s-8);
  border-top: 1px solid var(--line);
}

.ka-rule__main {
  display: grid;
  gap: var(--s-5);
  min-width: 0;
}

.ka-rule > *,
.ka-rule__main > * {
  margin: 0;
}

.ka-rule__statement {
  max-width: 46ch;
  font-size: var(--t-title-1);
  line-height: 1.35;
  color: var(--ink);
  text-wrap: pretty;
}

.ka-rule__statement strong,
.ka-rule__statement b {
  color: var(--ink);
  font-weight: 600;
}

.ka-rule__list {
  display: grid;
  gap: var(--s-4);
  padding: 0 0 0 clamp(1rem, 2.5vw, var(--s-8));
  border-left: 1px solid var(--line);
  list-style: none;
}

.ka-rule__list > li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: .04em;
  color: var(--body);
}

.ka-rule__list > li::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* --------------------------------------------------------------------------
   5. The run: rail + stage
   -------------------------------------------------------------------------- */

.ka-run {
  display: grid;
  gap: var(--s-8);
}

.ka-run__grid {
  display: grid;
  grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
  align-items: start;
  gap: clamp(2rem, 4vw, var(--s-12));
}

.ka-run__rail {
  display: grid;
  align-content: start;
  gap: var(--s-6);
  min-width: 0;
}

.ka-run__stage {
  position: sticky;
  top: var(--s-16);
  display: grid;
  gap: var(--s-6);
  min-width: 0;
}

/* --------------------------------------------------------------------------
   5b. The player — transport, position, progress
   -------------------------------------------------------------------------- */

.ka-player {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-6);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper-card);
  box-shadow: var(--shadow-card);
}

.ka-player__transport {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.ka-pbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-card-2);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--d-2) var(--e-out),
    border-color var(--d-2) var(--e-out),
    color var(--d-2) var(--e-out);
}

.ka-pbtn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card-2));
}

.ka-pbtn--main {
  padding-inline: var(--s-5);
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.ka-pbtn--main:hover {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
  color: #fff;
}

.ka-player__meter {
  display: flex;
  flex: 1 1 14rem;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
}

.ka-player__track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  min-width: 4rem;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--ink) 10%, transparent);
}

.ka-player__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 8%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width var(--d-4) var(--e-out);
}

.ka-player__pos {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
  color: var(--ink);
  white-space: nowrap;
}

.ka-player__live {
  flex: 1 1 100%;
  order: 9;
  margin: 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: .04em;
  color: var(--body);
}

/* Progress is derived from the documented run contract: whichever step is
   `current` sets the fill width. No dependence on undocumented internals. */
.ka-run:has([data-run-step="0"][data-run-state="current"]) .ka-player__fill { width:  9%; }
.ka-run:has([data-run-step="1"][data-run-state="current"]) .ka-player__fill { width: 25%; }
.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-player__fill { width: 42%; }
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-player__fill { width: 59%; }
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-player__fill { width: 76%; }
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-player__fill { width: 100%; }

/* Scenario record sitting above the stage list. */
.ka-scenario {
  --ka-scenario: 1;
}

.ka-scenario .record__rows {
  gap: var(--s-1);
}

/* Step list — every step is a jump target -------------------------------- */

.ka-steps__hint {
  margin-top: var(--s-2);
}

.ka-steps {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
  counter-reset: none;
}

.ka-step {
  min-width: 0;
}

.ka-step__btn {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  align-items: start;
  gap: var(--s-4);
  width: 100%;
  min-height: 44px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid transparent;
  border-left: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--d-2) var(--e-out),
    border-color var(--d-2) var(--e-out),
    transform var(--d-2) var(--e-out);
}

.ka-step__btn:hover {
  border-color: var(--line);
  border-left-color: var(--accent);
  background: var(--bg-card-2);
}

.ka-step__num {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
  line-height: 1.5;
  color: var(--muted);
  white-space: nowrap;
}

.ka-step__text {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}

.ka-step__title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--t-title-3);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.ka-step__title .badge {
  margin-left: var(--s-2);
  vertical-align: middle;
}

.ka-step__line {
  display: block;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--body);
}

/* Run states. Future steps step DOWN THE TEXT LADDER (--ink → --muted) rather
   than being dimmed with opacity, so every line still clears 4.5:1. Past steps
   keep full contrast but lose their rule. The current step is a raised white
   plate with an accent edge — state is never signalled by colour alone. */
.ka-step[data-run-state] .ka-step__btn {
  transition:
    background var(--d-3) var(--e-out),
    border-color var(--d-3) var(--e-out),
    box-shadow var(--d-3) var(--e-out);
}

.ka-step[data-run-state="future"] .ka-step__title,
.ka-step[data-run-state="future"] .ka-step__line {
  color: var(--muted);
}

.ka-step[data-run-state="future"] .ka-step__btn {
  border-left-color: var(--line);
}

.ka-step[data-run-state="past"] .ka-step__btn {
  border-left-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.ka-step[data-run-state="past"] .ka-step__num::after {
  content: " \2713";
  color: var(--accent);
}

.ka-step[data-run-state="current"] .ka-step__btn {
  border-color: var(--line);
  border-left: 3px solid var(--accent);
  background: var(--paper-card);
  box-shadow: var(--shadow-lift);
}

.ka-step[data-run-state="current"] .ka-step__num {
  color: var(--accent);
}

.ka-step[data-run-state="current"] .ka-step__title {
  font-weight: 600;
}

.ka-step--human[data-run-state="current"] .ka-step__btn {
  border-left-color: var(--amber-bright);
}

.ka-step--human[data-run-state="current"] .ka-step__num {
  color: var(--amber);
}

.ka-step--human .ka-step__btn {
  border-left-style: dashed;
  border-left-color: var(--amber-bright);
}

/* --------------------------------------------------------------------------
   6. Stage panel + thread
   -------------------------------------------------------------------------- */

.ka-panel {
  overflow: hidden;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lift);
}

.ka-panel__bar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 44px;
}

.ka-panel__title {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.ka-panel__sub {
  min-width: 0;
  overflow: hidden;
  font-size: var(--t-xs);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Neutral, not amber: amber on this page means a person is involved, and a
   data-provenance tag is not that. */
.ka-panel__tag {
  flex: 0 0 auto;
  margin-left: auto;
  padding: var(--s-1) var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.ka-panel__body {
  display: grid;
  gap: var(--s-6);
  padding: clamp(1.25rem, 2.4vw, var(--s-8));
}

/* Thread ---------------------------------------------------------------- */

.ka-thread {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.ka-msg {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
  max-width: 46rem;
  padding: var(--s-3) var(--s-5);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-card-2);
  transition:
    opacity var(--d-3) var(--e-out),
    background var(--d-3) var(--e-out);
}

.ka-msg__who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.ka-msg__text {
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1.55;
  color: var(--body);
  text-wrap: pretty;
}

/* Employee — the question that starts the run. */
.ka-msg--emp {
  border-left-color: var(--blue-hi);
  background: var(--bg-card-3);
}

.ka-msg--emp .ka-msg__text {
  color: var(--ink);
  font-size: var(--t-body);
}

/* System — machine bookkeeping, deliberately quiet. */
.ka-msg--sys {
  padding-block: var(--s-2);
  border-color: transparent;
  border-left-color: var(--line-strong);
  background: transparent;
}

.ka-msg--sys .ka-msg__text {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: .01em;
  color: var(--muted);
}

/* Assistant — the cited answer, the most elevated surface in the panel. */
.ka-msg--ai {
  border-left-color: var(--cyan-hi);
  border-color: color-mix(in srgb, var(--cyan-hi) 26%, var(--line));
  background: var(--bg-card-3);
}

.ka-msg--ai .ka-msg__text {
  color: var(--ink);
  font-size: var(--t-body);
}

/* Escalation — amber means a person is now involved. */
.ka-msg--esc {
  border-left-color: var(--amber-bright);
  border-color: color-mix(in srgb, var(--amber-bright) 30%, var(--line));
  background: color-mix(in srgb, var(--amber-bright) 9%, var(--bg-card-2));
}

.ka-msg--esc .ka-msg__text {
  color: var(--ink);
}

/* The panel is forced dark (.theme-dark), so amber text is safe here. */
.ka-msg__flag {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  border: 1px solid color-mix(in srgb, var(--amber-bright) 50%, transparent);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--amber-bright) 14%, transparent);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--amber-bright);
  white-space: nowrap;
}

.ka-msg__flag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber-bright);
}

/* The transcript BUILDS with the run: nothing after the current step has
   happened yet, so it is not on screen. Derived from the documented
   `data-run-state` contract, so with scripting off every line is present. */
.ka-run:has([data-run-step="0"][data-run-state="current"]) .ka-panel :is([data-at="1"],[data-at="2"],[data-at="3"],[data-at="4"],[data-at="5"]),
.ka-run:has([data-run-step="1"][data-run-state="current"]) .ka-panel :is([data-at="2"],[data-at="3"],[data-at="4"],[data-at="5"]),
.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-panel :is([data-at="3"],[data-at="4"],[data-at="5"]),
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-panel :is([data-at="4"],[data-at="5"]),
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-panel [data-at="5"] {
  display: none;
}

/* The newest line is the one that just happened. */
.ka-run:has([data-run-step="0"][data-run-state="current"]) .ka-msg[data-at="0"],
.ka-run:has([data-run-step="1"][data-run-state="current"]) .ka-msg[data-at="1"],
.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-msg[data-at="2"],
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-msg[data-at="3"],
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-msg[data-at="4"],
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-msg[data-at="5"] {
  border-color: color-mix(in srgb, var(--cyan-hi) 34%, var(--line));
  background: var(--bg-card-3);
}

/* Keep the transcript from jumping while the first lines arrive. It no longer
   has to prop the panel open on its own — the source set below it does that. */
.ka-thread {
  min-height: 8.5rem;
  align-content: start;
}

/* --------------------------------------------------------------------------
   7. Citations + chips
   -------------------------------------------------------------------------- */

/* The approved source set — present from step 1 so the panel is never an
   empty black rectangle waiting for a message to arrive. */
.ka-src {
  display: grid;
  gap: var(--s-3);
  padding-top: var(--s-5);
  border-top: 1px dashed var(--line-strong);
}

.ka-src__label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-4);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}

.ka-src__meta {
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--muted);
}

.ka-src__list {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ka-src__item {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr) max-content;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  min-width: 0;
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-card-2);
  transition:
    border-color var(--d-3) var(--e-out),
    background var(--d-3) var(--e-out);
}

.ka-src__id {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink);
  white-space: nowrap;
}

.ka-src__t {
  overflow: hidden;
  font-size: var(--t-xs);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ka-src__state {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.ka-src__done { display: none; }

/* From the moment the search runs, the two matched documents become citations
   and the third is visibly ruled out. Same documented run contract. */
.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-src__pending,
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-src__pending,
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-src__pending,
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-src__pending,
.ka-run:not(:has([data-run-state])) .ka-src__pending {
  display: none;
}

.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-src__done,
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-src__done,
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-src__done,
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-src__done,
.ka-run:not(:has([data-run-state])) .ka-src__done {
  display: inline;
}

.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-src__item--hit,
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-src__item--hit,
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-src__item--hit,
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-src__item--hit,
.ka-run:not(:has([data-run-state])) .ka-src__item--hit {
  border-left-color: var(--cyan-hi);
  border-color: color-mix(in srgb, var(--cyan-hi) 26%, var(--line));
  background: var(--bg-card-3);
}

.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-src__item--hit .ka-src__state,
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-src__item--hit .ka-src__state,
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-src__item--hit .ka-src__state,
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-src__item--hit .ka-src__state,
.ka-run:not(:has([data-run-state])) .ka-src__item--hit .ka-src__state {
  color: var(--cyan-hi);
}

/* The gap line: the one amber thing inside the panel body, and it says in
   words that a person now owns it. */
.ka-src__gap {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin: var(--s-1) 0 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid color-mix(in srgb, var(--amber-bright) 34%, var(--line));
  border-left: 2px solid var(--amber-bright);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--amber-bright) 9%, transparent);
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--ink);
}

.ka-src__gap-mark {
  flex: 0 0 auto;
  margin-top: .45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-bright);
}

.ka-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ka-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  max-width: 100%;
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--bg-card-2);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink);
  white-space: nowrap;
}

.ka-chip::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.ka-chips--light .ka-chip {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

/* --------------------------------------------------------------------------
   8. Split of labour + run controls
   -------------------------------------------------------------------------- */

/* What changed at this step: arrived → system did → record now → owner. */

.ka-change {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-5) var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper-card);
  box-shadow: var(--shadow-card);
}

.ka-change__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.ka-change__head::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 1px;
  background: var(--accent);
}

.ka-change__row {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4) var(--s-5);
  min-width: 0;
}

/* One row visible: the one the player is on. Driven only by the documented
   `data-run-state` contract. */
.ka-run:has([data-run-step="0"][data-run-state="current"]) .ka-change__row[data-change="0"],
.ka-run:has([data-run-step="1"][data-run-state="current"]) .ka-change__row[data-change="1"],
.ka-run:has([data-run-step="2"][data-run-state="current"]) .ka-change__row[data-change="2"],
.ka-run:has([data-run-step="3"][data-run-state="current"]) .ka-change__row[data-change="3"],
.ka-run:has([data-run-step="4"][data-run-state="current"]) .ka-change__row[data-change="4"],
.ka-run:has([data-run-step="5"][data-run-state="current"]) .ka-change__row[data-change="5"] {
  display: grid;
}

/* No player (scripting off): every row is readable, stacked. */
.ka-run:not(:has([data-run-state])) .ka-change__row {
  display: grid;
  padding-top: var(--s-4);
  border-top: 1px dashed var(--line-soft);
}

.ka-change__cell {
  display: grid;
  align-content: start;
  gap: var(--s-2);
  min-width: 0;
  padding-left: var(--s-4);
  border-left: 1px solid var(--line);
}

.ka-change__row > .ka-change__cell:first-child {
  padding-left: 0;
  border-left: 0;
}

.ka-change__k {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.ka-change__v {
  font-size: var(--t-sm);
  line-height: 1.45;
  color: var(--ink);
  text-wrap: pretty;
}

.ka-change__row--human .ka-change__cell:last-child {
  border-left-color: var(--amber-bright);
}

/* Human boundary block — kept verbatim, given its own weight. */
.ka-keeps {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-6);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber-bright);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--amber-bright) 7%, var(--bg-card));
}

.ka-keeps__text {
  margin: 0;
  max-width: 60ch;
  font-size: var(--t-sm);
  line-height: 1.55;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   9. Two answers — the cited one and the escalated one
   -------------------------------------------------------------------------- */

/* Stretch, not start: the escalation card is taller because it carries the
   routing diagram, and a short left card left a block of empty band under it.
   Both cards now run to the same baseline and their footers sit on it. */
.ka-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(1.25rem, 2.4vw, var(--s-8));
}

.ka-two__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  min-width: 0;
  padding: clamp(1.5rem, 2.6vw, var(--s-10));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.ka-two__card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 72%);
}

/* Cyan hairline = the documents answered. Amber = a person has it now. */
.ka-two__card--cited::before {
  background: linear-gradient(90deg, var(--accent), transparent 72%);
}

.ka-two__card--human::before {
  background: linear-gradient(90deg, var(--amber-bright), transparent 72%);
}

.ka-two__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line-soft);
}

.ka-two__num {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: .1em;
  color: var(--accent);
}

.ka-two__card--human .ka-two__num {
  color: var(--muted);
}

.ka-two__q {
  margin: 0;
  max-width: 34ch;
  font-family: var(--font-display);
  font-size: var(--t-title-2);
  font-weight: 500;
  line-height: 1.38;
  color: var(--ink);
  text-wrap: pretty;
}

.ka-two__q--gap {
  position: relative;
  padding-left: var(--s-5);
  border-left: 2px solid var(--amber-bright);
}

.ka-two__a {
  margin: 0;
  max-width: 52ch;
  font-size: var(--t-sm);
  line-height: 1.65;
  color: var(--body);
  text-wrap: pretty;
}

/* Routing diagram inside the escalation card. */
.ka-route {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: var(--s-2) 0;
  color: var(--muted);
  overflow: visible;
}

/* Sizes are viewBox units (440 wide), so they scale with the card. */
.ka-route text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.ka-route__ch {
  fill: none;
  stroke: var(--rf-ch-2);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.ka-route__stop { fill: var(--amber-bright); }

.ka-route__human {
  fill: none;
  stroke: var(--amber-bright);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  stroke-linecap: round;
}

.ka-route__person {
  fill: color-mix(in srgb, var(--amber-bright) 16%, transparent);
  stroke: var(--amber-bright);
  stroke-width: 1.6;
}

.ka-route__initials {
  letter-spacing: .8px;
  fill: var(--amber);
}

.ka-route__label { fill: var(--rf-label); }
.ka-route__label--human text { fill: var(--amber); }

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

.ka-two__foot {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  gap: var(--s-3) var(--s-5);
  margin: auto 0 0;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-soft);
}

.ka-two__foot > div {
  display: contents;
}

.ka-two__foot dt {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.7;
}

.ka-two__foot dd {
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--body);
}

.ka-two__foot--human dd {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   10. Same shape, two cases
   -------------------------------------------------------------------------- */

.ka-shape {
  display: grid;
  gap: var(--s-8);
}

.ka-case {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
  height: 100%;
}

.ka-case__q {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--t-title-3);
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  text-wrap: pretty;
}

.ka-case__a {
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1.6;
  color: var(--body);
}

.ka-case__gap {
  display: grid;
  gap: var(--s-2);
  margin-top: auto;
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line);
  border-left: 2px solid var(--amber-bright);
  border-radius: var(--r-lg);
  background: var(--bg-card-2);
}

.ka-case__gap-text {
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--ink);
}

/* Third row is the named owner (core .owner) — only spacing is ours. */
.ka-case__gap > .owner {
  margin: var(--s-1) 0 0;
}

/* --------------------------------------------------------------------------
   11. Manual vs connected + never automated
   -------------------------------------------------------------------------- */

.ka-ways {
  align-items: stretch;
  gap: clamp(1.25rem, 2.4vw, var(--s-8));
}

.ka-way {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--s-5);
  min-width: 0;
  overflow: hidden;
}

.ka-way--now {
  border-color: var(--line);
}

.ka-way--next::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 78%);
}

.ka-way__list {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ka-way__list > li {
  position: relative;
  padding-left: var(--s-6);
  font-size: var(--t-sm);
  line-height: 1.55;
  color: var(--body);
}

.ka-way__list > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .68em;
  width: 12px;
  height: 1px;
  background: var(--muted);
  opacity: .8;
}

.ka-way__list--ticks > li::before {
  top: .42em;
  width: 9px;
  height: 5px;
  border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  background: none;
  opacity: 1;
  transform: rotate(-45deg);
}

.ka-way--next .ka-way__list > li {
  color: var(--ink);
}

/* Never automated ------------------------------------------------------ */

.ka-never {
  display: grid;
  gap: var(--s-5);
  margin-top: clamp(var(--s-6), 2vw, var(--s-10));
  padding: clamp(1.25rem, 2.2vw, var(--s-8)) clamp(1.25rem, 2.6vw, var(--s-10));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.ka-never__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4) var(--s-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ka-never__list > li {
  position: relative;
  padding-left: var(--s-6);
  font-size: var(--t-sm);
  line-height: 1.55;
  color: var(--body);
}

.ka-never__list > li::before {
  content: "\00d7";
  position: absolute;
  left: 0;
  top: -.05em;
  font-family: var(--font-mono);
  font-size: var(--t-body);
  font-weight: 600;
  line-height: 1.6;
  color: var(--err);
}

/* --------------------------------------------------------------------------
   12. More demonstrations
   -------------------------------------------------------------------------- */

.ka-more {
  gap: clamp(1rem, 2vw, var(--s-6));
}

.ka-more__card {
  display: grid;
  align-content: start;
  gap: var(--s-3);
  min-width: 0;
}

/* The whole card is the anchor, so the link underline and link colour would
   otherwise bleed onto the title and the description. Reset on the anchor
   itself — a descendant cannot cancel an ancestor's text-decoration. */
a.ka-more__card {
  color: var(--body);
  text-decoration: none;
}

a.ka-more__card .link-arrow {
  color: var(--link);
}

.ka-more__card--here {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.ka-more__card--here > * {
  opacity: .74;
}

.ka-more__here {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 1;
}

.ka-more__all {
  margin: var(--s-10) 0 0;
  padding-top: var(--s-6);
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   13. Closing CTA
   -------------------------------------------------------------------------- */

.ka-cta .shell,
.ka-cta .shell--wide {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .ka-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-10);
  }

  .ka-hero__copy {
    max-width: 40rem;
  }

  .ka-run__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-8);
  }

  .ka-run__stage {
    position: static;
    top: auto;
  }

  .ka-change__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ka-change__row > .ka-change__cell:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .ka-never__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .ka-two {
    grid-template-columns: minmax(0, 1fr);
  }

  .ka-rule {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-6);
  }

  .ka-rule__list {
    padding: var(--s-5) 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .ka-panel__sub {
    display: none;
  }
}

@media (max-width: 640px) {
  .ka-hero__title {
    font-size: var(--t-display-3);
  }

  .ka-hero__lead,
  .ka-hero__copy {
    max-width: none;
  }

  .ka-hero__cta > * {
    flex: 1 1 100%;
  }

  /* Bleed the field diagram to the screen edges: the whole figure — including
     the citation chips — must stay on screen, so the only way to keep the
     labels readable is to give it every available pixel. */
  .ka-hero__figure {
    margin-inline: calc(var(--gutter) * -1);
    padding-block: var(--s-2) var(--s-4);
  }

  /* The figure bleeds to the screen edges here, so the plate behind it would be
     cut off — drop it and let the diagram sit straight on the band. */
  .ka-hero__figure-glow {
    display: none;
  }

  .ka-route text {
    font-size: 12px;
  }

  /* The figure keeps its geometry on small screens; only the type scales up,
     so no label drops below ~9px effective at 375. Capped at 15 so the
     two-line human label cannot grow into the amber path beside it. */
  .ka-field__labels text {
    font-size: 15px;
  }

  .ka-field__docid,
  .ka-field__chip text,
  .ka-field__initials {
    font-size: 15px;
  }

  .ka-rule__list {
    gap: var(--s-3) var(--s-5);
  }

  .ka-never__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .ka-change__row,
  .ka-change__row > .ka-change__cell:nth-child(3) {
    grid-template-columns: minmax(0, 1fr);
  }

  .ka-change__cell {
    padding-left: 0;
    padding-top: var(--s-3);
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .ka-change__row > .ka-change__cell:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .ka-change__row--human .ka-change__cell:last-child {
    border-top-color: var(--amber-bright);
  }

  .ka-player {
    gap: var(--s-3) var(--s-4);
  }

  .ka-player__transport {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .ka-pbtn--main {
    flex: 1 1 auto;
  }

  .ka-pbtn__more {
    display: none;
  }

  .ka-panel__body {
    padding: var(--s-5) var(--s-4);
  }

  .ka-thread {
    min-height: 9rem;
  }

  /* Three columns will not fit: the document title drops to its own line
     rather than being truncated to an ellipsis. */
  .ka-src__item {
    grid-template-columns: minmax(0, 1fr) max-content;
    padding: var(--s-3) var(--s-4);
  }

  .ka-src__t {
    grid-column: 1 / -1;
    order: 3;
    white-space: normal;
  }

  .ka-msg {
    padding: var(--s-3) var(--s-4);
  }

  .ka-two__foot {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-1) 0;
  }

  .ka-two__foot dd {
    margin-bottom: var(--s-3);
  }

  .ka-more__all {
    margin-top: var(--s-8);
  }
}

/* The mobile cut. Below this width the wide drawings can only fit by being
   scaled to about 56%, which drags every label under 9px. So the wide cuts
   step aside and the narrow ones take the band at close to 1:1 — same story,
   redrawn vertically with fewer parts, labels set at their own size. */
@media (max-width: 560px) {
  .ka-field.ka-field--wide,
  .ka-route.ka-route--wide {
    display: none;
  }

  .ka-field.ka-field--narrow,
  .ka-route.ka-route--narrow {
    display: block;
  }

  /* Match the drawing to the space it actually gets, so the scale stays ~1:1. */
  .ka-field--narrow {
    max-width: 360px;
  }

  .ka-hero__figure {
    padding: var(--s-2) var(--s-2) var(--s-4);
  }

  .ka-field--narrow .ka-field__labels text,
  .ka-field--narrow .ka-field__docid,
  .ka-field--narrow .ka-field__chip text,
  .ka-field--narrow .ka-field__initials {
    font-size: 13px;
  }

  .ka-route--narrow text {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .ka-panel__bar {
    flex-wrap: wrap;
    gap: var(--s-2) var(--s-3);
    padding-block: var(--s-3);
  }

  .ka-panel__tag {
    margin-left: 0;
  }

  .ka-chip {
    white-space: normal;
  }

  .ka-two__q {
    font-size: var(--t-title-3);
  }
}

/* --------------------------------------------------------------------------
   16. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .ka-field__ring {
    animation: none;
    opacity: .35;
  }

  .ka-field__doc,
  .ka-msg,
  .ka-msg[data-run-state],
  .ka-step[data-run-state] .ka-step__btn,
  .ka-player__fill {
    transition: none;
  }

  /* The run must read complete without motion: the whole transcript is present
     and every step's cause-and-effect row is shown as static content. */
  .ka-panel [data-at] {
    display: grid !important;
  }

  .ka-change__row {
    display: grid;
    padding-top: var(--s-4);
    border-top: 1px dashed var(--line-soft);
  }

  .ka-change__row:first-of-type {
    padding-top: 0;
    border-top: 0;
  }

  /* The player settles at the end of the run, so the meter reads complete. */
  .ka-player__fill {
    width: 100%;
  }
}
