/* ============================================
   GLOBAL.CSS — Ooi Solutions (v4)
   Reset, base typography, scrollbar, Lenis base
   Smooth loading, no white flash
   ============================================ */

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

/* ── SELECTION ── */
::selection {
    background: var(--accent);
    color: #fff;
}
::-moz-selection {
    background: var(--accent);
    color: #fff;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* ── LENIS SMOOTH SCROLL BASE ── */
html.lenis, html.lenis body {
    height: auto;
}
.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}
.lenis.lenis-stopped {
    overflow: hidden;
}

/* ── HTML & BODY ── */
html, body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-dark);
    color: var(--fg);
    line-height: 1.5;
}

/* ── LOADING SCREEN ── */
#ooi-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#ooi-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.ooi-loader-bar {
    width: 120px;
    height: 2px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.ooi-loader-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-gold));
    border-radius: 2px;
    animation: ooiLoadProgress 1.5s ease-in-out forwards;
}
@keyframes ooiLoadProgress {
    0% { width: 0%; }
    60% { width: 70%; }
    100% { width: 100%; }
}

/* Hide page content while loading — but keep layout intact to prevent flash */
body.ooi-loading > *:not(#ooi-loader) {
    visibility: hidden;
    opacity: 0;
}

/* Smooth fade-in transition for content when loading completes */
body:not(.ooi-loading) > *:not(.squirrel-throw-container):not(.squirrel-nut-particle) {
    opacity: 1;
}

/* Ensure header is always visible once loading is done (no delay) */
body:not(.ooi-loading) .site-header {
    opacity: 1;
    visibility: visible;
}

/* ── LINKS & BUTTONS ── */
a {
    color: inherit;
    text-decoration: none;
}
button {
    font: inherit;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}

/* ── GLOBAL ACCESSIBILITY (Reduced Motion) ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
