/* XIRO PAGE-TO-PAGE ANIMATION
   Split from the supplied final code.
   Visual values and animation timing are retained exactly.
*/

/* --- GLOBAL VARIABLES --- */
:root {
    --bg-color: #02021a;
    --accent-color: #38bdf8;
    --text-color: #334155;
    --ease: cubic-bezier(0.25, 1, 0.35, 1);
}

/* --- TRANSITION LOCK / PAUSE ---
   Separate lock class avoids interfering with XIRO menu's existing body.locked. */
body.xiro-transition-locked {
    pointer-events: none;
    user-select: none;
    overflow: hidden;
}

body.paused *,
body.xiro-motion-paused * {
    animation-play-state: paused !important;
}

/* --- REAL SITE PUSHBACK ---
   The supplied demo's #app-container is mapped to persistent #xiro-site. */
#xiro-site {
    transition: transform 0.8s var(--ease), opacity 0.8s ease;
    transform-origin: center center;
}

#xiro-site.pushed-back {
    transform: scale(0.94);
    opacity: 0.5;
    filter: blur(3px);
    border-radius: 16px;
    overflow: hidden;
}

/* --- TRANSITION BARS --- */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 9998;
}

.transition-overlay > .bar {
    flex: 1;
    height: 100%;
    background-color: var(--bg-color);
    transform: translateY(100%);
    will-change: transform;
    border: none;
    margin-left: -1px;
    width: calc(100% + 1px);
}

/* --- LOADER --- */
.loader-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
    visibility: hidden;
    max-width: 90%;
}

.loader-container.visible {
    visibility: visible;
}

.logo-wrapper {
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.5s var(--ease);
}

.logo-wrapper svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* --- ANIMATION LOGIC --- */
.lottie-path {
    stroke: #ffffff;
    stroke-width: 2;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    fill-opacity: 0;
}

/* 1. FORWARD (AANA): Draw (1.2s) -> Fill (0.8s) */
.state-drawing .lottie-path {
    animation: drawLine 1.2s ease-out forwards, fillWhite 0.8s ease-out 0.8s forwards;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

@keyframes fillWhite {
    to { fill-opacity: 1; }
}

/* 2. REVERSE (JANA): Fade Out (0.8s) -> Undraw (1.0s) */
.state-reverse .lottie-path {
    stroke-dashoffset: 0;
    stroke-width: 2 !important;
    animation:
        fadeOutWhite 0.8s ease-in-out forwards,
        undrawLine 1.0s ease-in-out 0.8s forwards;
}

@keyframes fadeOutWhite {
    0% { fill-opacity: 1; }
    100% { fill-opacity: 0; }
}

@keyframes undrawLine {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 1000; }
}

/* --- TEXT ANIMATION — retained from supplied code --- */
.loading-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 4px;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    margin-left: 0;
    transition: all 0.7s var(--ease);
}

.state-text-reveal .loading-text {
    width: 170px;
    opacity: 1;
    margin-left: 20px;
}

/* --- HELPER STATES --- */
.state-show-logo .logo-wrapper {
    opacity: 1;
    transform: scale(1);
}

.state-exit .logo-wrapper {
    opacity: 0 !important;
    transition: opacity 0.4s ease;
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    .logo-wrapper {
        width: 80px;
        height: 80px;
    }

    .loading-text {
        font-size: 1rem;
        letter-spacing: 3px;
    }

    .state-text-reveal .loading-text {
        width: 140px;
        margin-left: 12px;
    }

    .transition-overlay > .bar {
        width: calc(100% + 2px);
        margin-left: -2px;
    }
}


/* v41 — project-specific Swup transition */
#xiro-site.project-pushed{
    transform:scale(.985);
    opacity:.72;
    filter:none;
}
.transition-overlay.project-mode > .bar{
    background:#0b0b0f;
}
