/* Relay v4: the Builders Map (the map itself, and its city and sector pages). Uses the tokens and the
   five type sizes in v4.css; nothing here adds a font size. Category colors keep their seven named
   families, a step deeper in light mode so they read on Stone. Built by scripts/build_v4_map.py. */

:root {
  /* the seven families, as named in the legend */
  --fam-air:#2F6FC4; --fam-def:#B8323A; --fam-nrg:#A86A12; --fam-sw:#1F8463; --fam-ro:#6E4FC2; --fam-ind:#8A7550; --fam-bio:#B8406F;
  /* Wire story types; investors and the Wire use the funding and milestone colors on the map */
  --type-funding:#2E8048; --type-defense:#B8323A; --type-policy:#5B52B8; --type-milestone:#2468B8; --type-news:#75706A;
  --vc:#2E8048; --wire:#2468B8;
  /* the map: a light paper land on slightly darker water */
  --map-water:#E1E1DC; --map-nb:#E8E8E4; --map-land:#F5F5F2; --map-line:#0F0F10; --map-line-k:1.4; --map-river:#8FA3B0;
  --map-place:rgba(15,15,16,.4); --map-halo:#F5F5F2; --map-lab-bg:rgba(238,238,235,.85);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --fam-air:#5B9BF0; --fam-def:#E0444C; --fam-nrg:#E8A33D; --fam-sw:#3FB68B; --fam-ro:#A585F2; --fam-ind:#CBB68C; --fam-bio:#E86FA0;
  --type-funding:#4FA86B; --type-defense:#E24B4A; --type-policy:#7F77DD; --type-milestone:#378ADD; --type-news:#A89E94;
  --vc:#4FA86B; --wire:#378ADD;
  --map-water:#0A0A0B; --map-nb:#141416; --map-land:#1C1C1F; --map-line:#F6F6F4; --map-line-k:1; --map-river:#5E7280;
  --map-place:rgba(246,246,244,.34); --map-halo:#0F0F10; --map-lab-bg:rgba(15,15,16,.78); } }
:root[data-theme="dark"] {
  --fam-air:#5B9BF0; --fam-def:#E0444C; --fam-nrg:#E8A33D; --fam-sw:#3FB68B; --fam-ro:#A585F2; --fam-ind:#CBB68C; --fam-bio:#E86FA0;
  --type-funding:#4FA86B; --type-defense:#E24B4A; --type-policy:#7F77DD; --type-milestone:#378ADD; --type-news:#A89E94;
  --vc:#4FA86B; --wire:#378ADD;
  --map-water:#0A0A0B; --map-nb:#141416; --map-land:#1C1C1F; --map-line:#F6F6F4; --map-line-k:1; --map-river:#5E7280;
  --map-place:rgba(246,246,244,.34); --map-halo:#0F0F10; --map-lab-bg:rgba(15,15,16,.78); }

/* ── THE MAP: a directory panel on the left, the map on the right; one screen, no page scroll ── */
body.map-app { overflow:hidden; }
.xp { position:fixed; left:0; right:0; bottom:0; top:calc(var(--bar) + env(safe-area-inset-top, 0px)); display:grid; grid-template-columns:440px minmax(0,1fr); }
.panel { position:relative; min-width:0; min-height:0; display:flex; flex-direction:column; border-right:1px solid var(--line); background:var(--bg); }
.mapcol { position:relative; min-height:0; overflow:hidden; }
#map { position:absolute; inset:0; background:var(--map-water); }

/* panel head: title, links to the city and sector pages, then the three tabs */
.ph { padding:28px 24px 0; flex-shrink:0; }
.ph-top { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
h1.title { font-size:var(--fs-xl); line-height:1.2; letter-spacing:-.01em; font-weight:600; }
.browse { display:flex; gap:20px; }
.browse a { font-size:var(--fs-s); font-weight:500; text-decoration:none; white-space:nowrap; }
.browse a span { color:var(--sub); font-weight:400; margin-left:5px; }
.browse a:hover { text-decoration:underline; text-underline-offset:5px; text-decoration-thickness:1px; }
.tabs { display:flex; margin-top:18px; border-bottom:1px solid var(--line); }
.tab { flex:1; font:inherit; font-size:var(--fs-s); font-weight:500; text-align:center; background:none; border:0; color:var(--sub); padding:12px 4px 11px; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; }
.tab:hover { color:var(--fg); }
.tab.active { color:var(--fg); border-bottom-color:var(--spark); }
/* each tab underlines in the color its pins use on the map */
.tab.active[data-tab="vcs"] { border-bottom-color:var(--vc); }
.tab.active[data-tab="wire"] { border-bottom-color:var(--wire); }
.tab .n { font-weight:400; color:var(--sub); margin-left:6px; }

/* search and filters */
.ctl { padding:14px 24px 12px; flex-shrink:0; border-bottom:1px solid var(--line); }
.search { position:relative; color:var(--sub); }
.search svg { position:absolute; left:12px; top:50%; transform:translateY(-50%); }
.search svg circle, .search svg line { stroke:currentColor; }
#q { width:100%; padding:10px 12px 10px 36px; font:inherit; font-size:var(--fs-s); background:var(--fig-bg); border:1px solid transparent; border-radius:0; color:var(--fg); outline:none; -webkit-appearance:none; appearance:none; }
#q:focus { border-color:var(--fg); }
#q::placeholder { color:var(--sub); }
.chips { display:flex; flex-wrap:wrap; gap:6px; padding-top:12px; }
.chip { font:inherit; font-size:var(--fs-s); white-space:nowrap; padding:5px 10px; background:none; border:1px solid var(--line); border-radius:0; color:var(--sub); cursor:pointer; display:inline-flex; align-items:center; gap:7px; }
.chip:hover { color:var(--fg); border-color:var(--sub); }
.chip[aria-pressed="true"] { border-color:currentColor; background:var(--fig-bg); }
.chip .dot { width:7px; height:7px; border-radius:50%; }
.chip.more { border-style:dashed; }
.chips .chip.extra { display:none; }
.chips.expanded .chip.extra { display:inline-flex; }
.status { display:none; align-items:center; justify-content:space-between; gap:8px; margin-top:12px; font-size:var(--fs-xs); letter-spacing:.12em; text-transform:uppercase; font-weight:500; color:var(--sub); }
.status.on { display:flex; }
.status .left { display:flex; align-items:center; gap:10px; min-width:0; }
.status b { color:var(--fg); font-weight:600; }
.active-filters { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.af, .clear { font:inherit; letter-spacing:inherit; text-transform:inherit; cursor:pointer; border-radius:0; }
.af { background:var(--fg); color:var(--bg); border:0; padding:3px 7px; }
.af.ghost { background:none; color:var(--fg); border:1px solid var(--line); }
.clear { background:none; border:0; padding:0; color:var(--spark); }
.fix { color:var(--sub); text-decoration:underline; text-underline-offset:3px; text-decoration-thickness:1px; }
.fix:hover { color:var(--fg); }

/* the list: name and place, then categories in their colors */
.list { flex:1; min-height:0; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
.row { display:block; width:100%; padding:14px 24px; border:0; border-bottom:1px solid var(--line); background:none; color:inherit; font:inherit; text-align:left; cursor:pointer; }
.row:hover, .row:focus-visible, .row.hot { background:var(--fig-bg); outline:none; }
.row .top { display:flex; align-items:baseline; gap:12px; }
.row .nm { flex:1; min-width:0; font-size:var(--fs-m); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row .where { flex-shrink:0; max-width:45%; font-size:var(--fs-s); color:var(--sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row .cats { display:block; margin-top:3px; font-size:var(--fs-s); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row .cats .sep, .near .cats .sep, .dmeta .sep, .dcats .sep { color:var(--sub); margin:0 6px; }
.dmeta .sep, .dcats .sep { margin:0; }
/* the latest Wire story, above the list on the landing view */
.peek { display:block; width:100%; padding:16px 24px 17px 22px; border:0; border-left:2px solid var(--spark); border-bottom:1px solid var(--line); background:var(--fig-bg); color:inherit; font:inherit; text-align:left; cursor:pointer; }
.peek-h { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:6px; font-size:var(--fs-xs); letter-spacing:.12em; text-transform:uppercase; font-weight:500; color:var(--spark); }
.peek-h .all { color:var(--sub); }
.peek:hover .all { color:var(--fg); }
.pk-hl { font-size:var(--fs-m); font-weight:600; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.wrow.flash { animation:flash 1.6s ease; }
@keyframes flash { 0%, 40% { background:var(--fig-bg); } 100% { background:transparent; } }
.empty { padding:40px 24px; text-align:center; color:var(--sub); }
.submit { padding:20px 24px 32px; font-size:var(--fs-s); color:var(--sub); }
.submit a { color:var(--fg); text-underline-offset:4px; text-decoration-thickness:1px; }

/* Wire stories */
.wrow { display:block; padding:16px 24px; border-bottom:1px solid var(--line); text-decoration:none; color:inherit; }
.wrow:hover { background:var(--fig-bg); }
.whl { font-size:var(--fs-m); font-weight:600; line-height:1.35; }
.wmeta { display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-top:5px; font-size:var(--fs-s); color:var(--sub); }
.wmeta .wt { font-weight:500; }
.wco { font:inherit; background:none; border:0; padding:0; color:var(--sub); cursor:pointer; white-space:nowrap; }
.wco:hover { color:var(--fg); }

/* the company / investor panel, sliding over the list */
.drawer { position:absolute; inset:0; z-index:5; display:flex; flex-direction:column; background:var(--bg); transform:translateX(-100%); visibility:hidden; transition:transform .25s ease, visibility 0s linear .25s; }
.drawer.open { transform:none; visibility:visible; transition:transform .25s ease; }
.dh { padding:16px 24px; border-bottom:1px solid var(--line); flex-shrink:0; }
.back { font:inherit; font-size:var(--fs-xs); letter-spacing:.12em; text-transform:uppercase; font-weight:500; background:none; border:0; padding:0; color:var(--sub); cursor:pointer; }
.back:hover { color:var(--fg); }
.db { flex:1; overflow-y:auto; padding:28px 24px 44px; }
.dname { font-size:var(--fs-xl); line-height:1.2; letter-spacing:-.01em; font-weight:600; }
.dmeta { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 8px; margin-top:10px; font-size:var(--fs-s); color:var(--sub); }
.dmeta .k { color:var(--fg); }
.city-link { font:inherit; background:none; border:0; padding:0; color:inherit; cursor:pointer; text-decoration:underline; text-decoration-color:var(--line); text-underline-offset:4px; text-decoration-thickness:1px; }
.city-link:hover { color:var(--fg); text-decoration-color:currentColor; }
.dcats { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 8px; margin-top:6px; font-size:var(--fs-s); }
.dcats button { font:inherit; background:none; border:0; padding:0; color:inherit; cursor:pointer; }
.dcats button:hover { text-decoration:underline; text-underline-offset:4px; }
.desc { margin-top:18px; line-height:1.6; }
/* Visit site: a text link with a drawn arrow, never a button */
.visit { display:inline-flex; align-items:center; gap:.45em; margin-top:18px; font-weight:500; text-decoration:none; border-bottom:1px solid currentColor; padding-bottom:3px; }
.visit svg { color:var(--spark); }
.dsec { margin-top:40px; }
.dsec h3 { display:flex; justify-content:space-between; align-items:baseline; gap:10px; font-size:var(--fs-m); font-weight:600; padding-bottom:10px; border-bottom:1px solid var(--line); }
.dsec h3 a { font-size:var(--fs-s); font-weight:500; color:var(--sub); text-decoration:none; }
.dsec h3 a:hover { color:var(--fg); }
.near { display:block; width:100%; padding:12px 0; border:0; border-bottom:1px solid var(--line); background:none; color:inherit; font:inherit; font-weight:500; text-align:left; cursor:pointer; }
.near:hover { color:var(--sub); }
.near .where { float:right; margin-left:10px; font-size:var(--fs-s); font-weight:400; color:var(--sub); }
.near .cats { display:block; margin-top:2px; font-size:var(--fs-s); font-weight:400; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dnews { display:block; padding:12px 0; border-bottom:1px solid var(--line); text-decoration:none; }
.dnews .h { font-weight:500; line-height:1.4; }
.dnews:hover .h { color:var(--sub); }
.dnews .m { margin-top:4px; font-size:var(--fs-s); color:var(--sub); }
.vchips { display:flex; flex-wrap:wrap; gap:6px; padding-top:12px; }
.vchip { font:inherit; font-size:var(--fs-s); background:none; border:1px solid var(--line); border-radius:0; color:var(--fg); padding:6px 11px; cursor:pointer; }
.vchip:hover { border-color:var(--fg); }
.pf-sum { margin:12px 0 8px; font-size:var(--fs-s); color:var(--sub); }
.pf-row { display:grid; grid-template-columns:120px 1fr 28px; align-items:center; gap:10px; padding:4px 0; font-size:var(--fs-s); color:var(--sub); }
.pf-bar { height:6px; background:var(--fig-bg); }
.pf-bar i { display:block; height:100%; }
.pf-n { text-align:right; }
.site { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); }
.site i { flex-shrink:0; width:11px; height:11px; border-radius:50%; box-sizing:border-box; }
.site i.hq { background:var(--c); }
.site i.other { border:2.5px solid var(--c); }
.site b { font-weight:600; min-width:96px; }
.site .city-link { color:var(--sub); }
.dfoot { display:flex; justify-content:space-between; gap:12px; margin-top:44px; padding-top:14px; border-top:1px solid var(--line); font-size:var(--fs-s); color:var(--sub); }

/* the map: our own US outline in the page's colors (no third-party tiles) */
.leaflet-container { background:var(--map-water) !important; font-family:var(--sans) !important; }
.leaflet-control-zoom { border:0 !important; box-shadow:none !important; }
.leaflet-control-zoom a { background:var(--bg) !important; color:var(--fg) !important; border:1px solid var(--line) !important; border-radius:0 !important; }
.leaflet-control-zoom a + a { border-top:0 !important; }
.leaflet-control-attribution { background:var(--map-lab-bg) !important; color:var(--sub) !important; font-size:var(--fs-xs) !important; }
/* national view: one bubble per metro, its count inside */
.bub { display:flex; align-items:center; justify-content:center; border-radius:50%; box-sizing:border-box; background:var(--c); border:1px solid var(--c); opacity:.85; cursor:pointer;
  font-size:var(--fs-xs); font-weight:600; color:var(--ink, #0F0F10); transition:opacity .15s, transform .15s, box-shadow .15s; }
.bub:hover, .bub.hot { opacity:1; transform:scale(1.12); box-shadow:0 0 0 3px color-mix(in srgb, var(--fg) 30%, transparent); }
.bub.sel { opacity:1; box-shadow:0 0 0 3px var(--fg); }
.bub.dim { opacity:.22; }
.bw { position:relative; display:flex; align-items:center; justify-content:center; width:100%; height:100%; }
.mlab { display:none; position:absolute; top:100%; left:50%; transform:translateX(-50%); margin-top:4px; padding:1px 5px; white-space:nowrap; pointer-events:none;
  background:var(--map-lab-bg); font-size:var(--fs-xs); letter-spacing:.1em; text-transform:uppercase; font-weight:500; color:var(--fg); }
.show-labels .mlab { display:block; }
.mlab.at-above { top:auto; bottom:100%; margin:0 0 4px; }
.mlab.at-right { top:50%; left:100%; transform:translateY(-50%); margin:0 0 0 5px; }
.mlab.at-left { top:50%; left:auto; right:100%; transform:translateY(-50%); margin:0 5px 0 0; }
.plab { width:0; height:0; }
.plab span { position:absolute; transform:translate(-50%,-50%); white-space:nowrap; font-size:var(--fs-xs); color:var(--map-place); text-shadow:0 0 3px var(--map-halo), 0 0 3px var(--map-halo); }
/* a selected company with several sites: the bubbles step back and its sites draw on top */
.footprint .bub { opacity:.18; }
.footprint .bub.sel { box-shadow:none; }
.footprint .bub.sel + .mlab { display:none; }
.fp { position:relative; width:100%; height:100%; border-radius:50%; box-sizing:border-box; }
.fp.fp-hq { background:var(--c); box-shadow:0 0 0 3px var(--fg); }
.fp.fp-site { background:var(--map-land); border:3px solid var(--c); }
.fp span { position:absolute; left:50%; top:100%; transform:translateX(-50%); margin-top:5px; padding:1px 5px; white-space:nowrap; pointer-events:none;
  background:var(--map-lab-bg); font-size:var(--fs-xs); letter-spacing:.1em; text-transform:uppercase; font-weight:500; color:var(--fg); }

/* phones and small tablets: the list and the map are two screens, swapped with one control at the bottom */
.mtoggle { display:none; }
@media (max-width:900px) {
  .chips { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
  .chips::-webkit-scrollbar { display:none; }
  .chips .chip.extra { display:inline-flex; }
  .chip.more { display:none; }
  .xp { grid-template-columns:minmax(0,1fr); }
  .panel { border-right:0; }
  .mapcol { position:absolute; inset:0; z-index:4; visibility:hidden; }
  .xp.show-map .mapcol { visibility:visible; }
  .xp.show-map .panel, .xp.show-map .drawer.open { visibility:hidden; }
  .mtoggle { display:block; position:fixed; z-index:20; left:50%; transform:translateX(-50%); bottom:calc(18px + env(safe-area-inset-bottom, 0px));
    max-width:min(78vw, 340px); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:center; cursor:pointer;
    font:inherit; font-size:var(--fs-xs); letter-spacing:.12em; text-transform:uppercase; font-weight:600; background:var(--fg); color:var(--bg); border:0; border-radius:0; padding:13px 22px; }
  .ph { padding:20px 16px 0; }
  .ctl { padding:12px 16px 10px; }
  .row, .peek, .wrow, .dh, .db, .submit, .empty { padding-left:16px; padding-right:16px; }
  .peek { padding-left:14px; }
  .list { padding-bottom:76px; }
  .browse { gap:14px; }
}
@media (prefers-reduced-motion:reduce) { .drawer { transition:none; } .bub { transition:none; } }

/* ── CITY AND SECTOR PAGES ── */
.bp { padding-top:40px; padding-bottom:24px; }
.crumb { font-size:var(--fs-xs); letter-spacing:.12em; text-transform:uppercase; font-weight:500; color:var(--sub); }
.crumb a { color:var(--sub); text-decoration:none; }
.crumb a:hover { color:var(--fg); }
.crumb span { margin:0 8px; opacity:.6; }
h1.bp-h { margin-top:12px; font-size:var(--fs-xl); line-height:1.2; letter-spacing:-.01em; font-weight:600; }
.bp-stats { margin-top:8px; font-size:var(--fs-l); line-height:1.45; color:var(--sub); }
.bp-stats b { color:var(--fg); font-weight:600; }
.bp-intro { margin-top:16px; max-width:40em; font-size:var(--fs-l); line-height:1.45; }
.bp-open { margin-top:24px; }
.bp-sec { margin-top:80px; }
.bp-sec > h2 { font-size:var(--fs-xl); line-height:1.2; letter-spacing:-.01em; font-weight:600; padding-bottom:16px; border-bottom:1px solid var(--line); margin-bottom:24px; }
/* investor chips */
.bp .chips { padding-top:0; }
.bp .chip { color:var(--fg); text-decoration:none; }
.bp .chip:hover { border-color:var(--fg); }
/* companies: a box each, name and place, categories in their colors, one line under */
.co { display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap:12px; }
.co-card { display:block; padding:20px 22px 22px; background:var(--fig-bg); text-decoration:none; color:inherit; }
.co-card:hover .co-n { text-decoration:underline; text-underline-offset:5px; text-decoration-thickness:1px; }
.co-top { display:flex; align-items:baseline; gap:12px; }
.co-n { flex:1; min-width:0; font-weight:600; }
.co-w { flex-shrink:0; font-size:var(--fs-s); color:var(--sub); }
.co-c { margin-top:3px; font-size:var(--fs-s); }
.co-c i { font-style:normal; color:var(--sub); margin:0 6px; }
.co-d { margin-top:8px; font-size:var(--fs-s); color:var(--sub); line-height:1.5; }
/* the mix: a bar per sector (or metro), each opening the map filtered to it */
.bars { display:grid; gap:10px; max-width:760px; }
.bar-row { display:grid; grid-template-columns:200px 1fr 36px; align-items:center; gap:14px; }
.bar-row a, .bar-row span.l { text-decoration:none; }
.bar-row a:hover { text-decoration:underline; text-underline-offset:5px; text-decoration-thickness:1px; }
.bar-row .t { height:8px; background:var(--fig-bg); }
.bar-row .t i { display:block; height:100%; }
.bar-row .n { text-align:right; font-size:var(--fs-s); color:var(--sub); }
/* recent Wire stories */
.news { display:grid; max-width:820px; }
.story { display:block; padding:16px 0; border-bottom:1px solid var(--line); text-decoration:none; color:inherit; }
.story:first-child { padding-top:0; }
.story:hover .s-h { text-decoration:underline; text-underline-offset:5px; text-decoration-thickness:1px; }
.s-h { font-weight:600; line-height:1.4; }
.s-top { display:flex; flex-wrap:wrap; gap:8px; align-items:baseline; margin-top:5px; font-size:var(--fs-s); color:var(--sub); }
.s-tag { font-weight:500; }
/* the Cities and Sectors indexes */
.idx { display:grid; grid-template-columns:repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap:12px; }
.idx a { display:flex; justify-content:space-between; align-items:baseline; gap:12px; padding:18px 20px; background:var(--fig-bg); text-decoration:none; font-size:var(--fs-l); font-weight:600; }
.idx a:hover { text-decoration:underline; text-underline-offset:5px; text-decoration-thickness:1px; }
.idx a span { font-size:var(--fs-s); font-weight:400; color:var(--sub); }
.bp > .bp-sec:first-of-type { margin-top:56px; }
.fam { margin-top:56px; }
.fam h3 { display:flex; align-items:center; gap:10px; margin-bottom:16px; font-size:var(--fs-l); font-weight:600; }
.fam h3 i { width:9px; height:9px; border-radius:50%; display:inline-block; }
@media (max-width:820px) {
  .bp { padding-top:32px; }
  .bp-sec { margin-top:64px; }
  .bar-row { grid-template-columns:minmax(0,130px) 1fr 30px; gap:10px; }
  .co-top { flex-wrap:wrap; gap:2px 12px; }
}
