/* ═══════════════════════════════════════════════
   BASE — Reset, Variables, Typography
   ═══════════════════════════════════════════════ */

:root {
  /* Colors — Sci-Fi Mars Theme */
  --primary: #040506;             /* Deeper space black */
  --primary-light: #0D0E12;       /* Slightly lifted */
  --on-primary: #E8E0D8;          /* Warm white — slightly dusty */
  --on-primary-muted: #8A7A6A;    /* Warm grey — sand/stone */
  --accent-mars: #C84B20;         /* Mars orange-red (primary accent) */
  --accent-mars-glow: #E06030;    /* Brighter Mars glow */
  --accent-deep: #1A0A05;         /* Deep rust */
  --accent-warm: #D4A017;         /* Gold — sunrise/signal */
  --accent-blue: #1A5C8A;         /* Desaturated space blue (ARIA UI) */
  --accent-glow: #2068B0;         /* Blue glow */
  --accent-tear: #88CCFF;         /* Single tear catchlight */
  --accent-red-warn: #C02020;     /* Warning red — soily */

  /* Typography — Sci-Fi Stack */
  --font-headline: 'Orbitron', sans-serif;     /* Primary: geometric, futuristic */
  --font-sub: 'Orbitron', sans-serif;          /* Sub: same family, lighter weight */
  --font-body: 'Exo 2', sans-serif;            /* Body: clean, tech-flavored */
  --font-mono: 'JetBrains Mono', monospace;    /* Code/labels */

  /* Spacing */
  --section-pad: clamp(3rem, 8vh, 8rem);
  --content-gap: 2rem;
  --content-gap-lg: 4rem;

  /* Motion */
  --ease-apple: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-slow: 1.2s;
  --duration-base: 0.8s;
  --duration-fast: 0.4s;
  --stagger: 0.12s;

  /* Elevation */
  --z-bg: -1;
  --z-mid: 0;
  --z-content: 1;
  --z-overlay: 10;
  --z-nav: 100;
  --z-loader: 1000;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font-body);
  background: var(--primary);
  color: var(--on-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
ul { list-style: none; }

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-headline); font-weight: 700; line-height: 1.2; letter-spacing: 0.02em; }
h1 { font-size: clamp(2.5rem, 8vw, 6rem); text-transform: uppercase; }
h2 { font-size: clamp(2rem, 5vw, 3.5rem); text-transform: uppercase; }
h3 { font-size: clamp(1.3rem, 3vw, 2rem); }
h4 { font-size: clamp(1rem, 2vw, 1.4rem); font-family: var(--font-sub); font-weight: 500; }

p { font-size: clamp(0.9rem, 1.4vw, 1.1rem); color: var(--on-primary-muted); max-width: 45em; }

::selection { background: var(--accent-blue); color: white; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--primary); }
::-webkit-scrollbar-thumb { background: var(--accent-mars); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-mars-glow); }

/* ═══════════ LOADER ═══════════ */
#loader {
  position: fixed; inset: 0; z-index: var(--z-loader);
  background: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.8s var(--ease-out), visibility 0.8s var(--ease-out);
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-glow {
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(200,75,32,0.15) 0%, transparent 70%);
  animation: loaderPulse 2s ease-in-out infinite;
}
.loader-text { font-family: var(--font-headline); font-size: 1.8rem; letter-spacing: 0.4em; margin-top: 2rem; text-transform: uppercase; }
.loader-text span { opacity: 0; display: inline-block; animation: loaderChar 0.4s var(--ease-out) forwards; }
.loader-space { width: 0.5em; display: inline-block; }
.loader-bar { width: 200px; height: 2px; background: var(--primary-light); border-radius: 1px; margin-top: 2rem; overflow: hidden; }
.loader-bar-fill { height: 100%; width: 0%; background: var(--accent-mars); animation: loaderBar 2s var(--ease-out) 0.5s forwards; }

@keyframes loaderPulse { 0%,100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.2); opacity: 1; } }
@keyframes loaderChar { to { opacity: 1; transform: translateY(0); } }
@keyframes loaderBar { to { width: 100%; } }

/* ═══════════ NAV ═══════════ */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  padding: 1rem 2rem;
  transition: background 0.4s var(--ease-out), backdrop-filter 0.4s, transform 0.4s var(--ease-out);
}
#nav.scrolled { background: rgba(7,8,10,0.85); backdrop-filter: blur(20px); }
#nav.nav-hidden { transform: translateY(-100%); }
.nav-inner {
  display: flex; align-items: center; gap: 2rem; max-width: 1400px; margin: 0 auto;
}
.nav-logo {
  font-family: var(--font-headline); font-size: 0.8rem; letter-spacing: 0.25em;
  color: var(--on-primary); opacity: 0.7; transition: opacity 0.3s; white-space: nowrap;
}
.nav-logo:hover { opacity: 1; }
.nav-links { display: flex; gap: 1.5rem; margin-left: auto; }
.nav-link {
  font-family: var(--font-body); font-size: 0.75rem; letter-spacing: 0.05em;
  color: var(--on-primary-muted); transition: color 0.3s; text-transform: uppercase;
}
.nav-link:hover, .nav-link.active { color: var(--accent-mars-glow); }
.nav-progress {
  position: absolute; bottom: -1px; left: 0; right: 0; height: 1px; background: rgba(200,75,32,0.1);
}
#nav-progress-bar {
  height: 100%; width: 0%; background: var(--accent-mars-glow); transition: width 0.1s linear;
}
