/**
 * Apexaio Engine — Frontend Styles
 * @version 2.0.4
 * @package Apexaio_Engine
 */

/* === Reset & Base === */

.apexaio-layered-experience {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

.apexaio-engine {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* === Skip Link === */

.apexaio-skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    background: #000;
    color: #fff;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    transition: top 0.2s ease;
}

.apexaio-skip-link:focus {
    top: 0;
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* === Layer Base === */

.apexaio-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.apexaio-layer__scroll {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    /* Scrollbar always reserves space so it doesn't overlay/clip */
    scrollbar-gutter: stable;
}

.apexaio-layer--active .apexaio-layer__scroll,
.apexaio-layer--revealed .apexaio-layer__scroll {
    overflow-y: scroll; /* 'scroll' keeps scrollbar visible & draggable; 'auto' hides it until hover on some browsers */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Ensure the scrollbar track is always pointer-interactive */
    pointer-events: auto;
}

.apexaio-layer__content {
    min-height: 100%;
    width: 100%;
    position: relative;
}

/* === Z-Index Stacking (supports up to 20 layers) === */

.apexaio-layer[data-layer-index="0"]  { z-index: 1; }
.apexaio-layer[data-layer-index="1"]  { z-index: 2; }
.apexaio-layer[data-layer-index="2"]  { z-index: 3; }
.apexaio-layer[data-layer-index="3"]  { z-index: 4; }
.apexaio-layer[data-layer-index="4"]  { z-index: 5; }
.apexaio-layer[data-layer-index="5"]  { z-index: 6; }
.apexaio-layer[data-layer-index="6"]  { z-index: 7; }
.apexaio-layer[data-layer-index="7"]  { z-index: 8; }
.apexaio-layer[data-layer-index="8"]  { z-index: 9; }
.apexaio-layer[data-layer-index="9"]  { z-index: 10; }
.apexaio-layer[data-layer-index="10"] { z-index: 11; }
.apexaio-layer[data-layer-index="11"] { z-index: 12; }
.apexaio-layer[data-layer-index="12"] { z-index: 13; }
.apexaio-layer[data-layer-index="13"] { z-index: 14; }
.apexaio-layer[data-layer-index="14"] { z-index: 15; }
.apexaio-layer[data-layer-index="15"] { z-index: 16; }
.apexaio-layer[data-layer-index="16"] { z-index: 17; }
.apexaio-layer[data-layer-index="17"] { z-index: 18; }
.apexaio-layer[data-layer-index="18"] { z-index: 19; }
.apexaio-layer[data-layer-index="19"] { z-index: 20; }
.apexaio-layer[data-layer-index="20"] { z-index: 21; }

/* === Layer States === */

.apexaio-layer {
    pointer-events: none;
}

.apexaio-layer--active {
    pointer-events: auto !important;
}

.apexaio-layer--active .apexaio-layer__scroll,
.apexaio-layer--active .apexaio-layer__content {
    pointer-events: auto !important;
}

.apexaio-layer--revealed {
    pointer-events: none !important;
}

/* But the scroll container inside a revealed layer must stay interactive
   so the scrollbar remains draggable during layer transitions */
.apexaio-layer--revealed .apexaio-layer__scroll {
    pointer-events: auto !important;
}

.apexaio-layer--animating {
    pointer-events: none !important;
}

/* Static layer — always visible, never animates, bottom of stack */
.apexaio-layer--static {
    display: block !important;
    visibility: visible !important;
    z-index: 0 !important;
}

/* === Entrance Animations === */

/* Dissolve */
.apexaio-layer--entrance-dissolve {
    opacity: 0;
}
.apexaio-layer--entrance-dissolve.apexaio-layer--animate-in {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

/* Slide Up */
.apexaio-layer--entrance-slide-up {
    opacity: 0;
    transform: translateY(100%);
}
.apexaio-layer--entrance-slide-up.apexaio-layer--animate-in {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
}

/* Slide Down */
.apexaio-layer--entrance-slide-down {
    opacity: 0;
    transform: translateY(-100%);
}
.apexaio-layer--entrance-slide-down.apexaio-layer--animate-in {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
}

/* Slide Left (clip-path reveal from left) */
.apexaio-layer--entrance-slide-left {
    clip-path: inset(0 100% 0 0);
    opacity: 1;
}
.apexaio-layer--entrance-slide-left.apexaio-layer--animate-in {
    transition: clip-path var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: inset(0 0 0 0);
    opacity: 1;
}

/* Slide Right (clip-path reveal from right) */
.apexaio-layer--entrance-slide-right {
    clip-path: inset(0 0 0 100%);
    opacity: 1;
}
.apexaio-layer--entrance-slide-right.apexaio-layer--animate-in {
    transition: clip-path var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: inset(0 0 0 0);
    opacity: 1;
}

/* Scale & Fade */
.apexaio-layer--entrance-scale-fade {
    opacity: 0;
    transform: scale(0.92);
}
.apexaio-layer--entrance-scale-fade.apexaio-layer--animate-in {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: scale(1);
}

/* Curtain Reveal */
.apexaio-layer--entrance-curtain {
    clip-path: inset(0 50% 0 50%);
    opacity: 0;
}
.apexaio-layer--entrance-curtain.apexaio-layer--animate-in {
    transition: clip-path var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                opacity calc(var(--apexaio-duration, 800ms) * 0.3) ease;
    clip-path: inset(0 0 0 0);
    opacity: 1;
}

/* Blur Fade */
.apexaio-layer--entrance-blur-fade {
    opacity: 0;
    filter: blur(20px);
    transform: scale(1.05);
}
.apexaio-layer--entrance-blur-fade.apexaio-layer--animate-in {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                filter var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

/* === Exit Animations === */

.apexaio-layer--exit-dissolve.apexaio-layer--animate-out {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.apexaio-layer--exit-slide-up.apexaio-layer--animate-out {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(-100%);
}

.apexaio-layer--exit-slide-down.apexaio-layer--animate-out {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(100%);
}

/* Exit slide-left/right use clip-path for consistency with entrance */
.apexaio-layer--exit-slide-left.apexaio-layer--animate-out {
    transition: clip-path var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: inset(0 100% 0 0);
}

.apexaio-layer--exit-slide-right.apexaio-layer--animate-out {
    transition: clip-path var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    clip-path: inset(0 0 0 100%);
}

.apexaio-layer--exit-scale-fade.apexaio-layer--animate-out {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(1.08);
}

.apexaio-layer--exit-curtain.apexaio-layer--animate-out {
    transition: clip-path var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                opacity calc(var(--apexaio-duration, 800ms) * 0.8) ease calc(var(--apexaio-duration, 800ms) * 0.2);
    clip-path: inset(0 50% 0 50%);
    opacity: 0;
}

.apexaio-layer--exit-blur-fade.apexaio-layer--animate-out {
    transition: opacity var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                filter var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--apexaio-duration, 800ms) cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    filter: blur(20px);
    transform: scale(1.05);
}

/* === UI Elements === */

.apexaio-engine__ui {
    position: fixed;
    z-index: 9990;
    pointer-events: none;
}

.apexaio-engine__counter {
    position: fixed;
    top: 28px;
    left: 32px;
    z-index: 9991;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    transition: color 0.4s ease;
    pointer-events: none;
    user-select: none;
}

.apexaio-engine__dots {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9991;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

.apexaio-engine__dot {
    width: 6px;
    height: 6px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.apexaio-engine__dot:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.4);
}

.apexaio-engine__dot--active {
    width: 10px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
}

.apexaio-engine__dot--past {
    background: rgba(255, 255, 255, 0.1);
}

.apexaio-engine__dot:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 4px;
}

/* === SEO Content === */

.apexaio-seo-content {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* === Reduced Motion === */

@media (prefers-reduced-motion: reduce) {
    .apexaio-layer,
    .apexaio-layer--animate-in,
    .apexaio-layer--animate-out {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* === Mobile === */

@media (max-width: 768px) {
    .apexaio-engine__counter {
        top: 16px;
        left: 16px;
        font-size: 11px;
        letter-spacing: 3px;
    }

    .apexaio-engine__dots {
        right: 12px;
        gap: 8px;
    }

    .apexaio-engine__dot {
        width: 5px;
        height: 5px;
    }

    .apexaio-engine__dot--active {
        width: 8px;
        height: 22px;
    }
}
