/* ============================================================
   VINTAGE MEDICARE — Premium 3D Animation Layer
   animations.css
   ============================================================ */

/* ============================================================
   PAGE LOADER
   ============================================================ */
.page-loader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #060d1f 0%, #0a1628 50%, #071020 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    animation: loaderLogoFade 0.6s ease forwards;
}

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

.loader-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 30px rgba(14,165,233,0.5);
}

.loader-logo-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #ffffff;
}

.loader-ring {
    width: 52px;
    height: 52px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: #0ea5e9;
    border-right-color: #38bdf8;
    border-radius: 50%;
    animation: loaderSpin 0.9s linear infinite;
    box-shadow: 0 0 20px rgba(14,165,233,0.3);
}

@keyframes loaderSpin {
    to { transform: rotate(360deg); }
}

.loader-text {
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    animation: loaderPulse 1.8s ease-in-out infinite;
}

@keyframes loaderPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, #38bdf8, #7dd3fc, #38bdf8, #0284c7);
    background-size: 300% auto;
    animation: progressShimmer 3s linear infinite;
    z-index: 99998;
    transform-origin: left center;
    box-shadow: 0 0 8px rgba(56,189,248,0.6);
    transition: width 0.1s linear;
}

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

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.cursor-dot {
    width: 8px;
    height: 8px;
    background: #38bdf8;
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 99997;
    transform: translate(-50%, -50%);
    transition: transform 0.05s ease, width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 10px rgba(56,189,248,0.8);
}

.cursor-ring {
    width: 36px;
    height: 36px;
    border: 1.5px solid rgba(56,189,248,0.5);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 99996;
    transform: translate(-50%, -50%);
    transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1),
                width 0.3s ease, height 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

.cursor-dot.hovering  { width: 12px; height: 12px; background: #7dd3fc; }
.cursor-ring.hovering { width: 52px; height: 52px; border-color: rgba(125,211,252,0.6); }

@media (hover: none) {
    .cursor-dot, .cursor-ring { display: none; }
}

/* ============================================================
   HERO CANVAS (Three.js particle field)
   ============================================================ */
#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}

#hero-canvas.ready { opacity: 1; }

.hero-content {
    position: relative;
    z-index: 2;
}

/* ============================================================
   HERO ENHANCEMENTS
   ============================================================ */
.gradient-text {
    background: linear-gradient(90deg, #38bdf8, #7dd3fc, #bae6fd, #7dd3fc, #38bdf8);
    background-size: 250% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 5s linear infinite;
}

@keyframes textShimmer {
    0%   { background-position: 0% center; }
    100% { background-position: 250% center; }
}

.location-badge {
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow:
        0 8px 32px rgba(0,0,0,0.12),
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 0 0 0 rgba(14,165,233,0.4);
    animation: badgeGlow 3.5s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.location-badge:hover { transform: translateY(-2px); }

@keyframes badgeGlow {
    0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.18), 0 0 0 0 rgba(14,165,233,0.4); }
    50%       { box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.18), 0 0 0 10px rgba(14,165,233,0); }
}

.dot {
    animation: dotHeartbeat 2.2s ease-in-out infinite;
}

@keyframes dotHeartbeat {
    0%, 100% { transform: scale(1);   box-shadow: 0 0 8px var(--primary); }
    40%       { transform: scale(1.4); box-shadow: 0 0 20px var(--primary), 0 0 40px rgba(14,165,233,0.4); }
    60%       { transform: scale(1.2); box-shadow: 0 0 14px var(--primary); }
}

/* ============================================================
   FLOATING 3D ICONS IN HERO
   ============================================================ */
.floating-icon-3d {
    position: absolute;
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(56, 189, 248, 0.85);
    pointer-events: none;
    z-index: 1;
    animation: floatIcon var(--fi-d, 8s) ease-in-out infinite var(--fi-delay, 0s);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
}

.floating-icon-3d svg { width: 22px; height: 22px; }

@keyframes floatIcon {
    0%   { transform: translateY(0px) rotate(0deg) scale(1); }
    25%  { transform: translateY(-18px) rotate(6deg) scale(1.05); }
    50%  { transform: translateY(-8px) rotate(-2deg) scale(0.98); }
    75%  { transform: translateY(-22px) rotate(4deg) scale(1.03); }
    100% { transform: translateY(0px) rotate(0deg) scale(1); }
}

/* ============================================================
   AMBIENT FLOATING ORBS
   ============================================================ */
.orb-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0;
    animation: orbDrift var(--o-d, 12s) ease-in-out infinite var(--o-delay, 0s) forwards;
}

.orb-blue   { background: radial-gradient(circle, rgba(14,165,233,0.7), rgba(56,189,248,0.3)); }
.orb-purple { background: radial-gradient(circle, rgba(139,92,246,0.7), rgba(167,139,250,0.3)); }
.orb-teal   { background: radial-gradient(circle, rgba(20,184,166,0.7), rgba(45,212,191,0.3)); }
.orb-indigo { background: radial-gradient(circle, rgba(99,102,241,0.7), rgba(129,140,248,0.3)); }

@keyframes orbDrift {
    0%   { opacity: 0;    transform: translate(0px, 0px) scale(1); }
    10%  { opacity: var(--o-opacity, 0.12); }
    50%  { opacity: var(--o-opacity, 0.12); transform: translate(var(--o-tx, 40px), var(--o-ty, -30px)) scale(1.1); }
    90%  { opacity: var(--o-opacity, 0.12); }
    100% { opacity: 0;    transform: translate(0px, 0px) scale(1); }
}

/* ============================================================
   3D CARD TILT SETUP
   ============================================================ */
.tilt-card {
    transform-style: preserve-3d;
    will-change: transform;
    cursor: default;
}

/* Shimmer gradient on card hover — controlled via JS CSS vars */
.feature-card,
.service-card {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    will-change: transform;
}

.feature-card::before,
.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--mx, 50%) var(--my, 50%),
        rgba(14,165,233,0.09) 0%,
        transparent 55%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    border-radius: inherit;
    z-index: 1;
}

.feature-card:hover::before,
.service-card:hover::before { opacity: 1; }

/* Elevated glow on hover */
.feature-card.hover-lift:hover {
    transform: translateY(-12px) perspective(900px) rotateX(3deg) !important;
    box-shadow: 0 24px 64px -12px rgba(14,165,233,0.22), 0 8px 24px -8px rgba(0,0,0,0.12) !important;
    border-color: rgba(14,165,233,0.2) !important;
}

.service-card:hover {
    transform: perspective(900px) rotateX(2deg) translateY(-8px) !important;
    box-shadow: 0 20px 60px -8px rgba(14,165,233,0.18), 0 6px 20px -6px rgba(0,0,0,0.1) !important;
}

.service-featured:hover {
    transform: scale(1.04) perspective(900px) rotateX(2deg) translateY(-8px) !important;
    box-shadow: 0 24px 64px rgba(14,165,233,0.5) !important;
}

/* ============================================================
   3D SCROLL REVEAL ANIMATIONS
   ============================================================ */
.reveal-3d {
    opacity: 0;
    transform: perspective(1000px) rotateX(14deg) translateY(48px);
    transition: opacity 0.75s cubic-bezier(0.4,0,0.2,1),
                transform 0.75s cubic-bezier(0.4,0,0.2,1);
}

.reveal-3d.visible {
    opacity: 1;
    transform: perspective(1000px) rotateX(0deg) translateY(0px);
}

.reveal-left {
    opacity: 0;
    transform: perspective(1000px) rotateY(18deg) translateX(-60px);
    transition: opacity 0.75s cubic-bezier(0.4,0,0.2,1),
                transform 0.75s cubic-bezier(0.4,0,0.2,1);
}

.reveal-left.visible {
    opacity: 1;
    transform: perspective(1000px) rotateY(0deg) translateX(0px);
}

.reveal-right {
    opacity: 0;
    transform: perspective(1000px) rotateY(-18deg) translateX(60px);
    transition: opacity 0.75s cubic-bezier(0.4,0,0.2,1),
                transform 0.75s cubic-bezier(0.4,0,0.2,1);
}

.reveal-right.visible {
    opacity: 1;
    transform: perspective(1000px) rotateY(0deg) translateX(0px);
}

.reveal-scale {
    opacity: 0;
    transform: perspective(1000px) scale(0.88) translateY(24px);
    transition: opacity 0.75s cubic-bezier(0.4,0,0.2,1),
                transform 0.75s cubic-bezier(0.4,0,0.2,1);
}

.reveal-scale.visible {
    opacity: 1;
    transform: perspective(1000px) scale(1) translateY(0px);
}

/* Stagger delays for sequential reveals */
.reveal-d1 { transition-delay: 0.08s !important; }
.reveal-d2 { transition-delay: 0.16s !important; }
.reveal-d3 { transition-delay: 0.24s !important; }
.reveal-d4 { transition-delay: 0.32s !important; }
.reveal-d5 { transition-delay: 0.40s !important; }
.reveal-d6 { transition-delay: 0.48s !important; }

/* ============================================================
   BUTTON RIPPLE & GLOW
   ============================================================ */
.btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--bx, 50%) var(--by, 50%),
        rgba(255,255,255,0.22) 0%,
        transparent 65%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: inherit;
    pointer-events: none;
}

.btn:hover::after { opacity: 1; }

.btn-primary, .btn-accent {
    box-shadow: 0 4px 15px rgba(14,165,233,0.3);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

.btn-primary:hover, .btn-accent:hover {
    box-shadow: 0 8px 30px rgba(14,165,233,0.45), 0 0 0 4px rgba(14,165,233,0.1);
}

/* ============================================================
   NAVBAR GLASSMORPHISM UPGRADE
   ============================================================ */
.navbar.scrolled {
    background: rgba(255,255,255,0.90) !important;
    backdrop-filter: blur(24px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.6) inset,
        0 4px 30px rgba(0,0,0,0.07) !important;
    border-bottom-color: rgba(226,232,240,0.7) !important;
}

/* ============================================================
   SECTION DECORATIVE SHAPES
   ============================================================ */
.section {
    position: relative;
    overflow: hidden;
}

.shape-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(14,165,233,0.08);
    pointer-events: none;
    animation: ringPulse var(--r-d, 8s) ease-in-out infinite var(--r-delay, 0s);
}

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

.shape-hex {
    position: absolute;
    opacity: 0.04;
    pointer-events: none;
    animation: hexSpin var(--h-d, 30s) linear infinite var(--h-dir, normal);
}

@keyframes hexSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   HERO MOUSE PARALLAX LAYER
   ============================================================ */
.hero-parallax-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* ============================================================
   STATS COUNTER ANIMATION
   ============================================================ */
.stat-number {
    display: inline-block;
    transition: transform 0.3s ease;
}

.stat-number.counting {
    animation: statPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes statPop {
    0%   { transform: scale(0.8); }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ============================================================
   FEATURE ICON 3D PULSE
   ============================================================ */
.feature-icon {
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.4s ease;
}

.feature-card:hover .feature-icon {
    transform: translateZ(24px) rotateY(10deg) scale(1.15);
    box-shadow: 0 8px 24px rgba(14,165,233,0.25);
}

/* ============================================================
   RIPPLE CLICK EFFECT
   ============================================================ */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background-color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================================
   AMBIENT MINI PARTICLES (rising bubbles in sections)
   ============================================================ */
.mini-particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(14,165,233,0.25);
    pointer-events: none;
    animation: particleRise var(--p-d, 7s) ease-in infinite var(--p-delay, 0s);
    width: var(--p-size, 4px);
    height: var(--p-size, 4px);
    left: var(--p-x, 50%);
    bottom: -8px;
    filter: blur(0.5px);
}

@keyframes particleRise {
    0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
    8%   { opacity: 0.9; }
    92%  { opacity: 0.4; }
    100% { transform: translateY(-120vh) translateX(var(--p-drift, 25px)) scale(0.4); opacity: 0; }
}

/* ============================================================
   HERO TITLE WORD ANIMATION
   ============================================================ */
.hero-title .word-anim {
    display: inline-block;
    animation: wordDrop 0.8s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes wordDrop {
    from { opacity: 0; transform: translateY(-30px) rotateX(40deg); }
    to   { opacity: 1; transform: translateY(0) rotateX(0deg); }
}

/* ============================================================
   SERVICE FEATURED CARD GLOW PULSE
   ============================================================ */
.service-featured {
    animation: featuredGlow 4s ease-in-out infinite;
}

@keyframes featuredGlow {
    0%, 100% { box-shadow: 0 12px 40px rgba(14,165,233,0.40), 0 0 0 0 rgba(14,165,233,0.2); }
    50%       { box-shadow: 0 16px 60px rgba(14,165,233,0.55), 0 0 0 8px rgba(14,165,233,0); }
}

/* ============================================================
   CTA SECTION ENHANCEMENT
   ============================================================ */
.cta-container h2, .cta-container p {
    position: relative;
    z-index: 2;
}

/* ============================================================
   FOOTER HOVER ENHANCEMENT
   ============================================================ */
.footer-icon {
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.4s ease;
}

.footer-brand:hover .footer-icon {
    transform: rotateY(20deg) scale(1.1);
    box-shadow: 0 8px 20px rgba(14,165,233,0.3);
}

/* ============================================================
   GENERAL SECTION HEADINGS DEPTH
   ============================================================ */
.heading {
    position: relative;
}

/* ============================================================
   MOBILE: DISABLE COSTLY EFFECTS
   ============================================================ */
@media (max-width: 768px) {
    .cursor-dot, .cursor-ring { display: none !important; }
    .floating-icon-3d { display: none; }
    .feature-card:hover, .service-card:hover {
        transform: translateY(-4px) !important;
    }
}

/* ============================================================
   REDUCED MOTION ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .page-loader { transition: none; }
    .page-loader.hidden { opacity: 0; visibility: hidden; }
}
