/* Full-screen "dragon" loading intro, shown at most once per browser
   session — see frontend/views/layouts/_intro.php (markup + the
   server-side route guard) and the critical inline script in
   layouts/main.php / layouts/home.php (the sessionStorage/
   prefers-reduced-motion check that adds .dg-intro-active on <html>
   before this file's link tag, so there's no flash of a hidden overlay).

   prefers-reduced-motion: the inline script never adds the activation
   class for a reduced-motion visitor, so #dg-intro simply never becomes
   visible for them — deliberately "deloc" rather than a static variant,
   since the whole point of this screen is the motion. Nothing here
   needs its own reduced-motion branch as a result.

   Every animation below touches only transform/opacity (or, for the
   mask-image set once per element, a static non-animated property) —
   GPU-composited, nothing that forces layout/paint on each frame. */

:root {
    --intro-lime: #7CFF00;
    --intro-gold: #FFD400;
}

#dg-intro {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    background-color: #0B0D0C;
    background-image: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--dg-secondary) 55%, #0B0D0C 45%) 0%, #0B0D0C 72%);
    opacity: 1;
    cursor: pointer;
}

html.dg-intro-active #dg-intro {
    display: flex;
}

#dg-intro.dg-intro-closing {
    opacity: 0;
    transition: opacity .45s cubic-bezier(.3, 0, .2, 1);
    pointer-events: none;
}

/* 0-0.4s: the lime spark the logo then appears out of. */
.dg-intro-glow {
    position: absolute;
    width: 70vmax;
    height: 70vmax;
    border-radius: 50%;
    background: radial-gradient(circle, var(--intro-lime) 0%, color-mix(in srgb, var(--intro-lime) 35%, transparent) 38%, transparent 70%);
    opacity: 0;
    transform: scale(.15);
    will-change: transform, opacity;
    animation: dg-intro-glow .4s ease-out forwards;
}

@keyframes dg-intro-glow {
    0% { opacity: 0; transform: scale(.15); }
    55% { opacity: .5; }
    100% { opacity: 0; transform: scale(1); }
}

.dg-intro-logo-wrap {
    position: relative;
    z-index: 1;
    display: inline-block;
}

/* 0.3-1.2s: fade/scale in, with one green glow pulse through the tail
   of that window. */
.dg-intro-logo {
    display: block;
    width: min(70vw, 420px);
    height: auto;
    opacity: 0;
    transform: scale(.92);
    will-change: transform, opacity, filter;
    animation:
        dg-intro-logo-in .9s ease-out .3s forwards,
        dg-intro-logo-pulse .6s ease-in-out .7s 1;
}

@keyframes dg-intro-logo-in {
    to { opacity: 1; transform: scale(1); }
}

@keyframes dg-intro-logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(124, 255, 0, 0)); }
    50% { filter: drop-shadow(0 0 18px rgba(124, 255, 0, .65)); }
}

/* Chrome "glint" sweep: the mask clips a moving gradient to the logo's
   own silhouette (its alpha channel), so only the sweep itself needs to
   animate — and it does that purely via transform. */
.dg-intro-glint-mask {
    position: absolute;
    inset: 0;
    overflow: hidden;
    mix-blend-mode: overlay;
    pointer-events: none;
    -webkit-mask-image: url('/images/logo/logo-800.webp');
    mask-image: url('/images/logo/logo-800.webp');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.dg-intro-glint-sweep {
    position: absolute;
    top: -25%;
    left: -60%;
    width: 55%;
    height: 150%;
    background: linear-gradient(115deg, transparent 15%, rgba(255, 255, 255, .95) 50%, transparent 85%);
    opacity: 0;
    transform: translateX(-20%);
    will-change: transform, opacity;
    animation: dg-intro-glint .7s ease-out .55s 1 forwards;
}

@keyframes dg-intro-glint {
    0% { opacity: 0; transform: translateX(-20%); }
    15% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateX(260%); }
}

/* 0.4-1.6s: 18-24 lime/gold embers rising — see intro.js for the
   randomized --x/--d/--s custom properties each particle gets. */
.dg-intro-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.dg-intro-particle {
    position: absolute;
    bottom: -10px;
    left: var(--x);
    width: var(--sz);
    height: var(--sz);
    border-radius: 50%;
    background: var(--intro-lime);
    opacity: 0;
    will-change: transform, opacity;
    animation: dg-intro-rise var(--s) ease-out var(--d) forwards;
}

.dg-intro-particle-gold {
    background: var(--intro-gold);
}

@keyframes dg-intro-rise {
    0% { opacity: 0; transform: translateY(0) scale(.6); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-46vh) scale(1); }
}

/* Fills in ~1.4s, GPU-only via scaleX (never animates width). */
.dg-intro-progress {
    position: relative;
    z-index: 1;
    width: min(60vw, 260px);
    height: 4px;
    margin-top: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    overflow: hidden;
}

.dg-intro-progress-bar {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-green, #1D8C39), var(--intro-lime));
    transform: scaleX(0);
    transform-origin: left;
    will-change: transform;
    animation: dg-intro-progress 1.4s cubic-bezier(.3, .6, .3, 1) forwards;
}

@keyframes dg-intro-progress {
    to { transform: scaleX(1); }
}

.dg-intro-skip {
    position: absolute;
    z-index: 1;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 18px;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 999px;
    background: transparent;
    color: #FFFFFF;
    font-size: .85rem;
    opacity: .85;
    cursor: pointer;
}

.dg-intro-skip:hover,
.dg-intro-skip:focus-visible {
    opacity: 1;
    outline: 2px solid var(--intro-lime);
    outline-offset: 2px;
}
