/* The Shape of the Abstraction Space — page styles.
   Every rule is scoped under .viz-root so the sheet is safe both standalone
   (abstraction-shape/index.html) and embedded in the MkDocs site (/shape/),
   where Material's .md-typeset rules would otherwise collide.
   Palette: the corpus dataviz reference palette (light + dark). */

.viz-root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6;   /* primes / primary marks */
  --series-2: #eb6834;   /* domain-specific */
  --seq-100:#cde2fb; --seq-150:#b7d3f6; --seq-200:#9ec5f4; --seq-250:#86b6ef;
  --seq-300:#6da7ec; --seq-350:#5598e7; --seq-400:#3987e5; --seq-450:#2a78d6;
  --seq-500:#256abf; --seq-550:#1c5cab; --seq-600:#184f95; --seq-650:#104281;
  --seq-700:#0d366b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --surface-1:#1a1a19; --page:#0d0d0d; --text-primary:#ffffff;
    --text-secondary:#c3c2b7; --muted:#898781; --grid:#2c2c2a;
    --baseline:#383835; --border:rgba(255,255,255,0.10);
    --series-1:#3987e5; --series-2:#d95926;
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --surface-1:#1a1a19; --page:#0d0d0d; --text-primary:#ffffff;
  --text-secondary:#c3c2b7; --muted:#898781; --grid:#2c2c2a;
  --baseline:#383835; --border:rgba(255,255,255,0.10);
  --series-1:#3987e5; --series-2:#d95926;
}
.viz-root {
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh; padding: 28px 16px 60px;
}
/* Inside the MkDocs site the page inherits the site chrome: site font, no
   full-viewport background, tighter top padding under the header. The site
   ships light-only, so the embedding shell also stamps data-theme="light". */
.viz-root.is-site-embedded {
  background: transparent;
  font-family: inherit;
  min-height: auto;
  padding: 6px 0 44px;
}
/* Match Material's content grid to this page's own content width.
   .md-grid governs the HEADER and TABS bars as well as the article, so if it
   and .viz-root .wrap below disagree, the header runs to a different width
   than the content under it and reads as left-aligned against a centred page.

   This was previously `92.5rem`, written expecting 16px rem = 1480px. It is
   not: mkdocs-material scales the root font size (125% -> 20px, and 137.5% ->
   22px above 100em), so 92.5rem resolved to 2035px — wider than almost any
   viewport, which let the header bar go full-bleed while the content stayed
   centred at 1400px. Stated in px so the root-font scale cannot drift it
   again, and matched to .viz-root .wrap. (Material's own default grid is
   64rem = 1408px at that scale, so this also keeps the page in line with the
   rest of the site.) */
body:has(.viz-root.is-site-embedded) .md-grid { max-width: 1400px; }

.viz-root .wrap { max-width: 1400px; margin: 0 auto; }
.viz-root .wrap h1 { font-size: 26px; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.01em; color: var(--text-primary); }
.viz-root .sub { color: var(--text-secondary); font-size: 15.5px; margin: 0 0 20px; max-width: 90ch; line-height: 1.5; }

/* Map + nearest-domains table side by side on desktop, stacked below 1100px.
   The default grid stretch keeps the two cards the same height; the flex
   column inside pins each card's footer content to the bottom. */
.viz-root .duo { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 22px; }
.viz-root .duo > .card { display: flex; flex-direction: column; }
.viz-root .duo > .card .note { margin-top: auto; padding-top: 10px; }
.viz-root .duo #tablebox { flex: 1 1 auto; min-height: 0; }
@media (max-width: 1100px) { .viz-root .duo { grid-template-columns: minmax(0, 1fr); } }

/* Four equal tiles spanning the full content width; two-up on small screens */
.viz-root .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
@media (max-width: 760px) { .viz-root .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.viz-root .tile {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 16px 12px; cursor: help;
}
.viz-root .tile .v { font-size: 24px; font-weight: 650; }
.viz-root .tile .l { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.viz-root .card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 18px 14px; margin-bottom: 22px;
}
.viz-root .card h2 { font-size: 17px; font-weight: 650; margin: 0 0 3px; color: var(--text-primary); }
.viz-root .card .hint { font-size: 13.5px; color: var(--text-secondary); margin: 0 0 10px; line-height: 1.5; max-width: 105ch; }
.viz-root .note { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.5; max-width: 110ch; }
.viz-root .selchip {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: 2px;
  margin-left: 10px; padding: 2px 9px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--baseline);
}
.viz-root .selchip:hover { color: var(--text-primary); border-color: var(--muted); }
.viz-root .selchip .x { font-size: 11px; }
.viz-root .selchip[hidden] { display: none; }
.viz-root svg text { user-select: none; }
/* matrix card: mode toggle + per-domain profile bars */
.viz-root .mx-toggle { display: inline-flex; margin-left: 12px; vertical-align: 2px;
  border: 1px solid var(--baseline); border-radius: 8px; overflow: hidden; }
.viz-root .mx-toggle button {
  font: inherit; font-size: 12px; font-weight: 500; padding: 3px 10px; cursor: pointer;
  border: none; background: transparent; color: var(--text-secondary);
}
.viz-root .mx-toggle button + button { border-left: 1px solid var(--baseline); }
.viz-root .mx-toggle button.is-on { background: var(--seq-450); color: #fff; }
.viz-root .profile { column-count: 2; column-gap: 36px; margin-top: 4px; }
@media (max-width: 1000px) { .viz-root .profile { column-count: 1; } }
.viz-root .pgroup { break-inside: avoid; margin-bottom: 16px; }
.viz-root .prow { display: flex; align-items: center; gap: 10px; padding: 2.5px 4px; border-radius: 5px; }
.viz-root .prow[data-i] { cursor: pointer; }
.viz-root .prow[data-i]:hover { background: color-mix(in srgb, var(--series-1) 8%, transparent); }
.viz-root .phead { border-bottom: 1px solid var(--grid); padding-bottom: 4px; margin-bottom: 3px; }
.viz-root .phead .pname { font-weight: 650; font-size: 13px; }
.viz-root .pname { flex: 0 0 44%; font-size: 12.5px; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viz-root .phome { font-size: 10.5px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--baseline); border-radius: 999px; padding: 0 6px; margin-left: 6px; }
.viz-root .pbar { flex: 1 1 auto; height: 9px; border-radius: 4px;
  background: color-mix(in srgb, var(--grid) 55%, transparent); overflow: hidden; }
.viz-root .pbar > span { display: block; height: 100%; border-radius: 4px; }
.viz-root .pbar.pavg { height: 11px; }
.viz-root .pval { flex: 0 0 3.4em; text-align: right; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--text-secondary); }

.viz-root .howto { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 28px; }
@media (max-width: 900px) { .viz-root .howto { grid-template-columns: minmax(0, 1fr); } }
.viz-root .howto-item .howto-t { font-size: 13.5px; font-weight: 650; margin: 6px 0 2px; }
.viz-root .howto-item p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 8px; }
.viz-root .mapwrap { position: relative; }
/* Zoom readout + spread slider: opaque pills so they stay legible over bubbles */
.viz-root .mapctl {
  position: absolute; right: 10px; font-size: 12px; color: var(--muted);
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 9px;
  display: flex; align-items: center; gap: 6px;
}
.viz-root #mapreadout { font-variant-numeric: tabular-nums; }
.viz-root #map { display: block; width: 100%; height: auto; }
.viz-root .legend { display: flex; gap: 18px; align-items: center; font-size: 13px; color: var(--text-secondary); margin-top: 8px; }
.viz-root .legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.viz-root .heatwrap { overflow-x: auto; }
.viz-root .heatgrid {
  display: grid; grid-template-columns: 208px max-content 244px;
  grid-template-rows: auto auto; gap: 0 12px; align-items: start; min-width: 1284px;
}
.viz-root .heatcap {
  align-self: end; padding-bottom: 4px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.viz-root .heatcap-left { text-align: right; padding-right: 8px; }
.viz-root #heattop { position: relative; }
.viz-root #heattop .toplab {
  position: absolute; bottom: 8px; width: 12px;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 10.5px; color: var(--text-secondary); white-space: nowrap;
  cursor: pointer;
}
.viz-root #heatrows { position: relative; font-size: 10.5px; color: var(--text-secondary); }
.viz-root #heatrows .rowlab {
  position: absolute; left: 0; width: 100%; height: 12px; line-height: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.viz-root #heattop .toplab:hover, .viz-root #heatrows .rowlab:hover { color: var(--text-primary); }
.viz-root #heattop .toplab.is-sel, .viz-root #heatrows .rowlab.is-sel { color: var(--text-primary); font-weight: 700; }
.viz-root #heatlabels { font-size: 12px; color: var(--text-secondary); line-height: 1.2; position: relative; }
.viz-root #heat { display: block; }
.viz-root .gradlegend { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); margin: 4px 0 12px; }
.viz-root .gradbar { height: 8px; width: 180px; border-radius: 4px; border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--seq-100), var(--seq-250), var(--seq-400), var(--seq-550), var(--seq-700)); }
.viz-root #cloud { display: block; width: 100%; height: auto; border-radius: 6px; }
.viz-root #tooltip {
  position: fixed; pointer-events: none; z-index: 50; display: none;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  padding: 8px 11px; font-size: 13px; max-width: 320px; line-height: 1.5;
}
.viz-root #tooltip .t { font-weight: 650; }
.viz-root #tooltip .s { color: var(--text-secondary); }
.viz-root .shape-table { border-collapse: collapse; width: 100%; font-size: 13.5px; display: table; margin: 0; }
.viz-root .shape-table th { text-align: left; color: var(--text-secondary); font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--grid); padding: 6px 10px 6px 0; background: transparent; }
.viz-root .shape-table td { border-bottom: 1px solid var(--grid); padding: 6px 10px 6px 0; }
.viz-root .shape-table td.num, .viz-root .shape-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.viz-root .shape-table .rowsub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.viz-root .shape-table tbody tr { cursor: pointer; }
.viz-root .shape-table tbody tr:hover td { background: color-mix(in srgb, var(--series-1) 8%, transparent); }
.viz-root select {
  font: inherit; font-size: 13.5px; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--baseline); border-radius: 7px;
  padding: 4px 8px; margin-left: 8px; max-width: 100%;
}
/* Labels are informational only — without pointer-events:none a label that
   overlaps a bubble swallows its clicks and hover (found by headless test). */
.viz-root .clusterlabel { fill: var(--muted); font-size: 12px; letter-spacing: 0.08em; font-weight: 600; pointer-events: none; }
.viz-root .domlabel { fill: var(--text-secondary); font-size: 13px; pointer-events: none; }
.viz-root .footer { font-size: 13px; color: var(--muted); line-height: 1.55; max-width: 120ch; }
.viz-root code { font-size: 0.92em; }
