/* Atlas surface — dark theme additive over styles.css.
   Activates on body.atlas-mode (set by atlas.js when /atlas route is active). */

:root {
  --atlas-bg-deep: #060912;
  --atlas-bg-grad-1: radial-gradient(ellipse at 50% 90%, rgba(20, 40, 80, 0.65) 0%, transparent 55%);
  --atlas-bg-grad-2: radial-gradient(ellipse at 80% 10%, rgba(70, 30, 90, 0.25) 0%, transparent 50%);

  --atlas-panel-bg: rgba(12, 17, 28, 0.78);
  --atlas-panel-bg-strong: rgba(15, 21, 33, 0.92);
  --atlas-panel-border: rgba(255, 255, 255, 0.06);
  --atlas-panel-border-strong: rgba(255, 255, 255, 0.12);
  --atlas-glass-blur: blur(24px) saturate(160%);

  --atlas-text: #e8eaed;
  --atlas-text-muted: #8a93a3;
  --atlas-text-subtle: #5a6373;
  --atlas-text-faint: #3e4757;

  --atlas-sphere-fill: #0f1521;
  --atlas-country-fill: #1c2533;
  --atlas-country-stroke: rgba(75, 92, 128, 0.35);
  --atlas-graticule: rgba(75, 92, 128, 0.14);
  --atlas-atmosphere-near: rgba(60, 120, 220, 0.35);
  --atlas-atmosphere-far: rgba(60, 120, 220, 0);

  --atlas-arc-from: #4a90e2;
  --atlas-arc-to: #50e3c2;
  --atlas-arc-pulse: rgba(74, 144, 226, 0.95);

  --atlas-status-scoping: #f0a020;
  --atlas-status-populated: #4a90e2;
  --atlas-status-reviewed: #50e3c2;
  --atlas-status-signed: #34c759;

  --atlas-marker-cement: #d8a060;
  --atlas-marker-steel: #8a93a3;
  --atlas-marker-oil: #5a6373;
  --atlas-marker-aluminium: #af8fda;

  --atlas-sidebar-width: 240px;
  --atlas-detail-width: 420px;
  --atlas-rail-width: 88px;
  --atlas-scenario-height: 92px;
}

body.atlas-mode {
  margin: 0;
  background: var(--atlas-bg-grad-1), var(--atlas-bg-grad-2), var(--atlas-bg-deep);
  background-attachment: fixed;
  color: var(--atlas-text);
  font-family: var(--font);
  overflow: hidden;
}

body.atlas-mode .app-shell,
body.atlas-mode > .footer { display: none; }

/* ── Atlas shell ── */

.atlas-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: var(--atlas-sidebar-width) 1fr var(--atlas-rail-width);
  grid-template-rows: 1fr;
  color: var(--atlas-text);
}

.atlas-stage {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#globe-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#globe-canvas:active { cursor: grabbing; }

/* ── Sidebar ── */

.atlas-sidebar {
  background: var(--atlas-panel-bg);
  backdrop-filter: var(--atlas-glass-blur);
  -webkit-backdrop-filter: var(--atlas-glass-blur);
  border-right: 1px solid var(--atlas-panel-border);
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

.atlas-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--atlas-text);
  text-decoration: none;
}
.atlas-brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4a90e2 0%, #50e3c2 100%);
  display: grid;
  place-items: center;
  color: #060912;
  font-weight: 700;
  font-size: 13px;
}
.atlas-brand-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--atlas-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.atlas-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
  margin: 0 0 8px;
}

.atlas-industry-switcher { display: flex; flex-direction: column; gap: 4px; }

.atlas-industry-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--atlas-text-muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.atlas-industry-btn:hover { background: rgba(255,255,255,0.04); color: var(--atlas-text); }
.atlas-industry-btn[data-active="true"] {
  background: rgba(74, 144, 226, 0.12);
  border-color: rgba(74, 144, 226, 0.32);
  color: var(--atlas-text);
}
.atlas-industry-btn[data-state="ghost"] {
  color: var(--atlas-text-faint);
  cursor: not-allowed;
}
.atlas-industry-btn[data-state="ghost"]:hover { background: transparent; }
.atlas-industry-tag {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
}

.atlas-filters { display: flex; flex-direction: column; gap: 6px; }

.atlas-filter-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--atlas-text-muted);
  transition: background var(--transition), color var(--transition);
}
.atlas-filter-row:hover { background: rgba(255,255,255,0.04); color: var(--atlas-text); }
.atlas-filter-row input { accent-color: #4a90e2; }
.atlas-filter-row .atlas-filter-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--atlas-text-faint);
  font-variant-numeric: tabular-nums;
}

.atlas-narrative-list { display: flex; flex-direction: column; gap: 4px; }
.atlas-narrative-item {
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--atlas-text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
}
.atlas-narrative-item[data-active="true"] {
  background: rgba(80, 227, 194, 0.10);
  border-color: rgba(80, 227, 194, 0.28);
  color: var(--atlas-text);
}
.atlas-narrative-item:hover { background: rgba(255,255,255,0.04); }

/* ── Lifecycle rail (right vertical) ── */

.atlas-rail {
  background: var(--atlas-panel-bg);
  backdrop-filter: var(--atlas-glass-blur);
  -webkit-backdrop-filter: var(--atlas-glass-blur);
  border-left: 1px solid var(--atlas-panel-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 18px 0;
  overflow-y: auto;
}

.atlas-rail-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  font-size: 10.5px;
  text-align: center;
  color: var(--atlas-text-muted);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  position: relative;
}
.atlas-rail-stage:hover { background: rgba(255,255,255,0.04); color: var(--atlas-text); }
.atlas-rail-stage[data-active="true"] {
  border-left-color: #4a90e2;
  background: rgba(74,144,226,0.08);
  color: var(--atlas-text);
}
.atlas-rail-stage i { font-size: 18px; }
.atlas-rail-stage-label { line-height: 1.2; }

/* ── Hero overlay (top-left over stage) ── */

.atlas-hero {
  position: absolute;
  top: 28px;
  left: 32px;
  max-width: 460px;
  pointer-events: none;
}
.atlas-hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
  margin: 0 0 6px;
}
.atlas-hero-title {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--atlas-text);
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}
.atlas-hero-subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: var(--atlas-text-muted);
  margin: 0;
}

/* ── Scenario dock (bottom over stage) ── */

.atlas-scenario {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(840px, calc(100% - 64px));
  background: var(--atlas-panel-bg-strong);
  backdrop-filter: var(--atlas-glass-blur);
  -webkit-backdrop-filter: var(--atlas-glass-blur);
  border: 1px solid var(--atlas-panel-border-strong);
  border-radius: 14px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.atlas-scenario-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.atlas-scenario-label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
}
.atlas-scenario-value {
  font-size: 13px;
  color: var(--atlas-text);
  font-variant-numeric: tabular-nums;
}
.atlas-scenario input[type="range"] {
  width: 100%;
  accent-color: #4a90e2;
}
.atlas-scenario select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--atlas-panel-border-strong);
  border-radius: 8px;
  color: var(--atlas-text);
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
}
.atlas-scenario-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--atlas-text-muted);
  cursor: pointer;
}

/* ── Detail dock (right slide-in) ── */

.atlas-detail {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--atlas-detail-width);
  max-width: 100vw;
  height: 100vh;
  background: var(--atlas-panel-bg-strong);
  backdrop-filter: var(--atlas-glass-blur);
  -webkit-backdrop-filter: var(--atlas-glass-blur);
  border-left: 1px solid var(--atlas-panel-border-strong);
  transform: translateX(100%);
  transition: transform 280ms var(--ease);
  display: flex;
  flex-direction: column;
  z-index: 40;
  box-shadow: -16px 0 40px rgba(0,0,0,0.5);
}
.atlas-detail[data-open="true"] { transform: translateX(0); }

.atlas-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 14px;
  gap: 12px;
  border-bottom: 1px solid var(--atlas-panel-border);
}
.atlas-detail-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
  margin: 0 0 4px;
}
.atlas-detail-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  color: var(--atlas-text);
}
.atlas-detail-close {
  background: transparent;
  border: 1px solid var(--atlas-panel-border-strong);
  color: var(--atlas-text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
.atlas-detail-close:hover { background: rgba(255,255,255,0.06); color: var(--atlas-text); }

.atlas-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 28px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--atlas-text-muted);
}
.atlas-detail-body h4 {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
  margin: 18px 0 8px;
}
.atlas-detail-body h4:first-child { margin-top: 0; }
.atlas-detail-body p { margin: 0 0 10px; color: var(--atlas-text); }
.atlas-detail-body dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 0 0 14px; }
.atlas-detail-body dt { color: var(--atlas-text-subtle); font-size: 12.5px; }
.atlas-detail-body dd { color: var(--atlas-text); margin: 0; font-size: 12.5px; }
.atlas-detail-body ul { margin: 0 0 12px; padding-left: 18px; }
.atlas-detail-body li { margin: 0 0 4px; color: var(--atlas-text); }

.atlas-stage-cost { font-variant-numeric: tabular-nums; font-weight: 600; }
.atlas-stage-cost.positive { color: var(--atlas-status-scoping); }
.atlas-stage-cost.negative { color: var(--atlas-status-signed); }
.atlas-stage-cost.zero { color: var(--atlas-text-subtle); }

.atlas-stage-laws { list-style: none; padding-left: 0; margin: 0; }
.atlas-stage-laws li {
  padding: 10px 0;
  border-bottom: 1px solid var(--atlas-panel-border);
  margin: 0;
  color: var(--atlas-text);
}
.atlas-stage-laws li:last-child { border-bottom: none; }
.atlas-stage-law-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.atlas-stage-law-head a {
  color: var(--atlas-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
}
.atlas-stage-law-head a:hover { color: #4a90e2; text-decoration: underline; }
.atlas-stage-law-meta {
  font-size: 10.5px;
  color: var(--atlas-text-subtle);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.atlas-stage-law-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.atlas-stage-law-tag {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--atlas-text-muted);
}
.atlas-stage-law-tag.climate {
  background: rgba(80, 227, 194, 0.10);
  color: var(--atlas-status-reviewed);
}
.atlas-stage-law-tag.burden-high {
  background: rgba(255, 59, 48, 0.10);
  color: #ff9c93;
}
.atlas-stage-law-tag.burden-medium {
  background: rgba(255, 149, 0, 0.10);
  color: var(--atlas-status-scoping);
}
.atlas-stage-law-tag.burden-low {
  background: rgba(52, 199, 89, 0.10);
  color: var(--atlas-status-signed);
}
.atlas-stage-law-cost {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--atlas-text);
  font-weight: 500;
}

/* Status pills */
.atlas-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.atlas-status-pill[data-status="in_scoping"] {
  background: rgba(240, 160, 32, 0.14);
  color: var(--atlas-status-scoping);
}
.atlas-status-pill[data-status="populated"] {
  background: rgba(74, 144, 226, 0.14);
  color: var(--atlas-status-populated);
}
.atlas-status-pill[data-status="peer_reviewed"] {
  background: rgba(80, 227, 194, 0.14);
  color: var(--atlas-status-reviewed);
}
.atlas-status-pill[data-status="signed_off"] {
  background: rgba(52, 199, 89, 0.16);
  color: var(--atlas-status-signed);
}

/* Loading state (inside stage before globe data resolves) */
.atlas-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--atlas-text-subtle);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Cell matrix overlay (#/cells route) ── */

.atlas-cell-matrix {
  position: absolute;
  inset: 24px 24px calc(var(--atlas-scenario-height) + 30px) 24px;
  background: var(--atlas-panel-bg-strong);
  backdrop-filter: var(--atlas-glass-blur);
  -webkit-backdrop-filter: var(--atlas-glass-blur);
  border: 1px solid var(--atlas-panel-border-strong);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  z-index: 30;
  overflow: hidden;
}
.atlas-cell-matrix[data-open="true"] { display: flex; }

.atlas-cell-matrix-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 26px 14px;
  border-bottom: 1px solid var(--atlas-panel-border);
  gap: 16px;
}
.atlas-cell-matrix-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--atlas-text);
}
.atlas-cell-matrix-header p {
  font-size: 12.5px;
  color: var(--atlas-text-muted);
  margin: 0;
  line-height: 1.5;
}
.atlas-cell-matrix-close {
  background: transparent;
  border: 1px solid var(--atlas-panel-border-strong);
  color: var(--atlas-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.atlas-cell-matrix-close:hover { background: rgba(255,255,255,0.06); color: var(--atlas-text); }

.atlas-cell-matrix-grid {
  flex: 1;
  overflow: auto;
  padding: 18px 26px 26px;
}

.atlas-cell-matrix-table {
  display: grid;
  gap: 6px;
  min-width: 100%;
}
.atlas-cell-matrix-row {
  display: grid;
  grid-template-columns: 140px repeat(12, minmax(80px, 1fr));
  gap: 6px;
  align-items: stretch;
}
.atlas-cell-matrix-corner,
.atlas-cell-matrix-region-head,
.atlas-cell-matrix-sector-head,
.atlas-cell-matrix-cell {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 56px;
  background: rgba(255,255,255,0.02);
}
.atlas-cell-matrix-region-head {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--atlas-text-subtle);
  font-weight: 600;
  text-align: left;
  font-size: 10px;
  background: transparent;
}
.atlas-cell-matrix-sector-head {
  font-size: 13px;
  font-weight: 600;
  color: var(--atlas-text);
  background: transparent;
}
.atlas-cell-matrix-corner {
  background: transparent;
}

.atlas-cell-matrix-cell {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--atlas-panel-border);
  cursor: not-allowed;
  transition: background var(--transition), border-color var(--transition);
  text-align: left;
  color: var(--atlas-text-faint);
}
.atlas-cell-matrix-cell[data-status="ghost"] {
  /* visually de-emphasised but still legible — sector × region with no row yet */
}
.atlas-cell-matrix-cell[data-status="in_scoping"],
.atlas-cell-matrix-cell[data-status="populated"],
.atlas-cell-matrix-cell[data-status="peer_reviewed"],
.atlas-cell-matrix-cell[data-status="signed_off"] {
  cursor: pointer;
  color: var(--atlas-text);
  background: rgba(74, 144, 226, 0.06);
  border-color: rgba(74, 144, 226, 0.18);
}
.atlas-cell-matrix-cell[data-status="in_scoping"]:hover,
.atlas-cell-matrix-cell[data-status="populated"]:hover,
.atlas-cell-matrix-cell[data-status="peer_reviewed"]:hover,
.atlas-cell-matrix-cell[data-status="signed_off"]:hover {
  background: rgba(74, 144, 226, 0.12);
  border-color: rgba(74, 144, 226, 0.36);
}

.atlas-cell-matrix-cell-status {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 4px;
}
.atlas-cell-matrix-cell-status[data-status="in_scoping"] { color: var(--atlas-status-scoping); }
.atlas-cell-matrix-cell-status[data-status="populated"] { color: var(--atlas-status-populated); }
.atlas-cell-matrix-cell-status[data-status="peer_reviewed"] { color: var(--atlas-status-reviewed); }
.atlas-cell-matrix-cell-status[data-status="signed_off"] { color: var(--atlas-status-signed); }
.atlas-cell-matrix-cell-status[data-status="ghost"] { color: var(--atlas-text-faint); }

/* Responsive: collapse rail and sidebar on narrow viewports */
@media (max-width: 960px) {
  .atlas-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .atlas-sidebar, .atlas-rail { display: none; }
  .atlas-hero { left: 16px; top: 16px; max-width: calc(100% - 32px); }
}
