/*
 * Public pages (home, company, project) — sign-in-free reading pages.
 * Loaded after /static/tokens.css; every colour, font and radius below is a
 * tokens.css variable, except the five local stage-bar colours. Ported from the company-first mockup
 * (docs/superpowers/specs/2026-11-19-company-first-site-mockup.html).
 * Light theme only, like the rest of the site. One reading column, 1040px max.
 *
 * Sections: base / shell (header, footer) / page head / facts / blocks and
 * cells / sources / chips / feed / map / error. Add page-specific rules for the
 * company and home pages in their own section at the end.
 */

/* ---- local colours --------------------------------------------------- */

/* The home page's stage bar: one hue stepping dark to light, then a neutral
   grey for cancelled or delayed. tokens.css has no sequential ramp, so these
   five are local, taken from the mockup's --s1..--s5. */
:root {
  --stage-1: #1D4B5C;
  --stage-2: #2F7388;
  --stage-3: #6FA5B5;
  --stage-4: #B9D3DA;
  --stage-5: #A9AFB3;
}

/* ---- base ------------------------------------------------------------ */

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

body {
  margin: 0;
  background: var(--color-paper-tint);
  color: var(--color-ink-800);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--color-brand-700); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-brand-600);
  outline-offset: 2px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
  /* A long unbroken name or URL must not push the page wider than the screen. */
  overflow-wrap: anywhere;
}
h2 { margin: 0; font-size: var(--type-title-md-size); font-weight: var(--fw-semibold); }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---- shell: header and footer ---------------------------------------- */

header.top { background: var(--color-surface); border-bottom: 1px solid var(--color-line-200); }
header.top .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-7);
  padding-block: var(--space-4);
}

.brand {
  color: var(--color-ink-800);
  font-size: 16px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand span { color: var(--color-brand-600); }

.search { flex: 1 1 240px; min-width: 0; margin: 0; }
.search input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-line-200);
  border-radius: var(--radius-md);
  background: var(--color-paper-tint);
  color: var(--color-ink-800);
  font: inherit;
  font-size: var(--type-body-md-size);
}

nav.main { display: flex; flex-wrap: wrap; gap: 18px; font-size: var(--type-body-md-size); }
nav.main a { color: var(--color-steel-600); text-decoration: none; }
nav.main a:hover { color: var(--color-ink-800); }

main .wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding-block: 28px 56px;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-7);
  padding-block: var(--space-6) 40px;
  border-top: 1px solid var(--color-line-200);
  color: var(--color-steel-400);
  font-size: var(--type-body-sm-size);
}

/* ---- page head ------------------------------------------------------- */

.head { display: flex; flex-direction: column; gap: 10px; }
.crumb { color: var(--color-steel-400); font-size: var(--type-body-sm-size); }
.lede { margin: 0; max-width: 68ch; color: var(--color-steel-600); font-size: 17px; }
.aliases { margin: 0; color: var(--color-steel-400); font-size: var(--type-body-md-size); }

.companies {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.companies .role { color: var(--color-steel-400); font-size: var(--type-body-sm-size); }

/* ---- four facts ------------------------------------------------------ */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px 28px;
  margin: 0;
}
.facts > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-top: 10px;
  border-top: 2px solid var(--color-ink-800);
}
.facts dt { color: var(--color-steel-400); font-size: var(--type-body-sm-size); }
.facts dd {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.facts dd .cell-note, .facts dd .src { font-family: var(--font-sans); }
.facts dd .chip { align-self: flex-start; font-family: var(--font-sans); font-size: var(--type-body-md-size); }

/* ---- blocks and cells ------------------------------------------------ */

.sec { display: flex; flex-direction: column; gap: 14px; }
.sec-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-4); }
.sec-h small { color: var(--color-steel-400); font-size: var(--type-body-sm-size); }

.block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--color-line-200);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.block h2 {
  color: var(--color-steel-400);
  font-size: var(--type-title-sm-size);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.block.refused { border-left: 3px solid var(--color-brand-600); }

.cells {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 72ch;
  margin: 0;
  padding-left: 18px;
}
.cell-text { display: block; overflow-wrap: anywhere; }
.cell-note { display: block; color: var(--color-steel-400); font-size: 12.5px; overflow-wrap: anywhere; }
.empty { margin: 0; color: var(--color-steel-400); }

/* ---- sources --------------------------------------------------------- */

.src { display: block; color: var(--color-steel-400); font-size: 12.5px; overflow-wrap: anywhere; }

/* ---- stage chips ----------------------------------------------------- */

.chip {
  display: inline-block;
  padding: 1px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--type-caption-size);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.c-op { background: var(--color-positive-bg); color: var(--color-positive-text); }
.c-bd { background: var(--color-neutral-bg); color: var(--color-steel-600); }
.c-dis { background: var(--color-risk-bg); color: var(--color-risk-text); }
.c-pr { background: var(--color-warn-bg); color: var(--color-warn-text); }

/* ---- dated feed ------------------------------------------------------ */

.feed { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--color-line-200); }
.feed li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-line-100);
}
.feed time { padding-top: var(--space-1); color: var(--color-steel-400); font-family: var(--font-mono); font-size: 12.5px; }
.feed p { margin: 0; overflow-wrap: anywhere; }

/* ---- maps ------------------------------------------------------------ */

/* The three map containers (#home-map, #company-map, #site-map) are empty divs
   that MapLibre fills, so they need an explicit height. map.js reads the stage
   colours above (and --stage-none) with getComputedStyle, so the map's points
   and the stage bar share one set of colours. */
:root { --stage-none: var(--color-steel-400); }

.map-canvas {
  height: 320px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-neutral-bg);
}
#home-map { height: 420px; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-steel-600);
  font-size: var(--type-body-sm-size);
}
.map-legend li { display: flex; align-items: center; }
.map-legend li[hidden] { display: none; }
.map-legend .sw { width: 11px; height: 11px; border-radius: 50%; }
.sw-none { background: var(--stage-none); }
.sw-disputed { background: transparent; box-shadow: inset 0 0 0 2px var(--clay); }
.sw-county { background: transparent; box-shadow: inset 0 0 0 2px var(--color-steel-600); }

.map-popup { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-sans); font-size: var(--type-body-sm-size); }
.map-popup a { font-weight: var(--fw-semibold); }
.map-popup span { color: var(--color-steel-600); }

@media (max-width: 760px) {
  .map-canvas, #home-map { height: 300px; }
}

/* ---- error page ------------------------------------------------------ */

.error p { margin: 0; }

/* ---- company page ---------------------------------------------------- */

.tick {
  color: var(--color-steel-400);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: var(--fw-semibold);
}

/* Tables scroll inside their own wrapper; the page body never scrolls sideways. */
.tw {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-line-200);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.tw table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: var(--type-body-md-size);
}
.tw th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-line-200);
  color: var(--color-steel-400);
  font-size: var(--type-caption-size);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.tw td {
  padding: var(--space-4) 14px;
  border-bottom: 1px solid var(--color-line-100);
  vertical-align: top;
}
.tw tr:last-child td { border-bottom: 0; }
.tw th.r, .tw td.r { text-align: right; }
.tw td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tw td .sub { display: block; color: var(--color-steel-400); font-size: 12.5px; }

.money-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.concentration { margin: 0; max-width: 72ch; color: var(--color-steel-600); }

.feed .who { font-weight: var(--fw-semibold); }
.mw-by-stage { margin: var(--space-3) 0 0; color: var(--color-steel-400); font-size: var(--type-body-sm-size); }
.role { color: var(--color-steel-400); font-size: var(--type-body-sm-size); }

/* ---- home page ------------------------------------------------------- */

.eyebrow {
  margin: 0;
  color: var(--color-steel-400);
  font-family: var(--font-mono);
  font-size: var(--type-caption-size);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
}

/* Stage bar: segment widths come from inline flex values set by the server. */
.bar { display: flex; gap: 2px; height: 28px; }
.bar .seg { display: block; height: 100%; min-width: 6px; }
.bar .seg:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.bar .seg:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.bar .seg:only-child { border-radius: var(--radius-sm); }

.s1 { background: var(--stage-1); }
.s2 { background: var(--stage-2); }
.s3 { background: var(--stage-3); }
.s4 { background: var(--stage-4); }
.s5 { background: var(--stage-5); }

/* The legend is the readable text; the swatch is decoration. */
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legend li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--color-steel-600);
  font-size: var(--type-body-sm-size);
}
.legend b {
  color: var(--color-ink-800);
  font-family: var(--font-mono);
  font-size: var(--type-title-md-size);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}
.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: var(--radius-xs);
}

.two {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-8);
}

.tw .tick { font-size: 12.5px; }

/* ---- search ---------------------------------------------------------- */

.hits {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- alert requests -------------------------------------------------- */

.alert-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.alert-form label { flex: 1 0 100%; font-weight: var(--fw-semibold); }
.alert-form input[type="email"] {
  flex: 1 1 240px;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-line-200);
  border-radius: var(--radius-md);
  background: var(--color-paper-tint);
  color: var(--color-ink-800);
  font: inherit;
  font-size: var(--type-body-md-size);
}
.alert-form button {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-brand-600);
  border-radius: var(--radius-md);
  background: var(--color-brand-600);
  color: var(--color-surface);
  font: inherit;
  font-size: var(--type-body-md-size);
  cursor: pointer;
}
.alert-note { margin: 0; color: var(--color-steel-400); font-size: 12.5px; }

/* The honeypot: off screen for sighted users, aria-hidden for assistive tech. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- narrow screens -------------------------------------------------- */

@media (max-width: 760px) {
  h1 { font-size: 25px; }
  .feed li { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
  .two { grid-template-columns: minmax(0, 1fr); }
}
