/* =====================================================
   DR. SABANATHAN — ANIMATIONS CSS
   Keyframes, scroll reveals, stagger effects
   ===================================================== */

/* ===================================================
   1. KEYFRAME DEFINITIONS
   =================================================== */

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-36px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(36px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.88);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Ambient / decorative animations */
@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(-30px, 40px) scale(1.05); }
    66%       { transform: translate(20px, -20px) scale(0.96); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40%       { transform: translate(40px, -30px) scale(1.08); }
    70%       { transform: translate(-15px, 20px) scale(0.94); }
}

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

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

@keyframes pulseLive {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.75);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(34, 197, 94, 0.25);
    }
    70% {
        box-shadow: 0 0 0 26px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.12);
    }
}

@keyframes nameGradientShift {
    0%   { background-position: 0% center; }
    100% { background-position: 300% center; }
}

@keyframes redLineRun {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

@keyframes topNewsPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220,38,38,0), 0 4px 20px rgba(220,38,38,0.15);
        border-color: rgba(220,38,38,0.40);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(220,38,38,0.18), 0 4px 24px rgba(220,38,38,0.30);
        border-color: rgba(220,38,38,0.75);
    }
}

@keyframes scrollWheel {
    0%   { transform: translateY(0); opacity: 1; }
    80%  { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes borderRotate {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes accordionOpen {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================================
   2. HERO ENTRANCE ANIMATIONS
   =================================================== */

/* Fired by JS when page loads */
.animate-fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.85s var(--ease-out) 0.2s forwards;
}

.animate-fade-in-right {
    opacity: 0;
    animation: fadeInRight 0.85s var(--ease-out) 0.4s forwards;
}

/* Announcement card stagger */
.animate-card-stagger {
    opacity: 0;
}
.animate-card-stagger.cards-animated {
    animation: fadeInRight 0.55s var(--ease-out) forwards;
    animation-delay: calc((var(--stagger, 1) - 1) * 120ms + 500ms);
}

/* ===================================================
   3. SCROLL REVEAL SYSTEM
   Cards and sections revealed by Intersection Observer
   =================================================== */

/* Default hidden state */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 0.65s var(--ease-out),
        transform 0.65s var(--ease-out);
}

/* Triggered when element enters viewport */
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Delay variants */
.reveal-on-scroll[data-reveal-delay="100"] { transition-delay: 0.10s; }
.reveal-on-scroll[data-reveal-delay="150"] { transition-delay: 0.15s; }
.reveal-on-scroll[data-reveal-delay="200"] { transition-delay: 0.20s; }
.reveal-on-scroll[data-reveal-delay="240"] { transition-delay: 0.24s; }
.reveal-on-scroll[data-reveal-delay="300"] { transition-delay: 0.30s; }
.reveal-on-scroll[data-reveal-delay="400"] { transition-delay: 0.40s; }

/* ===================================================
   4. ACCORDION ANIMATION
   =================================================== */

/* When policy content is shown via JS */
.policy-item__content:not([hidden]) {
    animation: accordionOpen 0.32s var(--ease-out) forwards;
}

/* ===================================================
   5. HEADER ANIMATION
   =================================================== */

/* Header slides down on load */
.site-header {
    animation: fadeInDown 0.6s var(--ease-out) forwards;
}

/* ===================================================
   6. MOBILE MENU LINK STAGGER
   =================================================== */
.mobile-menu.is-open .mobile-menu__link {
    animation: fadeInRight 0.4s var(--ease-out) both;
}
.mobile-menu.is-open .mobile-menu__list li:nth-child(1) .mobile-menu__link { animation-delay: 0.08s; }
.mobile-menu.is-open .mobile-menu__list li:nth-child(2) .mobile-menu__link { animation-delay: 0.14s; }
.mobile-menu.is-open .mobile-menu__list li:nth-child(3) .mobile-menu__link { animation-delay: 0.20s; }
.mobile-menu.is-open .mobile-menu__list li:nth-child(4) .mobile-menu__link { animation-delay: 0.26s; }
.mobile-menu.is-open .mobile-menu__list li:nth-child(5) .mobile-menu__link { animation-delay: 0.32s; }
.mobile-menu.is-open .mobile-menu__list li:nth-child(6) .mobile-menu__link { animation-delay: 0.38s; }

/* ===================================================
   7. HOVER MICRO-INTERACTIONS
   =================================================== */

/* Gold shimmer on primary buttons */
.btn--primary::after,
.btn--book::after,
.btn--gold::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255,255,255,0.18) 50%,
        transparent 100%
    );
    transition: left 0.6s ease;
    pointer-events: none;
}
.btn--primary:hover::after,
.btn--book:hover::after,
.btn--gold:hover::after {
    left: 150%;
}

/* Service card icon spin-nudge on hover */
.service-card:hover .service-card__icon {
    animation: pulse 0.5s var(--ease-out);
}

/* QR glow ring animation on hover */
.qr-card:hover ~ .qr-glow-ring,
.qr-display:hover .qr-glow-ring {
    animation-duration: 1.5s;
    opacity: 1;
}

/* ===================================================
   8. REDUCED MOTION SUPPORT
   =================================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .hero-bg__orb--1,
    .hero-bg__orb--2 {
        animation: none;
    }

    .about-credential-card,
    .about-patients-card {
        animation: none;
    }

    .announcements-pulse-dot {
        animation: none;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .animate-fade-in-up,
    .animate-fade-in-right,
    .animate-card-stagger {
        opacity: 1;
        animation: none;
    }
}
