/* ============================================================
   VEILBORN BASE — Foundation Layer
   Global reset, body setup, typography defaults, scrollbar,
   selection, focus, noise overlay, and reduced-motion.
   Loaded after tokens.css. No components here.
   ============================================================ */


/* ── RESET ─────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
}


/* ── BODY ──────────────────────────────────────────────────── */

body {
    background: var(--c-abyss);
    color: var(--c-text);
    font-family: var(--f-body);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}


/* ── TYPOGRAPHY ────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--f-display);
    color: var(--c-text);
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
}

h1 { font-size: var(--fs-hero); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-base); }

p {
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-3);
}

a {
    color: var(--c-gold);
    text-decoration: none;
    transition: color .15s ease;
}

a:hover {
    color: var(--c-gold-hi);
    text-decoration: underline;
}

small {
    font-size: var(--fs-xs);
    color: var(--c-text-muted);
}

strong {
    color: var(--c-text);
    font-weight: 700;
}


/* ── FORM ELEMENTS (inherit) ───────────────────────────────── */

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}


/* ── MEDIA DEFAULTS ────────────────────────────────────────── */

img, svg, video, canvas {
    display: block;
    max-width: 100%;
}


/* ── MISC ELEMENT RESETS ───────────────────────────────────── */

ul, ol { list-style: none; }
table  { border-collapse: collapse; border-spacing: 0; }


/* ── SELECTION ─────────────────────────────────────────────── */

::selection {
    background: var(--c-gold);
    color: var(--c-void);
}


/* ── FOCUS VISIBLE (keyboard navigation) ───────────────────── */

:focus-visible {
    outline: 2px solid var(--c-gold);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}


/* ── SCROLLBAR ─────────────────────────────────────────────── */

/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--c-fog);
}

::-webkit-scrollbar-thumb {
    background: var(--c-mist);
    border-radius: var(--r-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--c-veil);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--c-mist) var(--c-fog);
}

/* Narrow variant for inner panels */
.thin-scroll::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.thin-scroll {
    scrollbar-width: thin;
}


/* ── NOISE OVERLAY (atmospheric film grain) ────────────────── */

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: .025;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px;
}


/* ── 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;
    }
}
