:root {
    --itr-ambient-strength: 1.52;
    --itr-ambient-opacity: 1;
    --itr-ambient-particles-alpha: 0.86;
    --itr-ambient-grid-opacity: 0.3;
    --itr-ambient-sheen-opacity: 0.5;
    --itr-ambient-speed: 0.9;
    --itr-ambient-strength-mobile: 0.34;

    --itr-ambient-mood-strength: 1;
    --itr-ambient-mood-opacity: 1;
    --itr-ambient-mood-grid: 1;
    --itr-ambient-mood-particles: 1;
    --itr-ambient-mood-sheen: 1;
    --itr-ambient-mood-vignette: 0.24;

    --itr-ambient-runtime-strength: 1;
    --itr-ambient-runtime-speed: 1;
    --itr-ambient-runtime-particles: 1;
    --itr-ambient-runtime-grid: 1;
    --itr-ambient-runtime-sheen: 1;

    --itr-ambient-tone-a: rgba(56, 189, 248, 0.46);
    --itr-ambient-tone-b: rgba(16, 185, 129, 0.4);
    --itr-ambient-tone-c: rgba(245, 158, 11, 0.28);
    --itr-ambient-tone-d: rgba(14, 165, 233, 0.34);
}

.itr-ambient {
    --itr-ambient-strength: 1.52;
    --itr-ambient-opacity: 1;
    --itr-ambient-particles-alpha: 0.86;
    --itr-ambient-grid-opacity: 0.3;
    --itr-ambient-sheen-opacity: 0.5;
    --itr-ambient-speed: 0.9;
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: calc(var(--itr-ambient-opacity) * var(--itr-ambient-mood-opacity));
    transition: opacity 480ms ease, filter 520ms ease;
}

.itr-ambient[data-ambient-profile='soft'] {
    --itr-ambient-strength: 0.74;
    --itr-ambient-opacity: 0.72;
    --itr-ambient-particles-alpha: 0.34;
    --itr-ambient-grid-opacity: 0.08;
    --itr-ambient-sheen-opacity: 0.16;
    --itr-ambient-speed: 1.14;
}

.itr-ambient[data-ambient-profile='balanced'] {
    --itr-ambient-strength: 1.52;
    --itr-ambient-opacity: 1;
    --itr-ambient-particles-alpha: 0.86;
    --itr-ambient-grid-opacity: 0.3;
    --itr-ambient-sheen-opacity: 0.5;
    --itr-ambient-speed: 0.9;
}

.itr-ambient[data-ambient-profile='bold'] {
    --itr-ambient-strength: 1.72;
    --itr-ambient-opacity: 1;
    --itr-ambient-particles-alpha: 0.94;
    --itr-ambient-grid-opacity: 0.36;
    --itr-ambient-sheen-opacity: 0.62;
    --itr-ambient-speed: 0.78;
}

body.ambient-soft .itr-ambient {
    --itr-ambient-strength: 0.72;
    --itr-ambient-opacity: 0.7;
    --itr-ambient-particles-alpha: 0.34;
    --itr-ambient-grid-opacity: 0.08;
    --itr-ambient-sheen-opacity: 0.14;
    --itr-ambient-speed: 1.16;
}

body.ambient-bold .itr-ambient {
    --itr-ambient-strength: 1.74;
    --itr-ambient-opacity: 1;
    --itr-ambient-particles-alpha: 0.9;
    --itr-ambient-grid-opacity: 0.34;
    --itr-ambient-sheen-opacity: 0.6;
    --itr-ambient-speed: 0.78;
}

body[data-ambient-mode='off'] .itr-ambient {
    display: none;
}

body[data-animations='off'] .itr-ambient__particles,
body[data-animations='off'] .itr-ambient__grid,
body[data-animations='off'] .itr-ambient__sheen {
    display: none !important;
}

body[data-animations='off'] .itr-ambient,
body[data-animations='off'] .itr-ambient__aurora,
body[data-animations='off'] .itr-ambient__grain {
    animation: none !important;
    transition: none !important;
}

body[data-ambient-mode='lite'] .itr-ambient {
    --itr-ambient-strength: 0.9;
    --itr-ambient-opacity: 0.62;
    --itr-ambient-particles-alpha: 0.2;
    --itr-ambient-grid-opacity: 0.065;
    --itr-ambient-sheen-opacity: 0.14;
    --itr-ambient-speed: 1.02;
}

body[data-ambient-mode='lite'].has-brand-motion .itr-ambient {
    opacity: calc(var(--itr-ambient-opacity) * var(--itr-ambient-mood-opacity) * 0.84);
}

body[data-ambient-mode='full'].has-brand-motion .itr-ambient {
    opacity: calc(var(--itr-ambient-opacity) * var(--itr-ambient-mood-opacity) * 0.9);
}

body.has-brand-motion .itr-ambient__particles {
    opacity: calc(var(--itr-ambient-particles-alpha) * var(--itr-ambient-mood-particles) * var(--itr-ambient-runtime-particles) * 0.82);
}

body.has-brand-motion .itr-ambient__grid {
    opacity: calc(var(--itr-ambient-grid-opacity) * var(--itr-ambient-mood-grid) * var(--itr-ambient-runtime-grid) * 0.78);
}

body.has-brand-motion .itr-ambient__sheen {
    opacity: calc(var(--itr-ambient-sheen-opacity) * var(--itr-ambient-mood-sheen) * var(--itr-ambient-runtime-sheen) * 0.8);
}

body[data-ambient-mood='positive'] {
    --itr-ambient-mood-strength: 1.14;
    --itr-ambient-mood-opacity: 1.04;
    --itr-ambient-mood-grid: 1.06;
    --itr-ambient-mood-particles: 1.12;
    --itr-ambient-mood-sheen: 1.1;
    --itr-ambient-mood-vignette: 0.17;
    --itr-ambient-tone-a: rgba(56, 189, 248, 0.54);
    --itr-ambient-tone-b: rgba(16, 185, 129, 0.5);
    --itr-ambient-tone-c: rgba(45, 212, 191, 0.32);
    --itr-ambient-tone-d: rgba(14, 165, 233, 0.42);
}

body[data-ambient-mood='neutral'] {
    --itr-ambient-mood-strength: 1;
    --itr-ambient-mood-opacity: 1;
    --itr-ambient-mood-grid: 1;
    --itr-ambient-mood-particles: 1;
    --itr-ambient-mood-sheen: 1;
    --itr-ambient-mood-vignette: 0.24;
    --itr-ambient-tone-a: rgba(56, 189, 248, 0.46);
    --itr-ambient-tone-b: rgba(16, 185, 129, 0.4);
    --itr-ambient-tone-c: rgba(245, 158, 11, 0.28);
    --itr-ambient-tone-d: rgba(14, 165, 233, 0.34);
}

body[data-ambient-mood='negative'] {
    --itr-ambient-mood-strength: 0.84;
    --itr-ambient-mood-opacity: 0.92;
    --itr-ambient-mood-grid: 0.8;
    --itr-ambient-mood-particles: 0.7;
    --itr-ambient-mood-sheen: 0.72;
    --itr-ambient-mood-vignette: 0.38;
    --itr-ambient-tone-a: rgba(99, 102, 241, 0.38);
    --itr-ambient-tone-b: rgba(14, 116, 144, 0.3);
    --itr-ambient-tone-c: rgba(245, 158, 11, 0.2);
    --itr-ambient-tone-d: rgba(59, 130, 246, 0.28);
}

.itr-app-layer {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.itr-ambient__aurora {
    position: absolute;
    border-radius: 999px;
    filter: blur(46px);
    opacity: calc(0.72 * var(--itr-ambient-strength) * var(--itr-ambient-mood-strength) * var(--itr-ambient-runtime-strength));
    mix-blend-mode: screen;
    will-change: transform, opacity;
    transform: translate3d(calc(var(--itr-ambient-mouse-x, 0px) * 0.08), calc(var(--itr-ambient-mouse-y, 0px) * 0.08), 0);
    transition: opacity 560ms ease, filter 560ms ease;
    animation: itr-ambient-drift calc(22s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed)) ease-in-out infinite;
}

.itr-ambient__aurora--one {
    width: 64vmax;
    height: 64vmax;
    top: -24vmax;
    left: -22vmax;
    background: radial-gradient(circle at 32% 34%, var(--itr-ambient-tone-a), transparent 68%);
}

.itr-ambient__aurora--two {
    width: 58vmax;
    height: 58vmax;
    right: -22vmax;
    top: -22vmax;
    background: radial-gradient(circle at 58% 44%, var(--itr-ambient-tone-b), transparent 66%);
    animation-duration: calc(28s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed));
}

.itr-ambient__aurora--three {
    width: 62vmax;
    height: 62vmax;
    left: 12vmax;
    bottom: -36vmax;
    background: radial-gradient(circle at 46% 52%, var(--itr-ambient-tone-c), transparent 68%);
    animation-duration: calc(34s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed));
}

.itr-ambient__aurora--four {
    width: 44vmax;
    height: 44vmax;
    right: 8vmax;
    bottom: -24vmax;
    background: radial-gradient(circle at 44% 44%, var(--itr-ambient-tone-d), transparent 67%);
    animation-duration: calc(38s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed));
}

.itr-ambient__grid {
    position: absolute;
    inset: -30%;
    opacity: calc(var(--itr-ambient-grid-opacity) * var(--itr-ambient-mood-grid) * var(--itr-ambient-runtime-grid));
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.19) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.19) 1px, transparent 1px);
    background-size: 120px 120px;
    animation: itr-ambient-grid calc(58s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed)) linear infinite;
    transition: opacity 620ms ease;
}

.itr-ambient__sheen {
    position: absolute;
    inset: -40%;
    opacity: calc(var(--itr-ambient-sheen-opacity) * var(--itr-ambient-mood-sheen) * var(--itr-ambient-runtime-sheen));
    mix-blend-mode: screen;
    background:
        linear-gradient(115deg, transparent 32%, rgba(148, 220, 255, 0.4) 48%, transparent 62%),
        linear-gradient(295deg, transparent 40%, rgba(94, 234, 212, 0.34) 54%, transparent 66%);
    animation: itr-ambient-sheen-sweep calc(14s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed)) ease-in-out infinite;
    transition: opacity 620ms ease;
}

.itr-ambient__grain {
    position: absolute;
    inset: 0;
    opacity: calc(0.16 * var(--itr-ambient-strength) * var(--itr-ambient-mood-strength));
    background-image:
        radial-gradient(circle at 16% 22%, rgba(255, 255, 255, 0.09) 0 1px, transparent 2px),
        radial-gradient(circle at 72% 38%, rgba(255, 255, 255, 0.07) 0 1px, transparent 2px),
        radial-gradient(circle at 40% 78%, rgba(255, 255, 255, 0.06) 0 1px, transparent 2px),
        radial-gradient(circle at 84% 82%, rgba(255, 255, 255, 0.06) 0 1px, transparent 2px);
    background-size: 240px 240px, 260px 260px, 280px 280px, 320px 320px;
    animation: itr-ambient-grain calc(20s * var(--itr-ambient-speed) * var(--itr-ambient-runtime-speed)) steps(12) infinite;
    transition: opacity 620ms ease;
}

.itr-ambient__particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: calc(var(--itr-ambient-particles-alpha) * var(--itr-ambient-mood-particles) * var(--itr-ambient-runtime-particles));
    transition: opacity 620ms ease;
}

.itr-ambient__vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 42%, rgba(2, 6, 23, var(--itr-ambient-mood-vignette)) 100%);
    transition: background 620ms ease;
}

[data-bs-theme='light'] .itr-ambient__vignette {
    background: radial-gradient(circle at center, transparent 38%, rgba(15, 23, 42, calc(var(--itr-ambient-mood-vignette) * 0.56)) 100%);
}

@keyframes itr-ambient-drift {
    0% {
        transform: translate3d(calc(var(--itr-ambient-mouse-x, 0px) * 0.08), calc(var(--itr-ambient-mouse-y, 0px) * 0.08), 0) rotate(0deg) scale(1);
    }
    50% {
        transform: translate3d(calc(var(--itr-ambient-mouse-x, 0px) * 0.18 + 52px), calc(var(--itr-ambient-mouse-y, 0px) * 0.18 - 38px), 0) rotate(6deg) scale(1.2);
    }
    100% {
        transform: translate3d(calc(var(--itr-ambient-mouse-x, 0px) * 0.08), calc(var(--itr-ambient-mouse-y, 0px) * 0.08), 0) rotate(0deg) scale(1);
    }
}

@keyframes itr-ambient-grid {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 180px 120px, -180px -120px; }
}

@keyframes itr-ambient-grain {
    0% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-1%, 1%, 0); }
    50% { transform: translate3d(1%, -1%, 0); }
    75% { transform: translate3d(-1%, -1%, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

@keyframes itr-ambient-sheen-sweep {
    0% {
        transform: translate3d(-13%, -8%, 0) rotate(-6deg) scale(1);
        opacity: calc(var(--itr-ambient-sheen-opacity) * var(--itr-ambient-mood-sheen) * 0.72);
    }
    50% {
        transform: translate3d(10%, 10%, 0) rotate(6deg) scale(1.08);
        opacity: calc(var(--itr-ambient-sheen-opacity) * var(--itr-ambient-mood-sheen));
    }
    100% {
        transform: translate3d(-13%, -8%, 0) rotate(-6deg) scale(1);
        opacity: calc(var(--itr-ambient-sheen-opacity) * var(--itr-ambient-mood-sheen) * 0.72);
    }
}

@media (max-width: 992px) {
    .itr-ambient {
        opacity: calc(var(--itr-ambient-strength-mobile) * var(--itr-ambient-strength) * var(--itr-ambient-mood-opacity));
    }

    .itr-ambient__aurora {
        filter: blur(42px);
        opacity: calc(0.32 * var(--itr-ambient-strength) * var(--itr-ambient-mood-strength));
    }

    .itr-ambient__particles {
        display: none;
    }

    .itr-ambient__grid {
        opacity: calc(var(--itr-ambient-grid-opacity) * var(--itr-ambient-mood-grid) * 0.52);
        background-size: 164px 164px;
    }

    .itr-ambient__sheen {
        opacity: calc(var(--itr-ambient-sheen-opacity) * var(--itr-ambient-mood-sheen) * 0.5);
    }
}

@media (min-width: 1200px) {
    .itr-ambient {
        --itr-ambient-strength: calc(var(--itr-ambient-strength) * 1.12);
        --itr-ambient-grid-opacity: calc(var(--itr-ambient-grid-opacity) * 1.14);
        --itr-ambient-sheen-opacity: calc(var(--itr-ambient-sheen-opacity) * 1.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .itr-ambient,
    .itr-ambient__aurora,
    .itr-ambient__grid,
    .itr-ambient__grain,
    .itr-ambient__sheen,
    .itr-ambient__particles {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }

    .itr-ambient__particles,
    .itr-ambient__grid,
    .itr-ambient__sheen {
        display: none !important;
    }
}
