/**
 * Divyansh Educational Foundation - Animations
 * All keyframes, animation utilities, hover effects, page transitions
 * Extracted from style.css (lines 1977-2773)
 */

/* ============================================
   KEYFRAME DEFINITIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-3deg);
    }

    75% {
        transform: rotate(3deg);
    }
}

@keyframes bounceSubtle {

    0%,
    100% {
        transform: translateY(-5%);
    }

    50% {
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes sectionEnter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease-out forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-bounce-subtle:hover {
    animation: bounceSubtle 1s infinite;
}

/* ============================================
   STAGGERED ANIMATION DELAYS
   ============================================ */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* ============================================
   PAGE LOAD ANIMATIONS
   ============================================ */
/* Cards animate on load */
.card {
    animation: fadeInUp 0.6s ease-out backwards;
}

.grid-2 .card:nth-child(1),
.grid-3 .card:nth-child(1),
.grid-4 .card:nth-child(1) {
    animation-delay: 0.1s;
}

.grid-2 .card:nth-child(2),
.grid-3 .card:nth-child(2),
.grid-4 .card:nth-child(2) {
    animation-delay: 0.2s;
}

.grid-3 .card:nth-child(3),
.grid-4 .card:nth-child(3) {
    animation-delay: 0.3s;
}

.grid-4 .card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Hero content animation */
.hero-title {
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

/* ============================================
   NAVIGATION HOVER EFFECTS
   ============================================ */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
    left: 10%;
}

.nav-link:hover {
    color: var(--primary);
}

/* Override: Admin button must keep white text on hover */
.nav-link.btn-admin:hover {
    color: #ffffff;
}

/* ============================================
   FOOTER LINK HOVER
   ============================================ */
.footer-links a {
    position: relative;
    transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-links a::before {
    content: '→';
    position: absolute;
    left: -15px;
    opacity: 0;
    transition: opacity 0.3s ease, left 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 15px;
}

.footer-links a:hover::before {
    opacity: 1;
    left: 0;
}

/* ============================================
   LOGO HOVER
   ============================================ */
.logo {
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo:hover .logo-img {
    animation: wiggle 0.5s ease;
}

/* ============================================
   IMAGE HOVER
   ============================================ */
img {
    transition: transform 0.5s ease;
}

.card img:hover,
.about-image:hover {
    transform: scale(1.05);
}

/* ============================================
   ALERT ANIMATIONS
   ============================================ */
.alert {
    animation: fadeInDown 0.4s ease-out;
}

.alert-success {
    animation: fadeInDown 0.4s ease-out, pulse 2s ease-in-out 0.4s;
}

/* ============================================
   MOBILE MENU ANIMATION
   ============================================ */
.mobile-nav {
    animation: fadeInDown 0.3s ease-out;
}

.mobile-nav-link {
    animation: fadeInRight 0.3s ease-out backwards;
}

.mobile-nav-link:nth-child(1) {
    animation-delay: 0.05s;
}

.mobile-nav-link:nth-child(2) {
    animation-delay: 0.1s;
}

.mobile-nav-link:nth-child(3) {
    animation-delay: 0.15s;
}

.mobile-nav-link:nth-child(4) {
    animation-delay: 0.2s;
}

.mobile-nav-link:nth-child(5) {
    animation-delay: 0.25s;
}

.mobile-nav-link:nth-child(6) {
    animation-delay: 0.3s;
}

.mobile-nav-link:nth-child(7) {
    animation-delay: 0.35s;
}

/* ============================================
   LINK HOVER UNDERLINE
   ============================================ */
a[style*="color: var(--primary)"] {
    position: relative;
    transition: color 0.3s ease;
}

a[style*="color: var(--primary)"]::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

a[style*="color: var(--primary)"]:hover::after {
    width: 100%;
}

/* ============================================
   PAGE TRANSITION SYSTEM
   ============================================ */
/* Main content enter/exit */
.main-content {
    opacity: 0;
    transform: translateY(20px);
}

.main-content.page-enter {
    animation: pageEnter 0.5s ease-out forwards;
}

.main-content.page-exit {
    animation: pageExit 0.3s ease-in forwards;
}

/* Initial page load */
body:not(.page-loaded) .main-content {
    opacity: 0;
}

body.page-loaded .main-content {
    animation: pageEnter 0.6s ease-out forwards;
}

/* Section transitions within page */
.section,
.section-hero,
.section-card,
.section-primary {
    opacity: 0;
    transform: translateY(30px);
}

body.page-loaded .section,
body.page-loaded .section-hero,
body.page-loaded .section-card,
body.page-loaded .section-primary {
    animation: sectionEnter 0.6s ease-out forwards;
}

body.page-loaded .section-hero {
    animation-delay: 0.1s;
}

body.page-loaded .section:nth-of-type(1) {
    animation-delay: 0.2s;
}

body.page-loaded .section:nth-of-type(2) {
    animation-delay: 0.3s;
}

body.page-loaded .section-card:nth-of-type(1) {
    animation-delay: 0.3s;
}

body.page-loaded .section-card:nth-of-type(2) {
    animation-delay: 0.4s;
}

body.page-loaded .section-primary {
    animation-delay: 0.4s;
}

/* Header stays visible during transition */
.main-header,
.top-bar {
    opacity: 1 !important;
    transform: none !important;
}

/* ============================================
   ACCESSIBILITY: Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}