/*
 * Atmosphere: the layered backdrop, the scanline overlay and the animated "power conduit" line.
 * Both page-wide layers are fixed pseudo-elements of <body>, so nothing repaints while the page scrolls and neither ever receives a pointer event.
 *
 * Scanlines are on by default. They are switched off by <html data-scanlines="off"> (the visitor's preference), by prefers-reduced-motion,
 * by forced-colors / high-contrast modes and in print.
 */

/* Backdrop: noise over a faint cyan grid over a navy bloom, on near-black */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        var(--a2-tex-noise),
        linear-gradient(rgb(46 230 255 / .035) 1px, transparent 1px),
        linear-gradient(90deg, rgb(46 230 255 / .035) 1px, transparent 1px),
        radial-gradient(70rem 36rem at 12% -8%, rgb(30 94 255 / .2), transparent 62%),
        radial-gradient(52rem 30rem at 100% 0, rgb(46 230 255 / .07), transparent 58%),
        linear-gradient(180deg, var(--a2-bg-1), var(--a2-bg-0) 72%);
    background-size: 160px 160px, 48px 48px, 48px 48px, auto, auto, auto;
}

/* Scanlines: a 1 px dark line every 3 px. The text colours keep their contrast with the darkening included (DesignTokenContrastTests). */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: var(--a2-z-overlay);
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / .12) 2px 3px);
}

html[data-scanlines="off"] body::after {
    display: none;
}

/* Power conduit: a 2 px rail with a pulse of energy travelling along it */
.a2-conduit {
    position: relative;
    height: 2px;
    overflow: hidden;
    background: var(--a2-steel-2);
}

.a2-conduit::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 30%;
    background: linear-gradient(90deg, transparent, var(--a2-energy), transparent);
    filter: drop-shadow(var(--a2-energy-glow));
    animation: a2-conduit 5s linear infinite;
}

@keyframes a2-conduit {
    from { transform: translateX(-100%); }
    to { transform: translateX(340%); }
}

@media (prefers-reduced-motion: reduce) {
    body::after {
        display: none;
    }

    /* A steady glow instead of a travelling pulse */
    .a2-conduit::after {
        width: 100%;
        background: var(--a2-energy);
        opacity: .45;
        animation: none;
    }

    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (forced-colors: active) {
    body::before,
    body::after {
        display: none;
    }
}

@media print {
    body::before,
    body::after {
        display: none;
    }

    html,
    body {
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-shadow: none;
    }
}
