/* ══════════════════════════════════════════════════════════════
   Campus Libre — Animations & Micro-interactions v3.0
   ══════════════════════════════════════════════════════════════ */

/* ── Scroll Reveal ── */
.campus-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.campus-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children animation */
.campus-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.campus-stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.campus-stagger.is-visible > *:nth-child(2) { transition-delay: 0.1s; }
.campus-stagger.is-visible > *:nth-child(3) { transition-delay: 0.15s; }
.campus-stagger.is-visible > *:nth-child(4) { transition-delay: 0.2s; }
.campus-stagger.is-visible > *:nth-child(5) { transition-delay: 0.25s; }
.campus-stagger.is-visible > *:nth-child(6) { transition-delay: 0.3s; }
.campus-stagger.is-visible > *:nth-child(7) { transition-delay: 0.35s; }
.campus-stagger.is-visible > *:nth-child(8) { transition-delay: 0.4s; }
.campus-stagger.is-visible > *:nth-child(9) { transition-delay: 0.45s; }
.campus-stagger.is-visible > *:nth-child(10) { transition-delay: 0.5s; }
.campus-stagger.is-visible > *:nth-child(11) { transition-delay: 0.55s; }
.campus-stagger.is-visible > *:nth-child(12) { transition-delay: 0.6s; }
.campus-stagger.is-visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ── Tab fade-in ── */
.campus-tab-content.active {
    animation: campus-tab-enter 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes campus-tab-enter {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Grid loading spinner ── */
.campus-grid.loading {
    position: relative;
}
.campus-grid.loading::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--campus-border, #e2e8f0);
    border-top-color: var(--campus-primary, #000073);
    border-radius: 50%;
    animation: campus-spin 0.7s linear infinite;
    margin: 2rem auto;
    grid-column: 1 / -1;
}
@keyframes campus-spin {
    to { transform: rotate(360deg); }
}

/* ── Counter animation (for stats) ── */
.campus-counter {
    display: inline-block;
    transition: all 0.3s ease;
}

/* ── Pulse effect for badges ── */
@keyframes campus-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 115, 0.15); }
    50%      { box-shadow: 0 0 0 6px rgba(0, 0, 115, 0); }
}
.campus-badge--pulse {
    animation: campus-pulse 2s ease-in-out infinite;
}

/* ── Skeleton loading ── */
@keyframes campus-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.campus-skeleton {
    background: linear-gradient(90deg,
        var(--campus-bg, #f8fafc) 25%,
        var(--campus-border, #e2e8f0) 37%,
        var(--campus-bg, #f8fafc) 63%
    );
    background-size: 200% 100%;
    animation: campus-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

/* ── Hero entrance ── */
.campus-home-hero__content {
    animation: campus-hero-enter 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}
@keyframes campus-hero-enter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.campus-home-hero--carreras .campus-home-hero__content {
    animation-delay: 0.4s;
}

/* ── Floating animation for decorative elements ── */
@keyframes campus-float {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-10px); }
}
.campus-float {
    animation: campus-float 5s ease-in-out infinite;
}

/* ── Scale-in for modals/dropdowns ── */
@keyframes campus-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.campus-autocomplete-dropdown.open {
    animation: campus-scale-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Gradient border animation ── */
@keyframes campus-gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .campus-reveal,
    .campus-stagger > * {
        opacity: 1;
        transform: none;
    }
}
