/* ============================================================
   AELITHON — BASE  (reset, elements, layout primitives, buttons)
   Loaded after tokens.css.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
/* margin reset + kill the translucent blue/grey box mobile browsers flash on tap */
* { margin: 0; -webkit-tap-highlight-color: transparent; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* keep anchored sections clear of the fixed nav */
    scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-400);
    line-height: var(--lh-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    color: var(--text);
}

p { color: var(--text-muted); }

a { color: inherit; text-decoration: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul { list-style: none; padding: 0; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}
/* A plain mouse/touch click should NOT leave a focus box — only keyboard
   navigation shows the accent ring above (keeps it clean but still accessible). */
:focus:not(:focus-visible) { outline: none; }

/* Native cross-document page transitions (progressive enhancement —
   browsers that don't support it simply navigate normally). */
@view-transition { navigation: auto; }

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}
.container.narrow { max-width: var(--maxw-narrow); }

.section { position: relative; padding-block: clamp(4rem, 10vw, 9rem); }

.stack > * + * { margin-top: var(--sp-4); }

/* ============================================================
   TEXT HELPERS
   ============================================================ */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--fs-200);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.eyebrow::before {
    content: "";
    width: 28px;
    height: 1.5px;
    border-radius: 2px;
    background: var(--gradient);
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead { font-size: var(--fs-500); color: var(--text-muted); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: var(--fs-300);
    line-height: 1;
    padding: 0.95rem 1.6rem;
    border-radius: var(--r-pill);
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease),
                background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
    will-change: transform;
}
.btn svg { width: 1.1em; height: 1.1em; }
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
    background: var(--gradient);
    color: var(--on-accent);
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 64px -10px var(--glow); }

.btn-ghost {
    border: 1px solid var(--border-strong);
    color: var(--text);
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.btn-lg { padding: 1.1rem 2rem; font-size: var(--fs-400); }

/* ============================================================
   GRAIN OVERLAY (fine film texture over everything)
   ============================================================ */
.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Skip link — visible only on keyboard focus */
.skip-link {
    position: fixed;
    top: 12px; left: 12px;
    z-index: 10000;
    padding: 10px 18px;
    background: var(--gradient);
    color: var(--on-accent);
    font-weight: 600;
    border-radius: var(--r-md);
    transform: translateY(-160%);
    transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* Utility */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

/* ============================================================
   WEBGL CANVAS  (Three.js aurora + 3D orb live here)
   Sits behind the CSS .backdrop fallback shows through if WebGL
   is unavailable. Fixed so it stays as an ambient layer.
   ============================================================ */
.gl-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s var(--ease);
}
.gl-canvas.is-ready { opacity: 1; }

/* ============================================================
   SCROLL REVEAL
   Default (no JS): everything visible. Once motion.js adds
   `js-ready`, [data-reveal] elements start hidden and ease in
   when they enter the viewport (class `in`). Reduced-motion users
   skip the movement entirely.
   ============================================================ */
html.js-ready [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
    will-change: opacity, transform;
}
html.js-ready [data-reveal="left"]  { transform: translateX(-32px); }
html.js-ready [data-reveal="right"] { transform: translateX(32px); }
html.js-ready [data-reveal="scale"] { transform: scale(0.94); }
html.js-ready [data-reveal].in {
    opacity: 1;
    transform: none;
}
@media (prefers-reduced-motion: reduce) {
    html.js-ready [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
}

