/**
 * Animations CSS
 * Green Energy Career Night V4
 */

/* ===================================
   Scroll Reveal Animations
   =================================== */

/* Base state for animated elements */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
[data-reveal-stagger] > * {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal-stagger].is-revealed > *:nth-child(1) { transition-delay: 0ms; }
[data-reveal-stagger].is-revealed > *:nth-child(2) { transition-delay: 100ms; }
[data-reveal-stagger].is-revealed > *:nth-child(3) { transition-delay: 200ms; }
[data-reveal-stagger].is-revealed > *:nth-child(4) { transition-delay: 300ms; }
[data-reveal-stagger].is-revealed > *:nth-child(5) { transition-delay: 400ms; }
[data-reveal-stagger].is-revealed > *:nth-child(6) { transition-delay: 500ms; }

[data-reveal-stagger].is-revealed > * {
    opacity: 1;
    transform: translateY(0);
}

/* Slide from left */
[data-reveal="left"] {
    transform: translateX(-30px);
}

[data-reveal="left"].is-revealed {
    transform: translateX(0);
}

/* Slide from right */
[data-reveal="right"] {
    transform: translateX(30px);
}

[data-reveal="right"].is-revealed {
    transform: translateX(0);
}

/* Scale up */
[data-reveal="scale"] {
    transform: scale(0.95);
}

[data-reveal="scale"].is-revealed {
    transform: scale(1);
}

/* Fade only */
[data-reveal="fade"] {
    transform: none;
}

/* ===================================
   Hover Animations
   =================================== */

/* Button hover lift */
.btn {
    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

/* Card hover lift */
.card,
.format-card,
.calendar-card {
    transition:
        transform var(--transition-base),
        box-shadow var(--transition-base),
        border-color var(--transition-base);
}

/* Link underline animation */
.animated-underline {
    position: relative;
    display: inline-block;
}

.animated-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width var(--transition-base);
}

.animated-underline:hover::after {
    width: 100%;
}

/* ===================================
   Loading States
   =================================== */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200) 25%,
        var(--color-gray-100) 50%,
        var(--color-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===================================
   Countdown Animation
   =================================== */

.countdown__number {
    position: relative;
    overflow: hidden;
}

.countdown__number-inner {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.countdown__number.is-changing .countdown__number-inner {
    animation: countdownFlip 0.3s ease-out;
}

@keyframes countdownFlip {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   Hero Animations
   =================================== */

/* Hero content entrance */
.hero__content {
    animation: heroEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroEntrance {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero badge float */
.hero__badge .event-badge {
    animation: heroEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
    opacity: 0;
}

/* Floating background shapes */
.hero__background-shape {
    animation: floatShape 20s ease-in-out infinite;
}

.hero__background-shape--2 {
    animation-delay: -10s;
    animation-direction: reverse;
}

@keyframes floatShape {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(20px, 10px);
    }
    50% {
        transform: translate(10px, 20px);
    }
    75% {
        transform: translate(-10px, 10px);
    }
}

/* ===================================
   Hero Circle Animations
   =================================== */

/* Central circle - gentle pulse */
.hero-circle--center {
    animation: heroPulse 8s ease-in-out infinite;
    transform-origin: center;
}

@keyframes heroPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.03);
        opacity: 0.9;
    }
}

/* Orbiting circles - different float patterns */
.hero-circle--1 {
    animation: heroFloat1 12s ease-in-out infinite;
}

.hero-circle--2 {
    animation: heroFloat2 14s ease-in-out infinite;
}

.hero-circle--3 {
    animation: heroFloat3 11s ease-in-out infinite;
}

.hero-circle--4 {
    animation: heroFloat4 13s ease-in-out infinite;
}

@keyframes heroFloat1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(15px, -10px); }
    50% { transform: translate(5px, 15px); }
    75% { transform: translate(-10px, 5px); }
}

@keyframes heroFloat2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-12px, 8px); }
    50% { transform: translate(10px, -12px); }
    75% { transform: translate(8px, 10px); }
}

@keyframes heroFloat3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(10px, 12px); }
    50% { transform: translate(-8px, -8px); }
    75% { transform: translate(-15px, 6px); }
}

@keyframes heroFloat4 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-8px, -15px); }
    50% { transform: translate(12px, 8px); }
    75% { transform: translate(6px, -10px); }
}

/* Dots follow their circles with slight delay */
.hero-dot--1 { animation: heroFloat1 12s ease-in-out infinite 0.1s; }
.hero-dot--2 { animation: heroFloat2 14s ease-in-out infinite 0.1s; }
.hero-dot--3 { animation: heroFloat3 11s ease-in-out infinite 0.1s; }
.hero-dot--4 { animation: heroFloat4 13s ease-in-out infinite 0.1s; }

/* Connection lines subtle opacity pulse */
.hero-lines {
    animation: linesPulse 6s ease-in-out infinite;
}

@keyframes linesPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===================================
   Green Energy Illustrations
   =================================== */

.hero__energy-illustrations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.energy-illustration {
    position: absolute;
    color: var(--color-primary-dark);
}

/* Wind Turbine moved to Where section - see section-illustration--turbine below */

/* Solar Panel - bottom left, partially off-screen */
.energy-illustration--solar {
    width: 300px;
    height: auto;
    bottom: 5%;
    left: -120px;
    animation: solarFloat 25s ease-in-out infinite;
}

@keyframes solarFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* Battery - right side middle */
.energy-illustration--battery {
    width: 100px;
    height: auto;
    top: 50%;
    right: -30px;
    transform: translateY(-50%);
    animation: batteryPulse 8s ease-in-out infinite;
}

@keyframes batteryPulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.15; }
}

/* ===================================
   Section Illustrations (Global)
   =================================== */

.section-illustrations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.section-illustration {
    position: absolute;
    color: var(--color-primary-dark);
    opacity: 0.12;
}

.section-illustration--left {
    width: 150px;
    height: auto;
    left: -50px;
    top: 50%;
    transform: translateY(-50%);
}

.section-illustration--right {
    width: 120px;
    height: auto;
    right: -40px;
    top: 30%;
}

/* Additional section-specific illustrations */
.how .section-illustrations .section-illustration--left {
    opacity: 0.05;
}

/* Subtle animation for section illustrations */
.section-illustration--left {
    animation: illustrationDrift 30s ease-in-out infinite;
}

.section-illustration--right {
    animation: illustrationDrift 25s ease-in-out infinite reverse;
}

@keyframes illustrationDrift {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(5px); }
}

/* Turbine technical blueprint - bottom right of Where section */
.section-illustration--turbine {
    width: 400px;
    height: auto;
    right: -100px;
    bottom: -60px;
    top: auto;
    transform: none;
    opacity: 0.07;
    animation: none;
}

@media (min-width: 768px) {
    .section-illustration--turbine {
        width: 500px;
        right: -80px;
        bottom: -80px;
        opacity: 0.08;
    }
}

@media (min-width: 1024px) {
    .section-illustration--turbine {
        width: 600px;
        right: -60px;
        bottom: -100px;
        opacity: 0.1;
    }
}

@media (min-width: 1280px) {
    .section-illustration--turbine {
        width: 700px;
        right: -40px;
        bottom: -120px;
        opacity: 0.12;
    }
}

/* ===================================
   Stats Counter Animation
   =================================== */

.stat-number[data-count] {
    transition: none;
}

.stat-number.is-counting {
    animation: countPulse 0.1s ease-out;
}

@keyframes countPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===================================
   Partner Logo Animation
   =================================== */

.partner-logo {
    transition:
        filter var(--transition-base),
        opacity var(--transition-base),
        transform var(--transition-base);
}

.partner-logo:hover {
    transform: scale(1.05);
}

/* ===================================
   Mobile Menu Animation
   =================================== */

.mobile-nav {
    transition:
        opacity var(--transition-base),
        visibility var(--transition-base);
}

.mobile-nav__list {
    transform: translateY(-10px);
    opacity: 0;
    transition:
        transform var(--transition-base) 0.1s,
        opacity var(--transition-base) 0.1s;
}

.mobile-nav.is-open .mobile-nav__list {
    transform: translateY(0);
    opacity: 1;
}

/* Menu toggle animation */
.mobile-menu-toggle {
    position: relative;
}

.mobile-menu-toggle .icon-menu,
.mobile-menu-toggle .icon-close {
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

.mobile-menu-toggle .icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.mobile-menu-toggle.is-active .icon-menu {
    opacity: 0;
    transform: rotate(90deg);
}

.mobile-menu-toggle.is-active .icon-close {
    opacity: 1;
    transform: rotate(0);
}

/* ===================================
   Scroll Progress Indicator
   =================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--color-primary);
    z-index: calc(var(--z-sticky) + 1);
    transition: width 0.1s linear;
}

/* ===================================
   Focus Animations
   =================================== */

@keyframes focusRing {
    0% {
        outline-offset: 0;
    }
    50% {
        outline-offset: 4px;
    }
    100% {
        outline-offset: 2px;
    }
}

:focus-visible {
    animation: focusRing 0.3s ease-out forwards;
}
