/* Identia demo — application styles. */

*, *::before, *::after { box-sizing: border-box; }

/* The UA rule for [hidden] is only `display: none`, so any class that declares
   its own display — .modal-scrim, .drawer, .graph-loading — outranks
   it and renders while still marked hidden. Everything here toggles visibility
   with the attribute, so it has to win. */
[hidden] { display: none !important; }

/* Set by the inline script in index.html until the page's background image has
   loaded. opacity, not visibility: a visibility:hidden heading can't take the
   first-load focus that showView() gives it. The html background matters: with
   none, body's background propagates to the canvas, which body's opacity can't
   hide, so the image would visibly paint in strip by strip while "hidden". */
html.bg-pending { background: var(--paper); }
html.bg-pending body { opacity: 0; }

/* No elastic bounce past the top or bottom of the page. The bounce reveals the
   bare white canvas behind the gradient as a flash of white bar; this keeps the
   end of the page as the end. Deliberately NOT done by giving <html> a
   background: that would stop body's gradient propagating to the canvas. */
html { overscroll-behavior-y: none; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  background-attachment: fixed;
  /* `background-repeat` defaults to `repeat`, and was never overridden —
     on any page taller than one viewport (nearly all of them), the whole
     per-page gradient below just tiled vertically, repainting a second
     copy of itself every viewport-height with a visible seam at the tile
     boundary. That seam was the "invisible divider line" splitting the
     page into what looked like two separate gradients. One `no-repeat`
     fixes every page at once. */
  background-repeat: no-repeat;
  transition: background var(--dur-slow) var(--ease-out);
}

/* Per-page background wash. Added 2026-10-12, revised ten times same day
   — see git history for (1)-(6); (7) tried three overlapping circles for
   "randomness... think of solar flares", which fixed "obviously one
   perfect circle" but got called out as "too large and not spikey
   enough"; (8) read "spikey"/"solar flare" literally and built actual
   rays with a conic-gradient — rejected on sight as "awful, really corny
   ... far too sharp", with reference images showing the opposite of rays:
   one soft blob with no hard edge anywhere, colour just bleeding outward;
   (9) landed the shape — one radial-gradient ellipse through a real
   `filter: blur()` — and that shape stuck ("much better, leave it
   there"), but the colour sampled as too weak next to the reference: a
   blur this size is a weighted average with the paler pixels around it,
   so it pulls the peak down no matter how dark the pre-blur stop is,
   and the old hot stop (168,42,20 @ .88) wasn't dark/opaque enough to
   survive that averaging. (10) current colour ramp was built by reading
   actual pixel values out of the reference images (ImageMagick
   `txt:-` dump, not eyeballed) — darkest sampled pixel was ~(136,32,28)
   at the frame's edge, i.e. the true peak is likely darker still — so
   the hot end here is (112,24,18) at alpha .95. First attempt held that
   peak for only ~10% of the radius, which measured out (via a second
   ImageMagick sample of the actual render) as still too pale: at an
   80px blur, that 10% plateau (circa 70-115px, depending on the page's
   radius) is *narrower* than the blur's own effective reach, so the
   kernel was still mostly averaging the peak with its paler neighbours
   rather than with more peak. Re-measured and widened the plateau to
   35% of the radius — comfortably wider than the blur — which is what
   actually fixed it; the colour values themselves (112,24,18 / mid
   214,88,46 / pale 240,196,122) were already right, taken from sampled
   reference pixels. Shape/size/blur radius unchanged from (9).
   (11) "make the background less red": the ramp above read as pure red at
   the hot end (hue 4deg, mid 15deg). Hue-shifted to 20deg / 26deg / 38deg
   (hot 142,56,14 / mid 228,118,36 / pale 244,192,104) — burnt orange into
   amber — with the alpha curve and 35% plateau untouched, so intensity and
   shape are as approved; only the hue moved. */
:root {
  --flare-core-stops:
    rgba(142, 56, 14, 0.95) 0%,
    rgba(142, 56, 14, 0.95) 35%,
    rgba(157, 67, 18, 0.852) 40%,
    rgba(174, 79, 22, 0.746) 46%,
    rgba(192, 92, 27, 0.642) 52%,
    rgba(209, 104, 31, 0.543) 58%,
    rgba(228, 118, 36, 0.437) 64%,
    rgba(231, 131, 48, 0.336) 71%,
    rgba(234, 145, 61, 0.243) 77%,
    rgba(237, 158, 73, 0.157) 84%,
    rgba(240, 172, 85, 0.081) 90%,
    rgba(244, 192, 104, 0.0) 100%;
}

/* The one flare, in full. Fixed to the viewport (so it doesn't scroll with
   the page, same as the old background-attachment: fixed), sat behind all
   normal content via negative z-index. Every anchor below sits exactly on
   an edge or corner of the viewport (home: top-middle; the rest: a
   corner) — with inset:0 the box's edge lands exactly there too, so
   `filter: blur()` was averaging the hot peak with nothing/transparent for
   half its kernel (a quarter, at the three corner anchors), which quietly
   discounted the rendered intensity far more than the color stops alone
   could explain — this, not the color ramp, was the main cause of
   "lost its intensity". Fixed by inset: -140px (overhang comfortably
   bigger than the blur radius, so the kernel has real same-gradient
   pixels on the far side instead of hitting the box edge) with the
   anchors re-expressed in calc(): the box is now 280px taller/wider than
   the viewport, so a plain "50%" still lands on the horizontal centre
   (expansion is symmetric), but an edge that used to be 0%/100% has to
   be written as the fixed 140px / calc(100% - 140px) that actually
   coincides with the viewport's edge in the enlarged box. */
/* Switched off 2026-10-16 ("just make the background white"); delete the
   display line to bring the gradient back. */
.bg-flare {
  display: none;
  position: fixed; inset: -140px; z-index: -1; pointer-events: none;
  filter: blur(80px);
}

body[data-page="home"] .bg-flare {
  background: radial-gradient(ellipse 850px 700px at 50% 140px, var(--flare-core-stops));
}
body[data-page="match"] .bg-flare {
  background: radial-gradient(ellipse 1150px 950px at calc(100% - 140px) 140px, var(--flare-core-stops));
}
body[data-page="enrichment"] .bg-flare {
  background: radial-gradient(ellipse 1150px 950px at 140px 140px, var(--flare-core-stops));
}
body[data-page="graph"] .bg-flare {
  background: radial-gradient(ellipse 1150px 950px at calc(100% - 140px) calc(100% - 140px), var(--flare-core-stops));
}

/* Homepage only: the supplied gradient-5 (exported 2560x1440 lossless WebP from assets/backgrounds/source/). Longhands, not the
   `background` shorthand, so the base body rule's no-repeat / fixed still
   apply (the shorthand would reset them). Anchored bottom-right because the
   dark core sits at about 92% across, 95% down, so `cover` keeps it in view
   at any window shape instead of cropping it off. */
body[data-page="home"] {
  background-color: var(--paper);
  background-image: url('../assets/backgrounds/gradient-5.webp');
  background-size: cover;
  background-position: right bottom;
}

/* Every other page: one of gradient-1 to gradient-4, fixed per page by setPage() in
   core.js (so the four pages never share one). The
   position follows where each image's dark core sits, so `cover` crops the
   pale side first and the core stays in view at any window shape:
   1 top-right, 2 bottom-right, 3 bottom-left, 4 left edge at mid-height. */
body[data-gradient] {
  background-color: var(--paper);
  background-size: cover;
}
body[data-gradient="1"] { background-image: url('../assets/backgrounds/gradient-1.webp'); background-position: right top; }
body[data-gradient="2"] { background-image: url('../assets/backgrounds/gradient-2.webp'); background-position: right bottom; }
body[data-gradient="3"] { background-image: url('../assets/backgrounds/gradient-3.webp'); background-position: left bottom; }
body[data-gradient="4"] { background-image: url('../assets/backgrounds/gradient-4.webp'); background-position: left 40%; }

h1, h2, h3 { margin: 0 0 var(--s3); line-height: 1.25; font-weight: 600; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
p { margin: 0 0 var(--s3); }

/* Underlined, not just coloured — there's no brand hue left to be the sole
   link cue (there never should have been one, per the "never colour alone"
   rule this project already applies everywhere else). */
a { color: var(--text); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* The router moves focus to each page's h1 on arrival, so a screen reader starts at the new page. A heading is not a control (nothing can be
   typed or pressed in it), and now that the Graph page's h1 is a full-width centred title the ring above drew a black box around the whole
   line for a moment after a keyboard-started run. The heading keeps focus; only its ring is dropped. Every real control keeps its ring. */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }

.sr-live, .sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s4); top: -48px; z-index: 100;
  padding: var(--s2) var(--s4); background: var(--ink); color: var(--text-on-ink);
  border-radius: var(--radius-md); text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--s4); }

.eyebrow, .label-text {
  display: block; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: var(--s2);
}
.lede { font-size: 17px; color: var(--text-secondary); max-width: 62ch; }
/* Supporting text that can land on the saturated end of a page gradient sits
   on a thin glass backing, the same surface as the cards, so it keeps >= 4.5:1
   wherever the image puts it (measured, see PRD R30). Inside a card or panel
   the surface is already there, so it is only added for bare text. */
.hint { font-size: 13px; color: var(--text-muted); margin: var(--s2) 0 0; }
.step > .hint, .split-controls > .hint,
.eyebrow, .step-title {
  background: var(--glass-strong); backdrop-filter: blur(8px);
  padding: 2px var(--s2); border-radius: var(--radius-sm);
  width: fit-content; max-width: 100%;
}
/* fit-content stops a block stretching, so text-align can no longer centre it: the
   hero's eyebrow slid to the left edge. Centre the box itself. */
.hero .eyebrow { margin-inline: auto; }
.error { font-size: 13px; color: var(--text); font-weight: 600; margin: var(--s2) 0 0; }
.footnote { font-size: 13px; color: var(--text-muted); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* ─── Glass ──────────────────────────────────────────────────────── */
.glass {
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
@supports not (backdrop-filter: blur(1px)) {
  .glass { background: var(--paper); }
  /* Without blur, a 45% header would let scrolled content show through sharply and collide with its text. */
  .app-header::before { background: var(--glass-solid); }
  /* Same for the code panel: dense text needs a stable surface, and --code-string is tuned for 75% over a blurred page. */
  .code-face { background: var(--paper); }
  .code-head { background: var(--mist); }
}

/* ─── Header ─────────────────────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s3) var(--s5);
  position: sticky; top: 0; z-index: 20;
}
/* The frosted bar is its own layer so its bottom edge can be feathered with a
   mask without fading the logo, links and buttons. No border: a 1px line read
   as a bright edge over the orange; instead the fill and the blur fade out
   together over the last --header-fade px, so there is no boundary to see. */
.app-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--glass-header);
  backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--header-fade)), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - var(--header-fade)), transparent 100%);
}
.brand { display: flex; align-items: center; }
.brand-logo { display: block; height: 20px; width: auto; }
/* White-label: with the switch on, the logo and its box take no room (src/brand.js). */
html[data-brand="off"] .brand, html[data-brand="off"] .brand-logo { display: none; }

.breadcrumb { flex: 1; overflow: hidden; }
.breadcrumb ol {
  display: flex; gap: var(--s2); margin: 0; padding: 0; list-style: none;
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
/* The separator follows each crumb but the last, so a trail that wraps never starts a line with a slash. */
.breadcrumb li:not(:last-child)::after { content: "/"; margin-left: var(--s2); color: var(--hairline); }
.breadcrumb .is-current { color: var(--text-secondary); }
/* The last crumb names the country (and, on Graph, the use case): up to "United Arab Emirates - Medium Community Result", 46 characters. Inline
   it fits down to about 1200 px; below that the trail takes its own full-width row under the logo, and wraps only if it must, so the result
   crumb is never cut off (measured: it was clipped by 160 to 390 px at every width under 1180). */
@media (max-width: 1200px) {
  .app-header { flex-wrap: wrap; }
  .breadcrumb { order: 3; flex: 1 1 100%; min-width: 0; overflow: visible; }
  .breadcrumb ol { flex-wrap: wrap; white-space: normal; row-gap: 2px; }
}
/* A country with a short form (UAE) shows the full name, and the short one only where the full name no longer fits its row: 303 px needed, 288 px
   available at 320 wide, but 343 px at 375. The short form is hidden from assistive technology, so the full name is always what is read. */
.crumb-short { display: none; }
@media (max-width: 340px) {
  .crumb-full { display: none; }
  .crumb-short { display: inline; }
}

.header-actions { display: flex; align-items: center; gap: var(--s4); }
@media (max-width: 640px) {
  .app-header { flex-wrap: wrap; gap: var(--s2) var(--s4); padding-inline: var(--s4); }
  .header-actions { flex-wrap: wrap; gap: var(--s2) var(--s3); }
}
.devmode { display: flex; align-items: center; gap: var(--s2); font-size: 13px; cursor: pointer; }
.devmode input { accent-color: var(--ink); width: 16px; height: 16px; }
/* Developer Mode belongs to the query and result pages only. The saved choice is
   kept and comes back as soon as one of those pages opens. */
body[data-page="home"] .devmode,
body[data-page="home"] .split-code { display: none; }
body[data-page="home"] .shell.is-split { grid-template-columns: minmax(0, 1fr); }
/* Header notice: plain text, no pill. The shared .badge-sim box (pale outline,
   transparent fill) looked like a faint pink rectangle on the see-through
   header, so here it is just the label. Scoped to the header so the toast and
   loading-overlay badges keep their own styling. */
.app-header .trust-indicator {
  cursor: help;
  color: var(--text-muted); background: none; border: 0; padding: 0;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  font: 600 14px/1 var(--font-ui);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.btn:active { transform: translateY(1px); }
.btn-lg { padding: var(--s3) var(--s5); font-size: 15px; }
.btn-sm { padding: var(--s1) var(--s2); font-size: 12px; min-height: 24px; min-width: 24px; }   /* WCAG 2.2 target size (2.5.8): was 22px tall */

.btn-primary { background: var(--ink); color: var(--text-on-ink); }
.btn-primary:hover { background: var(--ink-hover); }

.btn-secondary { background: var(--glass-solid); color: var(--text); border-color: var(--ink); }
.btn-secondary:hover { background: var(--paper); box-shadow: inset 0 0 0 999px var(--ink-soft); }

/* Ghost and secondary buttons used to be transparent, so their text took whatever the page gradient put behind it (black on dark red = 1.17:1). A glass fill gives the text a known surface. */
.btn-ghost { background: var(--glass-solid); color: var(--text-secondary); border-color: var(--border-interactive); }
.btn-ghost:hover { background: var(--paper); border-color: var(--ink); color: var(--text); }

/* "Graph Walkthrough": the warm gradient and a black edge, so it reads as the
   vibrant button of its row, with the same hover glow the three result buttons share. While the playbook has never been
   opened this visit it also shimmers and glows on a slow loop (.is-calling); the first click turns that off for good. */
.playbook-toggle { position: relative; overflow: hidden; background: var(--warm-gradient); color: var(--text); border-color: var(--ink); transition: box-shadow var(--dur-fast), background var(--dur-fast), transform var(--dur-fast); }
.playbook-toggle:hover, .playbook-toggle:focus-visible { background: var(--warm-gradient); box-shadow: var(--glow-hover); }
.playbook-toggle[aria-expanded="true"] { background: var(--glass-solid); }
@media (prefers-reduced-motion: no-preference) {
  .playbook-toggle.is-calling { animation: call-glow 3.2s ease-in-out infinite; }
  .playbook-toggle.is-calling::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .75) 50%, transparent 65%); transform: translateX(-120%); animation: call-shimmer 3.2s ease-in-out infinite; }
  .playbook-toggle.is-calling:hover, .playbook-toggle.is-calling:focus-visible { animation: none; }
  .playbook-toggle.is-calling:hover::after, .playbook-toggle.is-calling:focus-visible::after { animation: none; opacity: 0; }
}
@keyframes call-glow { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px var(--glow-white-1), 0 0 18px 4px var(--glow-gold-1); } }
@keyframes call-shimmer { 0%, 45% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

.btn-link {
  background: none; border: none; color: var(--text);
  padding: var(--s2) 0; text-decoration: underline; font-size: 13px;
}

.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--mist); color: var(--text-muted);
  border-color: var(--hairline); cursor: not-allowed;
}
.btn[disabled]:active { transform: none; }

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--s1);
  font: 600 11px/1 var(--font-ui); letter-spacing: .04em; text-transform: uppercase;
  padding: 5px var(--s2); border-radius: var(--radius-sm); border: 1px solid transparent;
}
.badge-preview { color: var(--text); background: transparent; border: 1px dashed var(--ink); }
.badge-live    { color: var(--text-on-ink); background: var(--ink); border-color: var(--ink); }
.badge-new     { color: var(--text); background: var(--warm-gradient); border-color: var(--ink); }
.badge-sim     { color: var(--text-muted); border-color: var(--hairline); }
.badge-soon    { color: var(--text-muted); background: var(--mist); }

/* ─── Views ──────────────────────────────────────────────────────── */
.view {
  max-width: 1180px; margin: 0 auto; padding: var(--s7) var(--s5);
  animation: view-in var(--dur-base) var(--ease-out);
}
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }

/* Less top padding than other views — the capability cards should sit in
   the first viewport instead of scrolled below a tall hero. */
#view-home { padding-top: var(--s5); }

.hero { max-width: 680px; margin: var(--s6) auto 0; text-align: center; }
.hero h1 { font-size: 38px; line-height: 1.15; font-weight: 700; }
/* The title is two lines with the break after "Intelligence", so the product name stands alone on the first. Each half is a block of its
   own and balances its own wrapping if a narrow screen has to split it. */
.hero-line { display: block; text-wrap: balance; }
/* "High-Growth" is one word: a non-breaking hyphen would stop it splitting at the hyphen on a narrow screen. The text keeps the ordinary hyphen
   (so copying it and the accessible name are unchanged); this only forbids the break after it. */
.hero-nobreak { white-space: nowrap; }
/* On a phone the 38 px title cannot hold "for High-Growth Markets" on one line. That line is about 11.2 x the font size wide, and the hero is
   the viewport less 48 px, so a size of 8.1 vw (less a fixed 2 px) keeps it on one line down to 320 px wide, and 38 px is the ceiling it already had.
   Measured: it needs 334 px at 30 px, 313 px at 28 px and 266 px at 24 px. */
@media (max-width: 480px) { .hero h1 { font-size: clamp(22px, 8.1vw - 2px, 38px); } }
.hero .lede { margin-inline: auto; }

/* ─── Cards / grids ──────────────────────────────────────────────── */
.cap-grid {
  display: grid; gap: var(--s4); margin-top: var(--s6);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  text-align: left; padding: var(--s5);
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-lg);
  color: var(--text); font: inherit; cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.card:hover { border-color: var(--ink); background: var(--glass-strong); box-shadow: var(--glow-hover); }
.card[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-soft); }
.card[disabled] { border-color: var(--hairline); color: var(--text-muted); cursor: not-allowed; transform: none; }
.card h2 { font-size: 18px; margin-bottom: var(--s2); }
.card p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.card-meta { font-size: 12px; color: var(--text-muted); margin-top: var(--s3) !important; font-family: var(--font-mono); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }

/* Capability-card illustration: a gradient panel with a tiled hexagon
   outline — "fragmented data, stitched together" — plus a small white icon
   chip naming the capability. Added 2026-10-12 per the Identia rebrand's
   card reference; see UX-DESIGN-SPEC.md §8 View A. */
.card-art {
  position: relative; aspect-ratio: 16 / 10; margin-bottom: var(--s4);
  border-radius: var(--radius-md); overflow: hidden;
  background: radial-gradient(circle at 22% 18%, var(--warm-start), var(--warm-mid) 55%, var(--warm-end) 100%);
}
.card-art .hex-overlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-art-icon {
  position: absolute; left: var(--s3); bottom: var(--s3);
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--paper); box-shadow: var(--shadow-card);
  display: grid; place-items: center;
}
.card-art-icon-img { width: 24px; height: 24px; display: block; }
/* Colours for the inline SVG card art and the person silhouette. They were
   hard-coded hex in flow.js; as classes they take the brand tokens instead. */
.art-paper { fill: var(--paper); }
.art-o92 { fill-opacity: .92; }
.art-o60 { fill-opacity: .6; }
.art-ink { fill: var(--ink); }
.art-ink-text { fill: var(--ink); }
.art-on-ink { fill: var(--text-on-ink); }
.art-gold { fill: var(--warm-mid); }
.art-stroke-ink { fill: none; stroke: var(--ink); }
.art-link { stroke: var(--paper); }
.art-hex { fill: none; stroke: var(--paper); stroke-opacity: .55; }
.art-label { font-family: var(--font-ui); }
.sil-fill { fill: var(--sil); }
.sil-mark { fill: var(--paper); font-family: var(--font-ui); }

.card-art-icon svg {
  width: 20px; height: 20px; fill: none; stroke: var(--ink);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ─── Split screen (Developer Mode) ──────────────────────────────── */
/* The code rail lives outside the view sections so it survives the query →
   result transition; the request/response flip is the whole point of it. */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.shell.is-split { grid-template-columns: minmax(0, 1fr) minmax(420px, 44%); }
.shell.is-split #view-root { min-width: 0; }
.shell:not(.is-split) .split-controls { max-width: 640px; margin: 0 auto; }
.split-code { position: sticky; top: 60px; min-width: 0; padding: var(--s7) var(--s5) var(--s5) 0; }
@media (max-width: 1023px) {
  .shell.is-split { grid-template-columns: minmax(0, 1fr); }
  .split-code { position: static; padding: 0 var(--s5) var(--s6); }
}

.field { margin-bottom: var(--s5); }
.field label, .field .label-text { display: block; font-size: 13px; font-weight: 600; margin-bottom: var(--s2); }
.field input {
  width: 100%; padding: var(--s3);
  background: var(--mist); color: var(--text);
  border: 1px solid var(--border-interactive); border-radius: var(--radius-sm);
  font: 400 15px/1.4 var(--font-mono);
}
.field select {
  width: 100%; padding: var(--s3);
  background: var(--mist); color: var(--text);
  border: 1px solid var(--border-interactive); border-radius: var(--radius-sm);
  font: 400 15px/1.4 var(--font-ui);
}
.field input:focus-visible, .field select:focus-visible { border-color: var(--ink); }
.field input[aria-invalid="true"] { border-color: var(--ink); border-width: 2px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }

/* ─── Query builder: country / attributes / identity steps ─────────── */
/* The country and identity pickers are radio groups drawn as cards. The glow
   follows hover and keyboard focus alike, and "selected" is marked by a tick
   and a heavier border as well as colour, so it never relies on colour alone. */
.step { margin-bottom: var(--s6); }
.step[hidden] { display: none; }
.step-title { display: flex; align-items: center; gap: var(--s3); font-size: 15px; margin: 0 0 var(--s3); }
.step-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--text-on-ink); font-size: 12px; font-weight: 600;
}

.country-grid, .usecase-grid { display: grid; gap: var(--s3); }
.country-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.usecase-grid { grid-template-columns: 1fr; }

.pick { position: relative; display: block; cursor: pointer; }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick-body {
  display: flex; border-radius: var(--radius-lg); background: var(--glass);
  backdrop-filter: blur(12px); border: 1px solid var(--border-interactive);
  transition: box-shadow var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast), background var(--dur-fast);
}
.pick:hover .pick-body, .pick input:focus-visible + .pick-body {
  border-color: var(--ink); background: var(--glass-strong);
  box-shadow: var(--glow-hover);
}
.pick input:focus-visible + .pick-body { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.pick input:checked + .pick-body {
  border: 2px solid var(--ink); background: var(--glass-solid);
  box-shadow: 0 0 0 3px var(--glow-white-1), 0 0 28px 8px var(--glow-white-3), 0 0 40px 12px var(--glow-gold-2);
}
.pick-tick {
  position: absolute; top: var(--s2); right: var(--s2); width: 20px; height: 20px; border-radius: 50%;
  display: none; place-items: center; background: var(--ink); color: var(--text-on-ink); font-size: 12px; line-height: 1;
}
.pick input:checked ~ .pick-tick { display: grid; }

.country-grid { grid-auto-rows: 1fr; }
.country-card, .country-card .pick-body { height: 100%; }
.country-card .pick-body { flex-direction: column; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s4) var(--s3) var(--s3); }
.country-card svg { width: 100%; max-width: 104px; height: 76px; display: block; }
.country-card svg path { fill: var(--warm-mid); stroke: var(--ink); stroke-width: .9; stroke-linejoin: round; fill-opacity: .55; transition: fill-opacity var(--dur-fast); }
.country-card:hover svg path, .country-card input:focus-visible + .pick-body svg path,
.country-card input:checked + .pick-body svg path { fill-opacity: 1; }
.country-name {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-align: center; line-height: 1.25;
  padding: 3px var(--s3); border: 1px solid var(--ink); border-radius: 999px; background: var(--paper);
}

/* The fifth control: a full-width bar under the four featured cards. Same glass, border and
   hover glow as the cards, so it reads as part of the set without being a sixth tile. */
.country-search {
  display: flex; align-items: center; gap: var(--s3); width: 100%; margin-top: var(--s3);
  padding: var(--s3) var(--s4); font: inherit; font-size: 15px; color: var(--text); text-align: left; cursor: pointer;
  background: var(--glass); backdrop-filter: blur(12px); border: 1px solid var(--border-interactive); border-radius: var(--radius-lg);
  transition: box-shadow var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast), opacity var(--dur-fast);
}
.country-search:hover, .country-search:focus-visible { border-color: var(--ink); background: var(--glass-strong); box-shadow: var(--glow-hover); }
.country-search.is-active { border: 2px solid var(--ink); background: var(--glass-solid); box-shadow: var(--glow-hover); }
.country-search-lead { flex: none; width: 36px; height: 28px; display: grid; place-items: center; }
.country-search-lead .search-icon { width: 20px; height: 20px; }
.country-search-lead svg:not(.search-icon), .palette-item-shape svg { width: 100%; height: 100%; display: block; }
.country-search-lead svg:not(.search-icon) path, .palette-item-shape svg path {
  fill: var(--warm-mid); fill-opacity: .55; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; vector-effect: non-scaling-stroke;
}
.country-search-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.country-search-change { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.search-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* Only one choice is live at a time: when the search bar holds the selection, the four cards recede. */
.country-grid.is-dimmed .pick { opacity: .6; transition: opacity var(--dur-fast); }
.country-grid.is-dimmed .pick:hover { opacity: 1; }
.country-grid:not(.is-dimmed) + .country-search:not(.is-active) { opacity: 1; }

.palette-scrim {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center;
  padding: 12vh var(--s5) var(--s5); background: rgba(255, 255, 255, 0.28); backdrop-filter: blur(6px); overflow-y: auto;
}
.palette { width: 100%; max-width: 560px; padding: 0; overflow: hidden; box-shadow: var(--shadow-float); }
.palette-bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--glass-border); }
.palette-bar input {
  flex: 1; min-width: 0; padding: var(--s2) 0; font: inherit; font-size: 17px; color: var(--text);
  background: transparent; border: 0; outline: none;
}
.palette-list { list-style: none; margin: 0; padding: var(--s2); max-height: 50vh; overflow-y: auto; }
.palette-item {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid transparent;
}
.palette-item[aria-selected="true"] { background: var(--glass-solid); border-color: var(--ink); }
.palette-item-shape { flex: none; width: 40px; height: 32px; }
.palette-item-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--s3); }
.palette-item-name { font-size: 15px; }
.palette-item-meta { font-size: 12px; color: var(--text-muted); }
@media (max-width: 480px) { .palette-item-text { display: grid; gap: 2px; justify-content: start; } }
.palette-item .badge { flex: none; }
.palette-empty { margin: 0; padding: var(--s5); text-align: center; color: var(--text-muted); font-size: 14px; }
@supports not (backdrop-filter: blur(1px)) {
  .country-search { background: var(--paper); }
  .palette-scrim { background: rgba(255, 255, 255, 0.85); }
}

.usecase-card .pick-body { padding: var(--s4); align-items: stretch; }
.usecase-text { display: grid; gap: var(--s1); padding-right: var(--s6); }
.usecase-text strong { font-size: 16px; font-weight: 500; }
.usecase-text span { font-size: 13px; color: var(--text-secondary); }

/* The identity summary is information, not a choice: plain glass, no hover glow, no tick. */
.identity-summary {
  display: flex; gap: var(--s4); padding: var(--s3); align-items: stretch;
  border-radius: var(--radius-lg); background: var(--glass); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}
.identity-avatar {
  flex: none; width: 96px; height: 96px; align-self: flex-start; border-radius: var(--radius-md); display: grid; place-items: center;
  background: radial-gradient(circle at 25% 20%, var(--warm-start), var(--warm-mid) 55%, var(--warm-end) 100%);
}
.identity-avatar svg { width: 64px; height: 64px; display: block; }
.identity-main { flex: 1; min-width: 0; padding: var(--s1) var(--s6) var(--s1) 0; }
.identity-title { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; margin-bottom: var(--s2); }
.identity-title strong { font-size: 17px; font-weight: 500; }
.identity-count { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.identity-attrs-label { margin-bottom: var(--s1); }
.identity-attrs { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--s3); font-size: 13px; }
.identity-attrs dt { color: var(--text-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; align-self: center; margin: 0; }
.identity-attrs dd { margin: 0; font-family: var(--font-mono); overflow-wrap: anywhere; }
.identity-empty { margin: 0; font-size: 13px; color: var(--text-muted); }
/* The search type, under the query input inside the Summary card (PRD R60): just the key's name. */
.search-type { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--glass-border); }
.search-type-key { margin: 0; font-size: 14px; font-weight: 500; }
.search-type.is-pending .search-type-key { color: var(--text-muted); font-weight: 400; }

@media (max-width: 480px) {
  .identity-avatar { width: 64px; height: 64px; }
  .identity-avatar svg { width: 44px; height: 44px; }
  .identity-attrs { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .pick:hover .pick-body,
  .card:not([disabled]):hover { transform: translateY(-2px); }
}
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.run-row { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }

/* Attribute chips. Rebranded 2026-10-12: chip-group[data-invalid] used to mark
   a single sub-group (e.g. "probabilistic") as blocking under the retired
   deterministic/probabilistic engine split (PRD §13 R16). Match is now one
   flat group, so this now marks that whole panel while the "3 more
   attributes" rule (UX-DESIGN-SPEC.md §3.2) is unmet. */
.chip-group { margin-bottom: var(--s5); padding: var(--s4); border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--glass-strong); backdrop-filter: blur(8px); }
.chip-group[data-invalid="true"] { border-style: dashed; border-color: var(--border-interactive); }
.chip-group h3 { font-size: 13px; margin-bottom: var(--s1); }
.chip-group .hint { margin-bottom: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-section + .chip-section { margin-top: var(--s4); }
/* In a labelled section each chip grows to fill its line, so whichever chips land on the last row
   spread across it instead of leaving one small chip hanging at the left. */
.chip-section .chip { flex: 1 1 auto; }
.chip-section .chip span { display: block; text-align: center; }
.chip-section-label { margin: 0 0 var(--s2); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
/* The light button: the same face as .btn-ghost (the Graph page's buttons). Ticked is marked by the ink border and a soft
   white and gold glow, so it is not colour alone. The attribute selector on the query page stops there: a tick badge on each of
   up to seven chips was too busy. The Customize output panel keeps the badge (below). */
.chip span {
  display: inline-block; padding: var(--s2) var(--s3);
  background: var(--glass-solid); color: var(--text-secondary);
  border: 1px solid var(--border-interactive); border-radius: var(--radius-md);
  font: 600 13px/1.2 var(--font-ui); transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast), color var(--dur-fast);
}
.chip:hover input:not(:disabled) + span { background: var(--paper); border-color: var(--ink); color: var(--text); box-shadow: 0 0 10px 2px var(--glow-white-2); }
.chip input:checked + span {
  background: var(--paper); border-color: var(--ink); color: var(--text); box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 2px var(--glow-white-1), 0 0 10px 3px var(--glow-gold-1);
}
/* The tick badge is only drawn where chipGroup() is given ticks: true, which is the Customize output panel. The group is its own
   stacking context and the badge sits above it, so a neighbouring chip's glow cannot paint over the badge and turn it grey. */
.chip-group:has(.chip-tick) { isolation: isolate; }
.chip-tick {
  position: absolute; z-index: 2; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; pointer-events: none;
  display: none; place-items: center; background: var(--ink); color: var(--text-on-ink); font: normal 11px/1 var(--font-ui);
  box-shadow: 0 0 0 2px var(--paper);
}
.chip input:checked ~ .chip-tick { display: grid; }
/* The query page's attribute selector marks a ticked chip with a small tick inside the box, at its left edge. It is drawn on the
   span, out of the flow, so the label stays centred and nothing moves when a chip is ticked. The same padding is kept on both
   sides so a narrow chip has room for the tick without it touching the label, and ticking or unticking never changes a chip's width. */
#selector-root .chip span { position: relative; padding-inline: calc(var(--s3) + 10px); }
#selector-root .chip input:checked + span::before {
  content: "✓"; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ink); color: var(--text-on-ink); font: normal 8px/1 var(--font-ui);
}
.chip input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.chip input:disabled + span { border-color: var(--hairline); color: var(--text-muted); }


/* A panel that opens in place: its height eases from 0 to its natural size (the grid-row trick, so no
   measuring in script), the content fades down into it, and the chips arrive one after another. While
   closed it is visibility:hidden, so its chips are out of the tab order and invisible to a screen reader. */
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-slow) var(--ease-out); }
.reveal.is-open { grid-template-rows: 1fr; }
.reveal-inner {
  min-height: 0; overflow: hidden; visibility: hidden; opacity: 0; transform: translateY(-8px);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
}
.reveal.is-open .reveal-inner { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.reveal .chip { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.reveal.is-open .chip { opacity: 1; transform: none; transition-delay: calc(140ms + var(--i, 0) * 50ms); }
.reveal .chip:nth-child(2) { --i: 1; } .reveal .chip:nth-child(3) { --i: 2; }
.reveal .chip:nth-child(4) { --i: 3; } .reveal .chip:nth-child(5) { --i: 4; } .reveal .chip:nth-child(6) { --i: 5; }
/* Six options, always in even rows: 3 + 3 where there is room, otherwise 2 + 2 + 2. Measured against the panel's
   own width, not the screen's, because the column it sits in is half the page on a laptop and the whole page on a
   phone. */
.reveal-inner { container-type: inline-size; }
.reveal .chips { display: grid; grid-template-columns: repeat(2, 1fr); }
.reveal .chip span { display: block; text-align: center; }
@container (min-width: 440px) {
  .reveal .chips { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-inner, .reveal .chip { transition: none; }
}

/* ─── Code panel ─────────────────────────────────────────────────── */
.flip-scene { perspective: 1200px; height: 100%; }
.flip-card {
  position: relative; transform-style: preserve-3d;
  transition: transform var(--dur-slow) var(--ease-inout);
  min-height: 420px;
}
.flip-card.is-flipped { transform: rotateY(180deg); }
.flip-face { backface-visibility: hidden; }
.flip-face--back { position: absolute; inset: 0; transform: rotateY(180deg); }

/* Developer Mode code panel: Identia light theme (2026-10-20, was dark navy).
   Same pale glass as the cards; JSON syntax colours are our own (below), not
   a Prism theme, so no third-party stylesheet is loaded. */
.code-face {
  background: var(--code-bg); border: 1px solid var(--code-border);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column;
  color: var(--code-text);
}
.code-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--code-border);
  background: var(--code-head-bg);
}
.method-chip {
  font: 700 11px/1 var(--font-mono); letter-spacing: .06em;
  padding: 5px var(--s2); border-radius: var(--radius-sm);
  background: var(--ink); color: var(--text-on-ink);
}
.method-chip--ok { background: var(--ink); color: var(--text-on-ink); }
.method-chip--err { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.code-url { flex: 1; font: 400 12px/1.4 var(--font-mono); color: var(--code-muted); overflow-wrap: anywhere; }
.code-url .cc { color: var(--code-text); font-weight: 700; }

.code-body {
  margin: 0; padding: var(--s4); overflow: auto; flex: 1;
  font: 400 13px/1.6 var(--font-mono); tab-size: 2;
  color: var(--code-text);
}
/* JSON token colours. Prism's markup is kept (token.property etc.); only the
   colours are ours. Keys are ink, string values the darkened brand orange,
   punctuation grey. Weight cannot carry meaning (Saans has one), so keys vs
   values are told apart by hue and by the colon/quote structure. */
.code-body .token.property { color: var(--code-text); }
.code-body .token.string { color: var(--code-string); }
.code-body .token.number, .code-body .token.boolean, .code-body .token.null,
.code-body .token.keyword { color: var(--code-number); }
.code-body .token.punctuation, .code-body .token.operator { color: var(--code-muted); }
.code-line { display: block; white-space: pre; border-radius: 2px; }
.code-line.is-flash { animation: line-flash 600ms var(--ease-out); }
@keyframes line-flash {
  from { background: var(--flash); }
  to   { background: transparent; }
}

/* ─── Expected latency (replaces the Latency overlay) ──────────────── */
/* Expected-latency pill, beside each result's title. It replaces the full-screen latency overlay.
   A short track with a dot that travels end to end; how long the trip takes comes from the figure
   (--trip, set in views/latency.js), so a slower product visibly takes longer. */
.result-head { flex-wrap: wrap; justify-content: flex-start; }
/* The Sources pill and the latency pill travel together at the far end of the header, and wrap as a pair. */
.head-pills { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-left: auto; }
/* On a phone the pill wraps under the title and button; it then starts at the left margin like them, instead of
   floating right of centre. (Wider screens keep it at the far end of the header row.) */
@media (max-width: 640px) { .head-pills { margin-left: 0; } }
.latency-pill {
  display: inline-flex; align-items: center; gap: var(--s3); margin: 0; padding: var(--s2) var(--s4);
  border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.latency-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.latency-value { min-width: 6.4ch; font: 500 18px/1 var(--font-ui); font-variant-numeric: tabular-nums; text-align: right; }
/* "Simulated" is part of the figure and is never hidden (PRD FR-D-3). */
.latency-tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 2px var(--s2); border: 1px solid var(--ink); border-radius: 999px; background: var(--glass-solid); }
.latency-track { position: relative; width: 64px; height: 2px; border-radius: 2px; background: var(--ink-soft); flex: none; }
.latency-dot {
  position: absolute; top: 50%; left: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--ink); transform: translateX(64px);
}
@media (prefers-reduced-motion: no-preference) {
  .latency-pill.is-playing .latency-dot { transform: translateX(0); animation: latency-trip var(--trip, 1000ms) cubic-bezier(.4, 0, .2, 1) forwards; }
  .latency-pill.is-playing.is-done .latency-dot { animation: latency-land 700ms var(--ease-out) forwards; }
  .latency-pill.is-playing { animation: latency-in 500ms var(--ease-out) backwards; }
}
@keyframes latency-trip { from { transform: translateX(0); } to { transform: translateX(64px); } }
/* arrival: a brief brand-orange ring, then rest */
@keyframes latency-land {
  0% { transform: translateX(64px); box-shadow: 0 0 0 0 var(--glow-gold-2); background: var(--warm-start); }
  60% { transform: translateX(64px); box-shadow: 0 0 0 9px transparent; background: var(--warm-start); }
  100% { transform: translateX(64px); box-shadow: 0 0 0 0 transparent; background: var(--ink); }
}
@keyframes latency-in { from { opacity: 0; transform: translateY(-6px); } }

/* ─── Sources pill (beside the latency pill) ───────────────────────── */
/* Same shape and weight as the latency pill so the two read as a pair. One chip per source that appears in the
   response; no counts (PRD R58). Built from the response in views/sources.js. */
.sources-pill {
  display: inline-flex; align-items: center; gap: var(--s3); margin: 0; padding: var(--s2) var(--s4);
  border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.sources-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.source-chip {
  display: inline-flex; align-items: center; padding: 2px var(--s3);
  border: 1px solid var(--ink); border-radius: 999px; background: var(--glass-solid);
}
.source-name { font-size: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .sources-pill.is-playing { animation: latency-in 500ms var(--ease-out) 120ms backwards; }
  .sources-pill.is-playing .source-chip { animation: source-pop 520ms var(--ease-out) calc(380ms + var(--i, 0) * 140ms) backwards; }
}
@keyframes source-pop { from { opacity: 0; transform: translateY(6px) scale(.94); } }
@media (max-width: 640px) {
  .sources-pill { padding: var(--s2) var(--s3); gap: var(--s2); }
  .source-name { font-size: 11px; }
}
@media (max-width: 340px) { .sources-label { display: none; } }
/* On the narrowest phones the label, figure and the Simulated tag need the room, so the decorative track goes.
   The figure still counts up, and the tag is never dropped. */
@media (max-width: 340px) { .latency-track { display: none; } .latency-pill { gap: var(--s2); } }
@media (max-width: 640px) {
  .latency-pill { gap: var(--s2); padding: var(--s2) var(--s3); max-width: 100%; }
  .latency-label { letter-spacing: .04em; font-size: 10px; }
  .latency-value { font-size: 16px; min-width: 5.6ch; }
  .latency-tag { font-size: 10px; padding: 1px var(--s2); }
  .latency-track { width: 28px; }
  .latency-dot { transform: translateX(28px); }
  @keyframes latency-trip { from { transform: translateX(0); } to { transform: translateX(28px); } }
  @keyframes latency-land { 0%, 60% { transform: translateX(28px); box-shadow: 0 0 0 0 var(--glow-gold-2); background: var(--warm-start); } 100% { transform: translateX(28px); box-shadow: 0 0 0 0 transparent; background: var(--ink); } }
}

/* ─── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: var(--s5); bottom: var(--s5); z-index: 30;
  display: flex; align-items: center; gap: var(--s3);
  max-width: 420px; padding: var(--s3) var(--s4);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.toast .btn { flex-shrink: 0; }
/* The notice goes bottom-right so it never sits on top of the bottom-left privacy toast. */
.toast--notice { left: auto; right: var(--s5); }

/* ─── Results — match ────────────────────────────────────────────── */
.result-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.result-head h1 { margin: 0; }
.match-layout { display: grid; grid-template-columns: 280px 1fr; gap: var(--s5); margin: var(--s5) 0; }
@media (max-width: 767px) { .match-layout { grid-template-columns: 1fr; } }
.gauge-wrap { padding: var(--s5); display: grid; place-items: center; text-align: center; }
.gauge-svg { width: 180px; height: 180px; overflow: visible; }
.gauge-track { stroke: var(--track-soft); }
.gauge-arc { transition: filter var(--dur-reveal) var(--ease-out); }
/* The glow arrives when the sweep lands, not while it is still moving. */
.gauge-wrap.is-done .gauge-arc { filter: drop-shadow(0 0 5px var(--glow-gold-2)); }
.gauge-value { font: 700 28px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.gauge-tier { font-size: 13px; font-weight: 600; }

.bars { padding: var(--s5); }
.bar-row { margin-bottom: var(--s4); }
.bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: var(--s1); }
.bar-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; background: var(--track-soft); border-radius: 999px; overflow: hidden; }
.bar-fill {
  position: relative; height: 100%; border-radius: 999px; overflow: hidden;
  transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--match-from), var(--match-to));
  transition: transform var(--dur-slow) var(--ease-out);
}
/* A light sweep that crosses each bar once, after it has filled. */
.bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--shine) 50%, transparent 70%);
  transform: translateX(-100%);
}
@media (prefers-reduced-motion: no-preference) {
  .bar-fill::after { animation: bar-shine 1.4s var(--ease-inout) calc(2500ms + var(--i, 0) * 340ms) 1 forwards; }
  /* Cards, then the bars' card, rise in turn so the page builds rather than appears. */
  #view-match .gauge-wrap { animation: rise var(--dur-reveal) var(--ease-out) 160ms backwards; }
  #view-match .bars       { animation: rise var(--dur-reveal) var(--ease-out) 480ms backwards; }
  /* The buttons arrive last and gently. --ease-out would put most of the fade in the
     first 100 ms, which reads as a pop, so this one is a plain, longer ease. Match waits
     for its gauge and bars to land; Profile and Graph have nothing to wait for. */
  .bridge-row { animation: fade-in var(--dur-fade) ease-in-out var(--fade-delay, 700ms) backwards; }
  #view-match .bridge-row { --fade-delay: 3600ms; }
}
@keyframes bar-shine { to { transform: translateX(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
/* visibility as well as opacity: until its turn the row is not just see-through but
   unfocusable, so a keyboard user can't tab onto a button they can't see. */
@keyframes fade-in { from { opacity: 0; visibility: hidden; transform: translateY(6px); } }

/* Shared box for both of Match's bridges (added 2026-10-12 — the two used
   to be visually different: one a boxed alert, one a bare button; both
   now also share the same pulsing dot and solid black button, so there's
   only one dot style left — see .pulse-dot). */
.bridge-box {
  display: flex; align-items: center; gap: var(--s4); padding: var(--s5);
  border: 1px dashed var(--ink); margin: var(--s5) 0;
}
.bridge-box h2 { color: var(--text); font-size: 18px; margin-bottom: var(--s1); }
.bridge-box p { margin: 0; font-size: 14px; color: var(--text-secondary); }
.bridge-box button { margin-left: auto; flex-shrink: 0; }
.pulse-dot {
  width: 12px; height: 12px; border-radius: 999px; background: var(--ink);
  box-shadow: 0 0 0 0 var(--ink); animation: pulse 2s var(--ease-inout) infinite alternate;
  flex-shrink: 0;
}
@keyframes pulse {
  from { box-shadow: 0 0 0 0 var(--pulse-from); opacity: .7; }
  to   { box-shadow: 0 0 0 10px var(--pulse-to); opacity: 1; }
}
/* Wide gap on purpose: the hover glow reaches ~36px, and at the usual 12px a hovered button's
   white halo washed out the edge of its black neighbour. Stacked on a phone, a normal gap will do. */
.bridge-row { display: flex; gap: var(--s5); flex-wrap: wrap; margin-top: var(--s5); }
@media (max-width: 640px) { .bridge-row { gap: var(--s4); } }
/* The three result-page buttons share one hover: the same glow as the cards. */
.bridge-row .btn { transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast); }
/* Hover is the glow and nothing else: no fill change, so no inner highlight, matching the orange button. */
.bridge-row .btn:hover, .bridge-row .btn:focus-visible { box-shadow: var(--glow-hover); }
.bridge-row .btn-primary:hover { background: var(--ink); }
.bridge-row .btn-secondary:hover { background: var(--glass-solid); }

/* ─── Results — enrichment ───────────────────────────────────────── */
.profile { display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; }
@media (max-width: 767px) { .profile { grid-template-columns: 1fr; } }
.profile-col { padding: var(--s5); }
/* Each column's title row. "We discovered" carries the output control at its right edge; "You provided" gets
   the same row height so the two columns' first labels still line up. */
.col-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 36px; margin-bottom: var(--s1); }
.col-head h2 { margin: 0; }
/* Flag (src/flags.js, PRD R92): with the flag off, the Profile page's "Customize output" button and its panel are not shown. They stay in the page, so turning the flag on needs no other change. */
html[data-customize-output="off"] .output-toggle,
html[data-customize-output="off"] #enrich-customize { display: none; }
.output-toggle {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 6px var(--s3);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
  background: var(--glass-solid); border: 1px solid var(--border-interactive); border-radius: 999px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.output-toggle svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.output-toggle .chev { width: 14px; transition: transform var(--dur-slow) var(--ease-out); }
.output-toggle:hover, .output-toggle:focus-visible { border-color: var(--ink); box-shadow: var(--glow-hover); }
.output-toggle[aria-expanded="true"] { border: 2px solid var(--ink); padding: 5px calc(var(--s3) - 1px); }
.output-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
/* The panel inside the column wears the same surface as a "Verified" row (.attr--verified): the light glass
   fill, a 1px grey border and the small radius. It used to be a solid 85% white box with a pink hairline, which
   read as a different object from the rows around it. */
#enrich-customize .chip-group {
  margin: var(--s3) 0 var(--s2);
  background: var(--glass); backdrop-filter: none;
  border: 1px solid var(--border-interactive); border-radius: var(--radius-sm);
}
/* While the entrance sequence plays the column shows "Searching the profile…" at its top right, which is where
   this button sits. The button waits for the sequence to finish, then fades in with the same animation, and at the
   same moment, as the three buttons under the card (results.js sets the same --fade-delay on both). Until then it
   is invisible and cannot be focused or clicked. */
@media (prefers-reduced-motion: no-preference) {
  .profile.is-playing .output-toggle { animation: fade-in var(--dur-fade) ease-in-out var(--fade-delay, 0ms) backwards; }
}
.profile-col--discovered { border-left: 1px solid var(--hairline); }
@media (max-width: 767px) { .profile-col--discovered { border-left: 0; border-top: 1px solid var(--hairline); } }
.profile dl { margin: 0; }
.profile dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: var(--s4); }
.profile dd { margin: var(--s1) 0 0; font-family: var(--font-mono); font-size: 14px; }
.attr {
  display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap;
  padding: var(--s2); border-radius: var(--radius-sm);
}
.attr--new { border: 1px solid var(--ink); background: var(--new-wash); }
/* Confirmed, not discovered: a value you sent that the profile holds too. Quieter than New. */
.attr--verified { border: 1px solid var(--border-interactive); background: var(--glass); }
.badge-verified { color: var(--text); background: var(--glass-solid); border-color: var(--ink); }
.badge-verified::before { content: "✓"; font-weight: 700; }
.attr-seen { font-size: 12px; color: var(--text-muted); }

/* Profile entrance: every element with .seq waits for its own --at, then plays.
   The timings are set in results.js (PROFILE_*) so they are tuned in one place. */
.profile-tally { margin: var(--s5) 0 0; font-size: 13px; font-weight: 600; }
.profile { position: relative; }
@media (prefers-reduced-motion: no-preference) {
  .profile.is-playing { animation: rise var(--dur-reveal) var(--ease-out) 100ms backwards; }
  .seq { animation-duration: 450ms; animation-delay: var(--at, 0ms); animation-fill-mode: backwards; animation-timing-function: var(--ease-out); }
  .seq--left { animation-name: slide-in; }
  .seq--rise { animation-name: land; }
  .seq--flash { animation-name: land, new-flash; animation-duration: 450ms, 1100ms; animation-delay: var(--at, 0ms), var(--at, 0ms); animation-timing-function: var(--ease-out), ease-out; }
  .seq--check { animation-name: land, verify-pulse; animation-duration: 450ms, 900ms; animation-delay: var(--at, 0ms), var(--at, 0ms); animation-timing-function: var(--ease-out), ease-out; }

  /* The search line: one pass down the "We discovered" column, then it is gone. */
  .profile.is-playing .profile-col--discovered { position: relative; overflow: hidden; }
  .profile.is-playing .profile-col--discovered::after {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 56px; pointer-events: none;
    background: linear-gradient(to bottom, transparent, var(--scan-glow) 70%, var(--scan-line) 100%);
    transform: translateY(-100%); opacity: 0;
    animation: scan var(--scan-ms, 1700ms) ease-in-out var(--scan-at, 1500ms) 1 both;
  }
  .profile.is-playing .profile-col--discovered::before {
    content: "Searching the profile…"; position: absolute; top: var(--s3); right: var(--s5);
    font-size: 12px; color: var(--text-muted); opacity: 0;
    animation: searching calc(var(--scan-ms, 1700ms) + 600ms) ease-in-out calc(var(--scan-at, 1500ms) - 200ms) 1 both;
  }
}
@keyframes slide-in { from { opacity: 0; transform: translateX(-18px); } }
@keyframes land { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes new-flash { 0%, 35% { box-shadow: 0 0 0 0 var(--glow-gold-2), 0 0 18px 4px var(--glow-gold-1); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes verify-pulse { 0%, 35% { box-shadow: 0 0 0 3px var(--glow-white-1); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes scan {
  0% { transform: translateY(-100%); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(var(--scan-travel, 520px)); opacity: 0; }
}
@keyframes searching { 0%, 100% { opacity: 0; } 20%, 80% { opacity: 1; } }

/* ─── Results — graph ────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4); }
/* The same frosted glass as the cards and the graph panel (they used to be a flat --mist box). */
.kpi {
  display: grid; align-content: start; gap: var(--s1); padding: var(--s3) var(--s5);
  background: var(--glass); backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
}
@supports not (backdrop-filter: blur(1px)) { .kpi { background: var(--paper); } }
/* The label is plain small caps. It used to get the white tag backing every bare label gets; inside a
   card that backing is redundant (the card is already the surface), so it is switched off here. */
.kpi-label { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.kpi-value { margin: 0; font: 500 40px/1.05 var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-qual { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-family: var(--font-ui); }

/* ─── The four segments (PRD R70) ──────────────────────────────────── */
/* The page title is the root of a small hierarchy: a line down from it, a rail across, and a line into the top of each of the four cards
   (PRD R74). The four drops sit in a grid with the same columns and gap as the cards, so each lands on its card's centre.
   Only drawn when the cards are four across (a row 848px wide or more: 4 x 200px + 3 gaps); below that the cards wrap and a rail would
   point at the wrong boxes, so the tree is left out and the title is a plain left-aligned heading. */
.segments { margin: 0 0 var(--s5); container-type: inline-size; container-name: segments; --pl-cycle: 10s; --pl-start: 1800ms; --t-build: 1500ms; --t-stem: 700ms; --t-rail: 1600ms; --t-drop: 808ms; --comet: 120px; --halo: 18px; --lift: 20px; --leg: 21px; --stem: calc(13px + var(--lift) + 13px - var(--leg)); }
.segments-title { margin: 0 0 var(--s3); }
.seg-tree { display: none; }
@container segments (min-width: 848px) {
  /* The title carries the page (PRD R79): 40px with the letters drawn a little closer. (It also had a display numeral "4" at 1.6x until R83.) */
  .segments-title { text-align: center; margin-bottom: 4px; font-size: 40px; line-height: 1.1; letter-spacing: -0.015em; margin-top: calc(var(--lift) * -1); }   /* margin-top: the title sits --lift (24px) higher, into the page's top padding; the stem below grows by the same amount, so the boxes do not move (PRD R80) */
  /* The wire frame round the title (::before) and the white charge that builds on it before each pulse (::after). The title shrinks to its text so the frame hugs it;
     both pieces sit behind the text (isolation + z-index -1). The frame reaches 4px below the box, which is the margin under it, so its bottom edge meets the top of the stem. */
  .segments-title { width: fit-content; margin-inline: auto; position: relative; isolation: isolate; }
  .segments-title::before, .segments-title::after { content: ""; position: absolute; inset: -6px -28px -4px; z-index: -1; pointer-events: none; border-radius: var(--radius-lg); }
  .segments-title::before { border: 1px solid var(--ink); opacity: .55; z-index: -1; }
  .segments-title::after { z-index: -2; }   /* the charge sits under the wire, so the wire stays visible at full glow */
  .segments-title::after { border: 1px solid #fff; opacity: 0; background: rgba(255, 255, 255, .5); box-shadow: 0 0 4px 1px #fff, 0 0 14px 4px rgba(255, 255, 255, .95), 0 0 34px 9px rgba(255, 255, 255, .75), 0 0 64px 14px rgba(255, 255, 255, .45), inset 0 0 18px 4px rgba(255, 255, 255, .9); }
  .seg-tree { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); height: calc(var(--stem) + var(--leg)); position: relative; }
  .seg-tree::before { content: ""; position: absolute; left: 50%; top: 0; height: var(--stem); width: 1px; background: var(--ink); opacity: .55; }   /* the stem, from the title */
  .seg-tree span { position: relative; }
  .seg-tree span::before { content: ""; position: absolute; left: 50%; top: var(--stem); bottom: 0; width: 1px; background: var(--ink); opacity: .55; }   /* the drop into the card */
  .seg-tree span::after { content: ""; position: absolute; top: var(--stem); height: 1px; left: calc(var(--s4) / -2); right: calc(var(--s4) / -2); background: var(--ink); opacity: .55; }   /* the rail: each piece reaches halfway into the gap, so neighbours meet without overlapping and doubling the line */
  .seg-tree span:first-of-type::after { left: 50%; }   /* of-type, not -child: the pulse <i> elements sit before the four spans */
  .seg-tree span:last-of-type::after { right: 50%; }
}

/* ─── The idle pulse (PRD R79, reworked R81) ──────────────────────────────────────────────────────────────────────────────────────────
   Every --pl-cycle (10s) a comet of WHITE light runs from the title down the stem (--t-stem), out along the rail to both ends (--t-rail) and down
   into each box (--t-drop), and the top edge of each box glows as it lands (--t-glow). It starts --pl-start after the page, then sits still until the
   next pass. It was orange, 7s and about 2.6s a pass, and read as too fast and too subtle (R81): now white, with a soft bloom, longer legs, and a
   wider and brighter landing. Every leg starts the moment the one before it ends, from the variables below, so changing one duration moves the rest.
   White is only about 1.3:1 against the page behind the lines (measured), so a bare white line would be lost: the comet is a bright core with a soft
   halo, and a hairline of shadow keeps its edge on the pale background. Every piece shares the one cycle, so the pieces stay in step. Decorative
   (aria-hidden). Off under reduced motion, off while any other face of the graph panel is showing, and (like the lines) only on a four-across row. */
.pl { display: none; }
.kpi { position: relative; }
/* The timing variables live on .segments itself (above). A container query cannot style its own container, so they cannot be set inside it. */
@media (prefers-reduced-motion: no-preference) {
  @container segments (min-width: 848px) {
    .pl { display: block; position: absolute; z-index: 1; pointer-events: none; background-repeat: no-repeat; animation-duration: var(--pl-cycle); animation-iteration-count: infinite; animation-fill-mode: backwards; }
    /* down the stem and into the boxes: a comet with a long soft tail and a bright, soft-edged head, centred on the 1px line. Two things keep any edge from showing:
       the gradient fades back to transparent before the end of its tile (a radial glow bigger than its tile was cut off flat, giving a hard leading edge), and a mask fades the
       strip's sides. */
    .pl-stem, .pl-drop { left: calc(50% - var(--halo) / 2 + .5px); width: var(--halo); background-image: linear-gradient(180deg, transparent 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .95) 86%, transparent 100%), linear-gradient(180deg, transparent 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .95) 86%, transparent 100%); background-size: 100% 44px; background-position: 0 -44px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 38%, #000 62%, transparent); mask-image: linear-gradient(90deg, transparent, #000 38%, #000 62%, transparent); animation-name: pl-fall; animation-timing-function: ease-in-out; }
    .pl-stem { top: 0; height: var(--stem); animation-delay: var(--pl-start); animation-name: pl-fall-stem; }
    .pl-drop { top: var(--stem); bottom: 0; }
    /* the rail comet is as wide as the glow is tall; it enters at the middle and leaves past the end, so the light is never seen to start or stop */
    .pl-rail { top: calc(var(--stem) - var(--halo) / 2 + .5px); height: var(--halo); background-size: var(--comet) 100%; -webkit-mask-image: linear-gradient(180deg, transparent, #000 38%, #000 62%, transparent); mask-image: linear-gradient(180deg, transparent, #000 38%, #000 62%, transparent); animation-timing-function: linear; animation-delay: calc(var(--pl-start) + var(--t-stem)); }
    .pl-rail-r { left: 50%; right: calc((100% - 3 * var(--s4)) / 8); background-image: linear-gradient(90deg, transparent 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .95) 86%, transparent 100%), linear-gradient(90deg, transparent 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .95) 86%, transparent 100%); background-position: calc(var(--comet) * -1) 0; animation-name: pl-rail-r; }
    .pl-rail-l { left: calc((100% - 3 * var(--s4)) / 8); right: 50%; background-image: linear-gradient(270deg, transparent 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .95) 86%, transparent 100%), linear-gradient(270deg, transparent 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .95) 86%, transparent 100%); background-position: calc(100% + var(--comet)) 0; animation-name: pl-rail-l; }
    /* The drops start where the rail's light passes them: the inner drops a quarter of the way along, the outer ones at the end. */
    .seg-tree span:nth-of-type(2) .pl-drop, .seg-tree span:nth-of-type(3) .pl-drop { animation-delay: calc(var(--pl-start) + var(--t-stem) + var(--t-rail) * .25); }
    .seg-tree span:nth-of-type(1) .pl-drop, .seg-tree span:nth-of-type(4) .pl-drop { animation-delay: calc(var(--pl-start) + var(--t-stem) + var(--t-rail)); }
    /* landing: a soft white bloom at the foot of each line, over the page just above the box. (It cannot sit on the box: the title band is white, and white on white shows nothing.)
       It starts the moment the light arrives (the drop's delay + --t-drop) and fades over --t-glow. */
    .pl-bloom { left: 50%; bottom: 0; top: auto; width: 130px; height: 52px; transform: translate(-50%, 50%); opacity: 0; background-image: radial-gradient(ellipse 50% 50% at 50% 50%, #fff 0, rgba(255, 255, 255, .8) 25%, rgba(255, 255, 255, .35) 55%, rgba(255, 255, 255, 0) 100%); animation-name: pl-land; }
    .seg-tree span:nth-of-type(2) .pl-bloom, .seg-tree span:nth-of-type(3) .pl-bloom { animation-delay: calc(var(--pl-start) + var(--t-stem) + var(--t-rail) * .25 + var(--t-drop)); }
    .seg-tree span:nth-of-type(1) .pl-bloom, .seg-tree span:nth-of-type(4) .pl-bloom { animation-delay: calc(var(--pl-start) + var(--t-stem) + var(--t-rail) + var(--t-drop)); }
    /* The title's frame charges for --t-build, peaking the moment the stem's light leaves (so it starts --t-build before --pl-start), then lets go over 900ms as the light falls.
       Same cycle as the pulse, so they stay in step. */
    .segments-title::after { animation-name: title-charge; animation-duration: var(--pl-cycle); animation-iteration-count: infinite; animation-fill-mode: backwards; animation-timing-function: linear; animation-delay: calc(var(--pl-start) - var(--t-build)); }
    /* nothing runs while the graph panel is turned to the table, the overview or the playbook */
    .segments:has(~ .graph-flip:not([data-face="graph"])) .pl,
    .segments:has(~ .graph-flip:not([data-face="graph"])) .segments-title::after { animation: none; }
  }
}
/* Build 1500ms = 15% of the 10s cycle, release 900ms = 9%: change --t-build and the 15% and 24% here with it. */
@keyframes title-charge { 0% { opacity: 0; animation-timing-function: ease-in; } 15% { opacity: 1; animation-timing-function: ease-out; } 24%, 100% { opacity: 0; } }
/* Keyframe percentages cannot read the --t-* variables, so each leg's share of the 10s cycle is written here: stem 700ms = 7%, rail 1600ms = 16%, drop 808ms = 8.08%, glow 1400ms = 14%. Change a --t-* above and change its percentage here to match. */
@keyframes pl-fall-stem { 0% { background-position: 0 -44px; } 7% { background-position: 0 calc(100% + 44px); } 100% { background-position: 0 calc(100% + 44px); } }
@keyframes pl-fall { 0% { background-position: 0 -44px; } 8.08% { background-position: 0 calc(100% + 44px); } 100% { background-position: 0 calc(100% + 44px); } }
@keyframes pl-rail-r { 0% { background-position: calc(var(--comet) * -1) 0; } 16% { background-position: calc(100% + var(--comet)) 0; } 100% { background-position: calc(100% + var(--comet)) 0; } }
@keyframes pl-rail-l { 0% { background-position: calc(100% + var(--comet)) 0; } 16% { background-position: calc(var(--comet) * -1) 0; } 100% { background-position: calc(var(--comet) * -1) 0; } }
@keyframes pl-land { 0% { opacity: 0; } 3% { opacity: 1; } 14% { opacity: 0; } 100% { opacity: 0; } }   /* up in about 300ms, then fades out over about 1.1s */

/* A card has two faces and shows one (the other is display: none, so only one is read and tabbed through). */
.kpi[data-face="front"] > .seg-back, .kpi[data-face="back"] > .seg-front { display: none; }
.seg-face { display: grid; gap: 2px; align-content: start; min-width: 0; }
/* The segment name leads each card, with how many of its signals the face shows; the signal's own label follows. */
.seg-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.seg-name { font-size: 16px; font-weight: 600; color: var(--text); }
.seg-count { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* The head of each card is a band across its top in the colour of the light buttons (PRD R76, R78): --glass-solid with a --border-interactive hairline
   under it, the title in --text. It was solid black first; that was too heavy. The card keeps its own padding for the rest of the face and clips to its
   rounded corners. The connector lines end on the bands. */
.kpi { padding-top: 0; overflow: hidden; }
.seg-face > .seg-top { margin: 0 calc(var(--s5) * -1) var(--s2); padding: var(--s2) var(--s5) calc(var(--s2) - 1px); background: var(--glass-solid); border-bottom: 1px solid var(--border-interactive); }   /* -1px of padding under the title: the hairline takes that pixel, so the band is the height of the black one */
.seg-line { margin: 0 0 var(--s1); font-size: 12px; color: var(--text-muted); }
.seg-rows { margin: 0; display: grid; gap: 6px; }
.seg-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--s2); padding-top: 6px; border-top: 1px solid var(--glass-border); }
.seg-row dt { margin: 0; min-width: 0; font-size: 12px; color: var(--text-muted); }
.seg-row dd { margin: 0; margin-left: auto; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
/* A word-valued row (an enum such as LARGE_COMMUNITY or LOOSELY_CONNECTED) puts its value UNDER the label, left-aligned, in every case. Beside its label the
   longest values need 229 to 291 px in a 221 px column, so they used to wrap only when they were long and then hang off to the right under the label,
   which looked misaligned; this way a short value (HUB) and a long one lay out the same. Numbers stay beside their labels. */
.seg-row:has(dd.is-word) { display: grid; gap: 1px; justify-content: stretch; }
.seg-row dd.is-word { margin-left: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }

/* Turning the cards over: two half-turns driven from segments.js (out, swap, in), each card a little after the one before. While the
   row glides to its new height, it clips vertically so a card still showing the taller face cannot spill over the graph. */
.kpi-row.is-turning { overflow-y: clip; }
.kpi.is-turning-out { animation: kpi-out 170ms cubic-bezier(.5, 0, .9, .4) forwards; }
.kpi.is-turning-in { animation: kpi-in 260ms var(--ease-out) backwards; }
@keyframes kpi-out { to { transform: perspective(900px) rotateY(88deg); opacity: .6; } }
@keyframes kpi-in { from { transform: perspective(900px) rotateY(-88deg); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .kpi.is-turning-out, .kpi.is-turning-in { animation: none; } }

.graph-stage { position: relative; }

/* ─── Overview: the third face of the graph panel ("What is Graph Intelligence", PRD R66) ───────── */
/* An introduction above a split view: four vertical tabs on the left, the selected segment's signals on the right. The panel is
   a size container so the split stacks by ITS width (Developer Mode narrows the panel on a wide screen). */
.overview { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: var(--s3); height: 640px; padding: var(--s5); overflow: hidden; container-type: inline-size; container-name: overview; }
.graph-flip[data-face="graph"] > .overview, .graph-flip[data-face="playbook"] > .overview { visibility: hidden; }
.graph-flip[data-face="overview"] > .graph-stage, .graph-flip[data-face="overview"] > .playbook { visibility: hidden; }
.ov-title { margin: 0; font-size: 20px; }
.ov-intro { margin: 0; max-width: 92ch; font-size: 15px; line-height: 1.5; text-wrap: pretty; }   /* 92ch: at 78ch the paragraph ran to three lines on a desktop; pretty keeps a last line from being one word */
.ov-split { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: var(--s4); min-height: 0; }
.ov-tabs { display: grid; align-content: start; gap: var(--s2); }
.ov-tab { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--s3); width: 100%; padding: var(--s3) var(--s4); text-align: left; font: inherit; color: var(--text); cursor: pointer; background: var(--glass-solid); border: 1px solid var(--border-interactive); border-radius: var(--radius-md); transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast); }
.ov-tab:hover, .ov-tab:focus-visible { border-color: var(--ink); box-shadow: var(--glow-hover); }
.ov-tab.is-on { border: 2px solid var(--ink); padding: calc(var(--s3) - 1px) calc(var(--s4) - 1px); background: var(--warm-gradient); }
.ov-tab-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ink); font: 600 12px var(--font-ui); background: var(--paper); }
.ov-tab.is-on .ov-tab-num { background: var(--ink); color: var(--text-on-ink); }
.ov-tab-text { display: grid; gap: 1px; min-width: 0; }
.ov-tab-text strong { font-size: 15px; font-weight: 600; }
.ov-out { display: flex; flex-direction: column; container-type: inline-size; container-name: ovout; min-height: 0; overflow: auto; padding: var(--s4); background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.ov-out:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.ov-out-kicker { margin: 0 0 var(--s1); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.ov-out-line { margin: 0 0 var(--s4); font-size: 15px; font-weight: 500; line-height: 1.35; }
.ov-signals { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s3); align-items: start; }
.ov-sig { position: relative; display: grid; align-content: start; gap: var(--s2); padding: var(--s3) var(--s4); background: var(--glass-solid); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.ov-sig-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.ov-sig-value { font: 500 34px/1.05 var(--font-ui); font-variant-numeric: tabular-nums; }
.ov-sig-value small { font-size: 14px; color: var(--text-muted); font-weight: 400; }
/* A status is a labelled chip with a tick, so it is not conveyed by colour alone. */
.ov-chip { justify-self: start; padding: 4px var(--s3); border: 1px solid var(--ink); border-radius: 999px; background: var(--warm-gradient); font: 600 15px var(--font-ui); text-transform: capitalize; }
.ov-chip::before { content: "\25CF\00a0"; font-size: 9px; vertical-align: 2px; }
/* On the wide layout the status card (its five values side by side) takes a whole row under the number cards, so the pills sit on one line, low to high,
   and read as a scale. The number cards stay together in the row above. */
@container ovout (min-width: 561px) {
  .ov-sig--status { grid-column: 1 / -1; }
  .ov-pills { gap: 6px; }
}
.ov-pills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ov-pill { padding: 3px 10px; border: 1px solid var(--border-interactive); border-radius: 999px; font: 500 12px var(--font-ui); text-transform: capitalize; color: var(--text-muted); background: transparent; }
/* The lit pill is the status chip it replaces: the warm gradient, the ink edge and the dot, so it is not told apart by colour alone. */
.ov-pill.is-on { padding: 2px 10px; border: 2px solid var(--ink); background: var(--warm-gradient); color: var(--text); font: 600 13px var(--font-ui); }
.ov-pill.is-on::before { content: "\25CF\00a0"; font-size: 9px; vertical-align: 2px; }
.ov-bar { display: block; height: 8px; border-radius: 8px; background: var(--track-soft); overflow: hidden; }
.ov-bar-fill { display: block; height: 100%; width: var(--to); background: var(--warm-gradient); border-right: 2px solid var(--ink); }
.ov-sig-hint { font-size: 12px; line-height: 1.35; color: var(--text-muted); }
/* With the explanation paragraph and the note gone (PRD R102) the output column holds a heading, a line and three cards, about 290 px
   in a panel that is 640 px tall (that height is shared with the graph and the playbook, so it cannot shrink without the page jumping).
   On the wide layout the four tabs share the full height, and the cards are bigger and roomier. They keep their content together:
   stretching them to the full height flung the label, number and hint to the top, middle and bottom of each card. What is left under
   the cards is plain empty space at the bottom of the column. (.ov-out is the `ovout` container, so its layout is set on its own rule
   above, not inside this query: a container query cannot style its own container.) */
@container overview (min-width: 641px) {
  .ov-tabs { grid-auto-rows: 1fr; align-content: stretch; }
  .ov-tab { align-content: center; }
  .ov-tab-text strong { font-size: 17px; }
}
@container ovout (min-width: 561px) {
  .ov-out-line { font-size: 17px; margin-bottom: var(--s5); }
  .ov-signals { gap: var(--s4); }
  .ov-sig { padding: var(--s4); gap: var(--s2); }
  .ov-sig-value { font-size: 38px; }
}
@media (prefers-reduced-motion: no-preference) {
  .ov-sig { animation: pb-rise 420ms var(--ease-out) calc(var(--i, 0) * 90ms) backwards; }
  .ov-bar-fill { animation: pb-meter 900ms var(--ease-out) calc(160ms + var(--i, 0) * 90ms) backwards; }
}
/* Narrow panel (Developer Mode, tablet, phone): the tabs become a horizontal row above the output. */
@container overview (max-width: 640px) {
  .overview { padding: var(--s4); gap: var(--s2); }
  .ov-intro { font-size: 13.5px; line-height: 1.4; }
  .ov-split { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: var(--s3); }
  .ov-tabs { grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); overflow-x: auto; scrollbar-width: none; align-content: stretch; padding-right: var(--s5); -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
  .ov-tabs::-webkit-scrollbar { display: none; }
  .ov-tab { grid-template-columns: 1fr; justify-items: start; gap: 2px; padding: var(--s2) var(--s3); min-width: 120px; }
  .ov-tab.is-on { padding: calc(var(--s2) - 1px) calc(var(--s3) - 1px); }
  .ov-tab-num { display: none; }
  .ov-out-line { font-size: 13.5px; margin-bottom: var(--s3); }
  .ov-out { padding: var(--s3); }
  .ov-sig { padding: var(--s2) var(--s3); } .ov-sig-value { font-size: 22px; } .ov-chip { font-size: 13px; } .ov-sig-hint { font-size: 11px; }
}
/* The signal cards switch to one compact row each when the OUTPUT column is narrow, not when the panel is. In Developer Mode and on a
   tablet the panel is 734-772 px wide, so it keeps its two-column split, but the output column is only about 370-410 px, and three
   full cards stacked in it were 150-200 px taller than the panel. Decided on the column that actually holds them. */
@container ovout (max-width: 560px) {
  .ov-signals { grid-template-columns: 1fr; gap: 6px; }
  /* label | value on one line; when a long status chip leaves the label too little room (it was squeezed to 13 px at 320 px), the chip drops
     to its own line under the label. A label never gives way to a value. */
  .ov-sig { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: var(--s3); row-gap: 4px; min-width: 0; }
  .ov-sig-label { flex: 1 1 auto; min-width: 11ch; }
  .ov-sig-value, .ov-chip { flex: 0 1 auto; margin-left: auto; text-align: right; }
  .ov-chip { max-width: 100%; text-align: center; }
  .ov-sig-label { grid-column: 1; } .ov-sig-value, .ov-chip { grid-column: 2; justify-self: end; }
  .ov-bar { grid-column: 1 / -1; } .ov-sig-hint { display: none; }
  .ov-signals { grid-template-columns: 1fr; }
}

/* Narrow panels need more height than the 640 px the wide layout fits in: measured, three-signal tabs were 130-380 px short.
   With the compact rows above, Developer Mode needs 720 px. Phones were 760 px (840 at 320) for the explanation paragraph, which has
   gone (PRD R102): the content now needs about 520 px at 375 wide and 630 at 320, and the playbook on a phone is 680 px, so the shared
   panel is 680 px, not shorter, or the playbook would shrink with it. */
.is-split .overview, #graph-flip .overview.is-narrow { height: 720px; }
@media (max-width: 767px) { .overview { height: 680px; } }
/* The narrowest phones (320 px): the Topology status card stacks its five pills one per row and needs about 717 px; from 340 px up 680 px is enough. */
@media (max-width: 335px) { .overview { height: 740px; } }
@media (max-width: 360px) { .ov-intro { font-size: 12.5px; } }

/* ─── Playbook: the second face of the graph panel ─────────────────── */
/* Both faces sit in one grid cell, so the panel is always as tall as the taller of the two. The face that is not
   showing is hidden with visibility (out of the tab order and the accessibility tree) and also marked inert. */
.graph-flip { display: grid; }
.graph-flip > * { grid-area: 1 / 1; min-width: 0; }
.graph-flip[data-face="graph"] > .playbook { visibility: hidden; }
.graph-flip[data-face="playbook"] > .graph-stage { visibility: hidden; }

/* The turn is two half-turns driven from playbook.js (out, swap, in), so no 3D context is held open: glass
   (backdrop-filter) stays crisp on both faces, and nothing depends on backface-visibility. */
.graph-flip.is-turning-out { animation: face-out 240ms cubic-bezier(.5, 0, .9, .4) forwards; }
.graph-flip.is-turning-in { animation: face-in 340ms var(--ease-out) backwards; }
@keyframes face-out { to { transform: perspective(1600px) rotateY(88deg); opacity: .6; } }
@keyframes face-in { from { transform: perspective(1600px) rotateY(-88deg); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .graph-flip.is-turning-out, .graph-flip.is-turning-in { animation: none; } }

.playbook { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: var(--s3); height: 640px; padding: var(--s5); overflow: hidden; container-type: inline-size; container-name: playbook; }
@container playbook (max-width: 640px) { .playbook-top { gap: var(--s2); } .playbook-top h2 { font-size: 16px; } .playbook-kicker { font-size: 10px; letter-spacing: .05em; } }
/* Phones: 680 px, not 600. The chapters now carry a strip of fields, and chapter 4 also carries the decision lanes, so at 600 px
   the anomaly picture shrank to nothing at 320 px wide. (The closing chapter, which stacks three things, has its own height.) */
@media (max-width: 767px) { .playbook { height: 680px; padding: var(--s4); } }
.playbook-top { display: flex; flex-wrap: nowrap; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.playbook-top h2 { min-width: 0; }
.playbook-top h2 { margin: 0; font-size: 20px; }
.playbook-kicker { margin: 0 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.playbook-controls { display: flex; gap: var(--s1); }
.playbook-controls .btn { min-width: 32px; min-height: 32px; }
.playbook-stage { position: relative; min-height: 0; overflow: hidden; }
/* The footer: chapter dots in the middle, the API-call button at the right, in one row under the answer, so the
   button never sits over the answer box. The left cell is an empty twin of the right one, which keeps the dots
   centred. On narrow panels the button drops under the dots (stacked below). */
.playbook-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--s3); }
.playbook-foot .pb-peek-chip { justify-self: end; }
.playbook-dots { display: flex; justify-content: center; gap: var(--s2); }
@container playbook (max-width: 700px) {
  .playbook-foot { grid-template-columns: 1fr; justify-items: center; gap: var(--s2); }
  .playbook-foot-gap { display: none; }
  .playbook-foot .pb-peek-chip { justify-self: stretch; justify-content: center; order: 2; }
  .playbook-foot .playbook-dots { order: 1; }
}

/* The heading copy inside each caption (PRD R91). Hidden unless the panel is wide enough for the side-by-side layout, where the caption is centred beside the picture and
   the real heading in the top bar would be left stranded 150px above it. Written before the narrow @container rules below, which keep it hidden there. */
.pb-caption-head { display: none; }
.pb-caption-heading { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.25; color: var(--text-secondary); }   /* quieter than the chapter title (30px) so the title leads; the real heading in the top bar is 20px / 600 */
@container playbook (min-width: 701px) {
  .pb-caption-head { display: grid; gap: 2px; padding-bottom: var(--s2); margin-bottom: var(--s1); border-bottom: 1px solid var(--glass-border); }   /* a hairline closes the heading block, so it reads as the section label above the chapter, not a fourth line of the title */
  /* The real heading and its label stay in the page and in the accessibility tree (it is the panel's name and a heading to navigate to) but are not DRAWN: the copy above is.
     Visually hidden the way .sr-only is, not with visibility:hidden, which would also remove them from assistive technology. */
  .playbook-top > div:first-child { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
/* One chapter fills the stage: caption on the left, the picture in the middle, the answer under it. */
.playbook-stage { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 1.7fr); grid-template-rows: 1fr auto; gap: var(--s4) var(--s5); align-content: stretch; }
.pb-caption { grid-column: 1; grid-row: 1; align-self: center; display: grid; gap: var(--s3); }   /* centred beside the picture, as the caption was before; since R91 it contains the heading block, so the heading and the chapter text sit in the middle as one group */
.pb-scene { grid-column: 2; grid-row: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: var(--s3); overflow: hidden; }
.pb-result { grid-column: 1 / -1; grid-row: 2; display: grid; gap: 2px; padding: var(--s3) var(--s4); border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--glass-solid); }
.pb-step { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.pb-title { margin: 0; font-size: 30px; line-height: 1.12; }
.pb-question { margin: 0; font-size: 17px; line-height: 1.4; color: var(--text); }
.pb-answer { margin: 0; font-size: 15px; font-weight: 500; }
.pb-decision { margin: 0; font-size: 14px; color: var(--text-muted); }
/* Stacked layout: caption, picture, answer, one under the other. Decided by the PANEL's width, so it also applies
   in Developer Mode, where the page is wide but the panel is not. The picture gets whatever the others leave. */
@container playbook (max-width: 700px) {
  .playbook-stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--s2); }
  .pb-caption, .pb-scene, .pb-result { grid-column: 1; grid-row: auto; }
  .pb-caption { align-self: start; gap: 2px; }
  .pb-title { font-size: 20px; } .pb-question { font-size: 14px; line-height: 1.3; }
  .pb-result { padding: var(--s2) var(--s3); }
  .pb-answer { font-size: 13px; line-height: 1.3; } .pb-decision { font-size: 12px; line-height: 1.3; }
  .pb-counter { font-size: 30px; }
}

.pb-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1px solid var(--ink); background: transparent; cursor: pointer; }
.pb-dot.is-on { background: var(--ink); }
.pb-dot:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }

/* A scene is a counter on one line, then the picture, in a box of its own. The picture is clipped to that box, so
   nothing can run over the rail or the answer under it. */
.pb-frame { position: relative; min-height: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto minmax(0, 1fr); gap: 0 var(--s4); align-items: end; overflow: hidden; }
.pb-svg { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.pb-counter { grid-column: 2; grid-row: 1; margin: 0; font: 500 40px/1 var(--font-ui); font-variant-numeric: tabular-nums; text-align: right; }
.pb-counter-label { grid-column: 1; grid-row: 1; margin: 0 0 4px; text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); order: -1; align-self: end; }
.pb-meter { grid-column: 1 / -1; grid-row: 3; }

/* The spine every chapter shares: Your app -> Identia -> Your decision. */
/* Every stop has a 30 px badge row (the logo pill is 30 px; the plain dots sit centred in the same row), and the line
   between stops starts at that row's centre, so the line runs through the middle of every dot and the logo. */
.pb-rail { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: start; gap: var(--s2); }
.pb-stop { display: grid; grid-template-rows: 30px auto; justify-items: center; align-items: center; gap: 2px; }
.pb-leg { align-self: start; margin-top: 14px; }
.pb-stop-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); }
.pb-stop--id .pb-stop-dot { background: var(--ink); }
/* Identia's stop wears the logo mark: a dark pill with the white mark inside (the mark is 628x415, so it needs a pill,
   not a circle). Sized to sit on the same line as the two plain stops. */
.pb-logo { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 999px; background: var(--ink); border: 2px solid var(--ink); }
.pb-logo img { display: block; width: 26px; height: auto; }
.pb-stop-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.pb-leg { position: relative; height: 2px; background: var(--ink-soft); border-radius: 2px; }
.pb-packet { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; left: 100%; background: var(--ink); }
.pb-packet--back { background: var(--warm-start); box-shadow: 0 0 0 3px var(--glow-gold-1); }
@media (max-width: 480px) { .pb-stop-label { font-size: 10px; letter-spacing: .02em; } }
/* On the narrowest panels the stop labels are what eat the line. Shorten the long one so the line keeps room for the packet. */
@container playbook (max-width: 330px) { .pb-stop-label { font-size: 9px; letter-spacing: 0; } .pb-stop--you .pb-stop-label { max-width: 7ch; white-space: normal; text-align: center; line-height: 1.1; } .pb-rail { gap: 4px; } .pb-logo { width: 38px; height: 26px; } .pb-logo img { width: 22px; } .pb-stop { grid-template-rows: 26px auto; } .pb-leg { margin-top: 12px; } }

/* The decision lanes: the one the example rule lands in lights up and gains a tick, so it is not colour alone. */
.pb-lanes { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); }   /* two lanes: Approve and Review (PRD R90; there was a middle Quick check lane) */
.pb-lane { padding: 6px var(--s2); text-align: center; font-size: 12px; border: 1px solid var(--border-interactive); border-radius: var(--radius-sm); background: var(--glass-solid); opacity: .55; }
.pb-lane.is-active { opacity: 1; border: 2px solid var(--ink); font-weight: 600; background: var(--warm-gradient); }
.pb-lane.is-active span::before { content: "\2713\00a0"; }
.playbook-stage.is-playing .pb-lane.is-active span::before { animation: pb-tick-in 1ms linear 5500ms backwards; }
/* On the anomaly chapter each lane carries the example cut-off and a bar in its zone's colour from the queue above. */
.pb-lanes--keyed .pb-lane { display: grid; gap: 1px; border-top-width: 5px; }
.pb-lanes--keyed .pb-lane[data-lane="approve"] { border-top-color: var(--border-interactive); }
.pb-lanes--keyed .pb-lane[data-lane="review"] { border-top-color: var(--warm-start); }
.pb-lane-cut { font-size: 10px; letter-spacing: .04em; color: var(--text-muted); }
/* On the narrowest panels the lane name and its cut-off sit on one line, and the lanes lose a row of height, which goes back
   to the anomaly picture (at 320 px wide it had shrunk to 53 px). */
@container playbook (max-width: 340px) {
  .pb-lanes--keyed .pb-lane { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 4px; padding: 3px 2px; }
  .pb-lane { font-size: 11px; } .pb-lane-cut { font-size: 9px; letter-spacing: 0; }
}

/* "See the API call": a quiet chip in the corner, and a card that slides up over the picture. */
.pb-peek-chip { display: inline-flex; align-items: center; gap: var(--s2); padding: 5px var(--s3); font: inherit; font-size: 12px; color: var(--text); cursor: pointer; background: var(--glass-solid); border: 1px solid var(--border-interactive); border-radius: 999px; white-space: nowrap; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.pb-peek-chip:hover, .pb-peek-chip:focus-visible { border-color: var(--ink); box-shadow: var(--glow-hover); }
.pb-peek-chip[aria-expanded="true"] { border: 2px solid var(--ink); padding: 4px calc(var(--s3) - 1px); }
.pb-peek { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; max-height: 70%; overflow: auto; background: var(--glass-solid); border: 1px solid var(--ink); backdrop-filter: blur(12px); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); }
@media (prefers-reduced-motion: no-preference) { .pb-peek { animation: pb-peek-in 320ms var(--ease-out); } }
.pb-peek.is-scrollable::after { content: ""; position: sticky; bottom: 0; display: block; height: 28px; margin-top: -28px; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--glass-solid)); }
.pb-peek-head { position: sticky; top: 0; z-index: 1; background: var(--glass-solid); display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--code-border); font-size: 12px; color: var(--code-muted); }
.pb-peek-body { margin: 0; padding: var(--s3); font: 400 13px/1.7 var(--font-mono); color: var(--code-text); overflow-x: auto; }
.pb-peek-line { display: block; white-space: pre; }
.pb-peek-note { margin-left: var(--s3); font-family: var(--font-ui); font-size: 12px; color: var(--text-muted); }
@keyframes pb-peek-in { from { opacity: 0; transform: translateY(14px); } }
@container playbook (max-width: 700px) { .pb-peek { max-height: 62%; } }

/* ─── Playbook motion ─────────────────────────────────────────────────
   One 9-second chapter: 0-1s the question travels from Your app to Identia, 1-4.5s the scene builds, 4.5-5.5s the
   answer travels back, 5.5s the decision lane lights, then it holds. Everything below applies only while the
   stage is playing and motion is allowed; otherwise the end state is simply shown. The final state is the
   un-animated state of every rule, so a paused or reduced-motion view is a complete picture. */
@media (prefers-reduced-motion: no-preference) {
  .playbook-stage.is-playing .pb-packet--out { animation: pb-out 1000ms var(--ease-inout) 150ms backwards; }
  .playbook-stage.is-playing .pb-packet--back { animation: pb-back 1000ms var(--ease-inout) 4500ms backwards; }
  .playbook-stage.is-playing .pb-stop--id .pb-stop-dot, .playbook-stage.is-playing .pb-stop--id .pb-logo { animation: pb-think 900ms var(--ease-out) 1100ms backwards; }
  .playbook-stage.is-playing .pb-lane.is-active { animation: pb-lane-on 700ms var(--ease-out) 5500ms both; }
  .playbook-stage.is-playing .pb-counter { animation: pb-count-in 700ms var(--ease-out) 1200ms backwards; }
  .playbook-stage.is-playing .pb-result { animation: pb-rise 600ms var(--ease-out) 5300ms backwards; }
  .playbook-stage.is-playing .pb-caption { animation: pb-rise 500ms var(--ease-out) backwards; }

  /* connections: strands grow out, then people pop in along them one after another */
  .playbook-stage.is-playing .pb-strand { stroke-dasharray: 90; animation: pb-draw 600ms var(--ease-out) calc(1200ms + var(--o) * 90ms) backwards; }
  .playbook-stage.is-playing .pb-person { transform-box: fill-box; transform-origin: center; animation: pb-pop 420ms var(--ease-out) calc(1500ms + var(--o) * 110ms) backwards; }
  .playbook-stage.is-playing .pb-strand-label { animation: pb-rise 500ms var(--ease-out) 3600ms backwards; }

  /* community: loose dots drift in from wherever they were and settle into the ring, which then glows */
  .playbook-stage.is-playing .pb-dot-person { animation: pb-gather 1800ms var(--ease-out) calc(1200ms + var(--o) * 14ms) backwards; }
  .playbook-stage.is-playing .pb-ring { animation: pb-ring-in 1200ms var(--ease-out) 2600ms backwards; }

  /* influence: pulses travel in from the edges; the person's dot swells as they arrive; the meter fills */
  .playbook-stage.is-playing .pb-spoke { stroke-dasharray: 120; animation: pb-draw 700ms var(--ease-out) calc(1000ms + var(--o) * 70ms) backwards; }
  .playbook-stage.is-playing .pb-node { animation: pb-pop 400ms var(--ease-out) calc(1100ms + var(--o) * 70ms) backwards; transform-box: fill-box; transform-origin: center; }
  .playbook-stage.is-playing .pb-pulse { animation: pb-pulse 1100ms ease-in calc(1800ms + var(--o) * 260ms) backwards; }
  .playbook-stage.is-playing .pb-me[style*="--grow"] { animation: pb-swell 1400ms var(--ease-out) 3200ms backwards; }
  .playbook-stage.is-playing .pb-meter-fill { animation: pb-meter 1500ms var(--ease-out) 3200ms backwards; }

  /* anomaly: the queue appears left to right, then the person's dot slides in from the front of the line */
  .playbook-stage.is-playing .pb-q { animation: pb-pop 350ms var(--ease-out) calc(1100ms + var(--o) * 55ms) backwards; transform-box: fill-box; transform-origin: center; }
  .playbook-stage.is-playing .pb-you { animation: pb-slide 1500ms var(--ease-inout) 3000ms backwards; }

  /* together: four tiles land one by one on the return trip */
  .playbook-stage.is-playing .pb-tile { animation: pb-rise 500ms var(--ease-out) calc(1300ms + var(--o) * 160ms) backwards; }

  /* "Putting it together" has no picture to build, so it runs on its own short clock: the four signals arrive as
     soon as the request reaches Identia, the answer travels back at about 2.5 s, and the lane and sentence follow. */
  .playbook-stage.is-playing[data-chapter="together"] .pb-packet--back { animation-delay: 2500ms; }
  .playbook-stage.is-playing[data-chapter="together"] .pb-lane.is-active { animation-delay: 3500ms; }
  .playbook-stage.is-playing[data-chapter="together"] .pb-lane.is-active span::before { animation-delay: 3500ms; }
  .playbook-stage.is-playing[data-chapter="together"] .pb-result { animation-delay: 3300ms; }
}
@keyframes pb-out { from { left: 0; } to { left: 100%; } }
@keyframes pb-back { from { left: 0; } to { left: 100%; } }
@keyframes pb-think { 0% { box-shadow: 0 0 0 0 var(--glow-gold-2); } 60% { box-shadow: 0 0 0 12px transparent; } 100% { box-shadow: none; } }
/* Dim and plain until its moment, then it lights with a small bounce. 'both' holds the first frame during the delay,
   so the tick and the heavy border are not visible before the answer has come back. */
@keyframes pb-lane-on {
  from { opacity: .55; transform: scale(.96); border-width: 1px; background: var(--glass-solid); }
  60% { transform: scale(1.04); }
}
@keyframes pb-count-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pb-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pb-tick-in { from { content: ""; } }
@keyframes pb-draw { from { stroke-dashoffset: 120; opacity: .2; } }
@keyframes pb-pop { from { opacity: 0; transform: scale(.2); } 70% { transform: scale(1.25); } }
@keyframes pb-gather { from { opacity: 0; transform: translate(var(--fx), var(--fy)); } }
@keyframes pb-ring-in { from { opacity: 0; transform: scale(1.3); } }
@keyframes pb-pulse { 0% { transform: translate(var(--tx), var(--ty)); opacity: 1; } 100% { transform: translate(0, 0); opacity: 0; } }
@keyframes pb-swell { from { transform: scale(1); } }
@keyframes pb-meter { from { width: 0; } }
@keyframes pb-slide { from { transform: translateX(var(--from)); opacity: .2; } }

/* scene drawing (the end state) */
.pb-me { fill: var(--ink); stroke: var(--paper); stroke-width: 2; transform: scale(var(--grow, 1)); transform-box: fill-box; transform-origin: center; }
.pb-me--hub { fill: var(--warm-start); stroke: var(--ink); stroke-width: 3; }
.pb-me-mark { fill: var(--text-on-ink); font: 600 8px var(--font-ui); }
.pb-strand { stroke-width: 2; stroke: var(--border-interactive); }
.pb-strand--phone { stroke: var(--ink); } .pb-strand--mail { stroke: var(--warm-start); }
.pb-strand-label { font: 500 11px var(--font-ui); fill: var(--text); }
.pb-person { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.pb-person--phone { fill: var(--ink); } .pb-person--mail { fill: var(--warm-mid); }
.pb-dot-person { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.pb-ring { fill: rgba(243, 199, 114, .28); stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.pb-ring--big { stroke-width: 2.4; stroke-dasharray: none; filter: drop-shadow(0 0 6px var(--glow-gold-2)); }
.pb-spoke { stroke: var(--border-interactive); stroke-width: 1.4; }
.pb-node { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.pb-pulse { fill: var(--warm-start); }
.pb-meter { width: 100%; max-width: 220px; height: 8px; margin-top: var(--s2); border-radius: 8px; background: var(--track-soft); overflow: hidden; justify-self: center; }
.pb-meter-fill { display: block; height: 100%; width: var(--to); background: var(--warm-gradient); border-right: 2px solid var(--ink); }
.pb-q { fill: var(--paper); stroke: var(--border-interactive); stroke-width: 1.2; }
.pb-q--review { fill: var(--warm-start); stroke: var(--ink); stroke-width: 1.6; }
.pb-you { fill: var(--ink); stroke: var(--paper); stroke-width: 2.4; filter: drop-shadow(0 0 5px var(--glow-gold-2)); }
/* The closing chapter is a stack, not a counter-and-picture: key signals, then all 13 fields, then the decision lanes. It
   needs its own single-column frame (the shared frame is two columns, which dealt these parts out side by side and
   pushed half of the grid off the panel). */
.pb-frame--tiles { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: auto; align-content: center; align-items: stretch; gap: var(--s3); overflow: visible; }
.pb-frame--tiles > * { grid-column: 1; grid-row: auto; min-width: 0; }

/* The closing chapter: the four key signals on top, then all 13 fields in four labelled groups, so the final picture is the
   complete checklist. The grid is four columns on a wide panel and two on a narrow one. */
/* The columns share the width by what each group needs (the guide's field names are long: "Network Connectivity Type", "Linked Attribute
   Count"), instead of four equal tracks that each refuse to shrink below their content and pushed the last group off the panel. */
.pb-all { width: 100%; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.05fr) minmax(0, 1.35fr) minmax(0, 1.05fr); gap: var(--s2); }
.pb-all-group { min-width: 0; padding: var(--s2) var(--s2); border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--glass); }
.pb-all-title { margin: 0 0 3px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.pb-all-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.pb-all-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); font-size: 10.5px; min-width: 0; line-height: 1.25; }
.pb-all-list li span { color: var(--text-muted); min-width: min-content; overflow-wrap: normal; word-break: normal; flex: 1 1 auto; }
.pb-all-list li strong { flex: 0 1 auto; text-align: right; font: 600 11.5px var(--font-ui); font-variant-numeric: tabular-nums; }
/* a figure (11, 34.7) stays on one line; a worded value ("large community", "very high") may wrap at its space so the name beside it stays whole */
.pb-all-list li strong { white-space: nowrap; }
.pb-all-list li strong.is-word { white-space: normal; max-width: 60%; }
@media (prefers-reduced-motion: no-preference) { .playbook-stage.is-playing .pb-all-group { animation: pb-rise 450ms var(--ease-out) calc(1900ms + var(--g) * 140ms) backwards; } }
/* Narrow panel (Developer Mode, tablet, phone): the four key signals stay in one row, and the 13 fields drop to two columns.
   Padding and gaps shrink so the whole stack needs as little height as it can. */
@container playbook (max-width: 700px) {
  .pb-frame--tiles { gap: var(--s2); }
  .pb-tile { padding: 6px var(--s2); } .pb-tile strong { font-size: 18px; } .pb-tile-label { font-size: 9px; letter-spacing: .03em; }
  .pb-all { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .pb-all-group { padding: 5px var(--s2); } .pb-all-list li { font-size: 10.5px; } .pb-all-list li strong { font-size: 11px; } .pb-all-title { font-size: 9px; margin-bottom: 2px; }
}
/* Phones only: this one chapter is a stack of three things that cannot be made small enough, so the panel is allowed to be
   taller while it is showing (measured: 161 px short at 375 px wide, 227 px at 320 px). Every other chapter keeps 600 px. */
@media (max-width: 767px) { .playbook[data-chapter="together"] { height: 820px; } }
/* 320 px wide: the guide's full field names wrap onto two lines in the 13-field grid, which measured 66 px more than the panel allowed. */
@media (max-width: 340px) { .playbook[data-chapter="together"] { height: 1000px; } }
/* Four columns of the guide's field names need about 760 px of panel; below that (a tablet's 722 px) two columns keep every name whole. */
@container playbook (max-width: 760px) {
  .pb-all { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
}
/* A phone (under ~340 px of panel): the four key signals are a 2 x 2 grid, so the guide's full names fit on one or two lines each instead of
   the fourth tile running off the edge. */
@container playbook (max-width: 260px) { .pb-all { grid-template-columns: minmax(0, 1fr); } .pb-all-group { padding: 4px var(--s2); } .pb-all-list li { font-size: 10.5px; } }
/* Developer Mode splits the screen, so the panel is narrow on a wide screen; the shell carries .is-split then. */
.is-split .playbook[data-chapter="together"] { height: 700px; }

/* Only the face being shown sizes the panel. A face that is hidden stays in the page (the turn animation swaps faces
   mid-turn) but takes no height, so a tall face, such as the playbook's last chapter, cannot leave the graph or another
   face sitting in a taller panel after it has been closed (it used to push the graph's zoom buttons outside its canvas in
   Developer Mode). `!important` because the faces set their own heights with selectors of every strength (the playbook's last chapter, Developer Mode, phones), and a hidden face must lose to all of them. */
#graph-flip:not([data-face="graph"]) > .graph-stage,
#graph-flip:not([data-face="playbook"]) > .playbook[id],
#graph-flip:not([data-face="overview"]) > .overview[id] { height: 0 !important; min-height: 0 !important; overflow: hidden; padding-block: 0; border-width: 0; }

/* "In this response": every field of the chapter's group as small labelled values, one quiet row under the picture. */
.pb-strip { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px var(--s2); }
.pb-strip-item { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px var(--s3); border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-solid); font-size: 12px; white-space: nowrap; }
.pb-strip-name { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.pb-strip-value { font: 600 13px var(--font-ui); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .playbook-stage.is-playing .pb-strip-item { animation: pb-rise 450ms var(--ease-out) calc(3600ms + var(--o) * 90ms) backwards; }
}
/* On a narrow panel the strip is ONE row that scrolls sideways, so it costs a single row of height however many fields it
   holds (wrapping took three rows and squeezed the picture to a thumbnail). A fade at the right edge shows it scrolls. */
@container playbook (max-width: 700px) {
  .pb-strip { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
  .pb-strip::-webkit-scrollbar { display: none; }
  .pb-strip-item { flex: none; font-size: 11px; padding: 2px var(--s2); }
  .pb-strip-name { font-size: 10px; }
}
.pb-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); width: 100%; }
.pb-tile { display: grid; gap: 2px; padding: var(--s2) var(--s3); border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--glass-solid); }
.pb-tile strong { font: 500 24px/1.1 var(--font-ui); font-variant-numeric: tabular-nums; }
.pb-tile-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
/* Compact key-signal tiles below 760 px of panel (a tablet's 722 px sits in the two-column layout, so the four tiles share a ~440 px
   column and the guide's long names wrapped to three lines). This rule is AFTER the base tile rules on purpose: it was first written
   above them and lost every time. */
@container playbook (max-width: 760px) {
  .pb-tile { padding: 6px var(--s2); } .pb-tile strong { font-size: 18px; } .pb-tile-label { font-size: 9px; letter-spacing: .02em; }
}
/* Key-signal tile layout on narrow panels. These sit AFTER the base .pb-tiles rule on purpose (rules placed before it lost, three times). */
@container playbook (max-width: 700px) { .pb-tiles { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
/* A phone (under ~340 px of panel): a 2 x 2 grid, so the guide's full names fit on one or two lines each instead of the fourth tile running
   off the edge. */
@container playbook (max-width: 340px) {
  .pb-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .pb-tile { min-width: 0; } .pb-tile-label { overflow-wrap: break-word; }
}

@media (max-width: 767px) { .pb-peek-note { display: block; margin-left: 0; white-space: normal; } }


/* The row under the cards now holds only the view buttons; the legend / filter chips live inside the canvas (below). */
.graph-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }   /* centred (PRD R89), with one 12px gap throughout; it was packed from the left (R87), and before that space-between. The gap logic: the pills and the three buttons read as one row (it was space-between, which left 55px between the latency pill and the first button) */
.graph-filters { display: flex; flex-wrap: wrap; gap: var(--s2); }
/* The Sources and latency pills, as a pair at the left of the row; the buttons keep the far right (margin-left: auto on .graph-actions). */
.graph-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
/* Legend and filter in one: each chip shows what a node type looks like and switches it on or off. They sit over the top of the
   canvas like Zoom and Reset sit over the bottom. The strip itself lets clicks and drags through to the graph; only the chips take them. */
.graph-overlay { display: contents; }
.graph-stage .graph-filters { position: absolute; top: var(--s3); left: var(--s3); right: 124px; z-index: 2; pointer-events: none; }   /* 124px: room for "View as table" in the corner */
.graph-stage .graph-filters .filter-chip { pointer-events: auto; }
/* A view switch, not a filter: squarer and plainer than the pill chips. In the graph window's top-right corner, like Zoom and Reset in the
   bottom-left; in the table face the "Back to the graph" button takes the same corner. */
.view-toggle { min-height: 32px; }
.graph-stage .graph-table-toggle { position: absolute; top: var(--s3); right: var(--s3); z-index: 2; }
/* The two view buttons travel as a pair at the far end of the row, so they never split across lines
   (Developer Mode narrows the page enough to wrap a lone button onto its own row). */
.graph-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); }
/* "Show all signals" becomes the longer "Show top signals". In a row with only a few pixels of slack that 6px wrapped the row onto a second line
   and pushed the graph down 140px, so the button keeps the width of the longer label in both states. */
.graph-actions [data-action="toggle-signals"] { min-width: 112px; }
/* With three buttons and both pills on one line there were 4px to spare, so the pills here are a little tighter than on the other products' pages:
   a 40px trip instead of 64px, and side padding of 12px. The dot's travel is the track's width (--trip-px), so the animation matches. */
.graph-meta { --trip-px: 40px; }
.graph-meta .latency-track { width: var(--trip-px); }
.graph-meta .latency-dot { transform: translateX(var(--trip-px)); }
.graph-meta .latency-pill.is-playing .latency-dot { transform: translateX(0); }
.graph-meta .latency-pill, .graph-meta .sources-pill { padding-inline: var(--s3); }
@keyframes latency-trip-short { from { transform: translateX(0); } to { transform: translateX(var(--trip-px)); } }
@keyframes latency-land-short {
  0% { transform: translateX(var(--trip-px)); box-shadow: 0 0 0 0 var(--glow-gold-2); background: var(--warm-start); }
  60% { transform: translateX(var(--trip-px)); box-shadow: 0 0 0 9px transparent; background: var(--warm-start); }
  100% { transform: translateX(var(--trip-px)); box-shadow: 0 0 0 0 transparent; background: var(--ink); }
}
@media (prefers-reduced-motion: no-preference) { .graph-meta .latency-pill.is-playing .latency-dot { animation-name: latency-trip-short; } .graph-meta .latency-pill.is-playing.is-done .latency-dot { animation-name: latency-land-short; } }
.graph-actions .btn { min-height: 32px; }
/* On a phone the chips wrap onto three lines, and a small button stranded at the right of a fourth looks
   like a leftover. As a full-width bar under them it reads as the separate action it is. */
@media (max-width: 640px) { .graph-actions { flex: 1 1 100%; margin-left: 0; flex-direction: column; } .graph-actions .btn { width: 100%; min-height: 40px; } }
.filter-chip {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 4px var(--s3) 4px var(--s2);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
  background: var(--glass-solid); border: 1px solid var(--border-interactive); border-radius: 999px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast);
}
.filter-chip:hover, .filter-chip:focus-visible { border-color: var(--ink); box-shadow: var(--glow-hover); }
.filter-chip[aria-pressed="true"] { border: 2px solid var(--ink); padding: 3px calc(var(--s3) - 1px) 3px calc(var(--s2) - 1px); }
.filter-chip[aria-pressed="false"] { opacity: .55; }
.filter-swatch { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); }
.filter-swatch--warm { background: var(--warm-mid); }
.filter-count { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

/* View controls sit over the canvas, bottom-right, clear of the nodes. */
/* Bottom-LEFT, not right: the node drawer slides in over the right edge of the page and used to cover these. */
.graph-zoom { position: absolute; left: var(--s3); bottom: var(--s3); display: flex; align-items: center; gap: var(--s1); z-index: 2; }
.graph-zoom .btn { min-width: 32px; min-height: 32px; font-size: 15px; flex: none; pointer-events: auto; }
/* The group is a wide box (the buttons and the sentence beside them), so it must not take clicks itself: only the buttons do, and a drag that starts on the sentence or the gaps pans the graph. */
.graph-zoom { pointer-events: none; }
/* On a phone the drawer is a bottom sheet over the lower part of the screen, so the controls go to the top. */
@media (max-width: 640px) { .graph-zoom { bottom: auto; top: var(--s3); } }


/* Hover card for nodes and connections. */
.graph-tip {
  position: absolute; z-index: 3; pointer-events: none; max-width: 260px; padding: var(--s2) var(--s3);
  display: grid; gap: 2px; font-size: 13px; line-height: 1.3;
  background: var(--glass-solid); backdrop-filter: blur(8px); border: 1px solid var(--ink); border-radius: var(--radius-md); box-shadow: var(--shadow-card);
}
.graph-tip strong { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.graph-tip span { overflow-wrap: anywhere; }
.graph-tip-meta { color: var(--text-muted); font-size: 12px; }
.graph-status { margin-top: var(--s2); min-height: 1.2em; }
/* While the node-count line is empty it takes no room at all (it was a 16px blank plus 8px of margin between the graph and the buttons below). When a filter is switched
   off it fills ("Showing 14 of 19 nodes ...") and takes its room again. The buttons under it are placed relative to whichever is showing. */
.graph-status:empty { margin: 0; min-height: 0; }
/* The Try another query / Try our other products / Contact Sales row sits closer to the graph on this page (PRD R88): 16px under the graph, not 48px. The row is shared with the
   other products' pages, so only this page's copy changes. With the line filled, the 16px is measured from the line instead of the graph. */
#view-graph .bridge-row { margin-top: var(--s4); }
.graph-note { margin: 0 0 0 var(--s2); font-size: 12px; line-height: 1.3; color: var(--text-muted); white-space: nowrap; pointer-events: none;   /* plain text: clicks and drags pass through to the graph, as they do through the chip strip */
  background: var(--glass-strong); backdrop-filter: blur(8px); padding: 4px var(--s2); border-radius: var(--radius-sm); }
/* The sentence is sized by the graph WINDOW's width, which is not the screen's (Developer Mode is a 1440px screen with a 734px window), so graphview.js
   sets data-win="wide|mid|narrow" on the graph stage from the window's real width. (A container query would be the natural tool, but a size container
   cannot take its height from its children, and making .graph-stage one collapsed the stage and moved the buttons.) The sentence is 575px at 12px:
   - wide (770px and up): one line beside Reset: 140px of buttons + 12px gap + 575px + the 12px edge inset = 739px.
   - mid (660 to 769px): one line at 11px (the text ends 644px in), so Developer Mode on a normal screen (a 734px window) stays on one line.
   - narrow (under 660px): it does not fit beside the buttons at any readable size, so it goes under them and wraps (a phone). */
.graph-stage[data-win="mid"] .graph-note { font-size: 11px; padding-inline: 6px; }
.graph-stage[data-win="narrow"] .graph-zoom { flex-wrap: wrap; max-width: calc(100% - 124px - var(--s3)); align-items: flex-start; }
.graph-stage[data-win="narrow"] .graph-note { flex: 1 1 100%; margin: var(--s1) 0 0; white-space: normal; max-width: 34em; }
/* The same frosted panel as the cards (.glass), so the graph sits on the page like everything else. The
   canvas itself is transparent: vis-network paints only the nodes, edges and labels. Labels carry a white
   halo and the nodes have solid fills, so they stay legible over the gradient behind the glass. */
#cy {
  height: 640px; border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: var(--glass); backdrop-filter: blur(12px) saturate(120%);
}
@supports not (backdrop-filter: blur(1px)) { #cy { background: var(--paper); } }
@media (max-width: 767px) { #cy { height: 420px; } }
.graph-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-muted); font-size: 13px;
}

/* Parallel accessible representation of the canvas. */
/* The node list is one frosted panel (the same glass as the cards and the graph), with the rows as lines
   inside it, instead of a stack of flat grey bars with the bright gradient showing between them. */
.graph-a11y {
  margin-top: var(--s5); padding: var(--s4) var(--s5) var(--s3);
  background: var(--glass); backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
}
@supports not (backdrop-filter: blur(1px)) { .graph-a11y { background: var(--paper); } }
.graph-a11y:not(.is-visible) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; border: 0;
  clip: rect(0 0 0 0); white-space: nowrap; background: none; backdrop-filter: none;
}
.graph-a11y h2 { margin: 0 0 var(--s2); font-size: 15px; font-weight: 500; }
.graph-a11y ul { list-style: none; margin: 0; padding: 0; }
.graph-a11y li + li { border-top: 1px solid var(--glass-border); }
/* The table as the fourth face of the graph panel (PRD R73). Shown, it fills the cell at the graph's height and the list scrolls inside it;
   not shown, the 1px clip above applies (assistive tech keeps the list). Written after the base rules above so it wins at equal strength. */
.a11y-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.graph-a11y .a11y-head h2 { margin: 0; }
.graph-a11y:not(.is-visible) .table-back { display: none; }
.graph-flip > .graph-a11y { margin-top: 0; }
.graph-flip > .graph-a11y.is-visible { position: relative; display: flex; flex-direction: column; height: 640px; padding-top: var(--s3); padding-bottom: var(--s3); }
/* "Back to the graph" takes exactly the corner "View as table" has on the graph face (12px in from the top and right), so the button does not
   move when the panel turns. The heading is given the button's height so its text is centred on it. */
.graph-flip > .graph-a11y.is-visible .table-back { position: absolute; top: calc(var(--s3) - 1px); right: calc(var(--s3) - 1px); }   /* -1px: this panel's own 1px border */
.graph-flip > .graph-a11y.is-visible .a11y-head { min-height: 32px; }
.graph-flip > .graph-a11y.is-visible ul { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.graph-flip[data-face="table"] > .graph-stage, .graph-flip[data-face="table"] > .playbook, .graph-flip[data-face="table"] > .overview { visibility: hidden; }
@media (max-width: 767px) { .graph-flip > .graph-a11y.is-visible { height: 420px; } }
.node-btn {
  display: grid; grid-template-columns: 28px 76px minmax(0, 1fr) auto; gap: var(--s3); align-items: center;
  width: 100%; text-align: left; padding: var(--s2) var(--s2); margin: 0;
  background: none; color: var(--text); border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.node-btn:hover, .node-btn:focus-visible { background: var(--glass-strong); border-color: var(--ink); box-shadow: var(--glow-hover); }
.node-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); }
.is-flagged .node-icon { background: var(--warm-mid); border-width: 2px; }
.is-primary .node-icon { background: var(--ink); }
.node-btn .node-type { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.node-btn .node-id { font-family: var(--font-mono); font-size: 14px; overflow-wrap: anywhere; }
/* Status is words first; the flagged rows add the warm tag the graph uses, so it is not colour alone. */
.node-btn .node-status { justify-self: end; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.is-flagged .node-status { color: var(--text); font-weight: 600; padding: 2px var(--s2); border-radius: 999px; background: var(--warm-mid); border: 1px solid var(--ink); }
.is-primary .node-status { color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
  .node-btn { grid-template-columns: 28px minmax(0, 1fr); row-gap: 2px; }
  .node-btn .node-type { display: none; }
  .node-btn .node-status { grid-column: 2; justify-self: start; white-space: normal; }   /* wraps: "N identities share this address · Government + Telco" is longer than a phone row */
}

/* ─── Drawer + modal ─────────────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw; z-index: 40;
  padding: var(--s5); overflow-y: auto;
  background: var(--glass-solid); backdrop-filter: blur(12px);
  border-left: 1px solid var(--border-interactive); box-shadow: var(--shadow-float);
  animation: drawer-in var(--dur-base) var(--ease-out);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@media (max-width: 640px) {
  /* A bottom sheet, but short: the top of the graph stays visible and tappable, and tapping empty canvas closes it. */
  .drawer { top: auto; width: 100%; max-height: 45vh; border-left: 0; border-top: 1px solid var(--border-interactive); }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.drawer-head h2 { margin: 0; }
.drawer dl { margin: 0; }
.drawer dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: var(--s3); }
.drawer dd { margin: var(--s1) 0 0; font-family: var(--font-mono); font-size: 14px; }

.modal-scrim {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: var(--s5); background: var(--scrim); overflow-y: auto;
}
.modal { width: 100%; max-width: 520px; padding: var(--s5); box-shadow: var(--shadow-float); }
.form-status { font-size: 13px; color: var(--text); min-height: 1.4em; }

.coverage-matrix { margin-bottom: var(--s5); }
.coverage-matrix ul { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s1); }
.coverage-matrix li {
  display: flex; justify-content: space-between; gap: var(--s3);
  font-size: 13px; padding: var(--s2) 0; border-bottom: 1px solid var(--hairline);
}
.coverage-matrix li span:last-child { font-family: var(--font-mono); color: var(--text-secondary); }
