/* =========================================================
   SAAI RAAM HOSPITAL — 2026 MOTION LAYER
   Additive only. Safe to delete this file + animations.js
   to return to the original site.
========================================================= */

:root {
    --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- 1. SCROLL PROGRESS BAR ---------- */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 100%;
    z-index: 2000;
    transform-origin: left;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--accent), #4cc9a6, var(--primary));
    box-shadow: 0 0 12px rgba(31, 138, 112, .6);
    pointer-events: none;
}

/* ---------- 2. CURSOR GLOW (desktop only) ---------- */
.cursor-glow {
    position: fixed;
    top: 0; left: 0;
    width: 420px; height: 420px;
    margin: -210px 0 0 -210px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    background: radial-gradient(circle, rgba(31,138,112,.13), transparent 62%);
    transition: opacity .4s ease;
    will-change: transform;
}
.cursor-glow.on { opacity: 1; }
@media (hover: none), (max-width: 900px) { .cursor-glow { display: none; } }

/* ---------- 3. SCROLL REVEAL (blur + rise, staggered) ---------- */
/* Uses the individual `translate`/`scale` properties so it never
   fights with existing `transform` hover effects. */
.js .rv {
    opacity: 0;
    filter: blur(10px);
    translate: 0 48px;
    scale: .97;
    transition:
        opacity .9s var(--ease-out-expo) var(--d, 0s),
        filter .9s var(--ease-out-expo) var(--d, 0s),
        translate .9s var(--ease-out-expo) var(--d, 0s),
        scale .9s var(--ease-out-expo) var(--d, 0s),
        transform .3s ease,
        box-shadow .3s ease;
}
.js .rv.rv-left  { translate: -60px 0; }
.js .rv.rv-right { translate: 60px 0; }
.js .rv.rv-zoom  { translate: 0 0; scale: .88; }
.js .rv.rv-in {
    opacity: 1;
    filter: blur(0);
    translate: 0 0;
    scale: 1;
}

/* ---------- 4. SPLIT-WORD HEADINGS ---------- */
.word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: .12em;
    margin-bottom: -.12em;
}
.word > i {
    display: inline-block;
    font-style: normal;
    transform: translateY(110%) rotate(4deg);
    transition: transform .9s var(--ease-out-expo) var(--wd, 0s);
}
.split-in .word > i { transform: translateY(0) rotate(0); }

/* Word wrappers must inherit the heading colour (existing `h2 span` rules would tint them) */
.section-heading h2 span.word,
.about-content h2 span.word,
.doctors-heading h2 span.word,
.contact h2 span.word,
.contact-intro h2 span.word,
.appointment-content h2 span.word { color: inherit; }

/* ---------- 5. ANIMATED GRADIENT ON HEADING ACCENTS ---------- */
.hero h2 span,
.section-heading h2 span:not(.word),
.about-content h2 span:not(.word),
.doctors-heading h2 span:not(.word),
.contact-intro h2 span:not(.word) {
    background-image: linear-gradient(100deg,
        var(--accent) 0%, #4cc9a6 35%, var(--primary) 65%, var(--accent) 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: gradientSlide 6s linear infinite;
}
@keyframes gradientSlide {
    to { background-position: -250% 0; }
}

/* ---------- 6. NAVBAR: SHRINK + SHADOW ON SCROLL ---------- */
.navbar { transition: box-shadow .4s ease, background .4s ease; }
.nav-container { transition: min-height .4s var(--ease-out-expo); }
.navbar.scrolled { box-shadow: 0 10px 40px rgba(16, 42, 67, .10); }
.navbar.scrolled .nav-container { min-height: 68px; }
.brand-icon img { transition: transform .4s var(--ease-out-expo); }
.navbar.scrolled .brand-icon img { transform: scale(.88); }
.brand:hover .brand-icon img { transform: scale(1.06) rotate(-2deg); }

/* Nav link underline that draws in on hover */
.nav-menu a::before {
    content: "";
    position: absolute;
    left: 0; bottom: -9px;
    width: 100%; height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .4s var(--ease-out-expo);
}
.nav-menu a:hover::before { transform: scaleX(1); transform-origin: left; }
.nav-menu a.active::before { display: none; }
.nav-menu a.active::after {
    animation: underlineGrow .5s var(--ease-out-expo) both;
    transform-origin: left;
}
@keyframes underlineGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- 7. MOBILE MENU (animated open/close + stagger) ---------- */
.menu-button { transition: transform .4s var(--ease-spring); }
.menu-button.open { transform: rotate(90deg) scale(1.1); }
@media (max-width: 900px) {
    .mobile-menu {
        display: block !important;
        max-height: 0;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow: hidden;
        opacity: 0;
        border-bottom-width: 0;
        transition: max-height .6s var(--ease-out-expo),
                    padding .6s var(--ease-out-expo),
                    opacity .4s ease;
    }
    .mobile-menu.open {
        max-height: 520px;
        padding-top: 20px !important;
        padding-bottom: 20px !important;
        opacity: 1;
        border-bottom-width: 1px;
    }
    .mobile-menu a {
        opacity: 0;
        transform: translateX(-24px);
        transition: opacity .5s ease, transform .6s var(--ease-out-expo), color .25s;
    }
    .mobile-menu.open a { opacity: 1; transform: none; }
    .mobile-menu.open a:nth-child(1) { transition-delay: .05s; }
    .mobile-menu.open a:nth-child(2) { transition-delay: .10s; }
    .mobile-menu.open a:nth-child(3) { transition-delay: .15s; }
    .mobile-menu.open a:nth-child(4) { transition-delay: .20s; }
    .mobile-menu.open a:nth-child(5) { transition-delay: .25s; }
    .mobile-menu.open a:nth-child(6) { transition-delay: .30s; }
}

/* ---------- 8. HERO: FLOATING PARTICLES + AURORA ---------- */
.hero { position: relative; }
.hero > .container { position: relative; z-index: 2; }
.hero-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}
.hero-particles span {
    position: absolute;
    bottom: -40px;
    left: var(--x);
    font-size: var(--s);
    font-weight: 800;
    color: var(--accent);
    opacity: 0;
    animation: particleRise var(--t) linear var(--dl) infinite;
}
@keyframes particleRise {
    0%   { transform: translateY(0) rotate(0); opacity: 0; }
    10%  { opacity: .22; }
    90%  { opacity: .16; }
    100% { transform: translateY(-780px) rotate(220deg); opacity: 0; }
}
.hero::before {
    content: "";
    position: absolute;
    width: 520px; height: 520px;
    right: -120px; top: -140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(76,201,166,.22), transparent 65%);
    filter: blur(30px);
    animation: auroraDrift 14s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes auroraDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-120px, 90px) scale(1.25); }
}

/* Hero image parallax hooks (set by JS) */
.hero-card-main { transition: transform .25s ease-out; will-change: transform; }

/* Floating cards: gentle bob */
.floating-card.emergency-card { animation: cardBob 5s ease-in-out infinite; }
.floating-card.lab-card { animation: cardBob 6s ease-in-out -2s infinite; }
@keyframes cardBob {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -12px; }
}

/* Live "online" dot + badge pulse ring */
.online-dot { position: relative; }
.online-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: ringPing 2s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ringPing {
    75%, 100% { transform: scale(3); opacity: 0; }
}

/* Emergency icon heartbeat */
.emergency-card .floating-icon { animation: heartbeat 1.6s ease-in-out infinite; }
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14%      { transform: scale(1.18); }
    28%      { transform: scale(1); }
    42%      { transform: scale(1.12); }
    70%      { transform: scale(1); }
}

/* ---------- 9. BUTTONS: MAGNETIC + RIPPLE + ARROW ---------- */
.nav-button, .secondary-button, .appointment-button, .map-button {
    position: relative;
    overflow: hidden;
    transition: transform .3s var(--ease-out-expo), background .25s, box-shadow .3s, color .25s;
    will-change: transform;
}
.nav-button:hover, .appointment-button:hover {
    box-shadow: 0 14px 30px rgba(18, 60, 105, .28);
}
.appointment-arrow, .appointment-button span, .map-button span {
    display: inline-block;
    transition: transform .4s var(--ease-spring);
}
.nav-button:hover .appointment-arrow,
.appointment-button:hover span,
.map-button:hover span { transform: translateX(6px); }
.map-button:hover span { transform: translate(3px, -3px); }

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .45);
    transform: scale(0);
    animation: rippleOut .7s ease-out forwards;
    pointer-events: none;
}
.secondary-button .ripple, .map-button .ripple { background: rgba(31, 138, 112, .25); }
@keyframes rippleOut { to { transform: scale(4); opacity: 0; } }

/* Hero stat numbers pop when counted */
.stat strong { display: inline-block; transition: transform .4s var(--ease-spring); }
.stat strong.counted { animation: statPop .6s var(--ease-spring); }
@keyframes statPop { 50% { transform: scale(1.25); } }

/* ---------- 10. QUICK-SERVICE STRIP HOVER ---------- */
.quick-service { transition: transform .4s var(--ease-out-expo), box-shadow .4s; }
.quick-service:hover { transform: translateY(-6px); box-shadow: 0 18px 36px rgba(16, 42, 67, .12); }
.quick-icon { transition: transform .5s var(--ease-spring); }
.quick-service:hover .quick-icon { transform: scale(1.2) rotate(-8deg); }

/* ---------- 11. SERVICE CARDS: 3D TILT + SPOTLIGHT + IMAGE REVEAL ---------- */
.services-grid { perspective: 1200px; }
.service-card { transform-style: preserve-3d; will-change: transform; }
.service-card::after,
.contact-item::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%),
        rgba(31, 138, 112, .16), transparent 45%);
    transition: opacity .35s ease;
}
.service-card.featured::after {
    background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%),
        rgba(255, 255, 255, .18), transparent 45%);
}
.service-card:hover::after,
.contact-item:hover::after { opacity: 1; }
.contact-item { position: relative; overflow: hidden; }

/* Service numbers drift on hover */
.service-number { transition: transform .6s var(--ease-out-expo), opacity .4s; }
.service-card:hover .service-number { transform: translateY(-4px) scale(1.15); }

/* Learn-more arrow slides */
.service-card a { display: inline-block; transition: transform .35s var(--ease-out-expo), letter-spacing .35s; }
.service-card a:hover { transform: translateX(6px); }

/* Image curtain wipe when card enters */
.js .service-image.wipe { clip-path: inset(0 100% 0 0 round 18px); }
.js .service-image.wipe.wipe-in {
    clip-path: inset(0 0 0 0 round 18px);
    transition: clip-path 1.1s var(--ease-out-expo) .25s;
}

/* ---------- 12. ABOUT CHECKLIST TICKS POP ---------- */
.about-points > div span { display: inline-block; }
.about-points > div:hover span { animation: tickPop .5s var(--ease-spring); }
@keyframes tickPop { 50% { transform: scale(1.5) rotate(12deg); } }

/* ---------- 13. APPOINTMENT: ANIMATED GRADIENT + ECG LINE ---------- */
.appointment-box { position: relative; overflow: hidden; }
.appointment-box > * { position: relative; z-index: 1; }
.ecg-line {
    position: absolute !important;
    left: 0; right: 0; bottom: 14px;
    width: 100%; height: 70px;
    z-index: 0 !important;
    opacity: .28;
    pointer-events: none;
}
.ecg-line path {
    fill: none;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    animation: ecgDraw 4.5s linear infinite;
}
@keyframes ecgDraw {
    0%   { stroke-dashoffset: 1400; }
    60%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -1400; }
}
.appointment-button { animation: callPulse 2.6s ease-in-out infinite; }
@keyframes callPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); }
    50%      { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); }
}

/* ---------- 14. DOCTORS: STAGGERED SLIDE CONTENT ---------- */
.doctor-slide .doctor-icon,
.doctor-slide .doctor-info > * {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .7s ease, transform .8s var(--ease-out-expo);
}
.doctor-slide.active .doctor-icon { opacity: 1; transform: none; transition-delay: .15s; }
.doctor-slide.active .doctor-info > *:nth-child(1) { opacity: 1; transform: none; transition-delay: .25s; }
.doctor-slide.active .doctor-info > *:nth-child(2) { opacity: 1; transform: none; transition-delay: .35s; }
.doctor-slide.active .doctor-info > *:nth-child(3) { opacity: 1; transform: none; transition-delay: .45s; }
.doctor-slide.active .doctor-info > *:nth-child(4) { opacity: 1; transform: none; transition-delay: .55s; }

.doctor-dot { transition: transform .35s var(--ease-spring), width .45s var(--ease-out-expo), background .3s; }
.doctor-dot:hover { transform: scale(1.35); }

/* Slider progress bar (set by JS) */
.doctor-progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 5;
    border-radius: 0 3px 3px 0;
}
.doctor-progress.run { animation: doctorProgress 5s linear forwards; }
@keyframes doctorProgress { to { transform: scaleX(1); } }

/* ---------- 15. CONTACT + FOOTER ---------- */
.contact-item { transition: transform .4s var(--ease-out-expo), box-shadow .4s; }
.contact-item:hover { transform: translateX(8px); }
.contact-icon { transition: transform .5s var(--ease-spring); }
.contact-item:hover .contact-icon { transform: scale(1.18) rotate(-10deg); }

.location-map { transition: box-shadow .5s ease; }
.location-map:hover { box-shadow: 0 30px 60px rgba(16, 42, 67, .16); }

.footer-column a, .footer-bottom a { transition: transform .35s var(--ease-out-expo), color .25s; }
.footer-column a:hover { transform: translateX(7px); }
.footer-bottom a span { display: inline-block; transition: transform .4s var(--ease-spring); }
.footer-bottom a:hover span { transform: translateY(-5px); }
.footer-tagline span { display: inline-block; animation: dotBeat 2s ease-in-out infinite; }
@keyframes dotBeat { 50% { transform: scale(1.8); color: var(--accent); } }

/* ---------- 16. SECTION LABEL SHIMMER ---------- */
.section-label { position: relative; overflow: hidden; }
.section-label::after {
    content: "";
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
    transform: skewX(-20deg);
    animation: labelShine 5s ease-in-out infinite;
}
@keyframes labelShine { 0%, 60% { left: -80%; } 100% { left: 160%; } }

/* ---------- 17. PAGE LOAD CURTAIN ---------- */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background: #fff;
    transition: opacity .6s ease .15s, visibility .6s ease .15s;
}
.page-loader.done { opacity: 0; visibility: hidden; }
.page-loader .loader-cross {
    font-size: 56px;
    color: var(--accent);
    animation: loaderBeat 1s ease-in-out infinite;
}
@keyframes loaderBeat {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.3) rotate(90deg); }
}

/* ---------- REDUCED MOTION: respect user settings ---------- */
@media (prefers-reduced-motion: reduce) {
    .js .rv, .js .service-image.wipe {
        opacity: 1 !important; filter: none !important;
        translate: none !important; scale: none !important;
        clip-path: none !important; transition: none !important;
    }
    .word > i { transform: none !important; transition: none !important; }
    .hero-particles, .cursor-glow, .ecg-line, .page-loader { display: none !important; }
    .hero::before, .floating-card, .emergency-card .floating-icon,
    .hero h2 span, .section-heading h2 span:not(.word), .about-content h2 span:not(.word),
    .doctors-heading h2 span:not(.word), .contact-intro h2 span:not(.word),
    .appointment-button, .online-dot::after, .section-label::after,
    .footer-tagline span { animation: none !important; }
}

/* ---------- Prevent horizontal scroll from off-screen reveal offsets ---------- */
html, body { overflow-x: clip; }
@media (max-width: 700px) {
    .js .rv.rv-right, .js .rv.rv-left { translate: 0 36px; }
}
