/* ============================================================
   MAIN.CSS — BAB Dynamics
   Global: Variables, Reset, Body, Typography, Preloader,
           Skip Link, Zone Navigator, Shared Utilities
   Load order: FIRST — every other stylesheet depends on this.
   ============================================================ */

/* ── CSS VARIABLES ──────────────────────────────────────────── */
:root {
    /* Brand Colors */
    --primary:        #00d2ff;
    --primary-dim:    rgba(0, 210, 255, 0.12);
    --primary-glow:   rgba(0, 210, 255, 0.4);
    --gold:           #f5a623;
    --gold-dim:       rgba(245, 166, 35, 0.12);
    --accent-green:   #00ff88;

    /* Backgrounds */
    --dark:           #050a14;
    --dark-2:         #080f1e;
    --dark-3:         #0b1528;

    /* Glass / Surface */
    --glass:          rgba(255, 255, 255, 0.03);
    --glass-strong:   rgba(255, 255, 255, 0.06);
    --border:         rgba(0, 210, 255, 0.18);
    --border-dim:     rgba(255, 255, 255, 0.07);

    /* Text */
    --text-primary:   #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted:     rgba(255, 255, 255, 0.35);

    /* Glows */
    --glow-primary:   0 0 20px rgba(0, 210, 255, 0.4);
    --glow-gold:      0 0 20px rgba(245, 166, 35, 0.4);
    --glow-soft:      0 0 60px rgba(0, 210, 255, 0.08);

    /* Fonts */
    --font-display:   'Orbitron', sans-serif;
    --font-body:      'Rajdhani', sans-serif;
    --font-mono:      'Space Mono', monospace;

    /* Spacing */
    --space-xs:   8px;
    --space-sm:  16px;
    --space-md:  32px;
    --space-lg:  64px;
    --space-xl: 110px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.35s ease;
    --transition-slow: 0.6s ease;

    /* Radius */
    --radius-sm:  3px;
    --radius-md:  8px;
    --radius-lg: 20px;

    /* Z-Index Scale */
    --z-canvas:      0;
    --z-base:        1;
    --z-zone-nav:   40;
    --z-nav:        50;
    --z-progress:   60;
    --z-cursor:    100;
    --z-modal:     500;
    --z-preloader: 1000;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── SKIP LINK (Accessibility — first focusable element) ───── */
.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: calc(var(--z-preloader) + 1);
    padding: 12px 22px;
    background: var(--primary);
    color: var(--dark);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* ── VISUALLY HIDDEN (labels, screen-reader-only text) ─────── */
.visually-hidden,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── THREE.JS CANVAS ────────────────────────────────────────── */
#three-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: var(--z-canvas);
    pointer-events: none;
    display: block;
}

/* ── SCROLL PROGRESS BAR ────────────────────────────────────── */
#scroll-progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    z-index: var(--z-progress);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* ── ZONE SIDE NAVIGATOR (9-dot HQ indicator) ──────────────── */
.zone-side-nav {
    position: fixed;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--z-zone-nav);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.zone-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-dim);
    border: 1px solid transparent;
    cursor: pointer;
    transition:
        background var(--transition-base),
        transform var(--transition-base),
        box-shadow var(--transition-base);
}

.zone-dot:hover {
    background: var(--text-muted);
    transform: scale(1.3);
}

.zone-dot.zone-active {
    background: var(--primary);
    transform: scale(1.45);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* ── PRELOADER ──────────────────────────────────────────────── */
#preloader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: var(--z-preloader);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.pre-logo {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 8px;
    text-shadow: var(--glow-primary);
    animation: preGlow 1.5s ease-in-out infinite alternate;
}

.pre-sub {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    margin-top: -8px;
    margin-bottom: 24px;
}

.pre-bar-wrap {
    width: 280px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

.pre-bar-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    box-shadow: 0 0 10px var(--primary);
    animation: preLoad 2.2s ease-in-out forwards;
}

.pre-status {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    margin-top: 12px;
}

@keyframes preGlow {
    from { text-shadow: 0 0 20px rgba(0, 210, 255, 0.4); }
    to   { text-shadow: 0 0 50px rgba(0, 210, 255, 0.9); }
}

@keyframes preLoad {
    0%   { width: 0%; }
    40%  { width: 55%; }
    70%  { width: 80%; }
    100% { width: 100%; }
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-primary);
}

p {
    font-family: var(--font-body);
    color: var(--text-secondary);
    line-height: 1.75;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover { color: #ffffff; }

strong, b { color: var(--text-primary); font-weight: 700; }
em, i     { color: var(--text-secondary); font-style: italic; }

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── SECTION HEADER (shared across all zones) ──────────────── */
.section-header {
    text-align: center;
    margin-bottom: 64px;
    position: relative;
    z-index: var(--z-base);
}

.section-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 5px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 16px;
    opacity: 0.8;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 4.5vw, 42px);
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--text-primary);
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    margin: 14px auto 0;
    border-radius: 2px;
}

/* Zone subtitle (from Brand Identity doc) */
.section-lead {
    font-family: var(--font-body);
    font-size: clamp(15px, 2vw, 19px);
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 18px;
}

/* Secondary lead line */
.section-sub-lead {
    font-family: var(--font-body);
    font-size: clamp(14px, 1.8vw, 16px);
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 8px;
}

/* ── HQ ZONE BASE ───────────────────────────────────────────── */
.hq-zone {
    position: relative;
    z-index: var(--z-base);
    padding: var(--space-xl) 24px;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: #ffffff; }

/* ── SELECTION ──────────────────────────────────────────────── */
::selection      { background: var(--primary); color: var(--dark); }
::-moz-selection { background: var(--primary); color: var(--dark); }

/* ── FOCUS VISIBLE ──────────────────────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* ── UTILITIES ──────────────────────────────────────────────── */
.text-glow { text-shadow: 0 0 20px var(--primary-glow); }

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-primary-color { color: var(--primary); }
.text-gold          { color: var(--gold); }
.text-muted         { color: var(--text-muted); }

.glass-card {
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
}

/* ── REDUCED MOTION (global) ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── MOBILE: hide zone navigator on small screens ───────────── */
@media (max-width: 768px) {
    .zone-side-nav { display: none; }
}