/* ============================================================
   eq — Atari-Noir design tokens (source of truth: .savepoint/
   visual-identity.md). Custom properties + the few custom styles
   Tailwind utilities can't express (slider, scrollbar, glass).
   ============================================================ */

:root {
  /* Canvas */
  --bg: #000000;
  --surface: #000000;
  --surface-2: #0d0d0d;

  /* Borders */
  --border: #1a1a1a;
  --border-subtle: #222222;

  /* Ink */
  --text: #f0e6da;
  --text-muted: #707887;

  /* Atari accents */
  --accent-1: #fc6323; /* primary UI accent */
  --accent-2: #a4c639; /* live / healthy / new */
  --accent-3: #b1a1df; /* secondary / focus / info */

  /* Earthquake depth band (locked) */
  --depth-shallow: #f87171; /* < 70 km */
  --depth-intermediate: #facc15; /* 70-300 km */
  --depth-deep: #818cf8; /* > 300 km */

  /* Type */
  --font-display: "VT323", monospace;
  --font-body: "Share Tech Mono", monospace;

  /* Glassmorphic panel */
  --panel-bg: rgba(0, 0, 0, 0.55);
  --panel-blur: blur(12px);
}

/* ---------- Reset / base ---------- */

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* No scanlines, no texture noise, no decorative shadows — Atari-Noir flat. */

h1,
h2,
h3,
.panel-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Accessibility helpers ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus ring for keyboard users — accent border, never outline-only. */
:focus-visible {
  outline: 1px solid var(--accent-1);
  outline-offset: 2px;
}

/* ---------- Panel (glassmorphic overlay) ---------- */

.panel {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  flex-direction: column;
  gap: 12px;
  min-width: 240px;
  max-width: 300px;
  padding: 14px 16px;
  background: var(--panel-bg);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.panel-title {
  font-size: 22px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Night-side display toggle ---------- */

.night-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  cursor: pointer;
}

.night-mode-toggle:hover {
  border-color: var(--accent-3);
}

.night-mode-toggle[aria-checked="true"] {
  border-color: var(--accent-3);
  color: var(--accent-3);
}

/* ---------- Feed ---------- */

.feed {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  flex-direction: column;
  width: 300px;
  padding: 12px 0;
  background: var(--panel-bg);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-y: auto;
}

/* Atari-Noir scrollbar: quiet, thin, accent on hover. */
.feed::-webkit-scrollbar {
  width: 6px;
}

.feed::-webkit-scrollbar-track {
  background: transparent;
}

.feed::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

.feed::-webkit-scrollbar-thumb:hover {
  background: var(--accent-1);
}

/* ---------- Live status ---------- */

.live-status {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--panel-bg);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: live-pulse 2.4s ease-in-out infinite;
}

/* Status palette: LIVE green (accent-2), REFRESHING orange (accent-1),
   STALE red (shallow-band #f87171). Locked by visual-identity.md. */
.live-status[data-state="live"] .live-dot {
  background: var(--accent-2);
}

.live-status[data-state="refreshing"] .live-dot {
  background: var(--accent-1);
  animation: live-pulse 0.9s ease-in-out infinite;
}

.live-status[data-state="stale"] {
  color: #f87171;
}

.live-status[data-state="stale"] .live-dot {
  background: #f87171;
  animation: none;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ---------- Loading overlay ---------- */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-1);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* ---------- Error / empty states (T004) ---------- */

.state-overlay {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  max-width: 380px;
  padding: 14px 18px;
  background: var(--panel-bg);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}

.state-title {
  font-size: 20px;
  color: var(--text);
}

.state-body {
  font-size: 14px;
  color: var(--text-muted);
}

.state-btn {
  margin-top: 4px;
  padding: 6px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  cursor: pointer;
}

.state-btn:hover {
  border-color: var(--accent-1);
  color: var(--accent-1);
}

#error-state .state-title {
  color: #f87171;
}

/* ---------- Tooltip & popup (E02 fills content) ---------- */

.tooltip,
.popup {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  pointer-events: none;
}

/* ---------- Quake marker label (T005, minimal safe-DOM) ---------- */

.marker-label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.marker-label-place {
  color: var(--text);
}

.marker-label-mag {
  color: var(--accent-1);
}

.marker-label-depth {
  color: var(--text-muted);
}

/* ---------- Fatal error ---------- */

.fatal-error {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
  text-align: center;
  padding: 24px;
}

.fatal-title {
  font-size: 32px;
  color: var(--accent-1);
}

.fatal-body {
  color: var(--text-muted);
  max-width: 480px;
}
