/* One stylesheet, no build step and no CDN: the site is committed, so a
   reader loading it from a checkout gets the same page CI rendered. */
:root {
  --ink: #14181d; --muted: #5b6672; --rule: #dfe4ea; --bg: #fff; --panel: #f7f9fb;
  --causal: #1a6b3c; --causal-bg: #e8f4ec;
  --weak: #8a5a00; --weak-bg: #fdf3e0;
  --link: #0b5fa5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e9ed; --muted: #9aa5b1; --rule: #2b3138; --bg: #14181d; --panel: #1b2027;
    --causal: #7ed4a1; --causal-bg: #17301f; --weak: #e5b567; --weak-bg: #2e2413;
    --link: #79b8f3;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
.wrap { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { padding-bottom: .9rem; display: flex; gap: 1rem;
                    align-items: baseline; flex-wrap: wrap; }
header.site a.home { font-weight: 700; text-decoration: none; color: var(--ink); }
header.site nav { margin-left: auto; display: flex; gap: .9rem; flex-wrap: wrap; }
h1 { font-size: 1.6rem; margin: 1.2rem 0 .2rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 .5rem; padding-bottom: .3rem;
     border-bottom: 1px solid var(--rule); }
.sub { color: var(--muted); margin: 0 0 1rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; }
table { border-collapse: collapse; width: 100%; margin: .4rem 0 1rem; }
th, td { text-align: left; padding: .42rem .6rem; border-bottom: 1px solid var(--rule);
         vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.scroll { overflow-x: auto; }
.tag { display: inline-block; padding: .08rem .45rem; border-radius: .7rem;
       font-size: .76rem; border: 1px solid var(--rule); background: var(--panel);
       color: var(--muted); white-space: nowrap; }
.tag.causal { color: var(--causal); background: var(--causal-bg); border-color: transparent; }
.tag.weak { color: var(--weak); background: var(--weak-bg); border-color: transparent; }
.note { background: var(--panel); border-left: 3px solid var(--rule);
        padding: .7rem .9rem; margin: .8rem 0; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.card { border: 1px solid var(--rule); border-radius: .5rem; padding: .75rem .9rem; }
.card a { text-decoration: none; font-weight: 600; }
.card .count { color: var(--muted); font-size: .85rem; }
ul.records { list-style: none; padding: 0; margin: 0; columns: 2; }
ul.records li { break-inside: avoid; padding: .12rem 0; }
@media (max-width: 40rem) { ul.records { columns: 1; } }
footer.site { border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem; }

/* --- Structure map (ported from the fleet; see chemical_map.js) --- */
.map-page-wrap { max-width: 92rem; }
.map-controls {
  align-items: end;
  display: grid;
  gap: .8rem;
  grid-template-columns: minmax(14rem, 2fr) minmax(12rem, 1fr) minmax(12rem, 1fr) auto;
  margin: 1.4rem 0 .8rem;
}
.map-controls label {
  display: grid;
  font-size: .84rem;
  font-weight: 700;
  gap: .25rem;
}
.map-controls input,
.map-controls select,
.map-controls button {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: .35rem;
  color: var(--fg);
  font: inherit;
  min-height: 2.65rem;
  padding: .45rem .55rem;
}
.map-controls button {
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  font-weight: 700;
}
.map-status {
  font-size: .9rem;
  margin: .6rem 0;
}
.map-status.error { color: var(--danger); font-weight: 700; }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  font-size: .75rem;
  gap: .35rem .8rem;
  margin: .45rem 0 .8rem;
  min-height: 1.4rem;
}
.map-legend span { align-items: center; display: inline-flex; gap: .3rem; }
.map-legend i {
  border: 1px solid rgb(0 0 0 / .25);
  border-radius: 50%;
  display: inline-block;
  height: .65rem;
  width: .65rem;
}
.map-stage {
  min-width: 0;
  position: relative;
}
#map-canvas {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: .45rem;
  display: block;
  height: 620px;
  width: 100%;
}
.map-tooltip {
  /* The tooltip paints its OWN dark background, so its text cannot be keyed to
     the page's. `color: var(--bg)` gave white-on-dark in light mode and
     #211e16-on-#17202a in dark mode — a contrast ratio of 1.01:1, which renders
     as a visible box with no readable text. Both colours are fixed here because
     both belong to this component, not to the theme. */
  background: var(--tooltip-bg);
  border-radius: .3rem;
  color: var(--tooltip-fg);
  font-size: .75rem;
  max-width: 18rem;
  padding: .35rem .5rem;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}
.map-details {
  align-content: start;
  display: grid;
  gap: 1rem;
  max-height: 620px;
  overflow: auto;
}
.map-details > div {
  border: 1px solid #d8d0c2;
  border-radius: .45rem;
  padding: .75rem;
}
.map-details h2 { font-size: 1.05rem; margin: 0 0 .45rem; }
.map-details h3 { font-size: .9rem; margin: 1rem 0 .35rem; }
.map-details code {
  display: block;
  font-size: .72rem;
  max-height: 6rem;
  overflow-wrap: anywhere;
  overflow-y: auto;
  padding: .45rem;
}
.map-badges { display: flex; flex-wrap: wrap; gap: .3rem; }
.map-results,
.map-neighbors { margin: 0; padding-left: 1.4rem; }
.map-results li,
.map-neighbors li { margin: .25rem 0; }
.map-results button,
.map-neighbor-select {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}
.map-results span,
.map-neighbors span {
  color: var(--muted);
  display: block;
  font-size: .72rem;
}
.map-method { margin-top: 1.2rem; }
.map-method summary { cursor: pointer; font-weight: 700; }
@media (max-width: 850px) {
  .map-controls { grid-template-columns: 1fr 1fr; }
  .chemical-map-layout { grid-template-columns: 1fr; }
  .map-details { max-height: none; }
  #map-canvas { height: 520px; }
}
#map-controls { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
#map-controls .legend { cursor: pointer; border: 1px solid transparent; }
#map-controls .legend::before {
  content: ""; display: inline-block; width: .6rem; height: .6rem;
  border-radius: 50%; background: var(--dot); margin-right: .35rem;
}
#map-controls .legend.off { opacity: .4; text-decoration: line-through; }
#corpus-map { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
figure { margin: 0; }

/* --- Corpus map (text embeddings; see map.html) --- */
.lede { font-size: 1.05rem; color: var(--ink); margin: .3rem 0 .8rem; }
.meta { color: var(--muted); font-size: .88rem; margin: .5rem 0; }
#map-controls { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0; }
.pill { font: inherit; font-size: .8rem; padding: .2rem .6rem; border-radius: 1rem;
        border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
        cursor: pointer; }
.pill[aria-pressed="false"] { opacity: .38; }
.pill .swatch { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%;
                margin-right: .35rem; vertical-align: baseline; }
#corpus-map { margin: 0; }
#corpus-map canvas { width: 100%; height: auto; max-width: 100%;
                     border: 1px solid var(--rule); border-radius: .5rem;
                     background: var(--panel); touch-action: none; }
#map-hover { min-height: 1.4em; }
