/* ==========================================================================
   nullhex // Engineering Noir Design System - Foundation Tokens
   Version: 2.0.0
   Usage: Link this file BEFORE page-specific styles.
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS (Custom Properties)
   ========================================================================== */

:root {
    /* ------- Colour Palette ------- */

    /* Void (backgrounds) */
    --void-black: #0C0C12;
    --void-darker: #0a0e27;
    --void-accent: #1a2332;

    /* Cyber Green (brand accent) - full scale */
    --green-100: #d4ffc8;
    --green-200: #a8ff91;
    --green-300: #7cfa5a;
    --green-400: #4AF626;
    --green-500: #3cd41f;
    --green-600: #2eaf18;
    --green-700: #1f8a10;
    --green-800: #136609;
    --green-900: #094203;
    --cyber-green: var(--green-400);
    --cyber-green-dim: rgba(74, 246, 38, 0.6);
    --cyber-green-glow: rgba(74, 246, 38, 0.15);

    /* Surfaces (layered glass tints) */
    --surface-0: var(--void-black);
    --surface-1: rgba(255, 255, 255, 0.02);
    --surface-2: rgba(255, 255, 255, 0.04);
    --surface-3: rgba(255, 255, 255, 0.06);
    --surface-4: rgba(255, 255, 255, 0.08);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(74, 246, 38, 0.2);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    --glass-blur: 20px;
    --glass-blur-heavy: 30px;

    /* Text */
    --text-primary: rgba(255, 255, 255, 0.9);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.3);
    --text-brand: var(--cyber-green);

    /* Semantic */
    --color-success: var(--cyber-green);
    --color-warning: #ffc02f;
    --color-error: #ff6159;
    --color-info: #5b9aff;

    /* ------- Typography ------- */

    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* Type scale (major third - 1.25) */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-md: 1.125rem;   /* 18px */
    --text-lg: 1.25rem;    /* 20px */
    --text-xl: 1.5rem;     /* 24px */
    --text-2xl: 2rem;      /* 32px */
    --text-3xl: 2.5rem;    /* 40px */
    --text-hero: clamp(2.25rem, 5vw, 3.5rem);

    /* Line heights */
    --leading-tight: 1.2;
    --leading-normal: 1.6;
    --leading-relaxed: 1.8;

    /* Font weights */
    --weight-light: 300;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* ------- Spacing ------- */

    --space-2xs: 0.25rem;  /*  4px */
    --space-xs: 0.5rem;    /*  8px */
    --space-sm: 1rem;      /* 16px */
    --space-md: 2rem;      /* 32px */
    --space-lg: 4rem;      /* 64px */
    --space-xl: 6rem;      /* 96px */
    --space-2xl: 8rem;     /* 128px */

    /* ------- Border Radius ------- */

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* ------- Z-Index Scale ------- */

    --z-behind: -1;
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-scan: 9999;

    /* ------- Transitions ------- */

    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-base: 300ms;
    --duration-slow: 600ms;
    --transition-fast: var(--duration-fast) ease;
    --transition-base: var(--duration-base) ease;
    --transition-slow: var(--duration-slow) var(--ease-out);

    /* ------- Elevation (box-shadow presets) ------- */

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-glow-sm: 0 0 20px rgba(74, 246, 38, 0.1);
    --shadow-glow-md: 0 0 40px rgba(74, 246, 38, 0.15), 0 0 80px rgba(74, 246, 38, 0.08);
    --shadow-glow-lg: 0 0 40px rgba(74, 246, 38, 0.2), 0 0 80px rgba(74, 246, 38, 0.1), 0 20px 60px rgba(0, 0, 0, 0.3);

    /* ------- Layout ------- */

    --content-width: 1200px;
    --content-narrow: 800px;
    --grid-gap: var(--space-md);
}


/* ==========================================================================
   2. RESET
   ========================================================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-weight: var(--weight-regular);
    background: var(--void-black);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

img,
picture,
video,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}


/* ==========================================================================
   3. BODY BACKGROUND - Radial gradient + grid overlay
   ========================================================================== */

body {
    background: radial-gradient(
        ellipse at center,
        var(--void-black) 0%,
        var(--void-darker) 100%
    );
    background-attachment: fixed;
}

/* Grid overlay (body::before) is defined in styles.css with tuned opacities */


/* ==========================================================================
   4. GLASS MORPHISM CARD
   Reusable .card class. Compose with layout utilities.
   ========================================================================== */

.card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-heavy));
    -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);

    /* Subtle inner glow along top edge */
    box-shadow: inset 0 1px 0 var(--glass-highlight);

    transition:
        transform var(--transition-base),
        border-color var(--transition-base),
        box-shadow var(--transition-base);
}

/* Hover state - green glow lift */
.card:hover {
    transform: translateY(-4px);
    border-color: var(--glass-border-hover);
    box-shadow:
        inset 0 1px 0 var(--glass-highlight),
        var(--shadow-glow-md);
}

/* Gradient border accent (top-left corner glow, visible on hover) */
.card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(74, 246, 38, 0.25),
        transparent 50%
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card:hover::before {
    opacity: 1;
}

/* Card size variants */
.card-flush {
    padding: 0;
}

.card-compact {
    padding: var(--space-sm);
}


/* ==========================================================================
   5. SCANNING LINE ANIMATION
   A thin cyber-green beam sweeps top to bottom.
   Triggered via JS by toggling .active on the element.
   ========================================================================== */

.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--cyber-green) 50%,
        transparent 100%
    );
    opacity: 0;
    z-index: var(--z-scan);
    pointer-events: none;
    box-shadow:
        0 0 30px var(--cyber-green),
        0 0 60px var(--cyber-green-dim),
        0 0 90px var(--cyber-green-glow);
}

.scan-line.active {
    animation: scan-down 2s ease-in-out forwards;
}

@keyframes scan-down {
    0%   { top: 0;      opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { top: 100vh;  opacity: 0; }
}


/* ==========================================================================
   6. TYPOGRAPHY UTILITIES
   ========================================================================== */

.font-mono {
    font-family: var(--font-mono);
}

.font-sans {
    font-family: var(--font-sans);
}

.text-brand {
    color: var(--text-brand);
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}


/* ==========================================================================
   7. RESPONSIVE BASE LAYOUT
   Three breakpoints: mobile-first, tablet (640px), desktop (1024px)
   ========================================================================== */

/* Container - centres content with consistent padding */
.container {
    width: 100%;
    max-width: var(--content-width);
    margin-inline: auto;
    padding-inline: var(--space-sm);
}

.container-narrow {
    max-width: var(--content-narrow);
}

/* Section rhythm */
.section {
    padding-block: var(--space-xl);
}

/* Auto grid - responsive columns without media queries */
.grid {
    display: grid;
    gap: var(--grid-gap);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.grid-2 {
    grid-template-columns: 1fr;
}

.grid-3 {
    grid-template-columns: 1fr;
}

/* ------- Tablet (640px+) ------- */
@media (min-width: 640px) {
    .container {
        padding-inline: var(--space-md);
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ------- Desktop (1024px+) ------- */
@media (min-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ------- Small screens (below 640px) ------- */
@media (max-width: 639px) {
    :root {
        --space-lg: 3rem;
        --space-xl: 4rem;
        --space-2xl: 6rem;
    }

    /* Grid mobile rules are in styles.css */

    .card:hover {
        transform: translateY(-2px);
    }
}


/* ==========================================================================
   8. SCROLL REVEAL (base animation class)
   Pair with JS IntersectionObserver to add .visible
   ========================================================================== */

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity var(--duration-slow) var(--ease-spring),
        transform var(--duration-slow) var(--ease-spring);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .scan-line.active {
        animation: none;
    }

    .card:hover {
        transform: none;
    }
}
