/* ====================================================================
   BRAND LOGO BACKGROUND
   A 16×12 sprite atlas of the brand sphere (192 transparent frames).
   Frame index is driven by scroll in js/logo-scrub.js.

   Atlas:  4096 × 3072 px, cells of 256 × 256 px.
   --sprite-size  = rendered on-screen size of a single frame.
   --sprite-col   = column (0-15) for current frame — updated by JS.
   --sprite-row   = row (0-11) for current frame — updated by JS.
==================================================================== */

.brand-logo-bg {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.brand-logo-sprite {
    --sprite-size: clamp(280px, 58vmin, 640px);
    --sprite-col: 0;
    --sprite-row: 0;
    --atlas-cols: 16;
    --atlas-rows: 12;

    width: var(--sprite-size);
    height: var(--sprite-size);
    background-image: url('../images/logo-sphere-atlas.webp');
    background-repeat: no-repeat;
    background-size:
        calc(var(--sprite-size) * var(--atlas-cols))
        calc(var(--sprite-size) * var(--atlas-rows));
    background-position:
        calc(var(--sprite-col) * var(--sprite-size) * -1)
        calc(var(--sprite-row) * var(--sprite-size) * -1);

    /* crisp downscale / upscale */
    image-rendering: auto;
    filter: drop-shadow(0 20px 50px rgba(0, 66, 184, 0.25));

    opacity: 0;
    transition: opacity 500ms ease;
    will-change: background-position;
}

.brand-logo-sprite.is-ready {
    opacity: 0.92;
}

/* Ensure DOM content sits above the sprite */
.navbar-wrapper,
main,
footer {
    position: relative;
    z-index: 2;
}

/* Glass helper kept for anything already tagged */
.glass-readable {
    position: relative;
    isolation: isolate;
}

.glass-readable::before {
    content: '';
    position: absolute;
    inset: -24px -40px;
    border-radius: 24px;
    background: radial-gradient(
        ellipse 120% 80% at 50% 50%,
        rgba(255, 255, 255, 0.88) 0%,
        rgba(255, 255, 255, 0.72) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    backdrop-filter: blur(6px) saturate(1.1);
    -webkit-backdrop-filter: blur(6px) saturate(1.1);
    z-index: -1;
    pointer-events: none;
}

@media (max-width: 768px) {
    .brand-logo-sprite {
        --sprite-size: clamp(220px, 66vmin, 440px);
    }
    .brand-logo-sprite.is-ready {
        opacity: 0.75;
    }
}

@media (prefers-reduced-motion: reduce) {
    .brand-logo-sprite.is-ready {
        opacity: 0.6;
    }
}
