/* ===== Animations & Transitions ===== */

/* Luxury Fade In Animation for Shanti Yoga Club */
@keyframes luxuryFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Luxury Reveal Animation - scale effect */
@keyframes luxuryReveal {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Luxury Slide In Animation */
@keyframes luxurySlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

@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);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Hero Animations */
.hero-title {
    animation: fadeInUp 0.8s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out;
    animation-delay: 0.4s;
    animation-fill-mode: both;
}

.cta-button {
    animation: fadeInUp 0.8s ease-out;
    animation-delay: 0.6s;
    animation-fill-mode: both;
}

.hero-image {
    animation: fadeInRight 1s ease-out;
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

/* Header Animation */
.header {
    animation: fadeInDown 0.6s ease-out;
}

/* Scroll Triggered Animations */
section:not(.private-hero) {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Card hover effects */
.card {
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Button ripple effect */
.cta-button {
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cta-button:active::before {
    width: 300px;
    height: 300px;
}

/* Loading Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-light-gray);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Text reveal animation */
@keyframes revealText {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.reveal-text {
    animation: revealText 1s ease-out;
    animation-fill-mode: both;
}

/* Parallax effect for hero image */
@supports (transform: translateZ(0)) {
    .hero-image {
        will-change: transform;
        transform: translateZ(0);
    }
    
    .hero-image img {
        transform: scale(1.1);
        transition: transform 8s ease-out;
    }
    
    .hero:hover .hero-image img {
        transform: scale(1.05);
    }
}

/* Smooth transitions for interactive elements */
a,
button,
input,
textarea,
select {
    transition: all var(--transition-fast);
}

/* Focus styles with animation */
*:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(253, 167, 0, 0.2);
    transition: box-shadow var(--transition-fast);
}

/* Mobile menu animations */
.mobile-menu-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mobile-menu {
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active .mobile-nav-link {
    animation: fadeInLeft 0.3s ease-out;
    animation-fill-mode: both;
    opacity: 0;
}

.mobile-menu-overlay.active .mobile-nav-link:nth-child(1) {
    animation-delay: 0.05s;
}

.mobile-menu-overlay.active .mobile-nav-link:nth-child(2) {
    animation-delay: 0.1s;
}

.mobile-menu-overlay.active .mobile-nav-link:nth-child(3) {
    animation-delay: 0.15s;
}

.mobile-menu-overlay.active .mobile-nav-link:nth-child(4) {
    animation-delay: 0.2s;
}

/* Intersection Observer classes */
.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
}

.slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease-out;
}

.slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease-out;
}

.slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s ease-out;
}

.scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Premium Yoga Section Animations */
[data-animate] {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate="fade-up"] {
    transform: translateY(40px);
}

[data-animate="fade-down"] {
    transform: translateY(-40px);
}

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

[data-animate="fade-left"] {
    transform: translateX(40px);
}

[data-animate="fade-in"] {
    transform: scale(0.95);
}

/* Animated state */
[data-animate].animate {
    opacity: 1;
    transform: translate(0, 0) scale(1);
}

/* Stagger effect for benefits */
.yoga-benefits .benefit-item {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.yoga-benefits .benefit-item:not(.animate) {
    opacity: 0;
    transform: translateX(-30px);
}

/* Premium text reveal animation */
@keyframes revealTextPremium {
    0% {
        opacity: 0;
        filter: blur(10px);
        transform: translateY(20px);
    }
    50% {
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

.yoga-title.animate {
    animation: revealTextPremium 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Image zoom effect on scroll */
@keyframes zoomInImage {
    from {
        transform: scale(1.1);
        filter: blur(5px);
    }
    to {
        transform: scale(1);
        filter: blur(0);
    }
}

.yoga-image.animate img {
    animation: zoomInImage 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Letter by letter animation for mobile overlay title */
@media (max-width: 575px) {
    .yoga-image > .yoga-title {
        overflow: hidden;
    }
    
    .yoga-image > .yoga-title.animate {
        animation: none;
    }
    
    .yoga-image > .yoga-title.animate span {
        display: inline-block;
        opacity: 0;
        transform: translateY(20px);
        animation: letterReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
    
    @keyframes letterReveal {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Unique approach card animation */
.unique-approach {
    position: relative;
    overflow: hidden;
}

.unique-approach::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(253, 167, 0, 0.1) 50%, 
        transparent 100%);
    transition: left 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.unique-approach.animate::before {
    left: 100%;
}

/* ===== About Section Animations ===== */

/* About Hero Image Animation */
.about-image {
    transform: scale(0.9);
    opacity: 0;
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-hero.animate .about-image {
    transform: scale(1);
    opacity: 1;
    animation: premiumImageReveal 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes premiumImageReveal {
    0% {
        transform: scale(0.8) rotateY(-5deg);
        opacity: 0;
        filter: blur(8px);
    }
    60% {
        filter: blur(2px);
    }
    100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
        filter: blur(0);
    }
}

/* About Introduction Text Animation */
.about-greeting {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-introduction {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.2s;
}

.about-hero.animate .about-greeting {
    opacity: 1;
    transform: translateY(0);
}

.about-hero.animate .about-introduction {
    opacity: 1;
    transform: translateY(0);
}

/* Story Paragraphs Sequential Animation */
.story-paragraph {
    opacity: 0;
    transform: translateY(25px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-paragraph.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced Mission Animation with Glow Effect */
.about-mission {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.about-mission.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: missionGlow 2s ease-in-out;
}

@keyframes missionGlow {
    0%, 100% {
        box-shadow: 0 6px 40px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 8px 60px rgba(253, 167, 0, 0.15), 
                    0 0 40px rgba(253, 167, 0, 0.08);
    }
}

/* Stats Animation with Number Counter Effect */
.stat-item {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.stat-number {
    transform: scale(0.8);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item.animate .stat-number {
    transform: scale(1);
    animation: numberPulse 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes numberPulse {
    0%, 100% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.1);
    }
    60% {
        transform: scale(1.05);
    }
}

/* Certificates Animation with Sparkle Effect */
.about-certificates {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-certificates.animate {
    opacity: 1;
    transform: translateY(0);
}

.certificates-text {
    position: relative;
}

.about-certificates.animate .certificates-text {
    animation: sparkleText 2s ease-in-out;
}

@keyframes sparkleText {
    0%, 100% {
        text-shadow: none;
    }
    50% {
        text-shadow: 0 0 10px rgba(253, 167, 0, 0.3),
                     0 0 20px rgba(253, 167, 0, 0.2);
    }
}

/* Stagger Animation for Stats Grid */
.stats-grid .stat-item:nth-child(1) {
    transition-delay: 0.1s;
}

.stats-grid .stat-item:nth-child(2) {
    transition-delay: 0.2s;
}

.stats-grid .stat-item:nth-child(3) {
    transition-delay: 0.3s;
}

/* Highlight RYS500 Animation */
.highlight {
    position: relative;
    overflow: hidden;
}

.highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(253, 167, 0, 0.2) 50%,
        transparent 100%);
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-hero.animate .highlight::before {
    left: 100%;
    animation-delay: 0.5s;
}

/* Desktop specific animations */
@media (min-width: 992px) {
    .about-hero {
        opacity: 0;
        transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .about-hero.animate {
        opacity: 1;
    }
    
    .about-image {
        transform: scale(0.9) translateX(-40px);
    }
    
    .about-hero.animate .about-image {
        transform: scale(1) translateX(0);
    }
    
    .about-intro {
        transform: translateX(40px);
        opacity: 0;
        transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        transition-delay: 0.3s;
    }
    
    .about-hero.animate .about-intro {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile specific enhancements */
@media (max-width: 767px) {
    .about-mission {
        transform: translateY(30px) scale(0.98);
    }
    
    .stat-item {
        transform: translateY(20px) scale(0.95);
    }
    
    .story-paragraph {
        transform: translateY(20px);
    }
}

/* ===== Certificate Animations ===== */

/* Certificate item scale animation */
.certificate-item {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.certificate-item.animate {
    opacity: 1;
    transform: scale(1);
}

/* Stagger animation for certificate items */
.certificate-item[data-delay="1000"] {
    transition-delay: 0.1s;
}

.certificate-item[data-delay="1100"] {
    transition-delay: 0.2s;
}

.certificate-item[data-delay="1200"] {
    transition-delay: 0.3s;
}

.certificate-item[data-delay="1300"] {
    transition-delay: 0.4s;
}

.certificate-item[data-delay="1400"] {
    transition-delay: 0.5s;
}

.certificate-item[data-delay="1500"] {
    transition-delay: 0.6s;
}

/* Certificate image loading animation */
.certificate-image {
    transform: scale(1.1);
    filter: blur(5px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.certificate-image.loaded {
    transform: scale(1);
    filter: blur(0);
}

/* Certificate hover glow effect */
.certificate-item:hover {
    animation: certificateGlow 0.6s ease-out;
}

@keyframes certificateGlow {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 8px 30px rgba(253, 167, 0, 0.15),
                    0 4px 20px rgba(0, 0, 0, 0.12);
    }
    100% {
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    }
}

/* Certificate zoom icon animation */
.certificate-zoom-icon {
    animation: zoomIconPulse 2s ease-in-out infinite;
}

@keyframes zoomIconPulse {
    0%, 100% {
        transform: scale(0.8);
        background: rgba(253, 167, 0, 0.9);
    }
    50% {
        transform: scale(0.9);
        background: rgba(253, 167, 0, 1);
        box-shadow: 0 0 20px rgba(253, 167, 0, 0.3);
    }
}

/* Certificate loader animation enhancement */
.loader-spinner {
    animation: spin 1s linear infinite, loaderPulse 2s ease-in-out infinite;
}

@keyframes loaderPulse {
    0%, 100% {
        border-top-color: var(--color-accent);
    }
    50% {
        border-top-color: var(--color-accent-hover);
        transform: rotate(180deg) scale(1.1);
    }
}

/* Modal animations */
.certificate-modal {
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.certificate-modal.active {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Modal content entrance */
.modal-content {
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.certificate-modal.active .modal-content {
    animation-name: modalSlideIn;
}

@keyframes modalSlideIn {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Modal image loading */
.modal-image {
    transform: scale(0.9);
    filter: blur(3px);
}

.modal-image.loaded {
    transform: scale(1);
    filter: blur(0);
    animation: modalImageReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalImageReveal {
    0% {
        transform: scale(0.9);
        opacity: 0;
        filter: blur(3px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

/* Navigation buttons animation */
.modal-nav-btn {
    transform: scale(1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-nav-btn:active {
    transform: scale(0.95);
}

.modal-nav-btn:disabled {
    transform: scale(1);
    opacity: 0.5;
}

/* Certificate title and subtitle animation */
.certificates-title {
    opacity: 0;
    transform: translateY(20px);
    animation: certificateTitleReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

.certificates-subtitle {
    opacity: 0;
    transform: translateY(15px);
    animation: certificateTitleReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.7s forwards;
}

@keyframes certificateTitleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Certificate grid entrance */
.certificates-grid {
    opacity: 0;
    animation: certificateGridReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.8s forwards;
}

@keyframes certificateGridReveal {
    to {
        opacity: 1;
    }
}

/* Mobile optimized animations */
@media (max-width: 768px) {
    .certificate-item.animate {
        animation: mobileScaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    @keyframes mobileScaleIn {
        0% {
            transform: scale(0.9) translateY(20px);
            opacity: 0;
        }
        100% {
            transform: scale(1) translateY(0);
            opacity: 1;
        }
    }

    /* Premium cert viewer: disable desktop modal animations */
    .certificate-modal.active .modal-content {
        animation: none;
        transform: none;
    }

    .certificate-modal .modal-image {
        transform: none;
        filter: none;
    }

    .certificate-modal .modal-image.loaded {
        animation: mobileCertFadeIn 0.3s ease;
        transform: none;
        filter: none;
    }

    @keyframes mobileCertFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    .certificate-zoom-icon {
        animation: none;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .about-image,
    .about-greeting,
    .about-introduction,
    .story-paragraph,
    .about-mission,
    .stat-item,
    .about-certificates,
    .certificate-item,
    .certificate-image,
    .modal-content,
    .modal-image {
        transition-duration: 0.2s;
        animation: none;
    }
    
    .certificate-zoom-icon,
    .loader-spinner {
        animation: none;
    }
}
