/* =========================================================
   STARCHART — design tokens
   ========================================================= */
:root {
  --void: #050711;
  --void-2: #0A0E1C;
  --void-2-soft: rgba(10, 14, 28, 0.82);
  --nebula: #7B6EF6;
  --nebula-dim: #4B4394;
  --star: #F2C879;
  --signal: #5FE3C4;
  --text: #E7E9F5;
  --text-dim: #8B90AC;
  --line: rgba(139, 144, 172, 0.22);

  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--nebula); color: var(--void); }

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* =========================================================
   Visor overlay — vignette, scanlines, corner brackets, reticle
   ========================================================= */
#visor {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.visor-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(5, 7, 17, 0) 55%, rgba(5, 7, 17, 0.6) 100%);
}

.visor-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(231, 233, 245, 0.025) 0px,
    rgba(231, 233, 245, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.5;
}

.visor-corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(123, 110, 246, 0.35);
}
.visor-corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.visor-corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.visor-corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.visor-corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; }

.visor-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(95, 227, 212, 0.4);
  border-radius: 50%;
  animation: reticle-breathe 4.5s ease-in-out infinite;
}
.visor-reticle::before,
.visor-reticle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(95, 227, 212, 0.4);
  transform: translate(-50%, -50%);
}
.visor-reticle::before { width: 28px; height: 1px; }
.visor-reticle::after { width: 1px; height: 28px; }

@keyframes reticle-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

/* =========================================================
   Boot sequence — the one big orchestrated motion moment
   ========================================================= */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--void);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.8s ease;
}
#boot-screen.fade-out { opacity: 0; pointer-events: none; }

#boot-log {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  min-height: 90px;
  width: 280px;
  white-space: pre-line;
  line-height: 1.7;
}
#boot-log .ok { color: var(--signal); }

#boot-bar {
  width: 280px;
  height: 2px;
  background: rgba(139, 144, 172, 0.15);
}
#boot-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--nebula);
  transition: width 0.25s ease;
}

/* =========================================================
   HUD
   ========================================================= */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.9s ease;
}
#hud.hidden { opacity: 0; }

#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
}

.hud-bracket { color: var(--nebula); }

#vitals {
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
}
#vitals-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
}
#vitals-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid var(--nebula);
  padding-left: 9px;
}
#vitals-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.03em;
}
#vitals-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

#sector-readout {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 7px 16px;
  background: var(--void-2-soft);
  border: 1px solid var(--line);
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.4s ease, border-color 0.3s ease, color 0.3s ease;
  backdrop-filter: blur(6px);
}
#sector-readout.visible { opacity: 1; }
.sector-dot { margin-right: 8px; }

#hud-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 22px;
  pointer-events: auto;
}
.hud-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.hud-link:hover, .hud-link:focus-visible { color: var(--signal); border-color: var(--signal); }
.hud-link[aria-pressed="true"] { color: var(--signal); border-color: var(--signal); }

#hud-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px 28px 24px;
  gap: 24px;
}

#hud-hint {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  max-width: 480px;
}

#hud-coords {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
#coord-readout { color: var(--star); }

#return-btn {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  background: var(--void-2-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease, border-color 0.2s ease, transform 0.15s ease;
}
#return-btn:hover { border-color: var(--nebula); }
#return-btn.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(-6px); }

/* =========================================================
   Side panels (project detail + about/contact)
   ========================================================= */
#project-panel, #info-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--void-2-soft);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--line);
  z-index: 20;
  padding: 30px 28px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
#project-panel.open, #info-panel.open { transform: translateX(0); }
#project-panel.hidden, #info-panel.hidden { display: block; } /* keep transitions working */

#panel-close, #info-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--void-2-soft);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#panel-close:hover, #info-close:hover { color: var(--signal); }

#panel-tag {
  font-size: 11px;
  color: var(--star);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

#panel-image-wrap {
  position: relative;
  width: calc(100% + 56px);
  margin: -30px -28px 20px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
#panel-image-wrap.hidden { display: none; }
#panel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#panel-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 7, 17, 0) 55%, rgba(5, 7, 17, 0.85) 100%);
  pointer-events: none;
}

#panel-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.15;
}

#panel-role {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 20px;
}

#panel-description {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 22px;
  max-width: 60ch;
}

#panel-stack {
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#panel-stack li {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 5px 9px;
}

#panel-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
#panel-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--void);
  background: var(--nebula);
  padding: 10px 16px;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.2s ease;
}
#panel-links a:hover { background: var(--signal); }
#panel-links a.secondary {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
}
#panel-links a.secondary:hover { border-color: var(--signal); color: var(--signal); }

#panel-note {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
}

/* About / contact content typography reuse */
#info-content h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 18px;
}
#info-content p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 16px;
  max-width: 56ch;
}
#info-content a { color: var(--signal); }
#info-content ul { padding-left: 18px; font-size: 13px; line-height: 1.9; color: var(--text-dim); }

/* =========================================================
   Waypoint label (floating DOM tooltip near hovered node)
   ========================================================= */
#node-tooltip {
  position: fixed;
  z-index: 15;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--void-2-soft);
  border: 1px solid var(--line);
  padding: 6px 10px;
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
#node-tooltip.visible { opacity: 1; }
#node-tooltip .dot { color: var(--star); margin-right: 6px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {
  #hud-top { padding: 16px 18px; }
  #vitals-brand { font-size: 13px; }
  #vitals-role { display: none; }
  #hud-nav { gap: 8px 14px; }
  .hud-link { font-size: 10.5px; }
  #hud-bottom { padding: 16px 18px 20px; flex-direction: column-reverse; align-items: flex-start; gap: 8px; }
  #hud-hint { display: none; }
  #project-panel, #info-panel { width: 100%; padding: 26px 20px; }
  #panel-title { font-size: 22px; }
  #sector-readout { top: 64px; font-size: 10px; padding: 6px 12px; }
  .visor-corner { width: 22px; height: 22px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #boot-screen, #hud, #project-panel, #info-panel, #return-btn, #node-tooltip, #sector-readout {
    transition: none !important;
  }
  .visor-reticle {
    animation: none !important;
    opacity: 0.7;
  }
}

/* Keyboard focus visibility */
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}
