﻿/* the fog sweep layer — sits above the dim, below the modal */
.gr-fog {
    position: fixed;
    inset: 0;
    z-index: 6000; /* overlay is 5000, modal 6000 (see below) */
    pointer-events: none; /* never eats clicks */
    overflow: hidden;
}

.gr-fog__layer {
    position: absolute;
    top: -10%;
    left: 0;
    width: 200%;
    height: 120%;
    background-repeat: repeat;
    opacity: 0;
    mix-blend-mode: screen;
    will-change: transform, background-position, opacity;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
}

/* three depths: back = slow/large/faint, front = fast/small/denser */
.gr-fog__layer--back {
    background-image: url('/images/fog/fog3.png');
    background-size: auto 100%;
    animation: gr-fog-sweep-back 3.1s ease-in-out forwards;
}

.gr-fog__layer--mid {
    background-image: url('/images/fog/fog2.png');
    background-size: auto 100%;
    animation: gr-fog-sweep-mid 3.6s ease-in-out forwards;
}

.gr-fog__layer--front {
    background-image: url('/images/fog/fog1.png');
    background-size: auto 100%;
    animation: gr-fog-sweep-front 3.6s ease-in-out forwards;
}

/* each layer: fades in on the left, scrolls its texture across, fades out on the right.
   translateX moves the whole layer; background-position adds internal drift so it
   doesn't look like a rigid sheet. Different distances = parallax. */
@keyframes gr-fog-sweep-back {
    0% {
        transform: translateX(-120%);
        background-position: 0% 50%;
        opacity: 0;
    }

    25% {
        opacity: 0.55;
    }

    75% {
        opacity: 0.55;
    }

    100% {
        transform: translateX(120%);
        background-position: 140% 50%;
        opacity: 0;
    }
}

@keyframes gr-fog-sweep-mid {
    0% {
        transform: translateX(-120%);
        background-position: 0% 50%;
        opacity: 0;
    }

    20% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.8;
    }

    100% {
        transform: translateX(120%);
        background-position: 200% 50%;
        opacity: 0;
    }
}

@keyframes gr-fog-sweep-front {
    0% {
        transform: translateX(-120%);
        background-position: 0% 50%;
        opacity: 0;
    }

    18% {
        opacity: 0.95;
    }

    82% {
        opacity: 0.95;
    }

    100% {
        transform: translateX(120%);
        background-position: 260% 50%;
        opacity: 0;
    }
}





































/* ============================================================================
   LobbyFog.razor.css
   Everything visual is a function of --fog-fill (0 → 1). Move that one number
   and the fog thickens/thins. Textures screen-blend so black drops out.
   Swap the three fog PNG paths to yours if they differ.
   ============================================================================ */

.lobby-fog {
    position: fixed;
    inset: 0;
    z-index: 10; /* above the lobby, below modals/toasts */
    pointer-events: none;
    overflow: hidden;
    isolation: isolate; /* keep screen-blend blending within this layer */
}

.lobby-fog__layer {
    position: absolute;
    top: -10%;
    height: 120%;
    width: 250%; /* wider than viewport: no visible trailing edge */
    background-repeat: repeat;
    mix-blend-mode: screen; /* black → invisible, only fog shows */
    will-change: transform, background-position, opacity;
    /* feather horizontal edges so nothing ends in a hard wall */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 16%, black 84%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 16%, black 84%, transparent 100%);
}

/* ── Ambient idle + gathering ───────────────────────────────────────────────
   Both layers' opacity scales with --fog-fill, so the fog thickens as seats
   fill and thins on leave with zero extra logic. Ambient is always faintly
   present (the +0.06 floor); gather only really shows as the lobby fills. */

.lobby-fog__ambient {
    background-image: url('/images/fog/fog3.png'); /* faintest / largest */
    background-size: auto 80%;
    opacity: calc(0.06 + var(--fog-fill) * 0.34);
    animation: lf-drift-a 36s linear infinite;
    transition: opacity 900ms ease-in-out; /* smooth breathing on join/leave */
}

.lobby-fog__gather {
    background-image: url('/images/fog/fog1.png');
    background-size: auto 95%;
    opacity: calc(var(--fog-fill) * 0.5);
    animation: lf-drift-b 94s linear infinite reverse;
    transition: opacity 900ms ease-in; /* slow settle back after a pulse */
}

/* slow ambient drift — cheap (transform + background-position only) */
@keyframes lf-drift-a {
    from {
        transform: translateX(-6%);
        background-position: 0% 50%;
    }

    to {
        transform: translateX(-6%);
        background-position: 100% 50%;
    }
}

@keyframes lf-drift-b {
    from {
        transform: translateX(4%);
        background-position: 0% 50%;
    }

    to {
        transform: translateX(4%);
        background-position: 120% 50%;
    }
}

/* ── Join pulse ─────────────────────────────────────────────────────────────
   Fast surge on the gather layer when someone joins, then the 900ms ease-in
   above settles it back to the fill-based resting level. Feels like a breath. */
.lobby-fog.is-pulse .lobby-fog__gather {
    opacity: calc(var(--fog-fill) * 0.5 + 0.22);
    transition: opacity 180ms ease-out;
}

/* ── Ignition: two fronts converge to center ────────────────────────────────
   Starts from already-thick fog (fill is ~1), so this accelerates what's there
   rather than fading in from nothing. Meeting mid-screen = peak density = the
   handoff beat to the board + piece reveal. */
.lobby-fog__front-l {
    background-image: url('/images/fog/fog1.png'); /* front / densest */
    background-size: auto 120%;
    opacity: 0;
    animation: lf-front-l 1.4s cubic-bezier(.22,.61,.36,1) forwards;
}

.lobby-fog__front-r {
    background-image: url('/images/fog/fog1.png');
    background-size: auto 120%;
    opacity: 0;
    transform: scaleX(-1); /* mirror so the two fronts differ */
    animation: lf-front-r 1.4s cubic-bezier(.22,.61,.36,1) forwards;
}

@keyframes lf-front-l {
    0% {
        transform: translateX(-150%);
        opacity: 0;
    }

    30% {
        opacity: 0.9;
    }

    55% {
        transform: translateX(-8%);
        opacity: 1;
    }
    /* meet just past center */
    100% {
        transform: translateX(-8%);
        opacity: 0.9;
    }
    /* hold at the collision */
}

@keyframes lf-front-r {
    0% {
        transform: translateX(150%) scaleX(-1);
        opacity: 0;
    }

    30% {
        opacity: 0.9;
    }

    55% {
        transform: translateX(8%) scaleX(-1);
        opacity: 1;
    }

    100% {
        transform: translateX(8%) scaleX(-1);
        opacity: 0.9;
    }
}

/* during ignition, let the ambient bloom peak with the convergence */
.lobby-fog.is-igniting .lobby-fog__ambient {
    opacity: 0.55;
    transition: opacity 700ms ease-in;
}

/* ── Skip: any parent-set .lf-skip jumps to resolved state ───────────────────
   (parent adds it on click/tap during ignition, then swaps to the board) */
.lobby-fog.lf-skip .lobby-fog__layer {
    animation-duration: .001s !important;
    animation-delay: 0s !important;
}

/* ── Reduced motion: fog is static, still fill-driven, no drift/convergence ── */
@media (prefers-reduced-motion: reduce) {
    .lobby-fog__layer {
        animation: none !important;
        transform: none !important;
    }

    .lobby-fog__front-l, .lobby-fog__front-r {
        display: none;
    }

    .lobby-fog__ambient {
        opacity: calc(0.10 + var(--fog-fill) * 0.35);
    }

    .lobby-fog__gather {
        opacity: calc(var(--fog-fill) * 0.45);
    }

    .lobby-fog.is-pulse .lobby-fog__gather {
        transition: none;
    }
}