/* ══════════════════════════════════════════════════════
   base.css
   Variables, reset, and typography foundations
   ══════════════════════════════════════════════════════ */

/* === VARIABLES & RESET === */
:root {
    --graphite-900: #141416;
    /* Page-wide cursor tracking for oxblood warm grid */
    --mouse-x: -500px;
    --mouse-y: -500px;
    --graphite-800: #1a1a1c;
    --graphite-700: #1f1f22;
    --graphite-600: #2a2a2e;
    --graphite-500: #3a3a40;
    --text-primary: #f2efe9;
    --text-secondary: #b8b5ae;
    --text-tertiary: #6e6b66;
    --oxblood: #900919;
    --oxblood-bright: #b41024;
    /* Legacy aliases for layout.css var() references */
    --bg-main: var(--graphite-800);
    --bg-card: var(--graphite-700);
    --border: var(--graphite-600);
}

/* Reset and base styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
    overflow-x: hidden;
    /* Prevent fixed header "jump" when modals lock body scroll */
    scrollbar-gutter: stable;
}

body {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--graphite-800);
    /* Grid handled by fixed .page-grid-static (with left-fade mask) */
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: scroll;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Optimize for smooth scrolling */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.03em;
}

/* Fluid type scale — Task 2 */
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }

/* === LOADING & UTILITIES === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--graphite-800);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--graphite-600);
    border-radius: 4px;
    border: 1px solid var(--graphite-800);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--graphite-500);
}

::-webkit-scrollbar-corner {
    background: var(--graphite-800);
}

/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(184, 181, 174, 0.3);
    border-top: 4px solid var(--text-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === FOCUS STATES — Task 7 ===
   Using --text-primary (13.6:1 on dark) not --oxblood (1.76:1 — invisible on dark).
   Oxblood outline was specified in Phase 1 brief but fails WCAG AA contrast. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}
