@import url("../tokens.css");
/* BRAINVIEW — Night theme.
 * Tokens come from ../tokens.css (single source of truth); no local colour,
 * font or duration literals. Flat and boxy: near-black surface, warm-white ink,
 * restrained dark-green accent. Fullscreen layout: the brain IS the page;
 * controls float on the right.
 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: var(--night-bg); color: var(--night-ink); font-family: var(--night-sans); line-height: var(--leading-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--night-accent-soft); outline-offset: 3px; }

/* ---------- header (slim) ---------- */
.site-header { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: var(--hairline); height: 52px; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-family: var(--night-mono); font-size: var(--step--1); font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--night-ink); text-decoration: none; white-space: nowrap; transition: opacity var(--dur-1) var(--ease-out); }
.wordmark:hover, .wordmark:focus-visible { color: var(--night-accent-ink); }
.wordmark:active { color: var(--night-accent); }
.brand-mark { color: var(--night-accent); }
.status-dot { width: 8px; height: 8px; background: var(--night-faint); flex: none; }
.status-dot.ok { background: var(--night-accent); }
.status-dot.err { background: var(--night-danger); }
.status { font-family: var(--night-mono); font-size: var(--step--1); color: var(--night-muted); white-space: nowrap; }
.site-header nav { display: flex; gap: 8px; margin-left: auto; }
.home-link { margin-right: 2px; }
.nav-launch { border: 1px solid var(--night-accent); background: transparent; color: var(--night-ink); font-family: var(--night-mono); font-size: var(--step--1); padding: 6px 12px; min-height: 34px; display: inline-flex; align-items: center; text-decoration: none; transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out); }
.nav-launch:hover, .nav-launch:focus-visible { background: var(--night-accent); color: var(--night-accent-ink); }
.nav-launch:active { transform: translateY(1px); background: var(--night-accent-deep); color: var(--night-ink-strong); }
.nav-launch:disabled, .nav-launch[aria-disabled="true"] { opacity: .5; cursor: not-allowed; background: transparent; }

/* ---------- fullscreen viewer ---------- */
#main { height: calc(100% - 52px); }
.viewer { position: relative; width: 100%; height: 100%; background: var(--night-sunken); }
#gl { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#gl.dragging { cursor: grabbing; }

.hud { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 10px; border: var(--hairline); background: var(--night-bg); font-family: var(--night-mono); font-size: var(--step--1); color: var(--night-muted); pointer-events: none; }
.hud-row span { color: var(--night-accent-soft); }

/* ---------- pick panel (top-left; dock owns the right) ---------- */
.pick-panel { position: absolute; left: 12px; top: 12px; width: min(320px, calc(100% - 24px)); border: var(--hairline); background: var(--night-surface); padding: 12px 14px; }
.pick-panel.hidden { display: none; }
.pick-panel h2 { margin: 0 30px 10px 0; font-family: var(--night-mono); font-size: 14px; font-weight: 700; color: var(--night-accent-ink); overflow-wrap: anywhere; }
.pick-close { position: absolute; right: 6px; top: 4px; width: 26px; height: 26px; border: 0; background: transparent; color: var(--night-muted); font-size: 18px; cursor: pointer; transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out); }
.pick-close:hover, .pick-close:focus-visible { color: var(--night-ink); }
.pick-close:active { transform: translateY(1px); color: var(--night-accent-ink); }
.pick-close:disabled { opacity: .4; cursor: not-allowed; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.pick-grid .span { grid-column: 1 / -1; }
.pick-grid dt { font-family: var(--night-mono); font-size: var(--step--1); letter-spacing: 0; text-transform: none; color: var(--night-faint); }
.pick-grid dd { margin: 2px 0 0; font-size: 12px; color: var(--night-ink); overflow-wrap: anywhere; }
.pick-grid dd.mono { font-family: var(--night-mono); font-size: var(--step--1); color: var(--night-muted); }

/* ---------- floating dock (right side, minimize-able) ---------- */
.dock { position: absolute; right: 12px; top: 12px; width: 272px; max-width: calc(100% - 24px);
  max-height: calc(100% - 24px); display: flex; flex-direction: column;
  border: var(--hairline); background: var(--night-surface); }
.dock-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: var(--hairline);
  font-family: var(--night-mono); font-size: var(--step--1); font-weight: 700; letter-spacing: 0; color: var(--night-accent-ink); }
.dock-min { width: 24px; height: 24px; border: var(--hairline); background: transparent; color: var(--night-muted);
  font-family: var(--night-mono); font-size: 14px; line-height: 1; cursor: pointer; transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out); }
.dock-min:hover, .dock-min:focus-visible { color: var(--night-ink); border-color: var(--night-accent); }
.dock-min:active { transform: translateY(1px); }
.dock-min:disabled { opacity: .4; cursor: not-allowed; }
.dock-body { overflow-y: auto; padding: 10px; display: grid; gap: 10px; }
.dock.min .dock-body { display: none; }

.panel { border: var(--hairline); background: var(--night-surface); padding: 10px 12px; }
.panel h3 { margin: 0 0 8px; font-family: var(--night-mono); font-size: var(--step--1); font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--night-muted); }
#search { width: 100%; padding: 8px 10px; border: var(--hairline); background: var(--night-bg); color: var(--night-ink); font-family: var(--night-mono); font-size: 12px; transition: opacity var(--dur-1) var(--ease-out); }
#search::placeholder { color: var(--night-faint); }
#search:hover { border-color: var(--night-border-strong); }
#search:focus, #search:focus-visible { outline: 2px solid var(--night-accent); outline-offset: 0; }
#search:disabled { opacity: .5; cursor: not-allowed; }
.results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 200px; overflow-y: auto; }
.results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 6px 8px; border: 1px solid transparent; font-family: var(--night-mono); font-size: var(--step--1); color: var(--night-muted); cursor: pointer; transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out); }
.results li:hover, .results li:focus-visible { border-color: var(--night-accent); color: var(--night-ink); background: var(--night-elevated); }
.results li:active { background: var(--night-accent-deep); color: var(--night-ink-strong); }
.results li b { color: var(--night-ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results li span { color: var(--night-faint); }

.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-family: var(--night-mono); font-size: 12px; color: var(--night-muted); cursor: pointer; transition: opacity var(--dur-1) var(--ease-out); }
.check input { accent-color: var(--night-accent); }
.check em { font-style: normal; color: var(--night-ink); }
.check b { margin-left: auto; font-weight: 400; font-size: var(--step--1); color: var(--night-faint); }
.check:hover, .check:focus-within { color: var(--night-ink); }
.check:active { opacity: .75; }

.stat { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-family: var(--night-mono); }
.stat b { font-size: 14px; color: var(--night-ink); }
.stat span { font-size: var(--step--1); color: var(--night-muted); }
/* loading progress: transform-only fill, static full frame under reduced motion */
.prog { height: 6px; border: var(--hairline); background: var(--night-bg); margin-top: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 100%; background: var(--night-accent); transform: scaleX(0); transform-origin: left center; animation: bv-prog-fill 1.6s var(--ease-out) forwards; }
@keyframes bv-prog-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.legend div { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-family: var(--night-mono); font-size: var(--step--1); color: var(--night-muted); }
.dock-foot { padding: 4px 2px 0; font-family: var(--night-mono); font-size: var(--step--1); line-height: var(--leading-body); color: var(--night-faint); }
.dock-foot a { color: var(--night-muted); }
.dock-foot a:hover, .dock-foot a:focus-visible { color: var(--night-ink); }
.dock-foot a:active { color: var(--night-accent-ink); }

/* categorical data colours for the neuron-class legend — intentionally not tokens */
.sw { width: 10px; height: 10px; display: inline-block; flex: none; }
.sw-optic { background: #81b5c8; }
.sw-central { background: #cfcac0; }
.sw-desc { background: #dfb672; }
.sw-vnc { background: #af9bc3; }
.sw-other { background: #6c7777; }
.sw-circuit { background: #ff5040; }
.sw-fly { background: #9aa68f; }
.sw-exc { background: #ff5040; }
.sw-inh { background: #9e2c20; }
.sw-unk { background: #4a5550; }

@media (max-width: 640px) {
  .site-header { gap: 8px; padding: 8px 12px; }
  .site-header nav { display: none; }
  /* dock becomes a bottom sheet so the brain stays the hero */
  .dock { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; max-height: 46%; }
  .dock-body { max-height: 40vh; }
  .hud { bottom: auto; top: 12px; left: 12px; }
  .pick-panel { top: 44px; }
}
/* ============ 2026-09 UI overhaul: site nav, same night discipline ============ */
.bv-site-nav { display: flex; align-items: center; gap: 8px; font-family: var(--night-mono); font-size: var(--step--1); }
.bv-site-nav > a:not(.nav-launch) { color: var(--night-muted); text-decoration: none; padding-inline: 2px; transition: opacity var(--dur-1) var(--ease-out); }
.bv-site-nav > a:not(.nav-launch):hover, .bv-site-nav > a:not(.nav-launch):focus-visible { color: var(--night-ink); text-decoration: underline; text-decoration-thickness: 2px; }
.bv-site-nav > a:not(.nav-launch):active { color: var(--night-accent-ink); }
.bv-site-nav span { color: var(--night-faint); }

/* ================= V2 OVERHAUL — chrome polish, same palette ================= */
.site-header { height: 56px; padding-inline: 22px; }
.wordmark { letter-spacing: 0; }
.status { font-size: var(--step--1); color: var(--night-accent-ink); }
.hud { font-size: var(--step--1); padding: 8px 12px; }
.hud-row span { color: var(--night-accent-soft); }
.pick-panel { padding: 14px 16px; }
.nav-launch { min-height: 40px; padding: 8px 16px; }


/* V3: rounded world */
.site-header { border-bottom: 0; }
.wordmark { border: var(--hairline); border-radius: 999px; padding: 8px 14px; }
.nav-launch, .bv-site-nav .nav-launch { border-radius: 999px; }
.hud { border-radius: 12px; }
.pick-panel { border-radius: 16px; }
.dock, .dock-foot { border-radius: 16px; }

/* V4: mobile responsiveness — nav stays available, status tucks in */
@media (max-width: 640px) {
  .site-header { display: flex; flex-wrap: nowrap; align-items: center; height: 56px; padding-block: 0 8px; gap: 8px; }
  .wordmark { flex: 0 0 auto; }
  .site-header nav { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; order: 3; width: 100%; flex: 0 0 auto; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav > * { flex: 0 0 auto; white-space: nowrap; }
  .status { position: static; order: 2; margin-left: auto; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--step--1); }
  .status-dot { order: 1; flex: 0 0 auto; }
}

/* reduced motion: freeze the progress fill to a static full frame, drop transitions */
@media (prefers-reduced-motion: reduce) {
  .prog i { animation: none; transform: scaleX(1); }
  .nav-launch, .pick-close, .dock-min, .results li, .check, #search,
  .bv-site-nav > a, .dock-foot a, .wordmark { transition: none; }
}
