/* Bardu.AI — Sovereign Minimal HUD & Editorial Typography */

:root {
  --bg: #030408;
  --text-primary: #f2f7ff;
  --text-secondary: rgba(196, 214, 238, 0.78);
  --text-muted: rgba(144, 170, 204, 0.56);
  --cyan: #52f4ff;
  --cobalt: #2b5cff;
  --border: rgba(255, 255, 255, 0.11);
  --border-active: rgba(82, 244, 255, 0.48);
  --glass: rgba(8, 13, 24, 0.44);
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --pad-x: clamp(20px, 4vw, 52px);
  --pad-y: clamp(18px, 3.4vh, 40px);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Full-viewport real-time WebGL2 Canvas */
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  z-index: 1;
}

#stage:active {
  cursor: grabbing;
}

/* Subtle bottom optical feather solely to guarantee crisp typography legibility */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 45% at 50% 105%, rgba(3, 5, 11, 0.72) 0%, rgba(3, 5, 11, 0) 70%),
    linear-gradient(180deg, rgba(3, 5, 11, 0.42) 0%, rgba(3, 5, 11, 0) 18%, rgba(3, 5, 11, 0) 76%, rgba(3, 5, 11, 0.56) 100%);
}

/* Precision Architectural Corner Ticks */
.frame-corners {
  position: fixed;
  inset: clamp(10px, 1.6vw, 22px);
  z-index: 3;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 14px;
  height: 14px;
  opacity: 0.42;
}

.corner.tl { top: 0; left: 0; border-top: 1px solid var(--cyan); border-left: 1px solid var(--cyan); }
.corner.tr { top: 0; right: 0; border-top: 1px solid var(--cyan); border-right: 1px solid var(--cyan); }
.corner.bl { bottom: 0; left: 0; border-bottom: 1px solid var(--cyan); border-left: 1px solid var(--cyan); }
.corner.br { bottom: 0; right: 0; border-bottom: 1px solid var(--cyan); border-right: 1px solid var(--cyan); }

/* Custom Magnetic Reticle (Desktop fine pointer only) */
.reticle {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: transform;
}

.reticle.is-visible {
  opacity: 1;
}

.reticle-ring {
  position: absolute;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 1px solid rgba(82, 244, 255, 0.42);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.22s ease, background 0.22s ease;
}

.reticle-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(82, 244, 255, 0.9);
}

.reticle.is-hover .reticle-ring {
  transform: scale(1.42);
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(82, 244, 255, 0.06);
}

.reticle.is-charging .reticle-ring {
  transform: scale(1.9);
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(82, 244, 255, 0.45);
}

@media (hover: none), (pointer: coarse) {
  .reticle {
    display: none;
  }
}

/* HUD Shell */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--pad-y) + env(safe-area-inset-top)) var(--pad-x) calc(var(--pad-y) + env(safe-area-inset-bottom));
}

/* Top Bar */
.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: opacity 0.25s ease;
}

.brand:hover {
  opacity: 0.92;
}

.brand-mark {
  display: block;
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 14px rgba(82, 244, 255, 0.28));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand:hover .brand-mark {
  transform: scale(1.06);
}

.brand-name {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--text-primary);
}

.brand-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 7px 0 2px;
  background: var(--cyan);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(82, 244, 255, 0.85);
}

.brand-ai {
  color: var(--cyan);
  font-weight: 500;
}

.hud-controls {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-btn,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}

.hud-btn {
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.hud-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--text-primary);
  background: rgba(16, 26, 46, 0.62);
}

.hud-btn[aria-pressed='true'] {
  border-color: var(--border-active);
  color: var(--cyan);
  background: rgba(14, 42, 62, 0.54);
  box-shadow: 0 0 22px rgba(82, 244, 255, 0.16);
}

.btn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.hud-btn[aria-pressed='true'] .btn-dot {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

/* Minimal Animated Audio Bars */
.audio-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.audio-bars i {
  display: block;
  width: 2px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
  transition: height 0.2s ease;
}

.hud-btn[aria-pressed='true'] .audio-bars i:nth-child(1) {
  animation: barBounce 0.72s ease-in-out infinite alternate;
}
.hud-btn[aria-pressed='true'] .audio-bars i:nth-child(2) {
  animation: barBounce 0.56s ease-in-out 0.18s infinite alternate;
}
.hud-btn[aria-pressed='true'] .audio-bars i:nth-child(3) {
  animation: barBounce 0.66s ease-in-out 0.32s infinite alternate;
}

@keyframes barBounce {
  from { height: 3px; }
  to   { height: 10px; }
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(82, 244, 255, 0.9);
  animation: statusPulse 2.4s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.42; transform: scale(0.84); }
}

/* Edge Vertical Micro-Telemetry */
.edge-telemetry {
  position: fixed;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

.edge-left {
  left: clamp(14px, 2vw, 28px);
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left center;
}

.edge-right {
  right: clamp(14px, 2vw, 28px);
  transform: translateY(-50%) rotate(90deg);
  transform-origin: right center;
}

.edge-telemetry .sep {
  opacity: 0.45;
}

/* Resonance Charge Indicator */
.resonance-indicator {
  position: fixed;
  top: calc(var(--pad-y) + 52px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.resonance-indicator.is-active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.resonance-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(82, 244, 255, 0.65);
}

.resonance-track {
  width: 140px;
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  border-radius: 2px;
}

.resonance-track i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cobalt), var(--cyan), #ffffff);
  box-shadow: 0 0 12px var(--cyan);
}

/* Bottom Minimal Editorial Presentation Area */
.hud-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.chapter-stage {
  max-width: 560px;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.22em;
  color: var(--cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 18px rgba(82, 244, 255, 0.3);
}

.chapter-title {
  font-size: clamp(36px, 5.8vw, 72px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  text-shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
  margin-bottom: 14px;
}

.chapter-title .accent {
  color: var(--cyan);
}

.chapter-copy {
  font-size: clamp(14px, 1.45vw, 17px);
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 440px;
  margin-bottom: 18px;
}

.chapter-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 36px;
}

.soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(82, 244, 255, 0.26);
  background: rgba(8, 20, 36, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(212, 238, 255, 0.9);
}

.contact-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-active);
  background: rgba(12, 32, 54, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.contact-pill:hover {
  transform: translateY(-1px);
  background: rgba(18, 46, 76, 0.78);
  box-shadow: 0 0 26px rgba(82, 244, 255, 0.26);
}

.contact-icon {
  color: var(--cyan);
}

.contact-hint {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(82, 244, 255, 0.14);
  color: var(--cyan);
}

.is-hidden {
  display: none !important;
}

/* Chapter Navigation & Subtle Interaction Cue */
.chapter-nav {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.nav-dots {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 6px 2px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  transition: color 0.25s ease;
}

.nav-dot:hover {
  color: var(--text-primary);
}

.dot-bar {
  display: block;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease, box-shadow 0.3s ease;
}

.nav-dot.is-active {
  color: var(--cyan);
}

.nav-dot.is-active .dot-bar {
  width: 44px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(82, 244, 255, 0.8);
}

.interact-hint {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-align: right;
}

/* 404 & Noscript Fallbacks */
.page-404 {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 42%, #0a1428 0%, #030408 68%);
}

.not-found,
.noscript-fallback {
  position: relative;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 40px 24px;
}

.not-found h1,
.noscript-fallback h1 {
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: 0.14em;
}

.not-found .subtitle {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-active);
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  background: rgba(12, 30, 52, 0.55);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.action-pill:hover {
  background: rgba(20, 50, 82, 0.78);
  box-shadow: 0 0 24px rgba(82, 244, 255, 0.26);
}

/* Responsive Mobile Refinements */
@media (max-width: 820px) {
  .edge-telemetry,
  .status-pill {
    display: none;
  }

  .hud-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .chapter-nav {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .interact-hint {
    display: none;
  }

  .dot-bar {
    width: 20px;
  }

  .nav-dot.is-active .dot-bar {
    width: 34px;
  }
}

@media (max-width: 560px) {
  :root {
    --pad-x: 18px;
    --pad-y: 18px;
  }

  .hud-top {
    gap: 8px;
  }

  .brand {
    gap: 8px;
    flex-shrink: 0;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
  }

  .brand-name {
    font-size: 12.5px;
    letter-spacing: 0.14em;
  }

  .brand-dot {
    width: 4px;
    height: 4px;
    margin: 0 5px 0 1px;
  }

  .hud-controls {
    gap: 6px;
    flex-shrink: 0;
  }

  .hud-btn {
    padding: 0 9px;
    height: 29px;
    font-size: 9px;
    letter-spacing: 0.08em;
    gap: 5px;
    white-space: nowrap;
  }

  .eyebrow {
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }

  .chapter-title {
    font-size: clamp(32px, 10vw, 44px);
  }

  .chapter-copy {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .soon-badge {
    font-size: 9px;
    letter-spacing: 0.14em;
    padding: 6px 12px;
  }
}
