/* God's-Eye supply-chain map — page-specific rules only.
   Tokens, nav, buttons, tables and the footer come from /site-assets/site.css. */

.below-nav { padding-top: var(--nav-h); }

/* ------------------------------------------------------------------ layout */
.map-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: var(--s8);
  align-items: start;
}
@media (max-width: 1000px) { .map-layout { grid-template-columns: 1fr; } }
.map-layout > *, .map-controls fieldset, .map-controls .field { min-width: 0; }

.map-controls { position: sticky; top: calc(var(--nav-h) + var(--s5)); }
@media (max-width: 1000px) { .map-controls { position: static; } }

.map-controls fieldset { border: 0; margin-bottom: var(--s7); }
.map-controls legend {
  font-family: var(--font-serif); font-size: var(--t-h3);
  margin-bottom: var(--s4); padding: 0;
}
.map-controls select { width: 100%; }
.map-controls select,
.map-controls input[type="text"] {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: var(--t-body);
}

.check-row { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-body); }
.check-row input { margin-top: 3px; flex: none; }

/* ------------------------------------------------------------------ layers */
.layer-set { border: 0; padding: 0; margin: 0 0 var(--s7); }
.layer-set legend {
  font-family: var(--font-serif); font-size: var(--t-h3);
  margin-bottom: var(--s3); padding: 0;
}
.layer-set .check-row { margin-bottom: var(--s3); }
.layer-set .field-help { display: block; margin-bottom: var(--s4); }
.layer-scope {
  display: inline-block; margin-left: 4px;
  font-size: var(--t-fine); color: var(--ink-soft); white-space: nowrap;
}
.layer-note { margin-top: var(--s3); color: var(--ink-soft); line-height: 1.6; }

/* ------------------------------------------------------------- view switch */
.view-switch { display: flex; gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; }
.view-switch button {
  flex: 1; padding: 9px 14px; background: var(--surface); color: var(--ink-light);
  font-size: var(--t-body); font-weight: 500; min-height: 40px;
}
.view-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; margin-bottom: var(--s4); }
.view-head .view-switch { flex: 0 0 auto; min-width: 330px; }
.view-tools { display: flex; gap: var(--s3); flex-wrap: wrap; }

/* ------------------------------------------------------------------ canvas */
.stage {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  height: 560px;
}
@media (max-width: 700px) { .stage { height: 420px; } }

.stage-pane { position: absolute; inset: 0; }
.stage-pane[hidden] { display: none; }
#globe-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
#network-pane { overflow: hidden; }
.street-mount { width: 100%; height: 100%; overflow: hidden; border-radius: var(--radius); }

.stage-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: var(--s8); text-align: center; background: var(--surface);
  font-size: var(--t-body); color: var(--ink-light); line-height: 1.7;
}
.stage-status[hidden] { display: none; }

.map-tooltip {
  position: fixed; z-index: 90; pointer-events: none;
  max-width: 260px; padding: 8px 10px;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  font-size: var(--t-fine); line-height: 1.5;
}
.map-tooltip[hidden] { display: none; }
.map-tooltip b { display: block; font-weight: 600; }

.stage-caption { font-size: var(--t-fine); color: var(--ink-soft); margin-top: var(--s3); line-height: 1.6; }

/* ------------------------------------------------------------------ legend */
.legend { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); margin-top: var(--s5); list-style: none; padding: 0; }
.legend li { font-size: var(--t-fine); color: var(--ink-light); display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.25); flex: none; }

/* ------------------------------------------------------------------ search */
.search-wrap { position: relative; }
.firm-list {
  list-style: none; margin: var(--s3) 0 0; padding: 0;
  max-height: 230px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.firm-list li {
  padding: 7px 10px; font-size: var(--t-fine); line-height: 1.45; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.firm-list li:last-child { border-bottom: 0; }
.firm-list li[aria-selected="true"], .firm-list li:hover { background: var(--tag-bg); }
.firm-list li[aria-selected="true"] { border-left: 3px solid var(--accent); padding-left: 7px; }
.firm-list li[aria-selected="true"] .firm-name::after {
  content: ' ✓'; color: var(--accent); font-weight: 600;
}
.firm-list li.is-active { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.firm-list .firm-name { font-weight: 500; color: var(--ink); }
.firm-list .firm-meta { color: var(--ink-soft); }
.firm-list .firm-unlinked { color: var(--flat-ink); font-style: italic; }

/* ------------------------------------------------------------------- chips */
.chip-wrap { margin-top: var(--s5); }
.chip-title { font-size: var(--t-fine); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: var(--s3); }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 9px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--tag-bg); font-size: var(--t-fine); line-height: 1.4;
  max-width: 100%;
}
.chip-label { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.chip-flag { color: var(--ink-soft); font-style: italic; }
.chip-remove {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-light);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.chip-remove:hover, .chip-remove:focus-visible { background: var(--surface); color: var(--ink); }

/* --------------------------------------------------- selected-company facts */
.selected-facts { list-style: none; margin: var(--s3) 0 var(--s4); padding: 0; }
.selected-facts li { font-size: var(--t-fine); color: var(--ink-light); line-height: 1.6; margin-bottom: var(--s2); overflow-wrap: anywhere; }
.selected-facts .firm-name { font-weight: 600; color: var(--ink); }
.selected-facts .firm-meta { color: var(--ink-soft); }

/* --------------------------------------------------------------- evidence */
.evidence { margin-top: var(--s8); }
.evidence-empty { font-size: var(--t-body); color: var(--ink-light); line-height: 1.7; }
.evidence-firm { border-bottom: 1px solid var(--border); padding-bottom: var(--s5); margin-bottom: var(--s5); }
.evidence-firm h3 { font-size: var(--t-h3); margin-bottom: var(--s2); }

.edge-card { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s4); background: var(--surface); }
.edge-card h4 { font-size: var(--t-base); font-family: var(--font-sans); font-weight: 600; margin-bottom: var(--s3); line-height: 1.5; }
.edge-quote {
  border-left: 3px solid var(--accent-light); padding: 2px 0 2px var(--s4);
  margin: var(--s3) 0; font-size: var(--t-body); color: var(--ink-light); line-height: 1.7;
}
.edge-facts { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s5); font-size: var(--t-fine); margin: 0; }
.edge-facts dt { color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.edge-facts dd { color: var(--ink-light); margin: 0; word-break: break-word; }
.edge-group-title { font-size: var(--t-fine); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin: var(--s5) 0 var(--s3); }

.stat-row { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }

.prose h3 { font-size: var(--t-h3); margin: var(--s8) 0 var(--s3); }
.prose h3:first-child { margin-top: 0; }
.prose p, .prose li { font-size: var(--t-base); color: var(--ink-light); line-height: 1.75; }
.prose ul { padding-left: var(--s6); margin-top: var(--s4); }
.prose li { margin-bottom: var(--s3); }
.prose strong { color: var(--ink); }
.source-list { list-style: none; padding: 0; }
.source-list li { margin-bottom: var(--s5); font-size: var(--t-body); color: var(--ink-light); line-height: 1.7; }
.source-list a { word-break: break-word; }

@media (max-width: 560px) {
  .view-head { align-items: stretch; }
  .view-head .view-switch { min-width: 0; width: 100%; }
  .view-switch button { padding: 9px 6px; font-size: var(--t-fine); }
  .layer-scope { white-space: normal; }
}

@media (max-width: 460px) {
  .edge-facts { grid-template-columns: 1fr; gap: 2px; }
  .edge-facts dd { margin-bottom: var(--s3); }
}

.edge-card, .evidence-firm { overflow-wrap: anywhere; }

.view-switch button { white-space: nowrap; }

.leaflet-container, .leaflet-tooltip { font-family: var(--font-sans); }
.leaflet-container { background: var(--surface); }

/* -------------------------------------------------- company detail records */
.company-evidence { margin-top: var(--s8); }
.company-evidence .legend { margin-bottom: var(--s5); }

.company-block { border-top: 1px solid var(--border); padding-top: var(--s5); margin-top: var(--s5); }
.company-block:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.company-block > h4 { font-size: var(--t-h3); font-family: var(--font-serif); margin-bottom: var(--s3); }

.company-type { margin-bottom: var(--s5); }
.company-type h5 { font-size: var(--t-fine); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin: var(--s5) 0 var(--s3); }
.company-empty { font-size: var(--t-body); color: var(--ink-light); line-height: 1.7; }
.record-coverage { color: var(--ink-soft); line-height: 1.6; margin-top: var(--s2); }

.record-card {
  border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius);
  padding: var(--s5); margin-bottom: var(--s4); background: var(--surface);
  overflow-wrap: anywhere;
}
.record-card h6 { font-size: var(--t-base); font-family: var(--font-sans); font-weight: 600; margin-bottom: var(--s3); line-height: 1.5; }
.record-note { font-size: var(--t-body); color: var(--ink-light); line-height: 1.7; margin-bottom: var(--s3); }
.record-source { margin-top: var(--s4); font-size: var(--t-fine); }

/* Left edge repeats the marker colour, so a card and its pin read as one. */
.record-ownership   { border-left-color: #6B4C9A; }
.record-facility    { border-left-color: #2B4E8C; }
.record-procurement { border-left-color: #7A5210; }
.record-shipment    { border-left-color: #1F7A8C; }

/* An empty layer's heading is longer than a populated one's, because it says
   which kind of empty it is. It keeps the same type and colour: this is a
   statement about the dataset, not a warning about the company. */
.company-type-not_collected h5,
.company-type-claimed_not_published h5,
.company-type-reviewed_no_record h5,
.company-type-unavailable h5 { text-transform: none; letter-spacing: 0; }

/* ------------------------------------------------------- coverage overview */
.coverage-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: var(--s5) 0; background: var(--surface); }
.coverage-panel > summary { font-size: var(--t-base); font-weight: 600; cursor: pointer; }
.coverage-panel > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.coverage-panel .field { display: block; margin: var(--s4) 0; }
.coverage-panel input[type="text"] { width: 100%; }

.coverage-list { list-style: none; padding: 0; margin: var(--s4) 0 0; }
.coverage-row { border-top: 1px solid var(--border); padding: var(--s4) 0; }
.coverage-row:first-child { border-top: 0; }
.coverage-name { font-size: var(--t-base); font-weight: 600; line-height: 1.5; }

.coverage-counts { list-style: none; padding: 0; margin: var(--s3) 0 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.coverage-count { font-size: var(--t-fine); line-height: 1.6; }
.coverage-count.is-populated { color: var(--ink); font-weight: 600; }
.coverage-count.is-empty { color: var(--ink-soft); }

.coverage-pick { margin-top: var(--s3); }

/* --------------------------------------------------- published-data discovery */
.data-discovery {
  margin-bottom: var(--s10);
  padding: var(--s7);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.discovery-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s4) var(--s7);
  margin-bottom: var(--s6);
}
.discovery-head h2 { font-size: var(--t-h2); }
.discovery-head p { max-width: var(--measure); font-size: var(--t-body); color: var(--ink-light); }
.discovery-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s6);
}
.discovery-stat {
  min-width: 0;
  padding: var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--ink-light);
  font-size: var(--t-body);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.discovery-stat strong {
  display: block;
  color: var(--accent-deep);
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-bottom: var(--s2);
}
.discovery-summary {
  max-width: var(--prose);
  margin: var(--s4) 0 var(--s6);
  color: var(--ink-light);
  font-size: var(--t-body);
  line-height: 1.7;
}
.discovery-summary a { text-underline-offset: 3px; }
.discovery-companies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: var(--s4);
}
.discovery-company {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  min-width: 0;
  min-height: 88px;
  padding: var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-body);
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: background-color var(--ease), border-color var(--ease);
}
.discovery-company strong { font-size: var(--t-base); font-weight: 600; }
.discovery-company span, .discovery-company small { color: var(--ink-light); font-size: var(--t-body); }
.discovery-company:hover { background: var(--tag-bg); border-color: var(--accent); }
.discovery-company:focus-visible, .discovery-summary a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.discovery-company[aria-pressed="true"] { background: var(--tag-bg); border-color: var(--accent); }
.discovery-company:disabled { cursor: wait; opacity: 0.65; }
@media (max-width: 560px) {
  .data-discovery { padding: var(--s5); margin-bottom: var(--s8); }
  .discovery-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .discovery-stat { padding: var(--s4); }
  .discovery-stat strong { font-size: var(--t-h2); }
  .discovery-companies { grid-template-columns: 1fr; }
  .discovery-company { min-height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .discovery-company { transition: none; }
}
.record-summary { cursor: pointer; padding: 14px 0; color: var(--ink); }
.record-summary .record-title { font-weight: 600; }
.record-summary-meta { display: block; color: var(--ink-soft); font-size: var(--t-fine); margin-top: 4px; }
.record-summary:focus-visible { outline: 2px solid var(--forest); outline-offset: 4px; }
#company-detail-title { scroll-margin-top: calc(var(--nav-h) + 24px); }
.data-discovery { width: calc(100% - 48px); max-width: 1280px; margin: 0 auto; }
/* Company-first explorer: keep the map and its controls in view. */
.page-header { padding-bottom: var(--s6); }
.map-section { padding-top: var(--s5); }
.map-layout { gap: var(--s5); grid-template-columns: minmax(260px, 290px) minmax(0, 1fr); }
.map-controls { padding: var(--s5); }
.map-controls .search-wrap { margin-bottom: var(--s6); }
.map-controls #search-title, .relationship-controls legend { font-size: 1.2rem; }
.map-controls .firm-list { max-height: 132px; }
.map-controls .chip-wrap { margin-top: var(--s3); }
.map-controls fieldset.relationship-controls { margin-bottom: var(--s4); }
.relationship-controls .check-row { align-items: center; padding: 7px 0; margin-bottom: 0; cursor: pointer; }
.relationship-controls .check-row input { width: 18px; height: 18px; margin-top: 0; accent-color: var(--accent); }
.relationship-icon { display: inline-block; width: 26px; text-align: center; margin-right: 5px; color: var(--accent); }
.depth-control { padding-top: var(--s3); border-top: 1px solid var(--border); }
.depth-control > .field-label { display: inline-block; margin-right: var(--s3); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stepper button, .map-zoom button { width: 40px; height: 40px; background: var(--surface); color: var(--ink); font-size: 23px; cursor: pointer; }
.stepper output { min-width: 32px; text-align: center; font-size: var(--t-body); }
.stepper button:hover:not(:disabled), .map-zoom button:hover:not(:disabled) { background: var(--tag-bg); }
.stepper button:disabled, .map-zoom button:disabled { opacity: .4; cursor: default; }
.stepper button:focus-visible, .map-zoom button:focus-visible, .map-settings summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.map-settings { border-top: 1px solid var(--border); margin-top: var(--s5); padding-top: var(--s4); }
.map-settings summary, .browse-records > summary, .map-explainer > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.map-settings[open] summary { margin-bottom: var(--s5); }
.map-settings legend { font-size: 1rem; }
.map-zoom { position: absolute; z-index: 500; right: 12px; top: 12px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.map-zoom button + button { border-top: 1px solid var(--border); }
.stage { height: 620px; }
.browse-records { margin-top: var(--s6); padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius); }
.browse-records:not([open]) { display: block; }
.browse-records[open] > summary { margin-bottom: var(--s5); }
.map-explainer { padding-top: var(--s6); padding-bottom: var(--s6); }
.map-explainer[open] > summary { margin-bottom: var(--s5); }
@media (max-width: 1000px) {
  .map-layout { grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); }
  .view-head .view-switch { min-width: 0; width: 100%; }
  .map-controls { position: static; }
}
@media (max-width: 700px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-controls { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
  .map-controls .search-wrap { grid-column: 1 / -1; margin-bottom: 0; }
  .map-controls .firm-list { max-height: 92px; }
  .map-controls .relationship-controls { grid-column: 1 / -1; }
  .relationship-controls { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s3); }
  .relationship-controls legend, .relationship-controls > p { grid-column: 1 / -1; }
  .relationship-controls .check-row { font-size: var(--t-fine); }
  .relationship-icon { width: 20px; margin-right: 2px; }
  .depth-control, .map-settings { grid-column: 1 / -1; }
  .map-settings { margin-top: 0; }
  .stage { height: 470px; }
}
