:root {
  --bg: #07090c;
  --text: #ecebe7;
  --muted: #8f9497;
  --faint: #5f666a;
  --node: #9ea8ac;
  --node-active: #e7f0f3;
  --warm: #ffd9b8;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100svh;
  font-family: var(--sans);
  overflow: hidden;
}

button,
a {
  font: inherit;
}

.page {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 45% at 50% 50%, rgba(110, 145, 180, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 35% at 18% 22%, rgba(60, 100, 150, 0.07), transparent 70%),
    radial-gradient(ellipse 45% 40% at 84% 80%, rgba(100, 80, 160, 0.06), transparent 70%),
    var(--bg);
}

/* ---------- the network ---------- */

.network {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.network:active {
  cursor: grabbing;
}

.graph,
.link-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.graph {
  display: block;
}

.link-layer {
  pointer-events: none;
}

/* ---------- title ---------- */

.intro {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: min(420px, 78vw);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.intro::before {
  content: "";
  position: absolute;
  inset: -45% -25%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(7, 9, 12, 0.7), rgba(7, 9, 12, 0.3) 60%, transparent);
}

.kicker {
  margin: 0 0 14px;
  color: var(--muted);
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: lowercase;
}

h1 {
  margin: 0;
  font-size: clamp(3.3rem, 8vw, 7rem);
  line-height: 0.92;
  letter-spacing: -0.065em;
  font-weight: 520;
  transition: text-shadow 900ms ease, color 900ms ease;
}

.intro.wave h1 {
  color: #f6fbff;
  text-shadow: 0 0 28px rgba(160, 220, 255, 0.35), 0 0 80px rgba(160, 220, 255, 0.15);
  transition-duration: 180ms;
}

.subtitle {
  margin: 20px auto 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: clamp(0.86rem, 1.3vw, 1rem);
  line-height: 1.6;
}

/* ---------- floating hub labels ---------- */

.link-node {
  --dot: 16px;
  --ox: calc(var(--dot) * -1);
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  transform: translate(var(--ox), -50%);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 0;
  background: transparent;
  color: #b7bdc0;
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color 180ms ease;
}

.link-node::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--node);
  box-shadow: 0 0 0 4px rgba(214, 224, 228, 0.03);
  transition: transform 180ms ease, background 180ms ease, box-shadow 260ms ease;
}

.link-node.flip {
  --ox: calc(-100% + var(--dot));
  flex-direction: row-reverse;
  text-align: right;
}

.link-node .label {
  font-size: clamp(0.82rem, 1.2vw, 0.98rem);
  letter-spacing: -0.01em;
}

.link-node .host {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font: 500 0.55rem/1.2 var(--mono);
  letter-spacing: 0.035em;
  transition: color 180ms ease;
}

.link-node:hover,
.link-node.active {
  color: var(--text);
  outline: none;
}

.link-node:hover::before,
.link-node.active::before {
  background: var(--warm);
  transform: scale(1.4);
  box-shadow: 0 0 14px 3px rgba(255, 210, 170, 0.35);
}

.link-node:hover .host,
.link-node.active .host {
  color: #92999d;
}

.link-node.firing::before {
  background: #f4fbff;
  transform: scale(1.6);
  box-shadow: 0 0 14px 4px rgba(170, 215, 245, 0.45);
}

.link-node.unconfigured {
  color: #858b8e;
}

.link-node.tucked {
  pointer-events: none;
}

.link-node.unconfigured .host {
  color: #50575a;
}

/* ---------- dock: hint + index ---------- */

.dock {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 6;
  width: min(640px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 12px;
  pointer-events: none;
}

.hint {
  margin: 0;
  min-height: 1em;
  color: #545b5f;
  font: 500 0.58rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-align: center;
  transition: color 180ms ease;
}

.hint.flash {
  color: #a7afb2;
}

.index {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  pointer-events: auto;
}

.index-item {
  padding: 8px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8a9195;
  font: 500 0.7rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 180ms ease, background 180ms ease;
}

.index-item:hover,
.index-item:focus-visible,
.index-item.active {
  color: var(--text);
  background: rgba(255, 220, 190, 0.07);
  outline: none;
}

.index-item.unconfigured {
  color: #555c60;
}

.index-item.unconfigured:hover,
.index-item.unconfigured:focus-visible,
.index-item.unconfigured.active {
  color: #9aa1a4;
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .intro {
    width: min(360px, 80vw);
  }

  .kicker {
    margin-bottom: 11px;
    font-size: 0.62rem;
  }

  h1 {
    font-size: clamp(3.4rem, 17vw, 5rem);
  }

  .subtitle {
    margin-top: 16px;
    font-size: 0.82rem;
  }

  .link-node {
    --dot: 13px;
    padding: 11px 10px;
    gap: 7px;
  }

  .link-node .label {
    font-size: 0.78rem;
  }

  .link-node .host {
    display: none;
  }

  .dock {
    bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .index-item {
    padding: 9px 8px;
    font-size: 0.66rem;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  h1 {
    font-size: clamp(2.7rem, 9vw, 4.4rem);
  }

  .subtitle {
    font-size: 0.76rem;
    max-width: 25ch;
  }

  .hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
