* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* Desktop: Offset for 80px header + breathing room */
    /* Solid base prevents any white/dark clears during re-composition */
    background-color: #0a0a0f;
}

/* Mobile scroll offset adjustment */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 130px; /* Mobile: Offset for 100px header + extra breathing room */
    }
}

/* Ensure ::before stays in our stacking context */
body {
    font-family: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0f;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    isolation: isolate;
    
    /* Typography shift minimization */
    font-size-adjust: 0.5; /* tuned for Space Grotesk; reduces swap jump */
}

/* Static Background - promoted to its own layer, safe stacking */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 40%, rgba(120, 255, 200, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 75% 60%, rgba(120, 200, 255, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 80%, rgba(255, 160, 255, 0.08) 0%, transparent 60%),
        linear-gradient(160deg, #0a0e1a 0%, #101828 40%, #050510 100%);
    z-index: -1;                 /* keep inside body's stacking context */
    pointer-events: none;
    transform: translateZ(0);     /* force composited layer */
    backface-visibility: hidden;  /* avoid one-frame dark samples */
    will-change: transform;       /* scoped, stable hint */
}

/* Scoped Link Styling — applies only to links inside <main> */
main a {
    color: #fbbf24;
    text-decoration: underline;
    text-decoration-color: rgba(251, 191, 36, 0.3);
    text-underline-offset: 3px;
    transition: all 0.2s ease;
}

main a:hover {
    color: #f59e0b;
    text-decoration-color: #f59e0b;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

main a:visited {
    color: #d97706;
}
