/*
 * Glow Effect - plain CSS port of the React <GlowEffect> (motion/react) in ../../original/GlowEffect.tsx.
 * No React, no motion library: the same six modes with @property and @keyframes.
 *
 *   <div class="ge-host">                       position: relative; the thing that glows sits on top
 *     <div class="ge ge-rotate ge-blur-strong" aria-hidden="true"></div>
 *     <button class="ge-on-top">…</button>
 *   </div>
 *
 * Colours: --ge-c1 … --ge-c4 (the source's default four). Duration: --ge-duration (source: 5s).
 * Scale: --ge-scale (source: 1). Blur: one of the ge-blur-* classes or --ge-blur.
 *
 * What differs from the source, on purpose:
 * - Exactly four colours (the source takes any number). Give the same colour twice for fewer.
 * - Motion steps through the backgrounds; here the colour itself is animated (registered <color>),
 *   which crossfades the same way.
 * - Respects prefers-reduced-motion (the source does not): the glow stays, the motion stops.
 */
@property --ge-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@property --ge-a { syntax: "<color>"; initial-value: #FF5733; inherits: false; }
@property --ge-b { syntax: "<color>"; initial-value: #33FF57; inherits: false; }

.ge {
    --ge-c1: #FF5733;
    --ge-c2: #33FF57;
    --ge-c3: #3357FF;
    --ge-c4: #F1C40F;
    --ge-duration: 5s;
    --ge-scale: 1;
    --ge-blur: 12px;                    /* "medium" = Tailwind blur-md */

    pointer-events: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    scale: var(--ge-scale);
    filter: blur(var(--ge-blur));
    will-change: transform;
    backface-visibility: hidden;
}

/* Blur presets, as the source maps them to Tailwind. */
.ge-blur-softest   { --ge-blur: 4px; }
.ge-blur-soft      { --ge-blur: 8px; }
.ge-blur-medium    { --ge-blur: 12px; }
.ge-blur-strong    { --ge-blur: 16px; }
.ge-blur-stronger,
.ge-blur-strongest { --ge-blur: 24px; }
.ge-blur-none      { --ge-blur: 0px; }

/* rotate: the conic gradient turns once per duration, linear, forever. */
.ge-rotate {
    background: conic-gradient(from var(--ge-angle) at 50% 50%, var(--ge-c1), var(--ge-c2), var(--ge-c3), var(--ge-c4));
    animation: ge-turn var(--ge-duration) linear infinite;
}

/* pulse: one soft disc whose colour walks the list; it swells to 1.1 and brightens. */
.ge-pulse {
    background: radial-gradient(circle at 50% 50%, var(--ge-a) 0%, transparent 100%);
    animation: ge-walk-a var(--ge-duration) linear infinite alternate, ge-pulse var(--ge-duration) linear infinite alternate;
}

/* breathe: as pulse, a smaller swell (1.05) and full opacity. */
.ge-breathe {
    background: radial-gradient(circle at 50% 50%, var(--ge-a) 0%, transparent 100%);
    animation: ge-walk-a var(--ge-duration) linear infinite alternate, ge-breathe var(--ge-duration) linear infinite alternate;
}

/* colorShift: a conic from one colour to the next and back, walking the list. */
.ge-colorShift {
    background: conic-gradient(from 0deg at 50% 50%, var(--ge-a) 0%, var(--ge-b) 50%, var(--ge-a) 100%);
    animation: ge-walk-a var(--ge-duration) linear infinite alternate, ge-walk-b var(--ge-duration) linear infinite alternate;
}

/* flowHorizontal: a left-to-right gradient from one colour to the next, walking the list. */
.ge-flowHorizontal {
    background: linear-gradient(to right, var(--ge-a), var(--ge-b));
    animation: ge-walk-a var(--ge-duration) linear infinite alternate, ge-walk-b var(--ge-duration) linear infinite alternate;
}

/* static: no motion. */
.ge-static { background: linear-gradient(to right, var(--ge-c1), var(--ge-c2), var(--ge-c3), var(--ge-c4)); }

@keyframes ge-turn { to { --ge-angle: 360deg; } }
@keyframes ge-walk-a {
    0%      { --ge-a: var(--ge-c1); }
    33.33%  { --ge-a: var(--ge-c2); }
    66.66%  { --ge-a: var(--ge-c3); }
    100%    { --ge-a: var(--ge-c4); }
}
@keyframes ge-walk-b {
    0%      { --ge-b: var(--ge-c2); }
    33.33%  { --ge-b: var(--ge-c3); }
    66.66%  { --ge-b: var(--ge-c4); }
    100%    { --ge-b: var(--ge-c1); }
}
@keyframes ge-pulse {
    0%, 100% { scale: var(--ge-scale); opacity: .5; }
    50%      { scale: calc(var(--ge-scale) * 1.1); opacity: .8; }
}
@keyframes ge-breathe {
    0%, 100% { scale: var(--ge-scale); }
    50%      { scale: calc(var(--ge-scale) * 1.05); }
}

@media (prefers-reduced-motion: reduce) {
    .ge { animation: none !important; }
    .ge-pulse, .ge-breathe, .ge-colorShift, .ge-flowHorizontal { --ge-a: var(--ge-c1); --ge-b: var(--ge-c2); }
}
