:root {
  --ff-bg: #060810;
  --ff-bg-2: #0b0f1c;
  --ff-panel: #0e131f;
  --ff-panel-2: #141b2b;
  --ff-border: #222c42;
  --ff-grid: #16203a;
  --ff-land: #1a2338;
  --ff-land-edge: #32436b;
  --ff-text: #eef2fb;
  --ff-muted: #8595b4;
  --ff-faint: #55648a;
  --ff-accent: #FF5033;

  --c-dc: #ff5033;
  --c-lab: #38e1c8;
  --c-robot: #a78bfa;
  --c-chip: #f4c542;
  --c-space: #4d9bff;
  --c-policy: #ff7fb0;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;

  --fs-display: clamp(0.75rem, 1.7vw, 1.3rem);
  --fs-h2: clamp(1.35rem, 2.6vw, 2rem);
  --radius: 3px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --disp: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 70% -10%, #101a34 0%, transparent 60%),
    var(--ff-bg);
  color: var(--ff-text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
a { color: inherit; }

/* ---------- Masthead ---------- */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--ff-border);
  background: linear-gradient(180deg, rgba(11,15,28,.9), rgba(6,8,16,.6));
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; text-decoration: none; }
.wordmark { display: block; }
.masthead-mid { text-align: center; min-width: 0; }
.masthead-mid h1 {
  font-family: var(--disp); font-weight: 700; font-size: var(--fs-display);
  letter-spacing: -.02em; margin: 0; line-height: 1;
}
.masthead-search { justify-self: end; }
#search {
  background: var(--ff-panel); border: 1px solid var(--ff-border);
  border-radius: var(--radius); color: var(--ff-text);
  font-family: var(--mono); font-size: .78rem;
  padding: var(--sp-2) var(--sp-3); width: 230px; outline: none;
}
#search::placeholder { color: var(--ff-faint); }
#search:focus-visible { border-color: var(--ff-accent); box-shadow: 0 0 0 2px rgba(255,80,51,.25); }

/* ---------- Layers panel (categories + status) ---------- */
.layers {
  position: absolute; top: 16px; left: 16px; z-index: 24; width: 236px;
  background: rgba(8,11,20,.72); backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.09); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  padding: 6px;
}
.layers.min { width: auto; }
.layers.min .layers-body { display: none; }
.layers-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 10px 7px; }
.layers-head b {
  font-family: var(--body); font-weight: 600; font-size: 10px;
  letter-spacing: .18em; color: rgba(255,255,255,.45);
}
.layers-actions { display: flex; align-items: center; gap: 2px; }
.layers-actions [data-all] {
  border: 0; background: none; cursor: pointer; padding: 2px 6px; border-radius: 6px;
  font-family: var(--body); font-size: 10.5px; font-weight: 500; color: rgba(255,255,255,.4);
  transition: color .15s;
}
.layers-actions [data-all]:hover { color: #fff; }
.layers-toggle {
  border: 0; background: none; cursor: pointer; padding: 4px 5px; margin-left: 2px;
  display: flex; align-items: center; border-radius: 6px; color: rgba(255,255,255,.4);
  transition: color .15s, transform .2s ease;
}
.layers-toggle svg { width: 10px; height: 6px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.layers-toggle:hover { color: #fff; }
.layers.min .layers-toggle { transform: rotate(-90deg); }
.lrow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
  cursor: pointer; text-align: left;
  font-family: var(--body); font-size: 12.5px; font-weight: 500; color: rgba(255,255,255,.4);
  transition: background .15s ease, color .15s ease;
}
.lrow:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.75); }
.lrow:focus-visible { outline: 2px solid var(--ff-accent); outline-offset: -2px; }
.lrow[aria-pressed="true"] { color: rgba(255,255,255,.96); }
.ldot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.16); flex: 0 0 auto;
  transition: background .15s, box-shadow .15s;
}
.lrow[aria-pressed="true"] .ldot {
  background: var(--d);
  box-shadow: 0 0 10px color-mix(in srgb, var(--d) 80%, transparent);
}
.llabel { flex: 1 1 auto; }
.lcount { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.35); font-variant-numeric: tabular-nums; }
.layers-div { height: 1px; background: rgba(255,255,255,.08); margin: 6px 10px; }
.layers-sub {
  font-family: var(--body); font-weight: 600; font-size: 10px;
  letter-spacing: .18em; color: rgba(255,255,255,.45); padding: 4px 10px 5px;
}
/* status glyphs mirror the marker treatments */
.lglyph { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; box-sizing: border-box; transition: opacity .15s; }
.lg-live { background: rgba(255,255,255,.85); }
.lg-construction { border: 1.5px dashed rgba(255,255,255,.85); background: rgba(255,255,255,.15); }
.lg-planned { border: 1.5px solid rgba(255,255,255,.6); background: transparent; }
.lg-rumored { border: 1.5px dotted rgba(255,255,255,.55); background: transparent; opacity: .9; }
.lrow[aria-pressed="false"] .lglyph { opacity: .3; }

/* status-differentiated markers: operational = solid (default),
   construction = dashed ring + tinted fill, planned = hollow colored ring */
.marker.st-construction {
  background: color-mix(in srgb, var(--dot) 30%, rgba(10,14,24,.65));
  border: 1.5px dashed rgba(255,255,255,.9);
}
.marker.st-planned {
  background: rgba(10,14,24,.55);
  border: 1.5px solid var(--dot);
}
.marker.st-rumored {
  background: rgba(10,14,24,.4);
  border: 1.5px dotted var(--dot);
  opacity: .85;
}

/* status badge in the detail card */
.d-st {
  margin-left: 8px; padding: 2px 7px; border-radius: 999px; vertical-align: 1px;
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.7);
}
.d-st.st-live { background: rgba(70,220,140,.14); color: #6ee7a8; }
.d-st.st-construction { background: rgba(255,193,7,.14); color: #ffd666; }
.d-st.st-rumored { background: rgba(167,139,250,.16); color: #c4b5fd; }

@media (max-width: 720px) {
  .layers { width: 212px; top: 10px; left: 10px; }
}

/* ---------- Stage / map ---------- */
.stage { position: relative; }
.map-wrap {
  position: relative;
  height: min(70vh, 640px);
  min-height: 420px;
  background:
    linear-gradient(0deg, var(--ff-grid) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, var(--ff-grid) 1px, transparent 1px) 0 0 / 48px 100%,
    var(--ff-bg);
  overflow: hidden;
}
.map-scroll {
  position: absolute; inset: 0; overflow: hidden;
  cursor: grab; touch-action: none;
}
.map-scroll.dragging { cursor: grabbing; }
.worldmap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.worldmap path {
  fill: var(--ff-land); stroke: var(--ff-land-edge); stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}

.markers { position: absolute; inset: 0; pointer-events: none; }
.marker {
  position: absolute; width: 14px; height: 14px; margin: -7px;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,.7);
  background: var(--dot); cursor: pointer; pointer-events: auto;
  padding: 0;
  opacity: 0; transform: scale(0);
  transition: opacity .4s ease, transform .35s cubic-bezier(.3,1.5,.4,1), box-shadow .2s;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}
.marker.in { opacity: 1; transform: scale(1); }
.marker:hover, .marker:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(255,255,255,.12), 0 0 12px 2px var(--dot);
  z-index: 5;
}
.marker.active { box-shadow: 0 0 0 4px var(--ff-accent), 0 0 16px 3px var(--dot); z-index: 6; }
.marker.big { width: 18px; height: 18px; margin: -9px; }
.marker.big::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1.5px solid var(--dot); opacity: .6;
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.6); opacity: .7; }
  100% { transform: scale(2.1); opacity: 0; }
}
.marker.hidden { display: none; }
.marker.clustered { display: none; }
.marker.clustered.spiderfied { display: block; z-index: 8; }

/* name labels: on hover always; persistent when zoomed in or fanned out */
.marker::after {
  content: attr(data-name);
  position: absolute; left: calc(100% + 7px); top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; line-height: 1.3;
  color: var(--ff-text); background: rgba(10,14,24,.88);
  border: 1px solid var(--ff-border); border-radius: 2px;
  padding: 2px 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
/* hover/focus name labels are superseded by the imagery peek card */
.marker.spiderfied::after,
.markers.labels .marker:not(.clustered)::after { opacity: 1; }

/* ---------- Hover imagery peek ---------- */
.peek {
  position: absolute; z-index: 30; width: 240px;
  background: rgba(10,14,24,.96);
  border: 1px solid var(--ff-border); border-radius: 4px;
  overflow: hidden; pointer-events: none;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.peek img { display: block; width: 100%; height: 150px; object-fit: cover; background: #0d1322; }
.peek-meta { padding: 7px 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.peek-meta strong { font-family: var(--disp); font-size: .8rem; font-weight: 600; color: var(--ff-text); }
.peek-meta span { font-family: var(--mono); font-size: .6rem; color: var(--ff-muted); }
.peek-meta em { font-style: normal; font-family: var(--mono); font-size: .52rem; color: var(--ff-faint); }

/* satellite header in the detail card */
.d-img {
  display: block; width: 100%; height: 140px; object-fit: cover;
  border: 1px solid var(--ff-border); border-radius: 3px;
  margin-bottom: 10px; background: #0d1322;
}

/* cluster badges */
.clusters { position: absolute; inset: 0; pointer-events: none; }
.cluster {
  position: absolute; width: 30px; height: 30px; margin: -15px;
  border-radius: 50%; border: 0; padding: 3px; cursor: pointer;
  pointer-events: auto; z-index: 7;
  box-shadow: 0 0 0 2px rgba(255,255,255,.22), 0 6px 18px rgba(0,0,0,.45);
  animation: clusterin .25s ease;
}
@keyframes clusterin { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cluster i {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 50%;
  background: rgba(10,14,24,.92); color: var(--ff-text);
  font-style: normal; font-family: var(--mono); font-size: .7rem; font-weight: 600;
}
.cluster:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.4), 0 6px 18px rgba(0,0,0,.5); }
.cluster:focus-visible { outline: 2px solid var(--ff-accent); outline-offset: 2px; }

/* spiderfy leader lines */
.spiderlegs { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.spiderlegs line { stroke: rgba(255,255,255,.4); stroke-width: 1; }
.spiderlegs circle { fill: rgba(255,255,255,.55); }

/* zoom controls */
.zoom-controls {
  position: absolute; right: var(--sp-4); bottom: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-1); z-index: 20;
}
.zoom-controls button {
  width: 34px; height: 34px; border: 1px solid var(--ff-border);
  background: var(--ff-panel); color: var(--ff-text);
  font-size: 1.1rem; cursor: pointer; border-radius: var(--radius);
  font-family: var(--mono);
}
.zoom-controls button:hover { border-color: var(--ff-accent); color: var(--ff-accent); }
.zoom-controls button:focus-visible { outline: 2px solid var(--ff-accent); outline-offset: 2px; }

/* detail card */
.detail {
  position: absolute; right: var(--sp-4); top: var(--sp-4); z-index: 30;
  width: 320px; max-width: calc(100% - 32px);
  background: rgba(14,19,31,.96); backdrop-filter: blur(12px);
  border: 1px solid var(--ff-border); border-left: 3px solid var(--ff-accent);
  border-radius: var(--radius); padding: var(--sp-5) var(--sp-5) var(--sp-4);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: slidein .3s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.detail-close {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  background: none; border: none; color: var(--ff-muted);
  font-size: .9rem; cursor: pointer; line-height: 1;
}
.detail-close:hover { color: var(--ff-accent); }
.d-cat {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .2em;
  text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px;
}
.d-cat i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.d-name { font-family: var(--disp); font-weight: 700; font-size: 1.25rem; margin: var(--sp-2) 0 var(--sp-1); letter-spacing: -.01em; }
.d-loc { font-family: var(--mono); font-size: .72rem; color: var(--ff-muted); margin: 0 0 var(--sp-3); }
.d-desc { font-size: .85rem; color: var(--ff-text); margin: 0 0 var(--sp-4); line-height: 1.55; }
.d-facts { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; gap: 6px; }
.d-facts li {
  display: flex; justify-content: space-between; gap: var(--sp-3);
  font-size: .76rem; border-bottom: 1px dashed var(--ff-border); padding-bottom: 6px;
}
.d-facts .k { font-family: var(--mono); color: var(--ff-faint); text-transform: uppercase; letter-spacing: .08em; font-size: .62rem; }
.d-facts .v { color: var(--ff-text); text-align: right; }
.d-link {
  font-family: var(--mono); font-size: .72rem; color: var(--ff-accent);
  text-decoration: none; border-bottom: 1px solid rgba(255,80,51,.4);
}
.d-link:hover { border-color: var(--ff-accent); }

/* ---------- Briefing ---------- */
.briefing {
  max-width: 1080px; margin: 0 auto; padding: var(--sp-8) var(--sp-5);
}
.brief-head { max-width: 640px; }
.brief-head h2 {
  font-family: var(--disp); font-weight: 700; font-size: var(--fs-h2);
  letter-spacing: -.02em; line-height: 1.1; margin: 0 0 var(--sp-3);
}
.brief-head p { color: var(--ff-muted); font-size: .95rem; margin: 0; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4); margin: var(--sp-7) 0 var(--sp-5); padding: 0;
}
.stats div {
  border-top: 2px solid var(--ff-accent); padding-top: var(--sp-3);
}
.stats dt { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ff-faint); margin: 0; }
.stats dd { font-family: var(--disp); font-weight: 700; font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin: var(--sp-1) 0 0; letter-spacing: -.02em; }
.src { font-family: var(--mono); font-size: .68rem; color: var(--ff-faint); max-width: 640px; }
.src a { color: var(--ff-muted); }
.src a:hover { color: var(--ff-accent); }

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-5); border-top: 1px solid var(--ff-border);
}
.foot-brand { display: flex; align-items: center; text-decoration: none; }
.wordmark-sm { display: block; opacity: .85; }
.foot-brand:hover .wordmark-sm { opacity: 1; }
.foot-note { font-family: var(--mono); font-size: .62rem; color: var(--ff-faint); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .masthead { grid-template-columns: auto 1fr; grid-template-rows: auto auto; }
  .masthead-mid { text-align: left; grid-column: 1 / -1; order: 3; }
  .masthead-search { grid-column: 2; justify-self: end; }
  #search { width: 150px; }
  .detail { top: auto; bottom: 0; right: 0; left: 0; width: 100%; max-width: none;
    border-left: none; border-top: 3px solid var(--ff-accent); border-radius: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .marker { transition: opacity .2s; transform: none; }
  .marker.in { transform: none; }
  .marker.big::before { animation: none; }
  .cluster { animation: none; }
  .detail { animation: none; }
}
