/* NicheFinders AI — Obsidian-style system map
   Charcoal/blue register. Montserrat display, Open Sans body.
   The canvas carries the visual; HUD panels stay minimal and out of the way. */

:root {
  /* charcoal canvas, faint blue tint */
  --bg-0: #14181d;
  --bg-1: #1a1f26;
  --panel: rgba(26, 31, 38, 0.72);
  --panel-line: rgba(124, 196, 240, 0.16);

  /* brand blues */
  --blue: #0055a4;
  --blue-lt: #4a90d9;
  --cyan: #7cc4f0;
  --ink: #e8eef5;
  --muted: #93a4b8;
  --faint: #64748b;

  /* status */
  --live: #10b981;
  --build: #f5a623;
  --pause: #64748b;

  --sans: 'Open Sans', system-ui, sans-serif;
  --display: 'Montserrat', system-ui, sans-serif;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(130% 100% at 50% 42%, var(--bg-1), var(--bg-0) 78%);
}

#graph {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#graph:active { cursor: grabbing; }

/* ---------- HUD panels ---------- */
.hud {
  position: fixed;
  z-index: 5;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hud-tl { top: clamp(1rem, 3vw, 2.2rem); left: clamp(1rem, 3vw, 2.2rem);
  display: flex; align-items: center; gap: 1rem; max-width: min(90vw, 420px); }
.hud-tr { top: clamp(1rem, 3vw, 2.2rem); right: clamp(1rem, 3vw, 2.2rem); }
.hud-bl { bottom: clamp(1rem, 3vw, 2.2rem); left: clamp(1rem, 3vw, 2.2rem); }
.hud-br { bottom: clamp(1rem, 3vw, 2.2rem); right: clamp(1rem, 3vw, 2.2rem); }

.logo {
  width: clamp(84px, 12vw, 132px);
  height: auto;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.5));
  flex-shrink: 0;
}
.title-block h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.3rem);
  letter-spacing: -0.01em;
  line-height: 1;
  background: linear-gradient(92deg, var(--cyan), var(--blue-lt));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title-block p {
  color: var(--muted);
  font-size: clamp(0.8rem, 0.75rem + 0.2vw, 0.95rem);
  margin-top: 0.4rem;
  max-width: 34ch;
}

/* counts */
#counts {
  display: flex;
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.count {
  background: var(--panel);
  padding: 0.7rem 1.05rem;
  text-align: center;
}
.count-v {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.05rem, 0.9rem + 0.9vw, 1.6rem);
  line-height: 1;
  color: var(--cyan);
}
.count-l {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* view toggle */
#views {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  padding: 4px;
}
.view-btn {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}
.view-btn:hover { color: var(--ink); }
.view-btn.is-active {
  color: #fff;
  background: linear-gradient(120deg, var(--blue), var(--blue-lt));
}
.view-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* legend */
#legend {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.42rem;
  max-width: 44vw;
}
.legend-row { display: flex; align-items: center; gap: 0.55rem; font-size: 0.76rem; color: var(--muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-head {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.15rem;
}

@media (max-width: 720px) {
  .hud-tr { display: none; }
  #legend { max-width: 42vw; padding: 0.65rem 0.7rem; }
  .title-block p { display: none; }
}
@media (max-width: 480px) {
  #views { flex-wrap: wrap; max-width: 60vw; }
}
