/*
 * Holographic System
 *
 * Place .holo-background and .holo-particles directly inside .holo-scene.
 * Add .holo-scene--viewport to the scene for full-page coverage.
 *
 * Add holo-background--rhombic, holo-background--helix,
 * holo-background--crystal, or holo-background--meridian to .holo-background.
 * For meridian, place four .holo-sphere spans inside the background.
 *
 * Use <canvas class="holo-particles" data-photonic-particles aria-hidden="true"></canvas>
 * with photonic-particles.js.
 * With tsParticles v3, use a div with "holo-particles holo-particles--screen" on dark backgrounds.
 * Screen blending lets the dark trail fill reveal the background underneath.
 * Initialize the full v3 bundle with await loadFull(tsParticles), then use
 * tsParticles.load({ id, url }) with the URL of photonic-particles.json.
 *
 * Put .holo-aura inside .holo-vessel and .holo-logo-image inside .holo-logo-vessel.
 * Override --holo-nav-offset on the scene when the page uses a fixed header.
 */

.holo-scene {
    --holo-background-color: #0A0A0F;
    --holo-nav-offset: 0px;
    --holo-cyan: 0 229 255;
    --holo-violet: 139 92 246;
    --holo-magenta: 255 0 255;
    --holo-gold: 255 215 0;
    --holo-pearl: 255 254 240;
    --holo-rose: 255 107 157;
    --holo-display-font: Cinzel, Georgia, serif;
    --holo-body-font: Montserrat, system-ui, sans-serif;

    position: relative;
    isolation: isolate;
}

:where(.holo-scene) > :is(.holo-background, .holo-particles) {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

:where(.holo-scene.holo-scene--viewport) > :is(.holo-background, .holo-particles) {
    position: fixed;
}

:where(.holo-scene) > .holo-background {
    z-index: -2;
    overflow: hidden;
}

:where(.holo-scene) > .holo-particles {
    display: block;
    width: 100%;
    height: 100%;
    z-index: -1;
}

:where(.holo-scene) > .holo-particles--screen {
    mix-blend-mode: screen;
}

:where(.holo-scene) > .holo-particles > canvas {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Rhombic dodecahedron tessellation */
:where(.holo-scene) > .holo-background--rhombic {
    background:
        radial-gradient(ellipse at 20% 50%, rgb(var(--holo-violet) / 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgb(var(--holo-cyan) / 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 10%, rgb(var(--holo-magenta) / 0.05) 0%, transparent 50%),
        var(--holo-background-color);
}

:where(.holo-scene) > .holo-background--rhombic::before {
    content: '';
    position: absolute;
    inset: -50%;
    background-image:
        url("data:image/svg+xml,%3Csvg width='60' height='104' viewBox='0 0 60 104' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 26L60 78L30 104L0 78L0 26Z' fill='none' stroke='rgba(255,215,0,0.03)' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 60px 104px;
    animation: holo-tessellation-drift 60s linear infinite;
    transform-origin: center;
}

/* Photonic helix filament network */
:where(.holo-scene) > .holo-background--helix {
    background: var(--holo-background-color);
}

:where(.holo-scene) > .holo-background--helix::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 100px,
            rgb(var(--holo-cyan) / 0.02) 100px,
            rgb(var(--holo-cyan) / 0.02) 101px
        );
    animation: holo-filament-sway 12s ease-in-out infinite;
}

:where(.holo-scene) > .holo-background--helix::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 70%, rgb(var(--holo-magenta) / 0.12) 0%, transparent 40%),
        radial-gradient(circle at 70% 30%, rgb(var(--holo-gold) / 0.08) 0%, transparent 35%);
    filter: blur(80px);
}

/* Crystalline triangular bipyramid array */
:where(.holo-scene) > .holo-background--crystal {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

:where(.holo-scene) > .holo-background--crystal::before {
    content: '';
    position: absolute;
    inset: -20%;
    background-image:
        url("data:image/svg+xml,%3Csvg width='100' height='87' viewBox='0 0 100 87' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 0L100 43.5L50 87L0 43.5Z' fill='none' stroke='rgba(255,254,240,0.025)' stroke-width='0.5'/%3E%3Cpath d='M50 0L50 43.5M0 43.5L50 43.5L100 43.5' stroke='rgba(0,229,255,0.02)' stroke-width='0.3'/%3E%3C/svg%3E");
    background-size: 100px 87px;
    transform: perspective(1000px) rotateX(60deg);
    animation: holo-crystal-float 20s ease-in-out infinite;
}

/* Meridian sphere packing */
:where(.holo-scene) > .holo-background--meridian {
    background: var(--holo-background-color);
}

:where(.holo-scene) > .holo-background--meridian .holo-sphere {
    position: absolute;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 1px solid rgb(var(--holo-gold) / 0.04);
    animation: holo-sphere-breathe 8s ease-in-out infinite;
}

:where(.holo-scene) > .holo-background--meridian .holo-sphere:nth-child(1) {
    width: 300px;
    top: 10%;
    left: 15%;
}

:where(.holo-scene) > .holo-background--meridian .holo-sphere:nth-child(2) {
    width: 500px;
    top: 40%;
    left: 60%;
    animation-delay: -2s;
    border-color: rgb(var(--holo-cyan) / 0.04);
}

:where(.holo-scene) > .holo-background--meridian .holo-sphere:nth-child(3) {
    width: 200px;
    top: 60%;
    left: 25%;
    animation-delay: -4s;
    border-color: rgb(var(--holo-magenta) / 0.05);
}

:where(.holo-scene) > .holo-background--meridian .holo-sphere:nth-child(4) {
    width: 400px;
    top: 20%;
    left: 55%;
    animation-delay: -6s;
    border-color: rgb(var(--holo-violet) / 0.04);
}

/* Optional image and glass components */

:where(.holo-scene) .holo-vessel {
    position: relative;
    width: calc(100% - 2.5rem);
    max-width: 680px;
    margin: 0 auto;
    padding-top: calc(var(--holo-nav-offset) + 3rem);
    padding-bottom: 4rem;
    transform-style: preserve-3d;
    perspective: 1200px;
    isolation: isolate;
}

/* Ambient bloom */
:where(.holo-scene) .holo-vessel .holo-aura {
    position: absolute;
    inset: -15% 5%;
    background: radial-gradient(circle,
        rgb(var(--holo-rose) / 0.12) 0%,
        rgb(var(--holo-violet) / 0.10) 30%,
        rgb(var(--holo-cyan) / 0.08) 60%,
        transparent 75%);
    filter: blur(60px);
    animation: holo-aura-breathe 10s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

/* Holographic image effects */
:where(.holo-scene) .holo-logo-vessel {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 3rem;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

:where(.holo-scene) .holo-logo-vessel:hover {
    transform: rotateY(8deg) rotateX(-4deg) scale(1.02);
}

:where(.holo-scene) .holo-logo-vessel .holo-logo-image {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    z-index: 0;
    animation:
        holo-chromatic 4s ease-in-out infinite,
        holo-jitter 9s steps(1) infinite;
    filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.5));
}

/* Diagonal shimmer */
:where(.holo-scene) .holo-logo-vessel::before {
    content: '';
    position: absolute;
    inset: -5%;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        125deg,
        transparent 25%,
        rgb(var(--holo-rose) / 0.12) 42%,
        rgb(var(--holo-gold) / 0.15) 50%,
        rgb(var(--holo-cyan) / 0.12) 58%,
        transparent 75%
    );
    background-size: 400% 400%;
    animation: holo-shimmer 8s ease-in-out infinite;
    mix-blend-mode: screen;
    border-radius: 50%;
}

/* Scanlines */
:where(.holo-scene) .holo-logo-vessel::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgb(var(--holo-pearl) / 0.03) 4px,
        transparent 5px
    );
    animation: holo-scanline 5s linear infinite;
    mix-blend-mode: overlay;
    border-radius: inherit;
}

/* Glass cards */

:where(.holo-scene) .holo-glass-card {
    background: rgb(var(--holo-pearl) / 0.025);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    position: relative;
    transition-property: background-color, border-color, box-shadow, transform;
    transition-duration: 0.6s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    transform-style: preserve-3d;
}

:where(.holo-scene) .holo-glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    transition: left 0.9s;
    pointer-events: none;
}

:where(.holo-scene) .holo-glass-card:hover::before { left: 100%; }

:where(.holo-scene) .holo-glass-card:hover {
    background: rgb(var(--holo-pearl) / 0.06);
    border-color: rgb(var(--holo-rose) / 0.25);
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.45),
        0 0 60px rgb(var(--holo-violet) / 0.08),
        inset 0 0 20px rgba(255, 255, 255, 0.02);
    transform: translateZ(20px);
}

/* Optional type treatments */

:where(.holo-scene) .holo-display {
    font-family: var(--holo-display-font);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(var(--holo-pearl));
    text-shadow:
        0 0 20px rgb(var(--holo-pearl) / 0.3),
        0 0 40px rgb(var(--holo-violet) / 0.15);
    animation: holo-luminance-pulse 5s ease-in-out infinite;
}

:where(.holo-scene) .holo-subtitle {
    font-family: var(--holo-body-font);
    font-weight: 300;
    letter-spacing: 0.15em;
    color: rgb(var(--holo-pearl) / 0.75);
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* Animations */

@keyframes holo-chromatic {
    0%, 100% {
        opacity: 0.92;
        filter:
            drop-shadow(0 0 50px rgb(var(--holo-rose) / 0.3))
            drop-shadow(0 0 80px rgb(var(--holo-violet) / 0.2))
            drop-shadow(2px 0 0 rgba(255, 0, 128, 0.35))
            drop-shadow(-2px 0 0 rgb(var(--holo-cyan) / 0.35))
            brightness(1) contrast(1.05) hue-rotate(0deg);
    }
    25% {
        opacity: 1;
        filter:
            drop-shadow(0 0 65px rgb(var(--holo-gold) / 0.4))
            drop-shadow(3px 0 0 rgb(var(--holo-magenta) / 0.4))
            drop-shadow(-3px 0 0 rgb(var(--holo-cyan) / 0.45))
            brightness(1.15) contrast(1.08) hue-rotate(10deg);
    }
    50% {
        opacity: 1;
        filter:
            drop-shadow(0 0 80px rgba(255, 255, 255, 0.5))
            drop-shadow(1px 1px 0 rgb(var(--holo-rose) / 0.4))
            drop-shadow(-1px -1px 0 rgb(var(--holo-cyan) / 0.45))
            brightness(1.25) contrast(1.12) hue-rotate(18deg);
    }
    75% {
        opacity: 1;
        filter:
            drop-shadow(0 0 65px rgb(var(--holo-cyan) / 0.4))
            drop-shadow(-2px 0 0 rgb(var(--holo-magenta) / 0.4))
            drop-shadow(2px 0 0 rgb(var(--holo-gold) / 0.4))
            brightness(1.1) contrast(1.08) hue-rotate(-10deg);
    }
}

@keyframes holo-jitter {
    0%, 17.9%, 18.6%, 51.9%, 52.7%, 86.9%, 87.7%, 100% {
        transform: translate3d(0, 0, 0);
    }
    18%   { transform: translate3d(1px, 0, 0); }
    18.3% { transform: translate3d(-1px, 1px, 0); }
    52%   { transform: translate3d(-2px, 0, 0) skewX(0.8deg); }
    52.4% { transform: translate3d(1px, -1px, 0); }
    87%   { transform: translate3d(1px, 0, 0) skewY(-0.4deg); }
    87.4% { transform: translate3d(0, 1px, 0); }
}

@keyframes holo-shimmer {
    0%   { background-position: 100% 50%; opacity: 0.35; }
    30%  { opacity: 0.9; }
    50%  { background-position: 0% 50%; opacity: 0.35; }
    80%  { opacity: 0.9; }
    100% { background-position: 100% 50%; opacity: 0.35; }
}

@keyframes holo-scanline {
    from { background-position: 0 0; }
    to   { background-position: 0 10px; }
}

@keyframes holo-aura-breathe {
    0%, 100% { opacity: 0.6; transform: scale(1); filter: blur(60px) hue-rotate(0deg); }
    50% { opacity: 1; transform: scale(1.1); filter: blur(75px) hue-rotate(25deg); }
}

@keyframes holo-tessellation-drift {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-104px) rotate(2deg); }
}

@keyframes holo-filament-sway {
    0%, 100% { transform: translateX(0) skewX(0deg); opacity: 0.5; }
    50% { transform: translateX(20px) skewX(1deg); opacity: 1; }
}

@keyframes holo-crystal-float {
    0%, 100% { transform: perspective(1000px) rotateX(60deg) translateY(0); }
    50% { transform: perspective(1000px) rotateX(62deg) translateY(-20px); }
}

@keyframes holo-sphere-breathe {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.08); opacity: 0.7; }
}

@keyframes holo-luminance-pulse {
    0%, 100% { text-shadow: 0 0 20px rgb(var(--holo-pearl) / 0.3), 0 0 40px rgb(var(--holo-violet) / 0.15); }
    50% { text-shadow: 0 0 30px rgb(var(--holo-pearl) / 0.5), 0 0 60px rgb(var(--holo-rose) / 0.25), 0 0 90px rgb(var(--holo-violet) / 0.15); }
}

/* Leave the layers in place with their animations and hover movement paused. */
@media (prefers-reduced-motion: reduce) {
    :where(.holo-scene) > .holo-background::before,
    :where(.holo-scene) > .holo-background .holo-sphere,
    :where(.holo-scene) .holo-vessel .holo-aura,
    :where(.holo-scene) .holo-logo-vessel .holo-logo-image,
    :where(.holo-scene) .holo-display,
    :where(.holo-scene) .holo-logo-vessel::before,
    :where(.holo-scene) .holo-logo-vessel::after {
        animation: none;
    }

    :where(.holo-scene) .holo-logo-vessel .holo-logo-image {
        filter: drop-shadow(0 0 50px rgb(var(--holo-rose) / 0.3));
    }

    :where(.holo-scene) :is(.holo-logo-vessel, .holo-glass-card),
    :where(.holo-scene) .holo-glass-card::before {
        transition: none;
    }

    :where(.holo-scene) :is(.holo-logo-vessel, .holo-glass-card):hover {
        transform: none;
    }

    :where(.holo-scene) .holo-glass-card:hover::before {
        left: -100%;
    }
}
