/* ============================================================
   DISTILL ▲ GRAPH — v2
   Deep-space star chart. OKLCH cool-tinted neutrals, three type
   families (Oswald display / Inter body / JetBrains Mono data),
   spectral star color by source repo, named constellations.
   ============================================================ */

:root {
  /* cool-tinted neutrals (never pure black/white) */
  --canvas:      oklch(0.09 0.014 256);
  --canvas-deep: oklch(0.045 0.012 256);
  --surface:     oklch(0.13 0.016 256);
  --ink:         oklch(0.97 0.008 250);
  --text-1:      oklch(0.95 0.006 250);
  --text-2:      oklch(0.76 0.016 250);   /* AA secondary on canvas */
  --text-3:      oklch(0.63 0.018 250);   /* AA-large tertiary */
  --hair:        oklch(0.36 0.016 256);
  --hair-soft:   oklch(0.22 0.013 256);
  --star:        oklch(0.97 0.01 250);

  --display: "Oswald", "Arial Narrow", Arial, sans-serif;
  --body:    "Inter", system-ui, -apple-system, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 8px; --r-md: 14px; --r-pill: 999px;
  --s-xs: 8px; --s-sm: 12px; --s-md: 16px; --s-lg: 20px; --s-xl: 28px; --s-2xl: 40px;
  --nav-h: 58px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1); /* ease-out-expo */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background:
    radial-gradient(125% 90% at 72% 8%, oklch(0.17 0.045 268 / 0.55), transparent 58%),
    radial-gradient(110% 85% at 12% 102%, oklch(0.15 0.04 226 / 0.45), transparent 55%),
    var(--canvas-deep);
  color: var(--text-1);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}
a { color: inherit; }
::selection { background: var(--ink); color: var(--canvas-deep); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* ===================== LOADER ===================== */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--canvas-deep);
  display: grid; place-items: center;
  color: var(--ink);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
#loader.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { text-align: center; padding: 0 24px; }
.loader-inner .mark { opacity: 0; animation: markIn 0.9s var(--ease) forwards; }
.loader-word {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(30px, 9vw, 46px); line-height: 1; letter-spacing: 0.06em;
  margin-top: 16px;
}
.loader-word i { font-style: normal; color: var(--text-2); margin: 0 3px; }
.loader-sub {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em;
  color: var(--text-2); margin-top: 14px;
}
.loader-track { width: min(220px, 60vw); height: 1px; background: var(--hair); margin: 24px auto 0; overflow: hidden; }
#loader-bar { display: block; height: 100%; width: 0%; background: var(--ink); transition: width 0.25s linear; }
@keyframes markIn { to { opacity: 1; } }

@keyframes twinkle { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.6; } }

/* ===================== TOP NAV ===================== */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--s-md) 0;
  background: linear-gradient(to bottom, oklch(0.045 0.012 256 / 0.92), transparent);
  pointer-events: none;
}
#nav > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; flex-shrink: 0; }
.brand-word { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 16px; letter-spacing: 0.08em; }
.brand-word em { font-style: normal; color: var(--text-2); }

.nav-actions { display: flex; gap: var(--s-xs); }
.nav-btn {
  font-family: var(--display); font-weight: 600; text-transform: uppercase;
  font-size: 13px; letter-spacing: 0.05em;
  color: var(--text-1); background: oklch(0.13 0.016 256 / 0.7);
  border: 1px solid var(--hair); border-radius: var(--r-pill);
  padding: 9px 15px; min-height: 40px; cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
  white-space: nowrap;
}
.nav-btn:hover { border-color: var(--ink); }
.nav-btn[aria-pressed="true"] { background: var(--ink); color: var(--canvas-deep); border-color: var(--ink); }

#search-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--s-md) 0;
  display: flex; align-items: center; gap: var(--s-xs); background: var(--canvas-deep);
}
#search-bar[hidden] { display: none; }
#search-input {
  flex: 1; min-width: 0; background: transparent; border: none;
  border-bottom: 1px solid var(--hair); color: var(--text-1);
  font-family: var(--body); font-size: 15px; padding: 11px 2px; outline: none;
}
#search-input::placeholder { color: var(--text-3); }
#search-input:focus { border-bottom-color: var(--ink); }

/* ===================== MAP ===================== */
#map-view { position: fixed; inset: 0; }
#sky { width: 100%; height: 100%; display: block; touch-action: none; }

/* edges — brighter, clearer; types differ by brightness + dash + arrow */
.edge { stroke: var(--ink); fill: none; stroke-opacity: 0.18; vector-effect: non-scaling-stroke; transition: stroke-opacity 0.3s var(--ease); }
.edge.depends-on     { stroke-opacity: 0.34; }
.edge.same-repo      { stroke-opacity: 0.16; }
.edge.same-domain    { stroke-opacity: 0.22; stroke-dasharray: 0.5 4; stroke-linecap: round; }
.edge.alternative-to { stroke-opacity: 0.28; stroke-dasharray: 6 5; }
.edge.similar-pattern{ stroke-opacity: 0.14; stroke-dasharray: 2 6; }
.edge.lit { stroke-opacity: 0.9 !important; }
.edge.dim { stroke-opacity: 0.04 !important; }

.arrowhead { fill: var(--ink); opacity: 0.5; }

/* nodes — stars (fill set per-repo in JS) */
.node { cursor: pointer; transition: opacity 0.3s var(--ease); }
.node .halo { opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.node .hit { fill: transparent; }
.node .label {
  fill: var(--text-1); font-family: var(--display); font-weight: 500;
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.02em;
  text-anchor: middle; pointer-events: none; opacity: 0;
  paint-order: stroke; stroke: var(--canvas-deep); stroke-width: 3px; stroke-linejoin: round;
  transition: opacity 0.25s;
}
.node.show-label .label { opacity: 0.82; }
.node.dim { opacity: 0.13; }
.node.lit .halo { opacity: 0.9; }
.node.lit .label { opacity: 1; }
.node.selected .halo { opacity: 1; }
.node.selected .label { opacity: 1; }

/* named constellations (domain labels at cluster tops) */
.constellation {
  fill: var(--text-3); font-family: var(--display); font-weight: 600;
  text-transform: uppercase; font-size: 12px; letter-spacing: 0.18em;
  text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: var(--canvas-deep); stroke-width: 3.5px; stroke-linejoin: round;
  opacity: 0; transition: opacity 0.4s var(--ease), fill 0.3s;
}
.constellation.shown { opacity: 0.55; }
.constellation.active { opacity: 1; fill: var(--text-1); }
.constellation.muted { opacity: 0.12; }

/* domain filter rail */
#domain-rail {
  position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 14px);
  z-index: 30; display: flex; gap: var(--s-xs); padding: 0 var(--s-md);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
#domain-rail::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font-family: var(--display); font-weight: 500; text-transform: uppercase;
  font-size: 12px; letter-spacing: 0.04em; color: var(--text-2);
  background: oklch(0.13 0.016 256 / 0.86); border: 1px solid var(--hair);
  border-radius: var(--r-pill); padding: 9px 14px; min-height: 38px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: border-color 0.18s, color 0.18s, background 0.18s; white-space: nowrap;
}
.chip .chip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.chip:hover { border-color: var(--ink); color: var(--text-1); }
.chip.active { background: var(--ink); color: var(--canvas-deep); border-color: var(--ink); }

#hint {
  position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 62px);
  z-index: 25; text-align: center; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.01em; color: var(--text-3); transition: opacity 0.5s; padding: 0 16px;
}
#hint.gone { opacity: 0; pointer-events: none; }

/* domain context panel (top) */
#domain-info {
  position: fixed; z-index: 28; top: calc(var(--nav-h) + env(safe-area-inset-top) + 8px);
  left: var(--s-md); right: var(--s-md); max-width: 560px; margin: 0 auto;
  background: oklch(0.12 0.016 256 / 0.92); border: 1px solid var(--hair);
  border-radius: var(--r-md); padding: 13px 16px;
  opacity: 0; transform: translateY(-8px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
#domain-info.in { opacity: 1; transform: none; }
#domain-info[hidden] { display: none; }
.di-head { display: flex; align-items: center; gap: 9px; }
.di-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.di-name { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 15px; letter-spacing: 0.05em; color: var(--text-1); }
.di-count { font-family: var(--mono); font-size: 12px; color: var(--text-3); margin-left: auto; }
.di-desc { font-family: var(--body); font-size: 14px; line-height: 1.5; color: var(--text-2); margin-top: 7px; }

/* zoom controls */
#zoom-controls {
  position: fixed; z-index: 30; left: var(--s-md); bottom: calc(env(safe-area-inset-bottom) + 66px);
  display: flex; flex-direction: column; gap: 7px;
}
#zoom-controls button {
  width: 44px; height: 44px; border-radius: 12px;
  background: oklch(0.13 0.016 256 / 0.9); border: 1px solid var(--hair); color: var(--text-1);
  font-family: var(--body); font-size: 22px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: border-color 0.18s, background 0.18s;
}
#zoom-controls #zoom-reset { font-size: 17px; }
#zoom-controls button:hover { border-color: var(--ink); background: var(--surface); }
#zoom-controls button:active { background: var(--ink); color: var(--canvas-deep); }

/* legend */
#legend-btn {
  position: fixed; z-index: 30; right: var(--s-md); bottom: calc(env(safe-area-inset-bottom) + 66px);
  font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em;
  color: var(--text-1); background: oklch(0.13 0.016 256 / 0.9); border: 1px solid var(--hair);
  border-radius: var(--r-pill); padding: 0 16px; height: 44px; cursor: pointer; transition: border-color 0.18s;
}
#legend-btn:hover { border-color: var(--ink); }
#legend {
  position: fixed; z-index: 31; right: var(--s-md); bottom: calc(env(safe-area-inset-bottom) + 120px);
  width: min(260px, calc(100vw - 32px));
  background: oklch(0.11 0.016 256 / 0.96); border: 1px solid var(--hair); border-radius: var(--r-md);
  padding: 15px 16px; max-height: 60vh; overflow-y: auto;
}
#legend[hidden] { display: none; }
.legend-h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin: 12px 0 8px; }
.legend-h:first-child { margin-top: 0; }
.legend-row { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--text-2); margin-bottom: 7px; }
.legend-row .sw-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-row .sw-line { width: 24px; height: 0; flex-shrink: 0; border-top: 1.5px solid var(--text-2); }
.legend-row .sw-line.s-depends { border-top-style: solid; }
.legend-row .sw-line.s-same-domain { border-top-style: dotted; }
.legend-row .sw-line.s-alt { border-top-style: dashed; }
.legend-row .sw-arrow { font-family: var(--body); }

/* ===================== INDEX ===================== */
#index-view {
  position: fixed; inset: 0; z-index: 20; background: var(--canvas-deep);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--nav-h) + env(safe-area-inset-top));
}
#index-view[hidden] { display: none; }
.index-head { padding: var(--s-2xl) var(--s-md) var(--s-lg); max-width: 760px; }
.eyebrow { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; color: var(--text-3); }
.index-head h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(46px, 16vw, 76px); line-height: 0.95; letter-spacing: 0.02em; margin: 6px 0 12px; }
.index-stats { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.idx-domain { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding: var(--s-lg) var(--s-md) 8px; display: flex; align-items: center; gap: 9px; }
.idx-domain .sw-dot { width: 8px; height: 8px; border-radius: 50%; }
.idx-row { display: flex; align-items: baseline; gap: var(--s-sm); width: 100%; text-align: left; padding: 15px var(--s-md); background: transparent; border: none; border-top: 1px solid var(--hair-soft); color: var(--text-1); cursor: pointer; transition: background 0.15s; }
.idx-row:hover { background: oklch(0.13 0.016 256 / 0.6); }
.idx-row .idx-label { font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 18px; letter-spacing: 0.01em; line-height: 1.15; flex: 1; }
.idx-row .idx-repo { font-family: var(--mono); font-size: 12px; color: var(--text-3); white-space: nowrap; }
.site-footer { display: flex; flex-direction: column; gap: 6px; padding: var(--s-2xl) var(--s-md) calc(var(--s-2xl) + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair-soft); margin-top: var(--s-lg); font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }
.site-footer a { text-decoration: underline; color: var(--text-2); }

/* ===================== DETAIL SHEET ===================== */
#scrim { position: fixed; inset: 0; z-index: 50; background: oklch(0.02 0.01 256 / 0.6); opacity: 0; transition: opacity 0.3s; }
#scrim.in { opacity: 1; }
#scrim[hidden] { display: none; }

#sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 84vh;
  background: var(--surface); border-top: 1px solid var(--hair); border-radius: 18px 18px 0 0;
  transform: translateY(101%); transition: transform 0.42s var(--ease);
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
}
#sheet.in { transform: translateY(0); }
#sheet[hidden] { display: none; }
.sheet-grip { align-self: center; width: 42px; height: 4px; border-radius: 99px; background: var(--hair); border: none; margin: 10px 0 2px; cursor: pointer; flex-shrink: 0; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--s-md) var(--s-xl) var(--s-xl); }

.sheet-tag { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; color: var(--text-2); }
.sheet-tag .sw-dot { width: 9px; height: 9px; border-radius: 50%; }
.sheet-title { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(30px, 8vw, 42px); line-height: 1.02; letter-spacing: 0.01em; margin: 8px 0 8px; }
.sheet-from { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.sheet-from a { text-decoration: underline; }
.sheet-summary { font-family: var(--body); font-size: 15.5px; line-height: 1.65; color: var(--text-1); margin: var(--s-md) 0 var(--s-lg); max-width: 64ch; }
.sheet-rule { height: 1px; background: var(--hair-soft); margin: var(--s-md) 0; }

.cta-row { display: flex; flex-direction: column; gap: 10px; }
.cta { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--s-sm); font-family: var(--display); font-weight: 600; text-transform: uppercase; font-size: 14px; letter-spacing: 0.04em; color: var(--ink); text-decoration: none; background: transparent; border: 1px solid var(--text-2); border-radius: var(--r-pill); padding: 15px 22px; min-height: 52px; transition: background 0.18s, color 0.18s, border-color 0.18s; }
.cta:hover { background: var(--ink); color: var(--canvas-deep); border-color: var(--ink); }
.cta .arr { font-family: var(--body); }

.connected-head { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin: var(--s-lg) 0 var(--s-sm); }
.conn-list { display: flex; flex-wrap: wrap; gap: var(--s-xs); }
.conn { font-family: var(--display); font-weight: 500; text-transform: uppercase; font-size: 12px; letter-spacing: 0.02em; color: var(--text-1); background: transparent; border: 1px solid var(--hair); border-radius: var(--r-pill); padding: 8px 13px; min-height: 36px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: border-color 0.18s; }
.conn:hover { border-color: var(--ink); }
.conn .sw-dot { width: 7px; height: 7px; border-radius: 50%; }
.conn em { font-style: normal; color: var(--text-3); font-family: var(--mono); font-size: 11px; }

/* ===================== RESPONSIVE ===================== */
@media (min-width: 768px) {
  :root { --nav-h: 64px; }
  #nav { padding-left: var(--s-xl); padding-right: var(--s-xl); }
  #domain-rail { justify-content: center; flex-wrap: wrap; overflow: visible; mask-image: none; row-gap: var(--s-xs); bottom: calc(env(safe-area-inset-bottom) + 18px); }
  #hint { bottom: calc(env(safe-area-inset-bottom) + 74px); }
}
@media (min-width: 1024px) {
  #sheet { left: auto; right: 0; top: 0; bottom: 0; width: 420px; max-height: none; border-radius: 0; border-top: none; border-left: 1px solid var(--hair); transform: translateX(101%); }
  #sheet.in { transform: translateX(0); }
  .sheet-grip { display: none; }
  .sheet-body { padding-top: calc(var(--nav-h) + var(--s-md)); }
  #scrim { background: oklch(0.02 0.01 256 / 0.4); }
  .index-head, .idx-domain, .idx-row, .site-footer { padding-left: var(--s-2xl); padding-right: var(--s-2xl); }
}

/* ===================== REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.06ms !important; }
  #loader .mark { opacity: 1; animation: none; }
}

/* ===================== POLISH PASS — make-interfaces-feel-better ===================== */

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* updating numbers stay aligned */
.index-stats, .di-count, .loader-sub { font-variant-numeric: tabular-nums; }

/* kinder text wrapping (no orphans on titles, even rag on body) */
.loader-word, .sheet-title, .index-head h1, .di-name, .idx-label { text-wrap: balance; }
.sheet-summary, .di-desc, .site-footer span { text-wrap: pretty; }

/* tactile, interruptible press states on controls (compositor-friendly only) */
.nav-btn, .chip, .cta, .conn, #zoom-controls button, #legend-btn {
  transition-property: transform, background-color, color, border-color, box-shadow;
  transition-duration: 160ms;
  transition-timing-function: var(--ease);
}
.nav-btn:active, .chip:active, .cta:active, .conn:active,
#zoom-controls button:active, #legend-btn:active { transform: scale(0.96); }

/* depth only where a floating surface earns it (popovers / the sheet) */
#sheet { box-shadow: 0 -24px 64px oklch(0.02 0.01 256 / 0.55); }
@media (min-width: 1024px) { #sheet { box-shadow: -30px 0 72px oklch(0.02 0.01 256 / 0.5); } }
#domain-info, #legend { box-shadow: 0 12px 34px oklch(0.02 0.01 256 / 0.5); }

/* hit areas >= 40px */
.chip, .conn { min-height: 40px; }

/* optical centering: the up-right arrow + reset glyph sit a hair low geometrically */
.cta .arr { transform: translateY(0.5px); }
#zoom-controls #zoom-reset { padding-bottom: 1px; }

/* respect reduced-motion: no press-scale if the user opts out */
@media (prefers-reduced-motion: reduce) {
  .nav-btn:active, .chip:active, .cta:active, .conn:active,
  #zoom-controls button:active, #legend-btn:active { transform: none; }
}

/* ===================== v3 CRAFT REFINEMENT ===================== */

/* kill the browser focus box on tap; keyboard users get a clean ring on the star only */
.node:focus { outline: none; }
.node:focus-visible { outline: none; }
.node:focus-visible .star { stroke: var(--ink); stroke-width: 2px; paint-order: stroke; }

/* stars: bright crisp core + tight, sparing glow (no muddy grey blobs) */
.node .core { fill: oklch(0.99 0.004 250); opacity: 0.92; pointer-events: none; transition: opacity 0.2s; }
.node .halo { opacity: 0; }
.node.lit .halo { opacity: 0.4; }
.node.selected .halo { opacity: 0.62; }
.node.dim .core { opacity: 0.45; }

/* labels: soft layered shadow, no hard cartoon outline */
.node .label {
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.03em;
  stroke: none; paint-order: normal;
  text-shadow: 0 0 4px var(--canvas-deep), 0 0 9px var(--canvas-deep), 0 1px 2px oklch(0 0 0 / 0.85);
}
.node.show-label .label { opacity: 0.78; }
.node.lit .label, .node.selected .label { opacity: 1; }

/* a delicate web at rest; crisp only where it's lit */
.edge { stroke-opacity: 0.12; }
.edge.depends-on { stroke-opacity: 0.2; }
.edge.same-repo { stroke-opacity: 0.1; }
.edge.same-domain { stroke-opacity: 0.15; }
.edge.alternative-to { stroke-opacity: 0.18; }
.edge.similar-pattern { stroke-opacity: 0.09; }
.edge.lit { stroke-opacity: 0.85 !important; }
.edge.dim { stroke-opacity: 0.03 !important; }
.arrowhead { fill: var(--ink); opacity: 0.78; }

/* constellation names: refined, soft, only at low zoom */
.constellation {
  font-size: 11.5px; letter-spacing: 0.22em; fill: var(--text-3);
  stroke: none; paint-order: normal;
  text-shadow: 0 0 6px var(--canvas-deep), 0 1px 2px var(--canvas-deep);
}
.constellation.shown { opacity: 0.4; }
.constellation.active { opacity: 0.92; fill: var(--text-2); }
.constellation.muted { opacity: 0.08; }

/* ===================== POLISH: interaction states + empty state ===================== */

/* star hover feedback (real-pointer devices only, so touch taps don't stick) */
@media (hover: hover) {
  .node:hover .core { opacity: 1; }
  .node:hover .halo { opacity: 0.32; }
  .node:hover .label { opacity: 0.96; }
}

/* search: no-results state (teaches, doesn't just go dark) */
#search-empty {
  position: fixed; z-index: 26; top: 50%; left: 0; right: 0;
  transform: translateY(-50%); text-align: center; padding: 0 24px;
  font-family: var(--mono); font-size: 13px; color: var(--text-2);
  pointer-events: none;
}
#search-empty[hidden] { display: none; }
#search-empty b { color: var(--text-1); font-weight: 500; }

/* ===================== REDESIGN: calm resting state ===================== */

/* whisper-faint web at rest; dots and negative space carry the composition */
.edge { stroke-opacity: 0.06; }
.edge.depends-on { stroke-opacity: 0.11; }
.edge.same-repo { stroke-opacity: 0.05; }
.edge.same-domain { stroke-opacity: 0.08; }
.edge.alternative-to { stroke-opacity: 0.1; }
.edge.similar-pattern { stroke-opacity: 0.05; }

/* constellation names are the primary orientation at rest */
.constellation { font-size: 12.5px; letter-spacing: 0.26em; fill: var(--text-2); font-weight: 600; }
.constellation.shown { opacity: 0.5; }
.constellation.active { opacity: 1; fill: var(--text-1); }

/* film grain breaks the digital flatness (static, very subtle) */
#grain {
  position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===================== HIGH-END VISUAL PASS (Awwwards-tier chrome) ===================== */
:root {
  --body: "Geist", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --island: cubic-bezier(0.32, 0.72, 0, 1);
  --glass: oklch(0.16 0.018 256 / 0.6);
  --glass-solid: oklch(0.15 0.018 256 / 0.92);
  --hairline: oklch(0.92 0.012 250 / 0.1);
  --inset-hi: inset 0 1px 0 oklch(0.99 0.01 250 / 0.12);
}

/* deeper OLED base + restrained warm/cool mesh orbs (not the purple cliche) */
body {
  background:
    radial-gradient(58% 48% at 80% 4%, oklch(0.5 0.1 64 / 0.1), transparent 60%),
    radial-gradient(52% 44% at 8% 98%, oklch(0.46 0.09 244 / 0.1), transparent 60%),
    oklch(0.038 0.009 256);
}

/* floating glass control island, detached and rounded-full */
#nav { background: none; }
.nav-actions {
  gap: 3px; padding: 4px; border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--hairline);
  box-shadow: var(--inset-hi), 0 10px 34px oklch(0.02 0.01 256 / 0.5);
}
.nav-btn {
  font-family: var(--body); font-weight: 500; text-transform: none; letter-spacing: 0;
  font-size: 13.5px; background: transparent; border: none; min-height: 36px; border-radius: 999px;
  transition: background 0.45s var(--island), color 0.45s var(--island), transform 0.45s var(--island);
}
.nav-btn:hover { background: oklch(0.99 0.01 250 / 0.08); border: none; }
.nav-btn:active { transform: scale(0.95); }
.nav-btn[aria-pressed="true"] { background: var(--ink); color: oklch(0.04 0.01 256); }

/* small floating controls: solid glass (no blur on scroll containers) + inset highlight */
#zoom-controls button, #legend-btn {
  background: var(--glass-solid); border: 1px solid var(--hairline); box-shadow: var(--inset-hi);
}
#zoom-controls button { border-radius: 14px; }
.chip { background: var(--glass-solid); border: 1px solid var(--hairline); box-shadow: var(--inset-hi); font-family: var(--body); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.chip.active { background: var(--ink); color: oklch(0.04 0.01 256); }

/* double-bezel detail sheet: glass outer shell + distinct inner core */
#sheet {
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(1.5); backdrop-filter: blur(30px) saturate(1.5);
  border: 1px solid var(--hairline); padding: 6px;
  box-shadow: var(--inset-hi), 0 -34px 80px oklch(0.02 0.01 256 / 0.6);
}
.sheet-body { background: oklch(0.09 0.013 256 / 0.82); border-radius: 19px; box-shadow: inset 0 1px 0 oklch(0.99 0.01 250 / 0.07); }
.sheet-grip { margin: 9px 0 5px; }
@media (max-width: 1023px) { #sheet { border-radius: 26px 26px 0 0; } .sheet-body { border-radius: 21px 21px 0 0; } }
@media (min-width: 1024px) { #sheet { border-radius: 0; border-left: 1px solid var(--hairline); padding: 8px; } .sheet-body { border-radius: 16px; } }

/* domain panel + legend: glass + inset hairline */
#domain-info, #legend {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--hairline); box-shadow: var(--inset-hi), 0 18px 44px oklch(0.02 0.01 256 / 0.5);
}

/* eyebrow pill on the sheet domain tag */
.sheet-tag {
  padding: 6px 12px 6px 10px; border-radius: 999px;
  background: oklch(0.99 0.01 250 / 0.05); border: 1px solid var(--hairline);
  letter-spacing: 0.1em; font-size: 10.5px; text-transform: uppercase;
}

/* button-in-button CTAs with magnetic hover physics */
.sheet-title { letter-spacing: 0; }
.cta {
  justify-content: space-between; padding: 9px 9px 9px 22px; min-height: 54px;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: oklch(0.99 0.01 250 / 0.045); box-shadow: var(--inset-hi);
  text-transform: none; letter-spacing: 0;
  transition: background 0.5s var(--island), transform 0.4s var(--island), border-color 0.45s var(--island);
}
.cta:hover { background: oklch(0.99 0.01 250 / 0.09); border-color: oklch(0.92 0.012 250 / 0.22); color: var(--ink); }
.cta:active { transform: scale(0.985); }
.cta .cta-label { font-family: var(--body); font-weight: 500; font-size: 15px; }
.cta .cta-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px; display: grid; place-items: center;
  background: oklch(0.99 0.01 250 / 0.1); color: var(--ink); font-size: 16px;
  transition: transform 0.5s var(--island), background 0.45s var(--island), color 0.45s var(--island);
}
.cta:hover .cta-icon { transform: translate(2px, -2px) scale(1.07); background: var(--ink); color: oklch(0.04 0.01 256); }

/* connected chips: glass pill, sentence case */
.conn { background: oklch(0.99 0.01 250 / 0.04); border: 1px solid var(--hairline); box-shadow: var(--inset-hi); font-family: var(--body); font-weight: 500; text-transform: none; letter-spacing: 0; }
.conn:hover { border-color: oklch(0.92 0.012 250 / 0.24); }

/* ===================== DETAIL PASS: connected list + control placement ===================== */

/* connected items become a clean, scannable, divider-separated list (handles any length) */
.conn-list { flex-direction: column; flex-wrap: nowrap; gap: 0; margin-top: 6px; border-top: 1px solid var(--hair-soft); }
.conn {
  width: 100%; justify-content: flex-start; align-items: center; gap: 11px;
  min-height: 0; padding: 13px 4px; border: none; border-bottom: 1px solid var(--hair-soft);
  border-radius: 0; background: transparent; box-shadow: none; text-align: left;
}
.conn:hover { background: oklch(0.99 0.01 250 / 0.035); border-bottom-color: var(--hair-soft); }
.conn .sw-dot { width: 9px; height: 9px; flex-shrink: 0; }
.conn .conn-name { flex: 1; min-width: 0; font-family: var(--body); font-weight: 500; font-size: 14.5px; color: var(--text-1); line-height: 1.32; }
.conn em { flex-shrink: 0; margin-left: 10px; font-family: var(--mono); font-style: normal; font-size: 11.5px; letter-spacing: 0; color: var(--text-3); white-space: nowrap; }

/* zoom controls move to the left edge midline so they never crowd the domain rail */
#zoom-controls { left: var(--s-md); top: 50%; bottom: auto; transform: translateY(-50%); }
@media (min-width: 1024px) { #zoom-controls { top: auto; bottom: calc(env(safe-area-inset-bottom) + 28px); transform: none; } }
