/* ===================================================================
   COBBLESTONE LEARNING · REPOSITORY HUB (v2)
   Design system — light editorial.

   No Tailwind, no build step. Everything is a token or a component
   class. Brand values come from the Cobblestone brand guidelines;
   the chart palette is the CVD-validated categorical theme (see
   README → "Chart palette" for the validator command + results).
   =================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand */
  --cyan:        #27AAE1;
  --blue:        #0074B4;
  --blue-deep:   #005C90;   /* gradient end / AA text on white */
  --yellow:      #FFC20E;
  --amber-ink:   #8A6500;   /* accessible "yellow" text */
  --ink:         #3D3D3D;   /* brand Dark — body + headings */
  --muted:       #6B6B6B;   /* load-bearing muted text (AA on white) */
  --faint:       #939393;   /* decorative only — never load-bearing */
  --line:        #E8ECF0;
  --line-soft:   #F0F3F7;
  --surface:     #FFFFFF;
  --canvas:      #F8F9FB;
  --canvas-deep: #F1F4F8;

  /* Chart categorical theme — fixed order, never cycled.
     Validated: lightness band PASS · chroma PASS · CVD all-pairs PASS
     · normal-vision PASS. Two slots warn on <3:1 contrast, which is
     relieved by the visible labels + table view every chart ships. */
  --c1: #0072B2;   /* Plugins        */
  --c2: #5BB8EC;   /* Snippets       */
  --c3: #D48200;   /* Themes         */
  --c4: #00916A;   /* Apps & tools   */
  --c5: #C4719B;   /* Sites & pages  */
  --c-none: #C8D0DA;

  /* Geometry */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(29,42,58,.04), 0 2px 8px rgba(29,42,58,.04);
  --shadow-2: 0 2px 4px rgba(29,42,58,.05), 0 12px 28px rgba(29,42,58,.10);
  --shadow-pop: 0 18px 50px rgba(29,42,58,.18);

  --maxw: 1360px;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 64px;

  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Montserrat', Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--blue); color: #fff; padding: 10px 16px;
  border-radius: var(--r-sm); font-weight: 700; font-size: 13px;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- 3. Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.band { border-top: 1px solid var(--line); }
.band--canvas { background: var(--canvas); }
.section-pad { padding-block: clamp(40px, 6vw, 76px); }

.eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted);
}
.eyebrow--accent { color: var(--blue); }

.section-head { margin-bottom: 28px; }
.section-head h2 {
  font-size: clamp(22px, 2.6vw, 30px); font-weight: 800; margin-top: 8px;
}
.section-head p {
  margin-top: 8px; color: var(--muted); font-size: 14.5px; max-width: 62ch;
}

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  min-height: var(--header-h); max-width: var(--maxw);
  margin: 0 auto; padding-inline: var(--gutter);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { height: 30px; width: auto; }
.brand-divider { width: 1px; height: 24px; background: var(--line); flex: none; }
.brand-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
}
.tag-preview {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--amber-ink); background: #FFF8E1; border: 1px solid #F5E3A8;
  padding: 3px 7px; border-radius: var(--r-pill);
}
.header-spacer { flex: 1 1 auto; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.kbd-hint {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--canvas);
  color: var(--muted); font-size: 12.5px; font-weight: 500;
  padding: 7px 10px 7px 12px; border-radius: var(--r-pill);
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.kbd-hint:hover { border-color: #D6DDE6; color: var(--ink); }
kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 5px; color: var(--muted);
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 700; padding: 9px 16px;
  border-radius: var(--r-pill); border: 1px solid transparent;
  white-space: nowrap; transition: background .16s var(--ease),
    border-color .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }

.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-outline:hover { border-color: #CBD5E0; background: var(--canvas); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--canvas); }
.btn-sm { font-size: 12px; padding: 7px 13px; }

/* ---------- 6. Masthead ---------- */
.masthead { padding-block: clamp(40px, 6vw, 76px) clamp(28px, 4vw, 44px); }
.masthead-grid {
  display: grid; gap: clamp(28px, 4vw, 56px); align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
}
@media (max-width: 1100px) { .masthead-grid { grid-template-columns: minmax(0,1fr); } }
.masthead-copy { padding-top: clamp(0px, 2vw, 22px); }
.masthead h1 {
  font-size: clamp(36px, 5vw, 62px); font-weight: 800;
  letter-spacing: -.035em; line-height: .98; margin-top: 14px;
  max-width: 16ch;
}
.masthead h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--blue), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.masthead-lede {
  margin-top: 22px; max-width: 58ch; font-size: clamp(15px, 1.4vw, 17.5px);
  color: var(--muted); line-height: 1.65;
}
.masthead-lede strong { color: var(--ink); font-weight: 600; }

/* Key figures — editorial rule-separated, not boxes */
.figures {
  display: grid; gap: 1px; margin-top: clamp(28px, 3.5vw, 44px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
@media (max-width: 460px) { .figures { grid-template-columns: minmax(0, 1fr); } }
.figure { background: var(--surface); padding: 20px 22px 18px; }
.figure-val {
  font-size: clamp(30px, 3.2vw, 42px); font-weight: 800; letter-spacing: -.035em;
  line-height: 1; font-variant-numeric: tabular-nums; display: flex;
  align-items: baseline; gap: 4px;
}
.figure-unit { font-size: .44em; font-weight: 700; color: var(--muted); letter-spacing: -.01em; }
.figure-label {
  margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink);
}
.figure-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ---------- 7. Panels & charts ---------- */
.panel-grid {
  display: grid; gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: start;
}
@media (max-width: 1080px) { .panel-grid { grid-template-columns: minmax(0,1fr); } }
/* Four analysis panels read best as a balanced 2x2, not 3-then-1. */
.panel-grid--quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 820px) { .panel-grid--quad { grid-template-columns: minmax(0, 1fr); } }
.panel-col { display: grid; gap: 20px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px 24px 20px;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.panel-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.panel-body { margin-top: 18px; }

/* Stacked proportional bar */
.stackbar {
  display: flex; width: 100%; height: 30px; gap: 2px;
  border-radius: var(--r-sm); overflow: hidden; background: var(--line-soft);
}
.stackbar-seg {
  position: relative; min-width: 3px; border-radius: 3px;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.stackbar-seg:first-child { border-radius: var(--r-sm) 3px 3px var(--r-sm); }
.stackbar-seg:last-child  { border-radius: 3px var(--r-sm) var(--r-sm) 3px; }
.stackbar-seg[data-dim="1"] { opacity: .28; }
.stackbar-seg:hover, .stackbar-seg:focus-visible { transform: scaleY(1.12); }

/* Legend / table view — the relief for the contrast WARN slots */
.legend { margin-top: 16px; display: grid; gap: 1px; background: var(--line-soft); }
.legend-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center;
  gap: 10px; background: var(--surface); padding: 8px 2px; font-size: 13px;
  text-align: left; width: 100%;
}
.legend-row:hover { background: var(--canvas); }
.legend-row[aria-pressed="true"] { background: rgba(39,170,225,.07); }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; }
.legend-pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; font-weight: 600; min-width: 42px; text-align: right; }

/* Ranked horizontal bars (platform coverage) */
.rank { display: grid; gap: 9px; }
.rank-row {
  display: grid; grid-template-columns: minmax(96px, 30%) 1fr auto;
  align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 3px 2px; border-radius: 6px;
}
.rank-row:hover { background: var(--canvas); }
.rank-row[aria-pressed="true"] .rank-name { color: var(--blue); }
.rank-name {
  font-size: 12.5px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.rank-track { display: block; height: 9px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.rank-fill {
  display: block; height: 100%; border-radius: 5px; background: var(--c1);
  transform-origin: left center; transition: width .7s var(--ease);
}
.rank-val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 26px; text-align: right; }

/* Cadence histogram */
.cadence { display: flex; align-items: flex-end; gap: 3px; height: 92px; }
.cadence-col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.cadence-bar {
  width: 100%; background: var(--c1); border-radius: 4px 4px 2px 2px;
  min-height: 2px; transition: height .6s var(--ease), background .15s var(--ease);
}
.cadence-col:hover .cadence-bar { background: var(--cyan); }
.cadence-axis {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 10.5px; font-weight: 600; color: var(--faint); letter-spacing: .04em;
}

/* ---------- 8. The Map ---------- */
.map-panel { padding-bottom: 24px; }
.map-groups { display: grid; gap: 18px; margin-top: 4px; }
.map-group-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 9px;
}
.map-group-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.map-group-name { font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.map-group-count {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--canvas); border-radius: var(--r-pill); padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.map-grid {
  display: grid; gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(26px, 1fr));
}
.map-tile {
  aspect-ratio: 1; border-radius: 5px; position: relative;
  background: var(--c1); transition: transform .14s var(--ease),
    opacity .18s var(--ease), box-shadow .14s var(--ease);
}
.map-tile::after {
  content: ''; position: absolute; inset: 0; border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.map-tile:hover, .map-tile:focus-visible {
  transform: scale(1.32); z-index: 5; box-shadow: var(--shadow-2);
}
.map-tile[data-dim="1"] { opacity: .13; }
.map-tile[data-dim="1"]:hover { opacity: .45; }
.map-tile .live-pip {
  position: absolute; right: 3px; bottom: 3px; width: 5px; height: 5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.22);
}
.map-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.map-scale { display: flex; align-items: center; gap: 6px; }
.map-scale-swatches { display: flex; gap: 2px; }
.map-scale-swatches i { width: 13px; height: 9px; border-radius: 2px; background: var(--c1); display: block; }

/* ---------- 9. Tooltip ---------- */
.tip {
  position: fixed; z-index: 120; pointer-events: none; opacity: 0;
  transform: translateY(4px); transition: opacity .12s var(--ease), transform .12s var(--ease);
  background: #FFFFFF; border: 1px solid var(--line); box-shadow: var(--shadow-2);
  border-radius: var(--r); padding: 11px 13px; max-width: 290px;
}
.tip[data-show="1"] { opacity: 1; transform: translateY(0); }
.tip-title { font-size: 13px; font-weight: 700; letter-spacing: -.01em; word-break: break-word; }
.tip-desc { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.tip-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 9px; padding-top: 8px;
  border-top: 1px solid var(--line-soft); font-size: 11px; font-weight: 600; color: var(--muted);
}
.tip-meta b { color: var(--ink); font-weight: 700; }

/* ---------- 10. Controls bar ---------- */
.controls {
  position: sticky; top: var(--header-h); z-index: 50;
  background: rgba(248,249,251,.94);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-block: 1px solid var(--line);
}
.controls-inner { max-width: var(--maxw); margin: 0 auto; padding: 12px var(--gutter); }
.controls-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.viewtoggle {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 3px; gap: 2px; flex: none;
}
.viewtoggle button {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  font-weight: 700; padding: 7px 15px; border-radius: var(--r-pill); color: var(--muted);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.viewtoggle button[aria-checked="true"] {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff;
}
.viewtoggle button:not([aria-checked="true"]):hover { color: var(--ink); background: var(--canvas); }

.searchfield {
  position: relative; flex: 1 1 260px; min-width: 200px;
  display: flex; align-items: center;
}
.searchfield svg { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.searchfield input {
  width: 100%; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-pill); padding: 10px 40px 10px 40px; font-size: 14px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.searchfield input::placeholder { color: var(--faint); }
.searchfield input:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(39,170,225,.16);
}
.searchfield .clear {
  position: absolute; right: 10px; width: 22px; height: 22px; border-radius: 50%;
  display: none; align-items: center; justify-content: center; color: var(--muted);
}
.searchfield .clear:hover { background: var(--canvas-deep); color: var(--ink); }
.searchfield[data-filled="1"] .clear { display: flex; }

.selectfield {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--r-pill); padding: 0 12px 0 14px;
  color: var(--muted); flex: none;
}
.selectfield select {
  border: 0; background: none; padding: 10px 4px; font-size: 12.5px;
  font-weight: 600; color: var(--ink); cursor: pointer;
}
.selectfield select:focus { outline: none; }

.toggle-check {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--r-pill); padding: 9px 15px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; flex: none;
}
.toggle-check input { accent-color: var(--blue); width: 14px; height: 14px; }

.chiprow {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.chiprow::-webkit-scrollbar { height: 5px; }
.chiprow::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.chiprow-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chiprow-wrap .chiprow { flex: 1 1 auto; min-width: 0; }
.chiprow-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); flex: none; padding-top: 10px;
}
@media (max-width: 640px) { .chiprow-label { display: none; } }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none; scroll-snap-align: start;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-pill); padding: 6px 13px; font-size: 12.5px; font-weight: 600;
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.chip:hover { border-color: #CBD5E0; }
.chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  border-color: transparent; color: #fff;
}
.chip[data-empty="1"] { opacity: .42; }
.chip-n {
  font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] .chip-n { color: rgba(255,255,255,.82); }
.chip-dot { width: 8px; height: 8px; border-radius: 2.5px; flex: none; }

/* ---------- 11. Project cards ---------- */
.results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.results-count { font-size: 13px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.cat-section { margin-bottom: 42px; }
.cat-head {
  display: flex; align-items: center; gap: 12px; padding-bottom: 12px;
  border-bottom: 2px solid var(--cyan); margin-bottom: 20px;
}
.cat-icon { color: var(--blue); flex: none; }
.cat-title { font-size: 17px; font-weight: 800; letter-spacing: -.015em; }
.cat-count {
  font-size: 11px; font-weight: 700; color: var(--muted); background: var(--canvas);
  padding: 2px 8px; border-radius: var(--r-pill); font-variant-numeric: tabular-nums;
}
.cat-blurb { font-size: 13px; color: var(--muted); margin-left: auto; text-align: right; font-weight: 500; }
@media (max-width: 720px) { .cat-blurb { display: none; } }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 20px 18px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--type-color, var(--c1)); opacity: 0;
  transition: opacity .18s var(--ease);
}
.card:hover { border-color: #D8E0E9; box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card:hover::before { opacity: 1; }
.card-top { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.card-name {
  font-size: 15.5px; font-weight: 700; letter-spacing: -.015em; min-width: 0;
  overflow-wrap: anywhere;
}
.card-desc {
  margin-top: 9px; font-size: 13.5px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 14px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.card-meta .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.card-works { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.card-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 16px;
}
.card-spacer { flex: 1 1 auto; }

.pill {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill); background: var(--canvas); color: var(--muted);
  white-space: nowrap;
}
.pill-live { background: #E8F4FC; color: var(--blue); }
.pill-private { background: #FFF8E1; color: var(--amber-ink); }
.pill-type { background: var(--type-tint, var(--canvas)); color: var(--type-color, var(--muted)); }
.pill-works { text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 600;
  background: var(--canvas); border: 1px solid var(--line-soft); color: var(--ink); }

/* Developer table */
.devtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.devtable thead th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); padding: 0 12px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.devtable tbody tr { border-bottom: 1px solid var(--line-soft); }
.devtable tbody tr:hover { background: var(--canvas); }
.devtable td { padding: 12px; vertical-align: middle; }
.devtable .t-name { font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.devtable .t-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.devtable .t-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap;
  font-weight: 600; font-size: 12.5px; color: var(--muted); }
.devtable .t-actions { text-align: right; white-space: nowrap; }
.devtable .lang-cell { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
@media (max-width: 860px) { .devtable .col-opt { display: none; } }

/* ---------- 12. Snippet library ---------- */
.snip-layout { display: grid; grid-template-columns: 228px minmax(0,1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .snip-layout { grid-template-columns: minmax(0,1fr); } }
.snip-facets { display: grid; gap: 22px; position: sticky; top: calc(var(--header-h) + 84px); }
@media (max-width: 900px) { .snip-facets { position: static; } }
.facet-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 10px;
}
.facet-list { display: grid; gap: 1px; }
.facet-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  color: var(--ink); transition: background .14s var(--ease);
}
.facet-item:hover { background: var(--canvas-deep); }
.facet-item[aria-pressed="true"] { background: rgba(39,170,225,.1); color: var(--blue); }
.facet-item .facet-n {
  margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.facet-item[aria-pressed="true"] .facet-n { color: var(--blue); }

.snip-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.snip-row {
  background: var(--surface); display: grid; align-items: center; gap: 14px;
  grid-template-columns: minmax(0,1.1fr) minmax(0,1.5fr) auto auto;
  padding: 13px 16px; width: 100%; text-align: left;
  transition: background .14s var(--ease);
}
.snip-row:hover { background: var(--canvas); }
.snip-name { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.snip-site { display: block; font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.snip-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.snip-tags { display: flex; gap: 5px; flex-wrap: nowrap; justify-content: flex-end; overflow: hidden; }
.snip-open { color: var(--faint); flex: none; }
.snip-row:hover .snip-open { color: var(--blue); }
@media (max-width: 760px) {
  .snip-row { grid-template-columns: minmax(0,1fr) auto; }
  .snip-desc { grid-column: 1 / -1; }
  .snip-tags { display: none; }
}

/* ---------- 13. Gists ---------- */
.gist-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.gist-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.gist-files { margin-top: 12px; display: grid; gap: 6px; }
.gist-file {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--canvas); border-radius: var(--r-sm); padding: 6px 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 14. Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: flex-start; justify-content: center; padding: clamp(12px, 4vh, 48px) 16px;
}
.modal[data-open="1"] { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(29,42,58,.46); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); width: min(920px, 100%); max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-head {
  display: flex; align-items: flex-start; gap: 16px; padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line); flex: none;
}
.modal-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.modal-sub { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.modal-close {
  margin-left: auto; width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: var(--muted); background: var(--canvas);
}
.modal-close:hover { background: var(--canvas-deep); color: var(--ink); }
.modal-body { padding: 20px 22px 24px; overflow-y: auto; flex: 1 1 auto; }
.modal-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--canvas); flex: none;
}
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.segmented button {
  font-size: 12px; font-weight: 700; padding: 6px 13px; border-radius: var(--r-pill); color: var(--muted);
}
.segmented button[aria-selected="true"] { background: var(--ink); color: #fff; }

/* Rendered markdown */
.doc-body { font-size: 14.5px; line-height: 1.7; color: var(--ink); overflow-wrap: anywhere; }
.doc-body h1, .doc-body h2 {
  font-size: 20px; font-weight: 800; margin: 26px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); letter-spacing: -.02em;
}
.doc-body h1:first-child, .doc-body h2:first-child { margin-top: 0; }
.doc-body h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.doc-body h4 { font-size: 14px; font-weight: 700; margin: 18px 0 6px; }
.doc-body p { margin: 0 0 13px; }
.doc-body ul, .doc-body ol { margin: 0 0 13px; padding-left: 22px; list-style: revert; }
.doc-body li { margin-bottom: 5px; }
.doc-body code {
  background: var(--canvas); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
}
.doc-body pre {
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; overflow-x: auto; margin: 0 0 14px;
}
.doc-body pre code { background: none; border: 0; padding: 0; font-size: 12.5px; }
.doc-body a { color: var(--blue); font-weight: 600; }
.doc-body blockquote {
  margin: 0 0 14px; padding: 4px 0 4px 16px; border-left: 3px solid var(--cyan); color: var(--muted);
}
.doc-body table { border-collapse: collapse; width: 100%; margin: 0 0 14px; font-size: 13px; }
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.doc-body th { background: var(--canvas); font-weight: 700; }
.doc-body img { max-width: 100%; border-radius: var(--r-sm); }
.doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

.codeblock {
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; white-space: pre; color: var(--ink); margin: 0;
}
.clone-row {
  display: flex; align-items: center; gap: 10px; background: var(--canvas);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px;
}
.clone-row code {
  flex: 1 1 auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; overflow-x: auto; white-space: nowrap; color: var(--ink);
}
.meta-grid {
  display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}
.meta-cell { background: var(--surface); padding: 12px 14px; }
.meta-k { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.meta-v { font-size: 14px; font-weight: 700; margin-top: 5px; letter-spacing: -.01em; overflow-wrap: anywhere; }

.demo-frame {
  width: 100%; height: min(70vh, 620px); border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface);
}

/* ---------- 15. Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 130; display: none; justify-content: center; align-items: flex-start; padding: clamp(40px, 12vh, 140px) 16px 16px; }
.palette[data-open="1"] { display: flex; }
.palette-overlay { position: absolute; inset: 0; background: rgba(29,42,58,.42); backdrop-filter: blur(3px); }
.palette-panel {
  position: relative; width: min(620px, 100%); background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden;
  animation: pop .18s var(--ease); display: flex; flex-direction: column; max-height: 62vh;
}
.palette-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-input-wrap svg { color: var(--faint); flex: none; }
.palette-input-wrap input { flex: 1 1 auto; border: 0; font-size: 16px; font-weight: 500; }
.palette-input-wrap input:focus { outline: none; }
.palette-results { overflow-y: auto; padding: 8px; }
.palette-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--r-sm);
}
.palette-item[data-active="1"] { background: rgba(39,170,225,.11); }
.palette-item .pi-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.palette-item .pi-name { font-size: 13.5px; font-weight: 700; }
.palette-item .pi-desc { font-size: 12px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-kind { margin-left: auto; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--faint); flex: none; }
.palette-foot {
  padding: 10px 18px; border-top: 1px solid var(--line); background: var(--canvas);
  font-size: 11.5px; color: var(--muted); font-weight: 600; display: flex; gap: 16px; flex-wrap: wrap;
}

/* ---------- 16. Auth ---------- */
.auth-user { display: flex; align-items: center; gap: 10px; }
.auth-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); }
.auth-login { font-size: 12.5px; font-weight: 700; }
@media (max-width: 640px) { .auth-login, .kbd-hint { display: none; } }
/* Narrow phones: the header must never be what pushes the page sideways. */
@media (max-width: 560px) {
  .brand-divider, .brand-label, .tag-preview { display: none; }
  .brand { gap: 8px; }
  .header-inner { gap: 10px; }
}

/* ---------- 17. States ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, #E4E9F0 37%, var(--line-soft) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-card { height: 188px; border-radius: var(--r-lg); }
.sk-line { height: 11px; }

.empty {
  border: 1px dashed #D5DDE6; border-radius: var(--r-lg); background: var(--canvas);
  padding: 40px 28px; text-align: center;
}
.empty h3 { font-size: 16px; font-weight: 700; }
.empty p { margin-top: 8px; font-size: 13.5px; color: var(--muted); max-width: 46ch; margin-inline: auto; }
.empty .btn { margin-top: 18px; }

.toast-region { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 150; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff;
  border-radius: var(--r-pill); padding: 11px 20px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-2); animation: pop .2s var(--ease);
}
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); flex: none; }

.loader-veil {
  position: fixed; inset: 0; z-index: 160; display: none; place-items: center;
  background: rgba(248,249,251,.9); backdrop-filter: blur(4px);
}
.loader-veil[data-open="1"] { display: grid; }
.loader-ring {
  width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--cyan);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 18. Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 32px var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px; justify-content: space-between;
}
.footer-note { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.footer-sig {
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(120deg, var(--blue), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- 19. Reveal ----------
   Scoped to .js so the page is readable if the script fails, is blocked, or
   never gets to run. Content must never depend on an animation firing. */
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal[data-in="1"] { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* ===================================================================
   20. THE STAGE — WebGL mortarboard + its atmosphere
   =================================================================== */

/* ---- atmosphere (fixed, inert) ---- */
.atmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.atmos-spot {
  position: absolute; inset: -12vmax;
  background:
    radial-gradient(48vmax 40vmax at 62% -8%, rgba(39,170,225,.16), transparent 62%),
    radial-gradient(42vmax 38vmax at 8% 6%, rgba(0,116,180,.08), transparent 62%),
    radial-gradient(38vmax 38vmax at 92% 26%, rgba(255,194,14,.055), transparent 62%);
  filter: blur(6px);
}
.atmos-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(130% 96% at 50% 30%, transparent 58%, rgba(61,61,61,.07) 100%);
}
/* The logo's paving, drifting — the mark's own texture as wallpaper. */
.atmos-cobbles {
  position: absolute; inset: -60px;
  opacity: .5;
  background-image:
    linear-gradient(90deg, rgba(61,61,61,.055) 22px, transparent 22px),
    linear-gradient(0deg,  rgba(61,61,61,.045) 14px, transparent 14px),
    linear-gradient(90deg, rgba(39,170,225,.05) 40px, transparent 40px);
  background-size: 34px 22px, 22px 34px, 118px 74px;
  animation: cobble-drift 90s linear infinite;
  -webkit-mask-image: radial-gradient(70% 56% at 50% 12%, #000 0%, transparent 78%);
  mask-image: radial-gradient(70% 56% at 50% 12%, #000 0%, transparent 78%);
}
@keyframes cobble-drift {
  to { background-position: 340px 220px, -220px 340px, 472px 296px; }
}
.topglow {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 70; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--cyan) 34%, var(--blue) 66%, transparent);
  opacity: .8;
}
/* Everything real sits above the atmosphere. */
.site-header, main, .site-footer, .controls { position: relative; z-index: 10; }

/* ---- stage ---- */
.stage-wrap { position: relative; }
.stage-host {
  width: 100%;
  height: clamp(340px, 42vw, 560px);
  touch-action: pan-y;
  cursor: grab;
}
.stage-host canvas { border-radius: var(--r-lg); }
.stage-cap {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--muted);
  text-align: center;
}
.stage-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); flex: none;
  box-shadow: 0 0 0 0 rgba(39,170,225,.55);
  animation: stage-pulse 2.6s var(--ease) infinite;
}
@keyframes stage-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(39,170,225,.5); }
  70%  { box-shadow: 0 0 0 9px rgba(39,170,225,0); }
  100% { box-shadow: 0 0 0 0 rgba(39,170,225,0); }
}
/* Before WebGL reports in, hold the space with a breathing placeholder
   rather than a jump. */
.stage-wrap:not([data-live]) .stage-host {
  border-radius: var(--r-lg);
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(39,170,225,.09), transparent 70%),
    var(--canvas);
}
.stage-wrap[data-nogl] .stage-host { display: none; }
.stage-wrap[data-nogl] .stage-cap::after {
  content: 'Your browser can’t run the 3D stage — the full tile map is below.';
}
.stage-wrap[data-nogl] #stage-note { display: none; }

/* ---- preview rail ---- */
.preview-band { background: var(--surface); overflow: hidden; }
.preview-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-block: clamp(28px,4vw,44px) 18px;
}
.preview-rail {
  overflow-x: auto; overflow-y: hidden; padding: 4px 0 clamp(28px,4vw,44px);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.preview-rail::-webkit-scrollbar { display: none; }
.preview-track {
  display: flex; gap: 16px; width: max-content; padding-inline: var(--gutter);
  animation: rail 68s linear infinite;
}
.preview-rail:hover .preview-track,
.preview-rail:focus-within .preview-track { animation-play-state: paused; }
@keyframes rail { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .preview-track { animation: none; } }

.pv-card {
  flex: none; width: 216px; text-align: left; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); padding: 12px 12px 14px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.pv-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: #D8E0E9; }
.pv-art {
  display: block; position: relative; height: 104px; border-radius: var(--r);
  overflow: hidden; margin-bottom: 11px;
  background: linear-gradient(145deg, var(--pv), rgba(0,0,0,.22)), var(--pv);
}
.pv-art-grid {
  position: absolute; inset: 0; opacity: .42;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.5) 12px, transparent 12px),
    linear-gradient(0deg,  rgba(255,255,255,.28) 8px, transparent 8px);
  background-size: 19px 13px, 13px 19px;
  transform: rotate(-8deg) scale(1.3);
}
.pv-art-kind {
  position: absolute; left: 9px; bottom: 9px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.30); backdrop-filter: blur(3px);
  padding: 3px 8px; border-radius: var(--r-pill);
}
.pv-name {
  display: block; font-size: 13.5px; font-weight: 700; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-desc {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.45;
}

/* The stage earns the wider half of the masthead. */
@media (min-width: 1101px) {
  .masthead-grid { grid-template-columns: minmax(0, 430px) minmax(0, 1fr); }
  .figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ===================================================================
   21. THE ESTATE — world mode
   =================================================================== */
body[data-mode="world"] { overflow: hidden; }
body[data-mode="world"] .atmos, body[data-mode="world"] .site-footer { display: none; }

.world {
  position: fixed; left: 0; right: 0; top: var(--header-h); bottom: 0; z-index: 5;
  background:
    radial-gradient(70% 60% at 50% 0%, #ffffff 0%, #f6f9fc 42%, #eaf0f6 100%);
}
.world[hidden] { display: none; }
.world-host { position: absolute; inset: 0; }
.world-gl { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.world-gl:active { cursor: grabbing; }
.world-labels {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}

.world-boot {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 12px;
  text-align: center; font-size: 13px; font-weight: 600; color: var(--muted);
  background: inherit; z-index: 4;
}
.world-boot[hidden] { display: none; }

/* ---- in-world labels ---- */
.w-district {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: rgba(255,255,255,.90); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 6px 13px;
  font-size: 12px; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow-1); transition: opacity .3s var(--ease);
  backdrop-filter: blur(6px);
}
.w-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.w-dn { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.w-stone {
  pointer-events: auto; white-space: nowrap; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.94); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 3px 9px; color: var(--ink);
  box-shadow: var(--shadow-1); transform: translateY(-4px);
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
}
.w-stone:hover { border-color: var(--cyan); color: var(--blue); }

/* ---- HUD ---- */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.hud > * { position: absolute; pointer-events: auto; }
.hud-tl { top: 18px; left: 18px; width: min(380px, calc(100vw - 36px)); }
.hud-tr { top: 18px; right: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.hud-bl { bottom: 18px; left: 18px; display: flex; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-1); }
.hud-br { bottom: 18px; right: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.hud-search {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.93); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 10px 14px; box-shadow: var(--shadow-2);
}
.hud-search svg { color: var(--faint); flex: none; }
.hud-search input { flex: 1 1 auto; border: 0; background: none; font-size: 14px; min-width: 0; }
.hud-search input:focus { outline: none; }
.hud-search button {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); flex: none;
}
.hud-search button:hover { background: var(--canvas-deep); color: var(--ink); }
.hud-result {
  margin: 9px 4px 0; font-size: 12px; font-weight: 600; color: var(--muted);
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}

.hud-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.90); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 6px 12px; font-size: 12px; font-weight: 600; box-shadow: var(--shadow-1);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.hud-chip:hover { border-color: #CBD5E0; }
.hud-chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff; border-color: transparent;
}
.hud-chip[aria-pressed="true"] .hud-n { color: rgba(255,255,255,.8); }
.hud-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.hud-n { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.hud-fig { background: rgba(255,255,255,.93); backdrop-filter: blur(8px); padding: 10px 16px; }
.hud-fig-v {
  display: block; font-size: 21px; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.hud-fig-v i { font-style: normal; font-size: .5em; font-weight: 700; color: var(--muted); margin-left: 2px; }
.hud-fig-l {
  display: block; margin-top: 5px; font-size: 9.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}

.hud-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 8px 14px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow-1);
}
.hud-btn:hover { border-color: #CBD5E0; }
.hud-help {
  font-size: 11px; font-weight: 500; color: var(--muted); text-align: right;
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}

/* ---- inspector ---- */
.inspector {
  position: absolute; top: 18px; right: 18px; z-index: 8;
  width: min(330px, calc(100vw - 36px)); max-height: calc(100% - 36px); overflow-y: auto;
  background: rgba(255,255,255,.97); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 18px 18px 16px;
  animation: insp-in .26s var(--ease);
}
.inspector[hidden] { display: none; }
@keyframes insp-in { from { opacity: 0; transform: translateX(18px); } }
/* the inspector takes the top-right corner, so the legend steps aside */
.inspector:not([hidden]) ~ .hud .hud-tr,
.world:has(.inspector:not([hidden])) .hud-tr { opacity: 0; pointer-events: none; }
.insp-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: var(--canvas);
}
.insp-close:hover { background: var(--canvas-deep); color: var(--ink); }
.insp-kicker {
  display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.insp-name { font-size: 17px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; padding-right: 28px; overflow-wrap: anywhere; }
.insp-desc { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 8px; }
.insp-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 16px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.insp-grid div { background: var(--surface); padding: 9px 10px; }
.insp-grid span {
  display: block; font-size: 9px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--faint);
}
.insp-grid b { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 700; }
.insp-works { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 14px; }
.insp-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

/* ---- mode switch ---- */
.modeswitch {
  display: inline-flex; background: var(--canvas); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 3px; gap: 2px; flex: none;
}
.modeswitch button {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 6px 13px; border-radius: var(--r-pill); color: var(--muted);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.modeswitch button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.masthead-grid--solo { grid-template-columns: minmax(0, 1fr) !important; }
.masthead-grid--solo .masthead-copy { max-width: 62ch; }

@media (max-width: 820px) {
  .hud-bl { display: none; }
  .hud-help { display: none; }
  .hud-tr { top: auto; bottom: 18px; left: 18px; right: 18px; flex-direction: row;
    flex-wrap: nowrap; overflow-x: auto; align-items: center; }
}

/* ===================================================================
   22. THE SOURCE — the city (night). Overrides §21 for world mode.
   =================================================================== */
.world { background: linear-gradient(180deg, #cfe0ee 0%, #e6edf3 55%, #dde5ec 100%); }
.city-gl { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.city-gl:active { cursor: grabbing; }
.city-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.city-label {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
  color: var(--ink); box-shadow: var(--shadow-1);
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 10px; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .35s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.city-label:hover { border-color: var(--cyan); color: var(--blue); }
.cl-dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.cl-name { overflow: hidden; text-overflow: ellipsis; }

/* ---- boot ---- */
.world-boot {
  background: #e6edf3; color: var(--muted); gap: 10px;
}
.boot-title { font-size: 15px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.boot-sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.boot-bar {
  width: 220px; height: 3px; border-radius: 2px; margin: 8px auto 0;
  background: var(--line); overflow: hidden;
}
.boot-bar i {
  display: block; height: 100%; width: 0%; border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width .4s var(--ease);
}

/* ---- HUD over the daylight city ---- */
body[data-mode="world"] .hud-search,
body[data-mode="world"] .hud-chip,
body[data-mode="world"] .hud-btn,
body[data-mode="world"] .hud-fig,
body[data-mode="world"] .inspector {
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(12px);
}
body[data-mode="world"] .hud-result,
body[data-mode="world"] .hud-help { text-shadow: 0 1px 2px rgba(255,255,255,.85); }
body[data-mode="world"] .crumb { color: var(--muted); }
body[data-mode="world"] .crumb:hover { background: rgba(0,0,0,.05); color: var(--ink); }
body[data-mode="world"] .crumb[aria-current="location"] { color: var(--blue); }
body[data-mode="world"] .crumb-sep { color: var(--faint); }

.insp-file {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-top: 9px; padding: 7px 9px; border-radius: var(--r-sm);
  background: rgba(39,170,225,.10); border: 1px solid rgba(39,170,225,.26);
}
.insp-file code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  color: #a8d8f0; overflow-wrap: anywhere;
}
.insp-file span { font-size: 10.5px; font-weight: 700; color: #7f95aa; flex: none; }

/* ===================================================================
   23. Descending into the city — breadcrumbs, folder labels, source
   =================================================================== */
.hud-crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  margin: 10px 2px 0; max-width: 100%;
}
.hud-crumbs[hidden] { display: none; }
.crumb {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  padding: 3px 8px; border-radius: var(--r-pill);
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.crumb:hover { background: rgba(255,255,255,.09); color: #fff; }
.crumb[aria-current="location"] { color: var(--cyan); }
.crumb-sep { color: #566a7d; font-size: 11px; font-weight: 600; }

/* folder districts read as openable, file districts don't */
.cl-sub {
  font-size: 9.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em;
  padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--line);
}
.city-label.is-leaf { border-style: dashed; }
.city-label.is-leaf .cl-name { font-weight: 600; }

/* disabled search while you're inside a repo */
.hud-search input:disabled { opacity: .55; cursor: not-allowed; }
.hud-tr[hidden] { display: none; }

/* ---- source viewer ---- */
.srcwrap {
  display: flex; gap: 0; background: var(--canvas); border: 1px solid var(--line);
  border-radius: var(--r); overflow: auto; max-height: 62vh;
}
.srcnums, .srccode {
  margin: 0; padding: 14px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.55; white-space: pre;
}
.srcnums {
  padding-inline: 12px; text-align: right; color: var(--faint);
  background: var(--canvas-deep); border-right: 1px solid var(--line);
  user-select: none; flex: none;
}
.srccode { padding-inline: 14px; color: var(--ink); flex: 1 1 auto; }

/* the file viewer has no tabs, so the empty pill must not render */
.segmented:empty { display: none; }

/* ---- shape key: the legend for the skyline ---- */
.hud-key {
  /* the platform beacons live in the upper middle, so the key sits along
     the bottom between the figures panel and the buttons */
  position: absolute; left: 470px; right: 215px; bottom: 18px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px;
  padding: 7px 10px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.keyitem {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  padding: 2px 6px; white-space: nowrap;
}
.keyitem svg { width: 13px; height: 13px; flex: none; }
@media (max-width: 1280px) { .hud-key { display: none; } }

/* ---- platform beacons + signature ---- */
.city-hub {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 10.5px; font-weight: 700; color: var(--ink);
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 11px; box-shadow: var(--shadow-2);
}
.ch-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ch-n {
  font-size: 9.5px; font-weight: 700; color: var(--muted);
  padding-left: 6px; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.hud-btn[aria-pressed="false"] { opacity: .55; }
.hud-btn[hidden] { display: none; }
.insp-sig {
  margin-top: 12px; padding: 7px 10px; border-radius: var(--r-sm);
  background: rgba(39,170,225,.08); border: 1px solid rgba(39,170,225,.22);
  font-size: 11px; font-weight: 700; color: var(--blue); letter-spacing: .01em;
}

.trace-status {
  margin: 6px 4px 0; font-size: 11px; font-weight: 700; color: var(--blue);
  text-shadow: 0 1px 2px rgba(255,255,255,.85);
}
.trace-status[hidden] { display: none; }

/* ---- walking the streets ---- */
.hud-btn--go { border-color: rgba(39,170,225,.5); color: var(--blue); }
.hud-btn--go:hover { border-color: var(--cyan); background: rgba(39,170,225,.1); }
.walk-hud { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.walk-hud[hidden] { display: none; }
.walk-cross {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px;
  transform: translate(-50%, -50%); opacity: .65;
}
.walk-cross::before, .walk-cross::after {
  content: ''; position: absolute; background: var(--ink);
}
.walk-cross::before { left: 50%; top: 0; width: 1.5px; height: 100%; transform: translateX(-50%); }
.walk-cross::after { top: 50%; left: 0; height: 1.5px; width: 100%; transform: translateY(-50%); }
.walk-help {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(255,255,255,.90); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 8px 16px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  box-shadow: var(--shadow-1);
}
body[data-walk="1"] .city-labels { opacity: .35; }
