/* LuxLava Knowledge. Direction A: the lava field at night.
   Every colour, size, duration and easing is drawn from brand/tokens.css. */

:root {
  --ink: var(--colour-ink);
  --cream: var(--colour-cream);
  --lava: var(--colour-lava);
  --deep: var(--colour-lava-deep);
  --ash: var(--colour-ash);
  --basalt: var(--colour-basalt);

  --hair: color-mix(in srgb, var(--colour-ash) 16%, transparent);
  --hair-strong: color-mix(in srgb, var(--colour-ash) 30%, transparent);
  --glass: color-mix(in srgb, var(--colour-ink) 84%, transparent);
  --glass-deep: color-mix(in srgb, var(--colour-ink) 93%, transparent);
  --rock: color-mix(in srgb, var(--colour-basalt) 22%, var(--colour-ink));
  --rock-hi: color-mix(in srgb, var(--colour-basalt) 38%, var(--colour-ink));
  --ember-glow: color-mix(in srgb, var(--colour-lava) 45%, transparent);
  --ember-soft: color-mix(in srgb, var(--colour-lava) 14%, transparent);

  --bar-h: 64px;
  --meta-h: 28px;
  --top: calc(var(--bar-h) + var(--meta-h));
  --radius: 18px;
  --radius-s: 10px;
  --panel-w: min(440px, 38vw);
  --peek: 236px;
  --sheet-y: 0px;
  color-scheme: dark;
}

.no-motion {
  --duration-quick: 0ms;
  --duration-normal: 0ms;
  --duration-slow: 0ms;
}
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-quick: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text-on-dark);
  font-family: var(--font-body);
  font-size: var(--size-small);
  line-height: var(--leading-small);
  font-weight: var(--weight-400);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.num {
  font-family: var(--font-mono);
  font-weight: var(--weight-500);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.release {
  position: fixed; right: 16px; bottom: 12px; z-index: 40;
  margin: 0; color: var(--ash); font-size: var(--size-small); letter-spacing: .04em;
  pointer-events: none;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-on-dark);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: fixed; left: 16px; top: 12px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--action); color: var(--action-label);
  font-weight: var(--weight-500); text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--duration-normal) var(--easing-standard);
}
.skip:focus-visible { transform: none; outline-color: var(--cream); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent;
  font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-body); line-height: var(--leading-display);
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: box-shadow var(--duration-normal) var(--easing-standard),
              background-color var(--duration-normal) var(--easing-standard),
              transform var(--duration-quick) var(--easing-standard);
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--action); color: var(--action-label);
  box-shadow: 0 0 0 0 var(--ember-glow), 0 10px 30px -12px var(--ember-glow);
}
.btn--primary:hover { box-shadow: 0 0 0 4px var(--ember-soft), 0 14px 40px -10px var(--ember-glow); }
.btn--wide { width: 100%; min-height: 52px; }
.btn--ghost {
  background: transparent; color: var(--cream);
  border-color: var(--hair-strong);
  font-size: var(--size-small); min-height: 40px; padding: 0 16px;
}
.btn--ghost:hover { border-color: var(--lava); color: var(--cream); background: var(--ember-soft); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--ash);
  transition: color var(--duration-quick) var(--easing-standard),
              background-color var(--duration-quick) var(--easing-standard),
              border-color var(--duration-quick) var(--easing-standard);
}
.icon-btn:hover { color: var(--cream); background: var(--rock-hi); }
.icon-btn[aria-pressed="false"] { color: var(--ash); }
.icon-btn[aria-pressed="false"] .ico { opacity: .55; }
.icon-btn[aria-pressed="true"] { color: var(--cream); }
.icon-btn--light { color: var(--text-secondary); }
.icon-btn--light:hover { color: var(--ink); background: color-mix(in srgb, var(--colour-ink) 8%, transparent); }
.icon-btn--light:focus-visible { outline-color: var(--focus-on-light); }

/* ========== SIGN IN ========== */
.signin {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 540px);
  background: var(--ink);
  overflow: auto;
}
.signin__field { position: relative; overflow: hidden; min-height: 240px; }
.signin__still, .signin__lava, .signin__veil { position: absolute; inset: 0; width: 100%; height: 100%; }
.signin__still {
  background: var(--ink) url("assets/img/lava-cracks-1920.webp") center / cover no-repeat;
}
.signin__lava { display: block; }
.signin__veil {
  background:
    radial-gradient(120% 90% at 30% 60%, transparent 40%, color-mix(in srgb, var(--colour-ink) 75%, transparent) 100%),
    linear-gradient(90deg, transparent 70%, color-mix(in srgb, var(--colour-ink) 50%, transparent));
}
.signin__card {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 40px;
  padding: 56px clamp(28px, 5vw, 72px);
  background: var(--surface); color: var(--text);
  box-shadow: -40px 0 80px -30px var(--ember-glow);
}
.signin__card :focus-visible { outline-color: var(--focus-on-light); }
.signin__logo { width: 165px; height: auto; }
.signin__title {
  margin: 0;
  font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-display); line-height: var(--leading-display);
  letter-spacing: -0.01em; text-transform: uppercase;
}
.signin__lede {
  margin: 12px 0 0; color: var(--text-secondary);
  font-size: var(--size-body); line-height: var(--leading-body);
}
.signin__form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label {
  font-family: var(--font-mono); font-weight: var(--weight-500);
  font-size: var(--size-small); letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-secondary);
}
.field input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--basalt);
  background: var(--cream);
  color: var(--ink); font-size: var(--size-body);
  transition: border-color var(--duration-quick) var(--easing-standard), box-shadow var(--duration-quick) var(--easing-standard);
}
.field input:hover { border-color: var(--ink); }
.field input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.field input[aria-invalid="true"] { border-color: var(--deep); box-shadow: 0 0 0 1px var(--deep); }
.field__wrap { position: relative; }
.field__wrap input { padding-right: 56px; }
.field__eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 10px;
  display: grid; place-items: center;
  background: transparent; color: var(--text-secondary);
}
.field__eye:hover { color: var(--ink); }
.signin__error {
  margin: 0; min-height: 1.5em;
  color: var(--link-on-light); font-weight: var(--weight-500);
}

/* ========== APP SHELL ========== */
.app { position: fixed; inset: 0; }

.bar {
  position: absolute; inset: 0 0 auto 0; z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(200px, 560px) 1fr;
  grid-template-rows: var(--bar-h) var(--meta-h);
  grid-template-areas: "brand search tools" "meta meta meta";
  align-items: center; column-gap: 20px;
  padding: 0 16px 0 20px;
  background: linear-gradient(180deg, var(--glass-deep) 0%, var(--glass) 70%, transparent 100%);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar__brand { grid-area: brand; display: flex; align-items: center; gap: 14px; }
.bar__logo--full { width: 88px; height: 32px; }
.bar__logo--icon { width: 32px; height: 32px; display: none; }
.bar__short {
  font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-body); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ash); padding-left: 14px; border-left: 1px solid var(--hair-strong);
  line-height: var(--leading-h2);
}
.bar__tools { grid-area: tools; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.bar__meta {
  grid-area: meta; margin: 0; align-self: start;
  display: flex; gap: 22px; align-items: center; white-space: nowrap; overflow: hidden;
  color: var(--ash); font-size: var(--size-small); letter-spacing: .02em;
  pointer-events: none;
}
.stat .num { color: var(--cream); margin-right: 2px; }
.stat--upd { margin-left: auto; }

/* search */
.search { grid-area: search; position: relative; display: flex; align-items: center; }
.search input {
  width: 100%; height: 44px; padding: 0 76px 0 46px;
  border-radius: 999px; border: 1px solid var(--hair-strong);
  background: color-mix(in srgb, var(--colour-ink) 70%, transparent);
  color: var(--cream); font-size: var(--size-small);
  transition: border-color var(--duration-quick) var(--easing-standard), box-shadow var(--duration-normal) var(--easing-standard), background-color var(--duration-normal) var(--easing-standard);
}
.search input::placeholder { color: var(--ash); opacity: 1; }
.search input:hover { border-color: var(--ash); }
.search input:focus-visible {
  outline: none; border-color: var(--lava); background: var(--ink);
  box-shadow: 0 0 0 1px var(--lava), 0 0 32px -6px var(--ember-glow);
}
.search__ico { position: absolute; left: 16px; color: var(--ash); pointer-events: none; }
.search__kbd {
  position: absolute; right: 14px;
  min-width: 24px; height: 24px; display: grid; place-items: center;
  border: 1px solid var(--hair-strong); border-radius: 6px;
  font-family: var(--font-mono); font-size: var(--size-small); color: var(--ash);
  pointer-events: none;
}
.search.has-q .search__kbd { display: none; }
/* LK-3102 (A-05, design C): with nothing typed the box keeps room on the right for the '/' key only
   (the clear button shows once there is a query), so its words show whole as C's do. */
.search:not(.has-q) input { padding-right: 46px; }
.search__clear {
  position: absolute; right: 4px; width: 36px; height: 36px; border-radius: 999px;
  border: 0; background: transparent; color: var(--ash); display: grid; place-items: center;
}
.search__clear:hover { color: var(--cream); background: var(--rock-hi); }
.search__pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  max-height: min(70vh, 560px); overflow: auto;
  padding: 8px; border-radius: var(--radius);
  background: var(--glass-deep); border: 1px solid var(--hair-strong);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 30px 80px -20px color-mix(in srgb, var(--colour-ink) 90%, transparent), 0 0 0 1px var(--hair);
  animation: pop-in var(--duration-normal) var(--easing-enter);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.search__group + .search__group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--hair); }
.search__gh {
  margin: 0; padding: 8px 12px 6px;
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
  letter-spacing: .1em; text-transform: uppercase; color: var(--ash);
  display: flex; justify-content: space-between;
}
.opt {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  min-height: 48px; padding: 8px 12px; border-radius: 12px; cursor: pointer;
}
.opt__dot { width: 24px; height: 24px; color: var(--c, var(--lava)); }
.opt__dot .ico { width: 24px; height: 24px; }
.opt__main { min-width: 0; }
.opt__label { display: block; color: var(--cream); font-weight: var(--weight-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt__sub { display: block; color: var(--ash); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt__meta { color: var(--ash); }
.opt[aria-selected="true"], .opt:hover { background: var(--rock-hi); }
.opt[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--lava); }
mark { background: transparent; color: var(--lava); font-weight: var(--weight-500); box-shadow: inset 0 -1px 0 var(--lava); }
.search__empty { margin: 0; padding: 18px 14px; color: var(--ash); font-size: var(--size-small); }

/* segmented view switch */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: 999px; border: 1px solid var(--hair-strong);
  background: color-mix(in srgb, var(--colour-ink) 70%, transparent);
}
.seg__btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 999px; border: 0;
  background: transparent; color: var(--ash); font-weight: var(--weight-500);
  transition: background-color var(--duration-normal) var(--easing-standard), color var(--duration-normal) var(--easing-standard);
}
.seg__btn:hover { color: var(--cream); }
.seg__btn[aria-pressed="true"] { background: var(--cream); color: var(--ink); }

.flagbtn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 8px 0 14px; margin: 0 6px;
  border-radius: 999px; border: 1px solid var(--hair-strong);
  background: transparent; color: var(--cream); font-weight: var(--weight-500);
  transition: border-color var(--duration-quick) var(--easing-standard), background-color var(--duration-quick) var(--easing-standard);
}
.flagbtn .ico { color: var(--lava); }
.flagbtn:hover { border-color: var(--lava); background: var(--ember-soft); }
.flagbtn__n {
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--lava); color: var(--ink);
  font-family: var(--font-mono); font-weight: var(--weight-500); font-variant-numeric: tabular-nums;
}
.flagbtn.is-zero .flagbtn__n { background: var(--rock-hi); color: var(--cream); }
.flagbtn.is-zero .ico { color: var(--ash); }

/* ========== STAGE / MAP ========== */
.stage { position: absolute; inset: 0; }
/* LK-3088: clip, not hidden. Its ground reaches 4% past its edges and the open panel's layers further,
   and a hidden box can still be scrolled: a click or find that brings a covered control into view
   shifted the whole map (58,36 px at 1440 x 900) and every Fit framed off it. A clipped box never scrolls.
   Hidden stays first for a browser without clip. */
.mapview { position: absolute; inset: 0; overflow: hidden; overflow: clip; }
.mapview__ground {
  position: absolute; inset: -4%;
  background:
    radial-gradient(70% 60% at 50% 55%, color-mix(in srgb, var(--colour-lava-deep) 9%, transparent), transparent 70%),
    radial-gradient(120% 100% at 50% 50%, transparent 55%, color-mix(in srgb, var(--colour-ink) 96%, transparent) 100%),
    var(--ink);
}
.mapview__ground::after {
  content: ""; position: absolute; inset: 0;
  background: url("assets/img/ember-dim-960.webp") center / cover no-repeat;
  opacity: .07; mix-blend-mode: screen;
  filter: blur(2px) saturate(.8);
}
.mapview__stage { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.mapview__stage.is-grabbing { cursor: grabbing; }
.mapview__stage.is-over { cursor: pointer; }
.mapview__stage:focus-visible { outline: none; }
.mapview__stage:focus-visible::after {
  content: ""; position: absolute; inset: calc(var(--top) + 6px) 8px 8px 8px; border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--colour-lava) 55%, transparent);
  pointer-events: none;
}
.mapview__canvas, .mapview__grain { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mapview__grain { pointer-events: none; opacity: .5; mix-blend-mode: overlay; }
body.is-assembling .mapview__canvas { opacity: 1; }

/* docks */
.dock { position: absolute; bottom: 20px; z-index: 20; display: flex; gap: 10px; align-items: flex-end; }
.dock--left { left: 20px; max-width: min(760px, calc(100vw - 260px)); }
.dock--right { right: 20px; flex-direction: column; align-items: flex-end; transition: transform var(--duration-slow) var(--easing-standard); }
.has-panel .dock--right { transform: translateX(calc(-1 * var(--panel-w) - 16px)); }

.legend {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 12px 10px 16px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--hair);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.legend__title {
  margin: 0; height: 32px; display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
  letter-spacing: .1em; text-transform: uppercase; color: var(--ash); white-space: nowrap;
}
.legend__title .ico { width: 16px; height: 16px; }
.legend__rows { display: grid; gap: 6px; min-width: 0; }
.legend__chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Row 3027: a long cluster list scrolls inside the legend, three rows high, instead of growing up
   the stage; the map frames itself in the space the legend leaves (src/framing.js). */
#legend-clusters, #legend-ventures, .legend__chips--types {
  max-height: 108px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--hair-strong) transparent;
  /* A-05: each chip box paints as a group of its own, so the browser keeps its painting between
     frames. The date slider sits in the same legend: every step of a drag repainted the legend,
     and with it every chip of a long cluster list (8 ms a step with the CPU slowed 4x at 500
     clusters, a quarter of a frame's budget). */
  isolation: isolate;
}
#legend-ventures { max-height: 70px; }
/* The type box holds three rows of its 28 px chips whole (3 x 28 + 2 x 6 gaps), so all
   eleven types show on a tablet (820 x 1180, 768 x 1024) instead of a 70 px box cutting the last row. */
.legend__chips--types { max-height: calc(3 * 28px + 2 * 6px); }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--hair-strong); background: transparent;
  color: var(--cream); font-size: var(--size-small); font-weight: var(--weight-500); white-space: nowrap;
  transition: opacity var(--duration-normal) var(--easing-standard), border-color var(--duration-quick) var(--easing-standard), background-color var(--duration-quick) var(--easing-standard);
}
.chip:hover { border-color: var(--c, var(--ash)); }
.chip__sw {
  width: 12px; height: 12px; border-radius: 999px; flex: none;
  background: var(--c);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--c) 60%, transparent);
}
.chip .ico { width: 16px; height: 16px; color: var(--ash); stroke-width: 2; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c, var(--colour-ash)) 13%, transparent); border-color: color-mix(in srgb, var(--c, var(--colour-ash)) 55%, transparent); }
.chip[aria-pressed="false"] { color: var(--ash); }
.chip[aria-pressed="false"] .chip__sw { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.chip--all { padding: 0 14px; }
.chip--all[aria-pressed="true"] { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.legend__chips--types .chip { min-height: 28px; padding: 0 10px 0 8px; }
.chip__n { color: var(--ash); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.timebar { display: flex; flex-direction: column; gap: 4px; min-width: 160px; isolation: isolate; }
/* A-05: the day's room is kept whatever it reads ("now", "1 Jan 1905", "11 Dec 1952"), so a drag
   does not change the label's width, the slider's track beside it, and the legend's layout with
   every step. 11 characters, with the label's letter spacing. */
#as-of-label { display: inline-block; min-width: calc(11ch + .88em); }
/* A-05 (the slider's drag): a step changes the day's text and moves the slider's thumb, and the
   map reads the stage's size as it draws the step, so the browser lays the page out there and then.
   Neither sat in a box that ends a layout, so every step was laid out from the document down (the
   legend's rows and every box beside them looked at again): a quarter of a step's frame at the
   stand-in's size. The day now keeps its room in a box of fixed size, and the slider sits in a box
   of its own (a flex item cannot end a layout; the slider inside one can), each laid out alone.
   Their sizes are the ones they had: the day's 11 characters on one line, and the slider's own
   height in this browser, which the page reads once it is laid out and holds (--slider-h, set
   with the class by src/main.js; until then, and where it cannot be read, the slider is as it was). */
@supports (height: 1lh) {
  #as-of-label { width: calc(11ch + .88em); height: 1lh; vertical-align: top; contain: layout size; }
}
.timebar__track { display: block; min-width: 0; }
.timebar__track--held > input[type="range"] { box-sizing: border-box; height: var(--slider-h); contain: layout size; }
.timebar__label {
  font-family: var(--font-mono); font-size: var(--size-small); letter-spacing: .08em;
  text-transform: uppercase; color: var(--ash);
}
.timebar input[type="range"] { display: block; width: 100%; margin: 0; accent-color: var(--colour-lava, #e07a3d); }
/* LK-3099 (A-05, design C): on a desktop the legend is kept near C's height. The ventures,
   Disputed and the date slider (kept by the spec; C has none of them) share one line, the slider's
   label beside its track, instead of rows of their own: the legend was about twice C's height and
   hid the low clusters at 1440x900. A tablet and a phone keep their rows (the sheet's lifted date
   strip, LK-3080, is placed against the legend's full height). */
.legend__line { display: contents; }
@media (min-width: 1025px) {
  .legend__line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
  .legend__line > .legend__chips { flex: none; }
  .legend__line .chip { min-height: 28px; }
  .legend__line #legend-ventures:empty { display: none; }
  /* Go's live read of 0a94be8: the venture row was one line 2,856 px wide, 13 chips past the
     legend's edge. It takes the room the line leaves, wraps, and shows one row, scrolling. */
  .legend__line > #legend-ventures { flex: 1 1 0; min-width: 0; max-height: 28px; }
  .legend__line .timebar { flex: 1 1 220px; flex-direction: row; align-items: center; gap: 10px; }
  .legend__line .timebar__label { flex: none; white-space: nowrap; }
  .legend__line .timebar__track { flex: 1 1 auto; min-width: 100px; }
  /* Go's live read of 0a94be8: 266 px at 1440x900 where the small sample read 232. The cluster
     list, which scrolls, keeps two rows of 28 px chips on a desktop, so the legend stays near 230 px. */
  #legend-clusters .chip { min-height: 28px; }
  #legend-clusters { max-height: calc(2 * 28px + 6px); }
}
/* A venture name longer than the venture box (go's live read of 92b48a7: one chip of 15 clipped by
   5 px at the box's edge) is cut with an ellipsis inside its own chip; the chip's title keeps it whole. */
@media (min-width: 768px) {
  .legend__line #legend-ventures .chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; line-height: 26px; }
}
/* Design C's layers under the vertices, in DOM order: heat islands (a small canvas the map sets
   on the stage with a transform), cluster names, then flow light. */
.mapview__heat { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.mapview__names, .mapview__flow { position: absolute; inset: 0; width: 100%; height: 100%; transform-origin: 0 0; pointer-events: none; }
.flowbtn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px 0 14px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--glass); color: var(--cream);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
  letter-spacing: .1em; text-transform: uppercase;
}
.flowbtn .ico { width: 16px; height: 16px; color: var(--ash); }
.flowbtn__lamp {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--lava, var(--colour-lava)); box-shadow: 0 0 12px 2px var(--ember-glow, transparent);
}
.flowbtn[aria-pressed="false"] .flowbtn__lamp { background: transparent; box-shadow: inset 0 0 0 2px var(--basalt, var(--ash)); }
.flowbtn:hover { border-color: var(--lava, var(--colour-lava)); }

.zoom {
  display: flex; flex-direction: column; align-items: center; padding: 4px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--hair);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.zoom__pct { font-size: var(--size-small); color: var(--ash); padding: 2px 0; min-width: 44px; text-align: center; }
.flowbtn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px 0 14px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--glass); color: var(--cream);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
  letter-spacing: .1em; text-transform: uppercase;
}
.flowbtn .ico { width: 16px; height: 16px; color: var(--ash); }
.flowbtn__lamp {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--lava); box-shadow: 0 0 12px 2px var(--ember-glow);
}
.flowbtn[aria-pressed="false"] .flowbtn__lamp { background: transparent; box-shadow: inset 0 0 0 2px var(--basalt); }
.flowbtn:hover { border-color: var(--lava); }

/* ========== LIST VIEW ========== */
.listview { position: absolute; inset: 0; overflow: auto; padding-top: calc(var(--top) + 8px); background: var(--ink); }
.listview::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(80% 50% at 50% 0%, color-mix(in srgb, var(--colour-lava-deep) 12%, transparent), transparent 70%);
}
.listview__inner { position: relative; max-width: 1240px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 48px) 120px; }
.has-panel .listview__inner { margin-right: calc(var(--panel-w) + 32px); margin-left: clamp(16px, 4vw, 48px); }
.listview__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--hair-strong); padding-bottom: 16px; }
.listview__title {
  margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-h1); line-height: var(--leading-h1); text-transform: uppercase; letter-spacing: .01em;
}
.listview__count { margin: 0; color: var(--ash); }
.listview__count .num { color: var(--cream); }
.listview__empty { color: var(--ash); font-size: var(--size-body); padding: 40px 0; }
.lgroup { padding: 40px 0 8px; }
.lgroup__head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: baseline; margin-bottom: 18px; }
.lgroup__mark { width: 14px; height: 14px; border-radius: 999px; background: var(--c); box-shadow: 0 0 18px 3px color-mix(in srgb, var(--c) 55%, transparent); align-self: center; }
.lgroup__title { margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600); font-size: var(--size-h2); line-height: var(--leading-h2); text-transform: uppercase; letter-spacing: .04em; }
.lgroup__n { color: var(--ash); }
.lgroup__desc { grid-column: 2 / -1; margin: -8px 0 0; color: var(--ash); max-width: 70ch; }
.lgrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.litem {
  width: 100%; height: 100%; text-align: left;
  display: grid; grid-template-columns: 28px 1fr; gap: 4px 12px; align-items: start;
  padding: 14px 16px; border-radius: 14px;
  background: var(--rock); border: 1px solid var(--hair);
  transition: border-color var(--duration-quick) var(--easing-standard), background-color var(--duration-quick) var(--easing-standard), transform var(--duration-normal) var(--easing-standard);
}
.litem:hover { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: var(--rock-hi); }
.litem.is-selected { border-color: var(--lava); box-shadow: 0 0 0 1px var(--lava), 0 0 24px -8px var(--ember-glow); }
.litem__ico { color: var(--c); grid-row: span 3; padding-top: 2px; }
.litem__ico .ico { width: 24px; height: 24px; }
.litem__label { font-weight: var(--weight-500); color: var(--cream); font-size: var(--size-body); line-height: var(--leading-h2); display: flex; gap: 8px; align-items: center; }
.litem__label .ico { width: 16px; height: 16px; color: var(--lava); }
.litem__meta { color: var(--ash); display: flex; gap: 10px; flex-wrap: wrap; }
.litem__sum { color: var(--ash); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ========== PANEL ========== */
.panel {
  position: absolute; z-index: 40;
  top: calc(var(--top) + 4px); right: 16px; bottom: 16px; width: var(--panel-w);
  display: flex; flex-direction: column;
  border-radius: 22px;
  background: var(--ink);
  border: 1px solid var(--hair-strong);
  backdrop-filter: blur(22px) saturate(1.25); -webkit-backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: 0 40px 100px -30px color-mix(in srgb, var(--colour-ink) 95%, transparent), inset 0 1px 0 color-mix(in srgb, var(--colour-cream) 7%, transparent);
  transform: translateX(calc(100% + 32px)); opacity: 0;
  transition: transform var(--duration-slow) var(--easing-exit), opacity var(--duration-slow) var(--easing-exit);
}
.panel::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--lava), transparent);
  opacity: .8;
}
.panel.is-open { transform: none; opacity: 1; transition-timing-function: var(--easing-enter); }
.panel__grip { display: none; }
.panel__scroll { overflow: auto; padding: 24px 26px 32px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--basalt) transparent; }
.panel__head { position: relative; padding-bottom: 20px; border-bottom: 1px solid var(--hair); }
.panel__kicker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 48px 14px 0; }
.tag {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px 0 8px;
  border-radius: 999px; border: 1px solid var(--hair-strong);
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
  letter-spacing: .06em; text-transform: uppercase; color: var(--ash);
}
.tag .ico { width: 16px; height: 16px; color: var(--c, var(--lava)); }
.tag--cluster::before { content: ""; width: 10px; height: 10px; border-radius: 99px; background: var(--c); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent); }
.panel__title {
  margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-h1); line-height: var(--leading-h1); letter-spacing: -0.005em;
  color: var(--cream); text-wrap: balance;
}
.panel__title:focus-visible { outline-offset: 4px; }
/* LK-3103: the title takes the focus when an item opens; its ring shows on the keyboard only. */
.panel__title[data-quiet-focus]:focus-visible { outline: none; }
.panel__date { margin: 8px 0 0; color: var(--ash); }
.panel__date:empty { display: none; }
.panel__actions { display: flex; gap: 8px; margin-top: 18px; align-items: center; }
.panel__close { position: absolute; top: -6px; right: -8px; }
.psec { padding: 22px 0 4px; }
.psec__h {
  margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px;
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
  letter-spacing: .12em; text-transform: uppercase; color: var(--ash);
}
.psec__n { color: var(--lava); letter-spacing: 0; }
.psec__summary { margin: 0; font-size: var(--size-body); line-height: var(--leading-body); color: var(--cream); }
.facts { margin: 0; display: grid; gap: 0; }
.fact { padding: 12px 0; border-top: 1px solid var(--hair); display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr); gap: 4px 16px; }
.fact:first-child { border-top: 0; padding-top: 0; }
.fact dt { min-width: 0; overflow-wrap: anywhere; color: var(--ash); font-family: var(--font-mono); font-size: var(--size-small); letter-spacing: .04em; padding-top: 2px; }
.fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--cream); font-size: var(--size-small); }
.fact__v { display: block; font-size: var(--size-body); line-height: var(--leading-h2); }
.fact__v.is-flagged { color: var(--lava); }
.fact__src { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; color: var(--ash); }
.fact__src .lbl { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.linkish {
  padding: 0; border: 0; background: none; color: var(--link-on-dark); text-align: left;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  min-height: 24px;
}
.linkish:hover { color: var(--cream); }
.rel, .docs, .mentions { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rel__btn, .doc__row {
  width: 100%; display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center;
  min-height: 48px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; text-align: left;
  transition: background-color var(--duration-quick) var(--easing-standard), border-color var(--duration-quick) var(--easing-standard);
}
.rel__btn:hover, .rel__btn:focus-visible { background: var(--rock-hi); border-color: var(--hair-strong); }
.rel__ico { color: var(--c); }
.rel__ico .ico { width: 22px; height: 22px; }
.rel__main { min-width: 0; }
.rel__label { display: block; color: var(--cream); font-weight: var(--weight-500); }
.rel__edge { display: flex; gap: 6px; align-items: center; color: var(--ash); }
/* LK-3105 (A-05, design C): one line per connected name, and per link name, as C sets its list; a
   long one is cut with an ellipsis and read whole from the row's title (14 of 152 names wrapped). */
.rel__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel__edge { white-space: nowrap; min-width: 0; }
.rel__edge-t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rel__edge .ico { width: 14px; height: 14px; color: var(--lava); flex: none; }
.rel__edge .ico.is-inbound { transform: scaleX(-1); }
.rel__go { color: var(--ash); }
.rel__go .ico { width: 18px; height: 18px; }
.rel__more { padding: 6px 10px; color: var(--ash); }
/* A document with no thumbnail has no picture column: its name, date and page take the row (the
   24 px column was for an icon the panel never draws, so the text broke a word a line). */
.doc__row { grid-template-columns: 1fr; padding: 12px 10px; background: var(--rock); border-color: var(--hair); }
.doc__ico { color: var(--ash); }
.doc__title { display: block; color: var(--cream); font-weight: var(--weight-500); }
/* A document's name keeps to one line inside its row: a long file name (no space to break at) ran
   to the panel's edge and was clipped there. It is cut with an ellipsis and read whole from its
   title, as a connected name is (.rel__label). The text column may shrink below its longest word. */
.doc__row > div { min-width: 0; }
.doc__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc__meta { display: flex; gap: 10px; color: var(--ash); flex-wrap: wrap; margin-top: 2px; }
.doc__open { margin-top: 10px; min-height: 36px; font-size: var(--size-small); padding: 0 14px; }
.doc__row:has(.doc__thumb) { grid-template-columns: 48px 1fr; }
.doc__thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--rock-hi); }
/* LK-3094: the summary reads at C's paragraph size (body, 18 px), kept as bullets (spec section 5). */
.psec__bullets { margin: 0; padding-left: 1.15em; color: var(--cream); font-size: var(--size-body); line-height: var(--leading-body); }
.psec__bullets li + li { margin-top: 6px; }
.panel__status { margin: 8px 0 0; color: var(--ash); }
.panel__status:empty { display: none; }

/* inline flag inside panel */
.pflag {
  margin-top: 20px; padding: 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--colour-lava) 9%, var(--colour-ink));
  border: 1px solid color-mix(in srgb, var(--colour-lava) 45%, transparent);
}
.pflag__h { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; font-family: var(--font-heading); font-weight: var(--weight-600); font-size: var(--size-body); text-transform: uppercase; letter-spacing: .06em; color: var(--cream); }
.pflag__h .ico { color: var(--lava); width: 18px; height: 18px; }
.pflag__lede { margin: 0 0 12px; color: var(--ash); }

/* ========== VERSIONS (flags + panel) ========== */
.versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ver {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 12px;
  background: var(--rock); border: 1px solid var(--hair-strong);
  transition: border-color var(--duration-normal) var(--easing-standard), opacity var(--duration-normal) var(--easing-standard), background-color var(--duration-normal) var(--easing-standard);
}
.ver__v { font-family: var(--font-heading); font-weight: var(--weight-600); font-size: var(--size-h2); line-height: var(--leading-h2); color: var(--cream); overflow-wrap: anywhere; }
.ver__src { color: var(--ash); display: grid; gap: 2px; }
.ver__date { color: var(--ash); }
.ver .btn { margin-top: auto; align-self: flex-start; font-size: var(--size-small); min-height: 44px; }
.ver.is-kept { border-color: var(--lava); background: color-mix(in srgb, var(--colour-lava) 10%, var(--colour-ink)); box-shadow: 0 0 30px -10px var(--ember-glow); }
.ver.is-old .ver__v { text-decoration: line-through; text-decoration-color: var(--lava); text-decoration-thickness: 2px; color: var(--ash); }
.ver.is-old { opacity: .8; }
/* the answers that are not one of the versions: both, not sure; the same, not the same */
.qchoices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.qchoices .btn { font-size: var(--size-small); min-height: 44px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small); letter-spacing: .06em; text-transform: uppercase;
  background: var(--lava); color: var(--ink);
}
.badge .ico { width: 14px; height: 14px; }
.badge--muted { background: transparent; color: var(--ash); border: 1px solid var(--hair-strong); }

/* ========== DIALOGS ========== */
dialog { padding: 0; border: 0; color: inherit; background: transparent; max-width: none; max-height: none; }
dialog::backdrop {
  background: color-mix(in srgb, var(--colour-ink) 72%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
dialog[open] { animation: dlg-in var(--duration-slow) var(--easing-enter); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.reader {
  width: min(820px, calc(100vw - 32px)); height: min(92vh, 1000px); height: min(92dvh, 1000px);
  margin: auto; border-radius: 24px; overflow: hidden;
  background: var(--surface); color: var(--text);
  box-shadow: 0 50px 120px -30px color-mix(in srgb, var(--colour-ink) 95%, transparent), 0 0 0 1px color-mix(in srgb, var(--colour-lava) 25%, transparent);
}
.reader :focus-visible { outline-color: var(--focus-on-light); }
.reader__inner { height: 100%; overflow: auto; scrollbar-color: var(--ash) transparent; }
.reader__top {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 16px 28px;
  background: linear-gradient(180deg, var(--cream) 70%, color-mix(in srgb, var(--colour-cream) 0%, transparent));
}
.reader__top img { width: 32px; height: 32px; }
.reader__doc { padding: 8px clamp(24px, 7vw, 88px) 72px; }
.reader__doc canvas { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.reader__actions { display: flex; align-items: center; gap: 12px; }
.reader__status { margin: 0; padding: 0 28px 8px; color: var(--text-secondary); }
.reader__title {
  margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-display); line-height: var(--leading-display); letter-spacing: -0.01em;
  text-wrap: balance; max-width: 16ch;
}
.reader__meta {
  display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 8px 40px;
  margin: 28px 0 0; padding: 18px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--basalt);
}
.reader__meta dt { font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small); letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary); }
.reader__meta dd { margin: 4px 0 0; font-size: var(--size-body); color: var(--ink); }
.reader__text { margin-top: 40px; max-width: 64ch; font-size: var(--size-body); line-height: var(--leading-body); }
.reader__text p { margin: 0 0 1.1em; hanging-punctuation: first; text-wrap: pretty; }
.reader__text p:first-child::first-letter {
  float: left; margin: 8px 12px 0 0;
  font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-display); line-height: var(--leading-display); color: var(--link-on-light);
}
.reader__mentions { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--basalt); }
.reader__h { margin: 0 0 14px; font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small); letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); }
.mentions { display: flex; flex-wrap: wrap; gap: 8px; }
.mention {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px;
  border-radius: 999px; border: 1px solid var(--basalt); background: transparent; color: var(--ink);
  font-weight: var(--weight-500);
}
.mention .ico { width: 18px; height: 18px; color: var(--deep); }
.mention:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.mention:hover .ico { color: var(--lava); }

.sheet {
  width: min(1000px, calc(100vw - 32px)); max-height: min(88vh, 900px); max-height: min(88dvh, 900px);
  margin: auto; border-radius: 24px; overflow: hidden;
  background: var(--glass-deep); color: var(--cream);
  border: 1px solid var(--hair-strong);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 50px 120px -30px color-mix(in srgb, var(--colour-ink) 95%, transparent);
}
.sheet--small { width: min(520px, calc(100vw - 32px)); }
.sheet__inner { max-height: inherit; overflow: auto; padding: 28px 32px 36px; }
.sheet__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.sheet__title { margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600); font-size: var(--size-h1); line-height: var(--leading-h1); text-transform: uppercase; letter-spacing: .01em; }
.sheet__lede { margin: 8px 0 0; color: var(--ash); font-size: var(--size-body); line-height: var(--leading-body); max-width: 60ch; }
.flaglist { display: grid; gap: 14px; }
.fitem { padding: 20px; border-radius: 18px; background: color-mix(in srgb, var(--colour-basalt) 14%, var(--colour-ink)); border: 1px solid var(--hair); }
.fitem.is-open { border-color: color-mix(in srgb, var(--colour-lava) 35%, transparent); }
.fitem__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.fitem__node {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0;
  border: 0; background: none; color: var(--cream);
  font-family: var(--font-heading); font-weight: var(--weight-600); font-size: var(--size-h2); line-height: var(--leading-h2);
}
.fitem__node:hover { color: var(--lava); }
.fitem__node .ico { width: 20px; height: 20px; color: var(--lava); }
.fitem__fact { font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small); letter-spacing: .1em; text-transform: uppercase; color: var(--ash); }
.fitem__head .badge { margin-left: auto; }
.flaglist__none { padding: 32px 0; display: flex; gap: 12px; align-items: center; color: var(--ash); font-size: var(--size-body); }
.flaglist__none .ico { color: var(--lava); }

.keys { margin: 0; display: grid; gap: 2px; }
.keys > div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hair); }
.keys > div:first-child { border-top: 0; }
.keys dd { margin: 0; color: var(--cream); font-size: var(--size-body); }
kbd {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 8px; border: 1px solid var(--hair-strong); border-bottom-width: 2px;
  background: var(--rock); color: var(--cream);
  font-family: var(--font-mono); font-weight: var(--weight-500); font-size: var(--size-small);
}

/* ========== TOAST ========== */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%); pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast__card {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 16px; border-radius: 999px;
  background: var(--cream); color: var(--ink);
  box-shadow: 0 20px 60px -16px color-mix(in srgb, var(--colour-ink) 90%, transparent), 0 0 0 1px var(--lava), 0 0 40px -6px var(--ember-glow);
  font-weight: var(--weight-500);
  animation: toast-in var(--duration-slow) var(--easing-enter);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.toast__ico { color: var(--deep); }
.toast__undo {
  min-height: 36px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--cream); font-weight: var(--weight-500);
}
.toast__undo:focus-visible { outline-color: var(--focus-on-light); }

/* ========== VEILS ========== */
.veil {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: var(--ink);
  transition: opacity var(--duration-slow) var(--easing-exit);
}
.veil.is-leaving { opacity: 0; pointer-events: none; }
.veil__img {
  position: absolute; inset: 0;
  background: url("assets/img/lava-seam-960.webp") center / cover no-repeat;
  opacity: .22;
  -webkit-mask-image: radial-gradient(60% 50% at 50% 50%, var(--ink) 0%, transparent 80%);
  mask-image: radial-gradient(60% 50% at 50% 50%, var(--ink) 0%, transparent 80%);
}
.veil__body { position: relative; display: grid; justify-items: center; gap: 22px; padding: 24px; text-align: center; }
.veil__logo { width: 198px; height: auto; }
.veil--error .veil__logo { width: 56px; }
.seam { width: min(420px, 78vw); height: 36px; overflow: visible; }
.seam path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.seam__base { stroke: var(--basalt); stroke-width: 2; opacity: .6; }
.seam__hot {
  stroke: var(--lava); stroke-width: 2.5;
  stroke-dasharray: 560; stroke-dashoffset: 560;
  filter: drop-shadow(0 0 6px var(--lava)) drop-shadow(0 0 14px var(--deep));
  animation: seam-draw calc(var(--duration-slow) * 5) var(--easing-standard) forwards;
}
@keyframes seam-draw { to { stroke-dashoffset: 0; } }
.no-motion .seam__hot { animation: none; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) { .seam__hot { animation: none; stroke-dashoffset: 0; } }
.veil__title {
  margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-h2); line-height: var(--leading-h2); letter-spacing: .2em; text-transform: uppercase; color: var(--cream);
}
.veil--error .veil__title { font-size: var(--size-h1); letter-spacing: .02em; }
.veil__count { margin: 0; color: var(--ash); }
.veil__count .num { color: var(--lava); }
.veil__note { margin: 0; color: var(--ash); }

/* ========== RESPONSIVE ========== */
/* LK-3070 (A-05, design C on a laptop): at 1366x768 and 1280x720 the full legend (321 px) took over
   40% of the stage's height and covered 21-41% of the framed map's core. A short desktop stage keeps
   the cluster and venture boxes to the tablet's heights (two rows and one), scrolling inside. */
@media (min-width: 1181px) and (max-height: 820px) {
  #legend-clusters { max-height: calc(2 * 28px + 6px); }
  #legend-ventures { max-height: 28px; }
}

@media (max-width: 1180px) {
  /* LK-3102: the bar holds more tools than C's (Questions and Ask, the spec's): closer gaps leave the
     search box room for its words at 1024 and 820 px. */
  .bar { column-gap: 12px; padding: 0 12px 0 14px; }
  .bar__tools { gap: 2px; }
  .bar__brand { gap: 10px; }
  .bar__short { padding-left: 10px; }
  .search input { padding-left: 40px; }
  .search__ico { left: 14px; }
  .search:not(.has-q) input { padding-right: 36px; }
  .search__kbd { right: 8px; }
  .flagbtn__txt { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .flagbtn { padding-left: 12px; }
  .dock--left { max-width: calc(100vw - 200px); }
  #legend-clusters { max-height: 70px; }
}

@media (max-width: 960px) {
  .seg__txt { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .seg__btn { padding: 0 10px; }
  .bar__short { display: none; }
}

/* Tablet and phone: the detail panel is a bottom sheet (spec line 102). Row 3017 moved it from
   767 px to 1024 px with SHEET_BREAKPOINT in src/panel.js, so a tablet (820 x 1180, 1024 x 768) gets the sheet. */
@media (max-width: 1024px) {
  .has-panel .dock--right { transform: none; }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: 88vh; height: 88dvh;
    border-radius: 24px 24px 0 0; border-bottom: 0;
    transform: translateY(100%); opacity: 1;
    transition: transform var(--duration-slow) var(--easing-exit);
  }
  .panel.is-open { transform: translateY(var(--sheet-y)); }
  .panel.is-dragging { transition: none; }
  .panel__grip { display: flex; justify-content: center; padding: 6px 0 0; touch-action: none; cursor: grab; }
  .panel__handle { width: 88px; height: 28px; border: 0; background: transparent; display: grid; place-items: center; border-radius: 999px; }
  .panel__handle span { width: 44px; height: 5px; border-radius: 99px; background: var(--basalt); }
  .panel__scroll { padding: 6px 20px 40px; }
  .has-panel .listview__inner { margin: 0 auto; }
}

/* LK-3072 (A-05, design C on a tablet): C shows a side panel from 768 px and keeps its map controls
   beside it. VIEW shows the sheet there (spec line 102), so with the sheet open the docks (zoom, Fit,
   Flow, the legend and the date slider) sit above its peek instead of under it. A phone keeps C's
   sheet over them, and so does a stage under 720 px tall, where the lifted legend could reach the bar. Full, the sheet still covers them. */
@media (min-width: 768px) and (max-width: 1024px) and (min-height: 720px) {
  .dock--left { transition: transform var(--duration-slow) var(--easing-standard); }
  .has-panel .dock { transform: translateY(calc(20px - var(--peek) - 12px)); }
  /* LK-3080: lifted whole, the legend covered most of the map left above the peek (y 237 to 520 of
     92 to 532 at 1024 x 768). With the sheet open only its date slider shows, as a glass strip set
     down 6 px clear of the framed map, and its filters wait under the sheet as on a phone. Its box
     keeps its size, so Fit frames the map as with the sheet shut. */
  .has-panel .dock--left { pointer-events: none; }
  .has-panel .legend { background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .has-panel .legend__title, .has-panel .legend__chips { visibility: hidden; }
  .has-panel .timebar { position: relative; pointer-events: auto; transform: translateY(6px); }
  .has-panel .timebar::before {
    content: ""; position: absolute; inset: -8px -12px; z-index: -1; border-radius: var(--radius);
    background: var(--glass); border: 1px solid var(--hair);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
}

/* LK-3099 (A-05, design C on a tablet): go's live read found the legend 321 px at 1024x768 and 355 px
   at 820x1180, the lower 42% of the screen. It is compacted as on a desktop (ventures and Disputed on
   one line, the ventures one scrolling row, the cluster list one row, 28 px chips), and its date
   slider, label beside track, stays its last row on a line of its own. */
@media (min-width: 768px) and (max-width: 1024px) {
  .legend__line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
  .legend__line > .legend__chips { flex: none; }
  .legend__line #legend-ventures:empty { display: none; }
  .legend__line > #legend-ventures { flex: 1 1 0; min-width: 0; max-height: 28px; }
  .legend__line .timebar { flex: 1 1 100%; flex-direction: row; align-items: center; gap: 10px; }
  .legend__line .timebar__label { flex: none; white-space: nowrap; }
  .legend__line .timebar__track { flex: 1 1 auto; min-width: 100px; }
  .legend .chip { min-height: 28px; }
  #legend-clusters { max-height: 28px; }
}

/* LK-3099: the compact legend is shorter than the lift above the sheet, so its date strip, lifted
   with it, would sit over the map framed above the legend (sheet.browser, 1024 x 768). With the sheet
   at its peek the strip rides on the sheet's top edge instead, beside its grip and clear of its first
   row, over the sheet; pulled full, the sheet covers it as it covers the docks. */
@media (min-width: 768px) and (max-width: 1024px) and (min-height: 720px) {
  .app.has-panel:has(#panel[data-sheet="peek"]) #legend { z-index: 41; }
  /* Its line ends short of the sheet's grip (a margin, so the legend keeps its size and Fit its frame). */
  .has-panel .legend__line .timebar { transform: translateY(calc(100% + 27px)); margin-right: max(0px, calc(50vw - 132px)); }
  .has-panel .legend__line .timebar::before { inset: -4px -12px; }
}

@media (max-width: 767px) {
  :root { --bar-h: 56px; --meta-h: 56px; }
  /* A phone's sheet takes the h2 title, as C's own sheet does (cl-a :813); a tablet's keeps C's h1. LK-3094. */
  .panel__title { font-size: var(--size-h2); line-height: var(--leading-h2); }
  .bar {
    grid-template-columns: auto 1fr;
    grid-template-rows: var(--bar-h) 52px 26px;
    grid-template-areas: "brand tools" "search search" "meta meta";
    padding: 0 10px 0 14px; column-gap: 8px;
    --meta-h: 78px;
  }
  .app { --top: 134px; }
  .bar__logo--full { display: none; }
  .bar__logo--icon { display: block; }
  .bar__short { display: none; padding-left: 10px; }
  .bar__meta .stat--upd { display: none; }
  .bar__tools { gap: 2px; }
  .flagbtn { margin: 0 2px; height: 36px; padding: 0 6px 0 10px; gap: 6px; }
  .bar .icon-btn { width: 36px; height: 36px; }
  .seg__btn { width: 36px; height: 32px; padding: 0; justify-content: center; }
  .bar__meta { gap: 14px; }
  .search input { height: 44px; }
  .search__pop { position: fixed; left: 10px; right: 10px; top: 112px; max-height: calc(100dvh - 130px); }

  .signin { grid-template-columns: 1fr; grid-template-rows: 30vh auto; grid-template-rows: 30dvh auto; overflow: auto; }
  .signin__field { min-height: 0; }
  .signin__card { margin-top: -28px; border-radius: 24px 24px 0 0; padding: 32px 24px 40px; gap: 28px; justify-content: flex-start; box-shadow: 0 -30px 60px -30px var(--ember-glow); }
  .signin__title { font-size: var(--size-h1); line-height: var(--leading-h1); }

  .dock { bottom: 12px; }
  .dock--left { left: 10px; right: 64px; max-width: none; }
  .legend { padding: 6px; gap: 8px; width: 100%; }
  .legend__title { display: none; }
  .legend__rows { width: 100%; }
  .legend__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; }
  .legend__chips::-webkit-scrollbar { display: none; }
  .chip { min-height: 36px; }
  .dock--right { right: 10px; }
  .flowbtn span:not(.flowbtn__lamp):not(.vh) { display: none; }
  .flowbtn { width: 44px; height: 44px; padding: 0; justify-content: center; gap: 0; }
  .flowbtn .ico { display: none; }
  .zoom__pct { display: none; }

  .reader { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .reader__title { font-size: var(--size-h1); line-height: var(--leading-h1); }
  .reader__meta { grid-template-columns: repeat(2, auto); gap: 14px 32px; }
  .sheet { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .sheet__inner { padding: 20px 18px 32px; }
  .sheet__title { font-size: var(--size-h2); line-height: var(--leading-h2); }
  .ver__v { font-size: var(--size-body); }
  .keys > div { grid-template-columns: 120px 1fr; }
  .toast { bottom: 76px; }
}

@media (min-width: 520px) and (max-width: 767px) {
  .bar__short { display: inline; }
}
@media (max-width: 400px) {
  .bar__meta { gap: 10px; }
}

@media (forced-colors: active) {
  .chip[aria-pressed="true"], .seg__btn[aria-pressed="true"] { outline: 2px solid CanvasText; }
}

.qbtn { position: relative; }
.qbtn__n {
  position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--lava); color: var(--ink);
  font-size: 10px; line-height: 16px; text-align: center;
}
.qtray {
  position: absolute; z-index: 45; top: calc(var(--bar-h) + 12px); right: 16px;
  width: min(440px, calc(100vw - 32px)); max-height: calc(100% - var(--bar-h) - 28px);
  overflow: auto; padding: 12px; border-radius: 16px;
  background: var(--ink); border: 1px solid var(--hair-strong);
}
.qtray__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qtray__head h2 {
  margin: 0; font-family: var(--font-heading); font-weight: var(--weight-600);
  font-size: var(--size-body); letter-spacing: .06em; text-transform: uppercase; color: var(--cream);
}
.qcard + .qcard { margin-top: 12px; }
.qcard__prompt { margin: 0 0 6px; color: var(--cream); }
.qcard__who { margin: 0 0 8px; color: var(--ash); }
.qpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qopt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  min-height: 44px; padding: 12px; border-radius: 12px;
  background: var(--rock); border: 1px solid var(--hair-strong); color: var(--cream);
}
.qopt__quote, .qopt__src { color: var(--ash); }
.qopt__src { font-size: var(--size-small); }
.qtray__empty, .qtray__note { margin: 8px 0 0; color: var(--ash); }
.qtray__note:empty { display: none; }

/* Row 3022: design C's chrome on the live data. The questions button is C's flags button; the
   tray is C's flags sheet; the reader keeps C's paper page around the cited PDF page. */
.flagbtn[data-zero="true"] .flagbtn__n { background: var(--rock-hi); color: var(--cream); }
.flagbtn[data-zero="true"] .ico { color: var(--ash); }
.sheet .qtray__note { margin: -8px 0 16px; color: var(--ash); }
.sheet .qtray__note:empty { display: none; }
.fitem__prompt { margin: 0 0 14px; color: var(--ash); max-width: 70ch; }
.ver__quote { color: var(--ash); font-style: italic; overflow-wrap: anywhere; }
.pflag .fitem { padding: 14px; }
.reader__at { margin: 0; color: var(--text-secondary); font-size: var(--size-small); }
.btn--quiet {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--basalt); background: transparent; color: var(--ink); font-weight: var(--weight-500);
}
.btn--quiet:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn--quiet:focus-visible { outline-color: var(--focus-on-light); }
.reader__doc .reader__status { padding: 20px 0 0; }
.reader__doc .reader__status:empty { display: none; }
.reader__sheet { margin-top: 32px; }
.reader__sheet canvas { box-shadow: 0 18px 50px -24px color-mix(in srgb, var(--colour-ink) 60%, transparent), 0 0 0 1px var(--basalt); border-radius: 4px; }
.mention .ico { color: var(--c, var(--deep)); }
/* The cited page is a tall PDF, so the mentions sit above it rather than after the text as in C. */
.reader__doc .reader__mentions { margin-top: 28px; padding-top: 0; border-top: 0; }
/* C's search box is a text field with its own clear button; hide the browser's second one. */
#q::-webkit-search-cancel-button, #q::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* LK-3089: the partial search note, alone or under the results, with its Try again button */
.search__partial { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 12px; border-top: 1px solid var(--hair); }
.search__pop > .search__partial:first-child { border-top: 0; }
.search__again { flex: none; }
