/* 
 * IQRAA Scroll Animations Foundation
 * Handles the initial state and keyframe definitions for scroll-triggered animations.
 */

[data-animate] {
    opacity: 0;
    transition-property: opacity, transform;
    transition-duration: var(--animate-duration, 800ms);
    transition-delay: var(--animate-delay, 0ms);
    transition-timing-function: cubic-bezier(0.21, 0.45, 0.32, 0.9);
    will-change: opacity, transform;
}

/* Base State: Fade Up */
[data-animate="fade-up"] {
    transform: translateY(30px);
}

/* Base State: Fade Down */
[data-animate="fade-down"] {
    transform: translateY(-30px);
}

/* Base State: Fade Left */
[data-animate="fade-left"] {
    transform: translateX(-30px);
}

/* Base State: Fade Right */
[data-animate="fade-right"] {
    transform: translateX(30px);
}

/* Base State: Zoom In */
[data-animate="zoom-in"] {
    transform: scale(0.95);
}

/* Base State: Zoom Out */
[data-animate="zoom-out"] {
    transform: scale(1.05);
}

/* Base State: Flip Up */
[data-animate="flip-up"] {
    transform: perspective(1000px) rotateX(-30deg);
}

/* Reveal Text Effect */
[data-animate="reveal-text"] {
    clip-path: inset(100% 0 0 0);
    transform: translateY(20px);
}

/* ACTIVE STATES - Triggered by JS */
[data-animate].is-visible {
    opacity: 1;
    transform: translate(0) scale(1);
    clip-path: inset(0 0 0 0);
}

/* Special staggering for parent containers */
[data-stagger] > * {
    opacity: 0;
}

/* Split Text (Letter by Letter) */
[data-animate="split-text"] {
    opacity: 1 !important; /* Container stays visible, children animate */
    transform: none !important;
}

[data-animate="split-text"] .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.5em);
    transition: transform 0.6s cubic-bezier(0.21, 0.45, 0.32, 0.9), 
                opacity 0.6s cubic-bezier(0.21, 0.45, 0.32, 0.9);
    vertical-align: bottom;
    line-height: inherit;
}



[data-animate="split-text"].is-visible .char {
    opacity: 1;
    transform: translateY(0);
}

/* Smooth Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.floating {
    animation: float 4s ease-in-out infinite;
}

.floating-delayed {
    animation: float 5s ease-in-out infinite;
    animation-delay: 1s;
}

.floating-slow {
    animation: float 6s ease-in-out infinite;
    animation-delay: 0.5s;
}

/* --- Responsive Floating Utilities --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Always floating */
.floating { animation: float 4s ease-in-out infinite; }
.floating-delayed { animation: float 5s ease-in-out infinite; animation-delay: 1s; }

/* Small screens and up (640px) */
@media (min-width: 640px) {
    .sm\:floating { animation: float 4s ease-in-out infinite; }
    .sm\:floating-delayed { animation: float 5s ease-in-out infinite; animation-delay: 1s; }
}

/* Center-Out Reveal (For Header Links) */
[data-animate="reveal-left"] {
    opacity: 0;
    transform: translateX(40px);
}

[data-animate="reveal-right"] {
    opacity: 0;
    transform: translateX(-40px);
}

[data-animate="reveal-left"].is-visible,
[data-animate="reveal-right"].is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Smooth Parallax Fix */
[data-animate].is-visible[data-parallax] {
    transition-property: opacity;
}



/* ---------- Header menu toggle icons ----------
   Both header toggles (the desktop one in parts/header/header-main.php and the
   mobile one driven by assets/js/header.js) swap their two icons by toggling
   Tailwind's .hidden, which is display:none and cannot be transitioned.

   Here .hidden on those icons means faded-and-turned instead, so the change
   animates. The scripts are untouched -- they keep toggling the same class.
   Lives in animations.css rather than input.css so no Tailwind rebuild is
   needed, and it loads after main.css so the display override lands. */
.menu-toggle-icons {
    display: grid;
    place-items: center;
}

.menu-toggle-icons > svg {
    grid-area: 1 / 1;
    transition: opacity .18s ease, transform .28s cubic-bezier(.4, 0, .2, 1);
}

/* Beats Tailwind's .hidden (0,1,0) at (0,2,1), so the icon stays in the grid
   cell and fades rather than being removed. */
.menu-toggle-icons > svg.hidden {
    display: block;
    opacity: 0;
}

/* The bars turn away clockwise; the cross arrives from the other side. */
.menu-toggle-icons > svg[id^="menuIconOpen"].hidden {
    transform: rotate(90deg);
}

.menu-toggle-icons > svg[id^="menuIconClose"].hidden {
    transform: rotate(-90deg);
}

@media (prefers-reduced-motion: reduce) {
    .menu-toggle-icons > svg {
        transition: none;
    }
}
