/* ==========================================================================
   Reset & Baseline (Apple-Grade Smooth Performance)
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: auto; /* Handled smoothly by Lenis */
    -webkit-text-size-adjust: 100%;
}

html.lenis, html.lenis body {
    height: auto;
}

body {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    touch-action: manipulation;
}

a {
    color: inherit;
    text-decoration: none;
    touch-action: manipulation;
}

ul, ol {
    list-style: none;
}

/* Subtle grain texture overlay — GPU optimized with lightweight raster tile */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyBAMAAADsEZWCAAAAGFBMVEUAAAAAAABKSkpWVlZeXl5oaGhwcHB8fHxQ8x54AAAACHRSTlMAmN/37+9v/wBNXw61AAAAwUlEQVQ4y2NgQAX8DIxgxMggLCAg8IFRwEFQ4AMjowNIIwMjI1RBQQGGRkZHqIKCgkLCCgpC/4EaGYA0AwMDA1RBQeEDRgH/B0ABBiANYAMhCgiIH2AU+P/AAKYBo4CAwAdGIf8HRgHh/w8MYBoIGP5/YBQQEPzAKPAf6AEMQBo+MAoIDHxgFBQQ+MAoICD4gVHgP9ADGEA08IFRQIDhA6OAgOADRoH/QA8wAAD8p2f/a1QyXQAAAABJRU5ErkJggg==');
    background-repeat: repeat;
    opacity: 0.04;
    pointer-events: none;
    z-index: var(--z-loader);
    transform: translateZ(0);
}

/* On mobile, disable fixed overlay completely to maximize 60-120fps touch scroll */
@media (max-width: 991px), (pointer: coarse) {
    body::after {
        display: none !important;
    }
}
