/* ==========================================================================
   RESCUE ROVER - HIGH-PERFORMANCE THEME & EFFECTS STYLESHEET
   Tactical Design System, Lightweight Glassmorphism & GPU-Optimized Motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. COLOR SYSTEM & CSS CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */
:root {
  /* Dark Mode Colors (Default) */
  --bg-dark-primary: #03070d;
  --bg-dark-secondary: #06101b;
  --bg-dark-tertiary: #091827;
  --bg-dark-elevated: #0e2235;

  /* Accent Colors */
  --accent-cyan: #25d9ff;
  --accent-blue: #397dff;
  --accent-violet: #8b5cff;
  --accent-magenta: #f14fcb;
  --accent-orange: #ff8a3d;
  --accent-green: #48e597;
  --accent-yellow: #ffd166;
  --accent-red: #ff455d;

  /* Subsystem Accent Mapping */
  --accent-mobility: var(--accent-orange);
  --accent-manipulation: var(--accent-violet);
  --accent-vision: var(--accent-cyan);
  --accent-sensing: var(--accent-green);
  --accent-navigation: var(--accent-blue);
  --accent-communication: var(--accent-magenta);
  --accent-fire: var(--accent-red);
  --accent-power: var(--accent-yellow);

  /* Dark Mode Text Colors */
  --text-primary: #f4faff;
  --text-secondary: #abc1d2;
  --text-muted: #71899d;

  /* Optimized Surface Tokens */
  --card-bg: rgba(9, 24, 39, 0.88);
  --card-bg-hover: rgba(14, 34, 53, 0.95);
  --glass-border: rgba(37, 217, 255, 0.16);
  --glass-border-hover: rgba(37, 217, 255, 0.45);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);

  --navbar-bg: rgba(3, 7, 13, 0.85);
  --navbar-bg-scrolled: rgba(6, 16, 27, 0.96);
  
  --transition-speed: 0.25s;
  --ease-custom: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   2. LIGHT MODE OVERRIDES (.theme-light)
   -------------------------------------------------------------------------- */
html.theme-light {
  --bg-dark-primary: #edf6ff;
  --bg-dark-secondary: #f8fbff;
  --bg-dark-tertiary: #ffffff;
  --bg-dark-elevated: #e5f1fa;

  --text-primary: #0c2338;
  --text-secondary: #37556e;
  --text-muted: #657e92;

  --card-bg: rgba(255, 255, 255, 0.95);
  --card-bg-hover: rgba(237, 246, 255, 0.98);
  --glass-border: rgba(37, 125, 255, 0.2);
  --glass-border-hover: rgba(37, 125, 255, 0.5);
  --card-shadow: 0 4px 16px rgba(12, 35, 56, 0.06);

  --navbar-bg: rgba(237, 246, 255, 0.92);
  --navbar-bg-scrolled: rgba(255, 255, 255, 0.98);
}

/* --------------------------------------------------------------------------
   3. GLOBAL BASE ENHANCEMENTS
   -------------------------------------------------------------------------- */
body {
  background-color: var(--bg-dark-primary);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  overflow-x: hidden;
}

/* Scroll Progress Bar - Lightweight Transform */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent-cyan);
  z-index: 1050;
  width: 0%;
  transition: width 0.1s linear;
}

/* Cursor Glow - Hardware Accelerated */
.cursor-glow-element {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 217, 255, 0.06) 0%, rgba(37, 217, 255, 0) 70%);
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}

/* Standard Panel Card - Semi-Opaque for Speed (No Backdrop-Filter Lag) */
.panel-card,
.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
}

.panel-card:hover,
.glass-panel:hover {
  background: var(--card-bg-hover);
  border-color: var(--glass-border-hover);
}

/* Selected HUD panels receive crisp blur */
.hero-hud-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Holographic Top Accent Line */
.panel-card::before,
.glass-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   4. NAVIGATION ENHANCEMENTS
   -------------------------------------------------------------------------- */
.main-navbar {
  background: var(--navbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  transition: background-color 0.25s ease;
  padding: 0.75rem 0;
}

.main-navbar.is-scrolled {
  background: var(--navbar-bg-scrolled);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  padding: 0.5rem 0;
}

.rover-brand {
  font-family: inherit;
  letter-spacing: 0.5px;

  span small {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 2px;
  }
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(37, 217, 255, 0.12);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  margin-right: 10px;
}

.nav-link-item {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;

  &:hover,
  &.active {
    color: var(--accent-cyan) !important;
    background: rgba(37, 217, 255, 0.08);
  }
}

.theme-toggle-btn,
.fx-toggle-btn {
  background: rgba(37, 217, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--accent-cyan);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  cursor: pointer;

  &:hover {
    background: var(--accent-cyan);
    color: var(--bg-dark-primary);
    transform: translateY(-2px);
  }
}

/* --------------------------------------------------------------------------
   5. HERO SECTION & FALLBACK SCENE
   -------------------------------------------------------------------------- */
.landing-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 80px;
}

.hero-video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;

  &.is-hidden {
    display: none;
  }
}

.hero-video-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(3, 7, 13, 0.4) 0%, rgba(3, 7, 13, 0.85) 100%);
  z-index: 2;
}

/* CSS Fallback Scene when video unavailable */
.hero-fallback-scene {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #03070d 0%, #091827 60%, #03070d 100%);
  z-index: 1;
  overflow: hidden;
  display: none;
}

.body-video-fallback .hero-fallback-scene,
.body-video-fallback .hero-video-container {
  display: block;
}

.fallback-terrain {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 240px;
  background: linear-gradient(180deg, transparent 0%, rgba(9, 24, 39, 0.9) 100%);
  border-top: 1px dashed rgba(37, 217, 255, 0.3);
}

.fallback-rover-anim {
  position: absolute;
  bottom: 60px;
  left: 20%;
  width: 180px;
  height: 90px;
  background: rgba(37, 217, 255, 0.05);
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;

  .wheel {
    position: absolute;
    bottom: -15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px dashed var(--accent-cyan);
  }
  .wheel-1 { left: 10px; }
  .wheel-2 { left: 74px; }
  .wheel-3 { right: 10px; }

  .headlight-beam {
    position: absolute;
    top: 20px;
    right: -140px;
    width: 150px;
    height: 50px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.6) 0%, rgba(37, 217, 255, 0) 100%);
    clip-path: polygon(0 40%, 100% 0, 100% 100%, 0 60%);
  }
}

/* Neural Canvas */
#neuralCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   6. INFINITE STATUS TICKER
   -------------------------------------------------------------------------- */
.ticker-section {
  background: rgba(6, 16, 27, 0.95);
  border-y: 1px solid var(--glass-border);
  overflow: hidden;
  padding: 0.6rem 0;
  position: relative;
  z-index: 10;
}

.ticker-wrapper {
  display: flex;
  width: max-content;
  will-change: transform;
}

.ticker-wrapper.animate-ticker {
  animation: tickerSlide 35s linear infinite;
}

.ticker-wrapper:hover {
  animation-play-state: paused;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-secondary);
  white-space: nowrap;

  i {
    color: var(--accent-cyan);
  }
}

@keyframes tickerSlide {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* --------------------------------------------------------------------------
   7. CAPABILITY SLIDER & CATEGORY FILTERS
   -------------------------------------------------------------------------- */
.category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 2rem;
}

.filter-btn {
  background: rgba(9, 24, 39, 0.6);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;

  &:hover,
  &.active {
    background: var(--accent-cyan);
    color: #03070d;
    border-color: var(--accent-cyan);
  }
}

.capability-card {
  margin: 10px;
  padding: 1.75rem;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 4px solid var(--accent-cyan);
}

.capability-card[data-category="mobility"] { border-left-color: var(--accent-mobility); }
.capability-card[data-category="manipulation"] { border-left-color: var(--accent-manipulation); }
.capability-card[data-category="vision"] { border-left-color: var(--accent-vision); }
.capability-card[data-category="sensing"] { border-left-color: var(--accent-sensing); }
.capability-card[data-category="navigation"] { border-left-color: var(--accent-navigation); }
.capability-card[data-category="communication"] { border-left-color: var(--accent-communication); }
.capability-card[data-category="fire"] { border-left-color: var(--accent-fire); }
.capability-card[data-category="power"] { border-left-color: var(--accent-power); }

.capability-number {
  font-size: 1.8rem;
  font-weight: 800;
  opacity: 0.25;
  color: var(--text-primary);
}

.capability-icon {
  font-size: 2rem;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   8. RADAR & MISSION HUD COMPONENTS
   -------------------------------------------------------------------------- */
.radar-display {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 1px solid rgba(37, 217, 255, 0.4);
  background: radial-gradient(circle, rgba(37, 217, 255, 0.08) 0%, rgba(3, 7, 13, 0.9) 80%);
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

.radar-sweep-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 50%;
  background: linear-gradient(135deg, rgba(37, 217, 255, 0.6) 0%, transparent 70%);
  transform-origin: top left;
  animation: radarSpin 4s linear infinite;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  will-change: transform;
}

@keyframes radarSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-ping {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
}

/* --------------------------------------------------------------------------
   9. REDUCED EFFECTS & MOBILE LIGHTWEIGHT MODES
   -------------------------------------------------------------------------- */
body.effects-reduced,
body.mobile-lightweight-mode {
  .ticker-wrapper {
    animation: none !important;
  }
  #neuralCanvas,
  .cursor-glow-element,
  .radar-sweep-line {
    display: none !important;
  }
  .panel-card,
  .capability-card {
    transition: none !important;
    transform: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE UTILITIES
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .landing-hero {
    padding-top: 100px;
    min-height: auto;
  }
  .hero-hud-card {
    margin-top: 2rem;
  }
}

@media (max-width: 768px) {
  .cursor-glow-element {
    display: none !important;
  }
  .main-navbar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

@media (max-width: 575.98px) {
  .category-filter-bar {
    gap: 6px;
  }
  .filter-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
  }
}

/* --------------------------------------------------------------------------
   11. PRELOADER, VIDEO TOGGLE & TEAM AVATARS
   -------------------------------------------------------------------------- */
.page-preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-dark-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease;
}

.video-toggle {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(9, 24, 39, 0.85);
  border: 1px solid var(--glass-border);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.video-toggle:hover {
  transform: scale(1.08);
  border-color: var(--accent-cyan);
}

.avatar-img.width-80 {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 2px solid var(--glass-border);
}

