/* ============================================
   AEQUILIBRA — Shared Design Enhancements
   Film grain, custom cursor, split-text reveals,
   link animations, magnetic buttons, Lenis, form focus
   ============================================ */

/* --- FILM GRAIN TEXTURE --- */
.aeq-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    animation: aeq-grain-fade 0.6s ease 0.3s forwards;
}

.aeq-grain::before {
    content: '';
    position: absolute;
    inset: -200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    animation: aeq-grain-drift 8s steps(10) infinite;
}

@keyframes aeq-grain-fade {
    to { opacity: 1; }
}

@keyframes aeq-grain-drift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}


/* --- CUSTOM CURSOR --- */
.aeq-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    mix-blend-mode: difference;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%) scale(1);
    transition: width 0.3s cubic-bezier(0.19, 1, 0.22, 1),
                height 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: transform;
    opacity: 0;
}

.aeq-cursor.visible {
    opacity: 1;
}

.aeq-cursor.hover {
    width: 50px;
    height: 50px;
}

.aeq-cursor-active,
.aeq-cursor-active * {
    cursor: none !important;
}

@media (hover: none) and (pointer: coarse) {
    .aeq-cursor { display: none !important; }
    .aeq-cursor-active,
    .aeq-cursor-active * { cursor: auto !important; }
}


/* --- SPLIT-TEXT REVEAL --- */
.split-reveal {
    overflow: hidden;
}

.split-reveal .split-word {
    display: inline-block;
    overflow: hidden;
}

.split-reveal .split-char {
    display: inline-block;
    transform: translateY(110%);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1),
                opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.split-reveal.revealed .split-char {
    transform: translateY(0);
    opacity: 1;
}

.split-reveal .split-word + .split-word {
    margin-left: 0.25em;
}


/* --- LINK UNDERLINE WIPE --- */
.footer-link-item {
    position: relative;
    display: inline-block;
}

.footer-link-item::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.footer-link-item:hover::after {
    width: 100%;
}


/* --- MAGNETIC BUTTON --- */
.aeq-magnetic {
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: transform;
}


/* --- FORM FOCUS ENHANCEMENT --- */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 3px rgba(0, 71, 255, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}


/* --- LENIS SMOOTH SCROLL --- */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}


/* --- PAGE LOAD CHOREOGRAPHY --- */
html.aeq-loading body {
    opacity: 0;
}

html.aeq-ready body {
    opacity: 1;
    transition: opacity 0.4s ease;
}


/* --- REDUCED MOTION: DISABLE ALL ENHANCEMENTS --- */
@media (prefers-reduced-motion: reduce) {
    .aeq-grain::before {
        animation: none !important;
    }
    .aeq-grain {
        animation: none !important;
        opacity: 0.5;
    }
    .aeq-cursor {
        display: none !important;
    }
    .aeq-cursor-active,
    .aeq-cursor-active * {
        cursor: auto !important;
    }
    .split-reveal .split-char {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
    }
    .footer-link-item::after {
        transition: none !important;
    }
    .aeq-magnetic {
        transition: none !important;
    }
    html.aeq-loading body {
        opacity: 1;
    }
    html.aeq-ready body {
        transition: none !important;
    }
}
