/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.fade-up {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.text-gradient {
    background: linear-gradient(90deg, #ffffff, var(--accent), #e386ff);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: gradientBG 5s ease infinite;
}

.floating-abstract {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, rgba(94, 67, 243, 0.5), rgba(200, 80, 250, 0.5));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: float 6s ease-in-out infinite;
    box-shadow: inset 10px 10px 20px rgba(255, 255, 255, 0.2), 0 0 30px var(--accent-glow);
    backdrop-filter: blur(10px);
}

/* Global Page Loading Transition */
.global-page-transition {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark, #0a0a0c);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-page-transition.active {
    opacity: 1;
    pointer-events: all;
}

body.museum-theme .global-page-transition {
    background: #ffffff;
}

/* --- Pejmurdeadam Glitch Loader --- */
.pejmur-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pejmur-glitch-text {
    font-family: var(--font-heading), 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    position: relative;
    letter-spacing: 3px;
    /* This text stabilizes over 0.8s */
    animation: loader-text-stabilize 0.8s ease-out forwards;
}

/* Pseudo elements for the glitch layers */
.global-page-transition.active .pejmur-glitch-text::before,
.global-page-transition.active .pejmur-glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.global-page-transition.active .pejmur-glitch-text::before {
    color: #00fff9;
    z-index: -1;
    animation: loader-glitch-pseudo 0.8s ease-out forwards;
}

.global-page-transition.active .pejmur-glitch-text::after {
    color: #ff00c1;
    z-index: -2;
    animation: loader-glitch-pseudo 0.8s ease-out reverse forwards;
}

.pejmur-progress-bar {
    width: 250px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.pejmur-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: var(--accent, #a494ff);
}

.global-page-transition.active .pejmur-progress-fill {
    animation: load-bar 0.8s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* Museum Theme Overrides */
body.museum-theme .pejmur-glitch-text {
    color: #000;
}

body.museum-theme .global-page-transition.active .pejmur-glitch-text::before,
body.museum-theme .global-page-transition.active .pejmur-glitch-text::after {
    color: #d80b0b;
    /* Red glitch for museum */
}

body.museum-theme .pejmur-progress-bar {
    background: rgba(0, 0, 0, 0.1);
}

body.museum-theme .pejmur-progress-fill {
    background: #d80b0b;
}

/* Keyframes */
@keyframes loader-glitch-pseudo {
    0% {
        clip-path: inset(20% 0 80% 0);
        transform: translate(-3px, 1px);
        opacity: 1;
        text-shadow: -2px 0 #ff00c1;
    }

    15% {
        clip-path: inset(60% 0 10% 0);
        transform: translate(3px, -2px);
        opacity: 1;
        text-shadow: -2px 0 #00fff9;
    }

    30% {
        clip-path: inset(40% 0 50% 0);
        transform: translate(-3px, 2px);
        opacity: 1;
        text-shadow: 2px 2px #ff00c1;
    }

    45% {
        clip-path: inset(80% 0 5% 0);
        transform: translate(2px, -3px);
        opacity: 1;
    }

    60% {
        clip-path: inset(10% 0 70% 0);
        transform: translate(-2px, 1px);
        opacity: 0.8;
    }

    70% {
        clip-path: inset(50% 0 30% 0);
        transform: translate(2px, 2px);
        opacity: 0.4;
    }

    75% {
        clip-path: inset(0% 0 0% 0);
        transform: translate(0, 0);
        opacity: 0;
    }

    100% {
        clip-path: inset(0% 0 0% 0);
        transform: translate(0, 0);
        opacity: 0;
    }
}

@keyframes loader-text-stabilize {
    0% {
        opacity: 0.3;
        filter: blur(3px);
    }

    60% {
        opacity: 0.7;
        filter: blur(1px);
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }

    75% {
        opacity: 1;
        filter: blur(0);
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    }

    100% {
        opacity: 1;
        filter: blur(0);
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    }
}

@keyframes load-bar {
    0% {
        width: 0%;
        opacity: 1;
    }

    40% {
        width: 40%;
        opacity: 1;
    }

    70% {
        width: 95%;
        opacity: 1;
    }

    85% {
        width: 100%;
        opacity: 1;
    }

    100% {
        width: 100%;
        opacity: 1;
    }
}