/* ============================================================
   V20 Space Station Dock — UI Styles
   3D starfield rendered by Three.js; this file styles HUD,
   airlock doors, glassmorphism panel, and all animations.
   ============================================================ */

:root {
  --primary:   #e2e8f0;     /* cool white */
  --secondary: #38bdf8;     /* space blue */
  --accent:    #0ea5e9;     /* brighter blue accent */
  --surface:   rgba(5, 5, 15, 0.85);
  --text:      #f1f5f9;
  --text-dim:  rgba(241, 245, 249, 0.55);

  /* Reusable glow shadows */
  --glow-blue:  0 0 20px rgba(56, 189, 248, 0.7);
  --glow-white: 0 0 12px rgba(226, 232, 240, 0.4);

  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Airlock door transition timing */
  --door-duration: 900ms;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background: #00000f;   /* dark space fallback before Three.js initialises */
  overflow: hidden;
  font-family: 'Exo 2', sans-serif;
  font-weight: 400;
  color: var(--text);
}

/* ── Three.js canvas — fills entire viewport behind all UI layers ── */
#three-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#three-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── Airlock overlay — two door halves sit above starfield, below HUD ── */
.station-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  pointer-events: none;
  overflow: hidden;
}

/* Base door styles shared by both halves */
.airlock-door {
  flex: 1;
  background: #03060f;
  position: relative;
  transition: transform var(--door-duration) var(--ease-smooth);
  will-change: transform;
}

/* Left door edge glow — breathing animation */
.airlock-door.left {
  border-right: 2px solid var(--secondary);
  box-shadow: 2px 0 18px rgba(56, 189, 248, 0.45),
              inset -4px 0 24px rgba(56, 189, 248, 0.12);
  animation: breathe-left 2.4s ease-in-out infinite alternate;
}

/* Right door edge glow — breathing animation (phase-shifted) */
.airlock-door.right {
  border-left: 2px solid var(--secondary);
  box-shadow: -2px 0 18px rgba(56, 189, 248, 0.45),
              inset 4px 0 24px rgba(56, 189, 248, 0.12);
  animation: breathe-right 2.4s ease-in-out infinite alternate;
}

/* Scanline texture on doors for depth */
.airlock-door::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(56, 189, 248, 0.03) 3px,
    rgba(56, 189, 248, 0.03) 4px
  );
  pointer-events: none;
}

/* Door corner brackets — decorative HUD-style markings */
.airlock-door.left::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 8px;
  height: 40px;
  border-top: 2px solid var(--secondary);
  border-bottom: 2px solid var(--secondary);
  opacity: 0.6;
}

.airlock-door.right::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 8px;
  height: 40px;
  border-top: 2px solid var(--secondary);
  border-bottom: 2px solid var(--secondary);
  opacity: 0.6;
}

/* Open state — translate each door fully off-screen */
.station-overlay.open .airlock-door.left  { transform: translateX(-100%); }
.station-overlay.open .airlock-door.right { transform: translateX(100%);  }

/* ── HUD interface overlay — decorative telemetry boxes ── */
.interface-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.hud-box {
  position: absolute;
  padding: 10px 14px;
  background: rgba(5, 5, 20, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--secondary);
  min-width: 140px;
}

.hud-box.top-left  { top: 20px; left: 20px; }
.hud-box.top-right { top: 20px; right: 20px; text-align: right; }

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  line-height: 1.8;
}

.hud-label { color: var(--text-dim); }
.hud-value { color: var(--secondary); }
.hud-value.online { color: #4ade80; text-shadow: 0 0 8px rgba(74, 222, 128, 0.6); }
.hud-value.ok     { color: #4ade80; text-shadow: 0 0 8px rgba(74, 222, 128, 0.6); }

/* ── Center stage — wraps the main glass panel ── */
.center-stage {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Radial vignette to focus attention on center */
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 8, 0.55) 100%);
  pointer-events: none;
}

/* ── Glassmorphism panel ── */
.glass-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 44px 52px;
  background: var(--surface);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--glow-blue), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  pointer-events: auto;
  max-width: 440px;
  width: 90%;
}

/* Small eyebrow label above heading */
.panel-eyebrow {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--accent);
  opacity: 0.7;
  text-transform: uppercase;
}

/* Primary heading */
.panel-heading {
  font-family: 'Exo 2', sans-serif;
  font-weight: 600;
  font-size: clamp(22px, 5vw, 34px);
  letter-spacing: 0.12em;
  color: var(--primary);
  text-shadow: var(--glow-white);
  line-height: 1.2;
  text-transform: uppercase;
}

/* Countdown — large monospace number, hidden until docking starts */
.countdown {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(48px, 12vw, 80px);
  color: var(--secondary);
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.9),
               0 0 60px rgba(56, 189, 248, 0.4);
  line-height: 1;
  min-height: 1em;           /* reserve space to prevent layout shift */
  letter-spacing: 0.05em;
  display: none;             /* toggled by script.js */
}

/* Status text — updates through the three-step flow */
.status-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--secondary);
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  min-height: 20px;
  transition: color 0.4s ease, text-shadow 0.4s ease;
  text-transform: uppercase;
}

/* Success state colour override */
.status-text.success {
  color: #4ade80;
  text-shadow: 0 0 14px rgba(74, 222, 128, 0.8),
               0 0 30px rgba(74, 222, 128, 0.35);
}

/* ── Primary action button ── */
.dock-btn {
  font-family: 'Exo 2', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2em;
  text-transform: uppercase;

  /* Minimum 44px touch target for mobile accessibility */
  min-height: 44px;
  min-width: 160px;
  padding: 12px 36px;

  background: linear-gradient(135deg, var(--accent), var(--secondary));
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--glow-blue);
  transition: transform 0.2s var(--ease-smooth),
              box-shadow 0.2s var(--ease-smooth),
              opacity 0.3s;
}

.dock-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.85),
              0 0 60px rgba(14, 165, 233, 0.35);
}

.dock-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* Disabled / in-progress state */
.dock-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Hidden utility (for button after sequence completes) */
.dock-btn.hidden {
  display: none !important;
}

/* ── Door breathing keyframes ── */
@keyframes breathe-left {
  from { box-shadow: 2px 0 12px rgba(56, 189, 248, 0.3),  inset -4px 0 20px rgba(56, 189, 248, 0.08); }
  to   { box-shadow: 2px 0 28px rgba(56, 189, 248, 0.65), inset -4px 0 32px rgba(56, 189, 248, 0.18); }
}

@keyframes breathe-right {
  from { box-shadow: -2px 0 12px rgba(56, 189, 248, 0.3),  inset 4px 0 20px rgba(56, 189, 248, 0.08); }
  to   { box-shadow: -2px 0 28px rgba(56, 189, 248, 0.65), inset 4px 0 32px rgba(56, 189, 248, 0.18); }
}

/* ── Responsive — narrow viewport tweaks ── */
@media (max-width: 480px) {
  .glass-panel  { padding: 32px 24px; gap: 14px; }
  .hud-box      { font-size: 10px; min-width: 120px; padding: 8px 10px; }
}

/* ── Accessibility: prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Keep door open transition functional but instant */
  .station-overlay.open .airlock-door.left,
  .station-overlay.open .airlock-door.right {
    transition: none !important;
  }
}
