/* SIGNAL — living data organism */

:root {
  --bg: #06070A;
  --bg-deep: #04050A;
  --ink: #EDEBE4;
  --ink-dim: #8A877E;
  --ink-faint: #45433D;
  --line: rgba(237, 235, 228, 0.06);
  --line-strong: rgba(237, 235, 228, 0.14);
  --accent-h: 190;
  --accent: oklch(0.84 0.1 var(--accent-h));
  --accent-soft: oklch(0.84 0.1 var(--accent-h) / 0.2);
  --accent-faint: oklch(0.84 0.1 var(--accent-h) / 0.08);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Space Grotesk", -apple-system, system-ui, sans-serif;
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  width: 100%;
  height: 100%;
  cursor: none;
}

body {
  background:
    radial-gradient(ellipse 70% 50% at 50% 50%, oklch(0.84 0.1 var(--accent-h) / 0.08), transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 80%, oklch(0.84 0.1 var(--accent-h) / 0.04), transparent 70%),
    var(--bg);
}

::selection { background: var(--accent-soft); color: var(--ink); }

.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }

/* Root stage */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Custom cursor */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 24px; height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 200;
  mix-blend-mode: screen;
  will-change: transform;
}
.cursor-ring {
  position: absolute; inset: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.9;
}
.cursor-dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 3px; height: 3px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px var(--accent);
}
.cursor.hover .cursor-ring { transform: scale(1.8); opacity: 0.4; }
.cursor.pressed .cursor-ring { transform: scale(0.6); }

.cursor-coord {
  position: absolute;
  left: 24px; top: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--accent);
  white-space: nowrap;
  opacity: 0.6;
}

/* Background field canvas */
.field {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Streams */
.streams {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Globe */
.globe-wrap {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 620px; height: 620px;
  z-index: 2;
  pointer-events: none;
}
@media (max-width: 900px) {
  .globe-wrap { width: 420px; height: 420px; }
}

/* Central numeral */
.numeral-wrap {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  pointer-events: none;
  mix-blend-mode: screen;
}
.numeral-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(18px);
}
.numeral-label::before,
.numeral-label::after {
  content: "";
  width: 28px; height: 1px;
  background: var(--accent);
  opacity: 0.7;
}
.numeral {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(140px, 20vw, 280px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  text-shadow: 0 0 40px oklch(0.84 0.1 var(--accent-h) / 0.3);
}
.numeral .digit {
  display: inline-block;
  min-width: 0.58em;
  text-align: center;
  position: relative;
}
.numeral .unit {
  font-family: var(--mono);
  font-size: 0.22em;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-left: 0.1em;
  align-self: center;
  font-weight: 400;
}
.numeral-caption {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
  max-width: 480px;
}
.numeral-caption em {
  font-style: normal;
  color: var(--accent);
}

/* Metric cycle indicator */
.metric-switcher {
  display: flex;
  gap: 3px;
  margin-top: 8px;
}
.metric-switcher .pip {
  width: 18px; height: 2px;
  background: var(--line-strong);
  transition: background 0.4s;
}
.metric-switcher .pip.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* HUD — top-left identity + top-right status */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: 32px 36px;
}
.hud > * { pointer-events: auto; }

.hud-top {
  position: absolute;
  top: 28px; left: 36px; right: 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.identity {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}
.identity .mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 12px;
}
.identity .mark .glyph {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  position: relative;
  box-shadow: 0 0 10px oklch(0.84 0.1 var(--accent-h) / 0.4);
}
.identity .mark .glyph::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  animation: corePulse 2.6s ease-in-out infinite;
}
.identity .sub { color: var(--ink-faint); text-transform: uppercase; }

@keyframes corePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

.status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.status .row { display: flex; align-items: center; gap: 10px; }
.status .row .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: corePulse 2.4s ease-in-out infinite;
}
.status .time {
  color: var(--ink);
  font-size: 11px;
}

/* Bottom HUD */
.hud-bottom {
  position: absolute;
  left: 36px; right: 36px; bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
}

.readout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.readout .key { color: var(--ink-faint); }
.readout .val { color: var(--ink); font-size: 11px; letter-spacing: 0.16em; }
.readout .val strong { color: var(--accent); font-weight: 400; }

.hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: hintBreath 3.4s ease-in-out infinite;
}
.hint kbd {
  font-family: var(--mono);
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink);
  font-size: 10px;
  background: rgba(237, 235, 228, 0.04);
}
@keyframes hintBreath {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* Constellation — LinkedIn and other nodes */
.constellation {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.const-node {
  position: absolute;
  pointer-events: auto;
  cursor: none;
  text-decoration: none;
  color: inherit;
  transform: translate(-50%, -50%);
}
.const-node .n-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--accent);
  box-shadow: 0 0 10px oklch(0.84 0.1 var(--accent-h) / 0.6);
  transition: transform 0.3s, background 0.3s;
}
.const-node:hover .n-dot {
  transform: scale(1.6);
  background: var(--accent);
}
.const-node .n-label {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: color 0.3s;
}
.const-node:hover .n-label { color: var(--accent); }
.const-node .n-label .arrow { color: var(--ink-faint); margin-left: 6px; }

/* Command palette */
.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 7, 10, 0.7);
  backdrop-filter: blur(16px) saturate(1.1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.palette {
  width: min(640px, 90vw);
  background: color-mix(in oklch, var(--bg) 85%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7),
              0 0 0 1px var(--line),
              0 0 80px -10px oklch(0.84 0.1 var(--accent-h) / 0.3);
  overflow: hidden;
  animation: paletteIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes paletteIn {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.palette-input {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 22px 24px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.04em;
  outline: none;
  border-bottom: 1px solid var(--line);
}
.palette-input::placeholder { color: var(--ink-faint); }

.palette-results {
  max-height: 380px;
  overflow-y: auto;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  cursor: pointer;
  transition: background 0.12s;
  border-left: 2px solid transparent;
}
.palette-item.on {
  background: oklch(0.84 0.1 var(--accent-h) / 0.06);
  color: var(--ink);
  border-left-color: var(--accent);
}
.palette-item .tag {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-left: auto;
}
.palette-item.on .tag { color: var(--accent); }
.palette-item .prefix {
  color: var(--accent);
  font-size: 10px;
  width: 14px;
}

.palette-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.palette-footer kbd {
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink-dim);
  margin: 0 3px;
}

/* Detail panel (opens on palette select of a KPI) */
.detail {
  position: fixed;
  left: 36px; bottom: 72px;
  z-index: 80;
  width: min(360px, 32vw);
  background: color-mix(in oklch, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  animation: detailIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes detailIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.detail .dh {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.detail .dh .close {
  cursor: none;
  color: var(--ink-faint);
}
.detail .dh .close:hover { color: var(--ink); }
.detail .title {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--ink);
  font-weight: 300;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.detail .body { line-height: 1.6; text-transform: none; letter-spacing: 0.04em; font-size: 12px; color: var(--ink-dim); }
.detail .body em { font-style: normal; color: var(--accent); }
.detail .footer-row {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.2em;
}

/* Tweaks */
.tweaks {
  position: fixed; bottom: 24px; right: 24px; z-index: 120;
  width: 260px; padding: 18px;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-family: var(--mono); font-size: 11px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.6);
}
.tweaks h4 { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 14px; display: flex; justify-content: space-between; }
.tweaks .row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tweaks .row label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.tweaks input[type=range] { width: 100%; accent-color: var(--accent); }
.tweaks .seg { display: flex; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.tweaks .seg button { flex: 1; background: transparent; border: 0; color: var(--ink-dim); padding: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; cursor: none; }
.tweaks .seg button.on { background: oklch(0.84 0.1 var(--accent-h) / 0.12); color: var(--ink); box-shadow: inset 0 -1px 0 var(--accent); }
.tweaks .swatch { height: 6px; background: linear-gradient(90deg, oklch(0.84 0.1 0), oklch(0.84 0.1 60), oklch(0.84 0.1 120), oklch(0.84 0.1 180), oklch(0.84 0.1 240), oklch(0.84 0.1 300), oklch(0.84 0.1 360)); }

/* Palette trigger button (for touch / users who don't know the shortcut) */
.palette-trigger {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 32px;
  cursor: none;
  transition: all 0.25s;
}
.palette-trigger:hover { color: var(--ink); border-color: var(--accent); box-shadow: 0 0 20px oklch(0.84 0.1 var(--accent-h) / 0.25); }
.palette-trigger kbd {
  font-family: var(--mono);
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-size: 9px;
  color: var(--ink);
}
.palette-trigger .glow {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: corePulse 2.4s ease-in-out infinite;
}

/* Mode indicator (top center) */
.mode {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.mode .item { position: relative; padding-bottom: 6px; }
.mode .item.on { color: var(--ink); }
.mode .item.on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

@media (max-width: 700px) {
  html, body { cursor: auto; }
  .cursor { display: none; }
  .mode { display: none; }
  .hud-bottom { flex-direction: column; align-items: flex-start; }
  .hud-top { flex-direction: column; gap: 14px; }
  .tweaks { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
}
