/* Atlas (module atlas): app skin. Rules moved verbatim from styles.css (C1); the variables are the app identity, posture themes re-map the shell only. */
/* P9 scheme tokens: light = the colours these rules always used, dark = a dark map. */
:root {
  --atlas-surface: #fff;
  --atlas-surface-2: rgba(255, 255, 255, 0.88);
  --atlas-surface-3: #eef5f1;
  --atlas-surface-4: #f1f3f5;
  --atlas-surface-5: #e3edf5;
  --atlas-text: #202122;
}
[data-scheme="dark"] {
  --atlas-surface: #1a1e23;
  --atlas-surface-2: rgba(26, 30, 35, 0.88);
  --atlas-surface-3: #252a27;
  --atlas-surface-4: #28292b;
  --atlas-surface-5: #2b3136;
  --atlas-text: #dedfe1;
}
.module-body[data-module="atlas"] {
  --app-font: "Inter", "Open Sans", Arial, sans-serif;
  --app-accent: #3c7a5a;
  --app-bg: #eef5f1;
  --app-surface: #ffffff;
  --app-radius: 6px;
}

/* ---------- Atlas ---------- */
.atlas-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.map-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.map-region { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; }
.layer-toggles { display: flex; gap: 5px; flex-wrap: wrap; }
.layer-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; }
.layer-chip.is-on { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.layer-swatch { width: 7px; height: 7px; border-radius: 50%; }
.layer-swatch.infra { background: var(--brand); }
.layer-swatch.sensor { background: var(--warn); }
.layer-swatch.social { background: var(--danger); }

.map-canvas { position: relative; height: 520px; background: radial-gradient(120% 120% at 30% 20%, var(--map-land-2), var(--bg)); overflow: hidden; }
.map-shapes { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-marker { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; z-index: 2; }
.marker-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--brand); border: 2px solid var(--bg); box-shadow: 0 0 0 3px var(--brand-soft); }
.map-marker.sensor .marker-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.map-marker.social .marker-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.marker-pulse { position: absolute; top: -4px; width: 19px; height: 19px; border-radius: 50%; background: currentColor; opacity: 0.18; animation: pulse 2.4s infinite; color: var(--brand); }
.map-marker.sensor .marker-pulse { color: var(--warn); }
.map-marker.social .marker-pulse { color: var(--danger); }
@keyframes pulse { 0% { transform: scale(0.7); opacity: 0.3; } 70% { transform: scale(1.7); opacity: 0; } 100% { opacity: 0; } }
.marker-label { font-size: 9.5px; color: var(--text); background: rgba(8, 14, 18, 0.82); padding: 2px 6px; border-radius: 5px; white-space: nowrap; border: 1px solid var(--border); }
.map-marker.is-active .marker-dot { outline: 2px solid var(--text); outline-offset: 2px; }
.map-callout { position: absolute; width: 220px; transform: translate(-10%, 0); padding: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 9px; box-shadow: var(--shadow-soft); z-index: 3; }
.callout-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.callout-head strong { font-size: 11.5px; }
.callout-head button { color: var(--faint); }
.map-callout p { font-size: 11px; color: var(--muted); }
.map-attribution { position: absolute; right: 8px; bottom: 8px; font-size: 9px; color: var(--faint); background: rgba(8, 14, 18, 0.6); padding: 2px 6px; border-radius: 4px; }

.atlas-side { display: flex; flex-direction: column; gap: 12px; }
.map-feed-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.map-feed-item:last-child { border-bottom: none; }
.map-feed-item span { font-family: var(--font-mono); font-size: 9.5px; color: var(--accent); }
.map-feed-item p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.entity-row { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 7px; text-align: left; font-size: 11.5px; color: var(--muted); border-radius: 7px; }
.entity-row:hover, .entity-row.is-active { background: var(--surface-2); color: var(--text); }
.entity-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.entity-dot.sensor { background: var(--warn); }
.entity-dot.social { background: var(--danger); }
.entity-dot.gov { background: var(--brand); }

@media (max-width: 1180px) {
  .atlas-layout { grid-template-columns: minmax(0, 1fr);  }
  .atlas-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));  }
}
@media (max-width: 720px) {
  .atlas-side { grid-template-columns: 1fr;  }
  .map-canvas { height: 400px;  }
}
/* ---------- Atlas ---------- */
.map-canvas { background: radial-gradient(120% 120% at 30% 20%, var(--atlas-surface-3), var(--atlas-surface-5)); }
.marker-label { background: var(--atlas-surface); color: var(--atlas-text); border-color: var(--border); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14); }
.map-attribution { background: var(--atlas-surface-2); color: var(--faint); }
.map-callout { background: var(--atlas-surface); }
.map-callout p { color: var(--muted); }
.map-toolbar { background: var(--atlas-surface); }
.layer-chip { background: var(--atlas-surface); }
.layer-chip.is-on { background: var(--atlas-surface-4); }

/* --- C10 Atlas: layer counts, live markers, callout with linked content, severity, off entities */
.layer-chip small { font-size: 9.5px; opacity: 0.7; }
.layer-swatch.gov { background: var(--brand); }
.map-marker.is-active .marker-label { border-color: var(--border-strong); }
.marker-dot { animation: markerIn 0.5s ease-out; }
@keyframes markerIn { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.map-callout { max-height: 300px; overflow: auto; width: 240px; }
.callout-head { position: sticky; top: 0; background: var(--surface-2); }
.pill.severity-critical { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill.severity-high { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.severity-medium, .pill.severity-low { color: var(--muted); }
.callout-linked { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.callout-linked .eyebrow { margin: 0 0 4px; }
.callout-linked ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.callout-linked li { font-size: 11px; color: var(--text); line-height: 1.35; }
.callout-linked li small { display: block; font-size: 9.5px; color: var(--faint); }
.entity-row.is-off { opacity: 0.45; }
.entity-row.is-active { box-shadow: inset 2px 0 0 var(--accent); }
@media (max-width: 390px) {
  .map-canvas { height: 380px; }
  .map-callout { width: 200px; }
}

/* P9 dark scheme: the module tokens above, a dark map */
[data-scheme="dark"] .module-body[data-module="atlas"] {
  --app-accent: #75ad8e;
  --app-bg: #111a16;
  --app-surface: #1a1e23;
}
