/* ============================================
   Henrico County-Saint Marys Hospital
   Custom Styles
   ============================================ */

/* Base */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

/* Selection */
::selection {
    background-color: #2d4f2d;
    color: #fafaf8;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f5f0;
}

::-webkit-scrollbar-thumb {
    background: #9bbf9b;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #72a372;
}

/* Navigation transitions */
#navbar.scrolled {
    background: rgba(250, 250, 248, 0.95);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(45, 79, 45, 0.08);
}

#navbar.scrolled .font-serif,
#navbar.scrolled .text-forest-900 {
    color: #1d321d;
}

/* Mobile menu */
.mobile-link {
    opacity: 0;
    transform: translateY(10px);
}

#mobile-menu.open .mobile-link {
    animation: fadeUp 0.4s ease forwards;
}

#mobile-menu.open .mobile-link:nth-child(1) { animation-delay: 0.05s; }
#mobile-menu.open .mobile-link:nth-child(2) { animation-delay: 0.1s; }
#mobile-menu.open .mobile-link:nth-child(3) { animation-delay: 0.15s; }
#mobile-menu.open .mobile-link:nth-child(4) { animation-delay: 0.2s; }
#mobile-menu.open .mobile-link:nth-child(5) { animation-delay: 0.25s; }

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

/* Hamburger animation */
#mobile-menu-btn.active #menu-icon span:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

#mobile-menu-btn.active #menu-icon span:nth-child(2) {
    opacity: 0;
}

#mobile-menu-btn.active #menu-icon span:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
}

/* Service cards */
.service-card {
    opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
    .service-card {
        opacity: 0;
        transform: translateY(20px);
    }
    
    .service-card.revealed {
        animation: revealUp 0.6s ease forwards;
    }
    
    .service-card.revealed:nth-child(1) { animation-delay: 0s; }
    .service-card.revealed:nth-child(2) { animation-delay: 0.08s; }
    .service-card.revealed:nth-child(3) { animation-delay: 0.16s; }
    .service-card.revealed:nth-child(4) { animation-delay: 0.24s; }
    .service-card.revealed:nth-child(5) { animation-delay: 0.32s; }
    .service-card.revealed:nth-child(6) { animation-delay: 0.40s; }
}

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

/* Specialty items */
@media (prefers-reduced-motion: no-preference) {
    #specialties .flex {
        opacity: 0;
        transform: translateY(16px);
    }
    
    #specialties .flex.revealed {
        animation: revealUp 0.5s ease forwards;
    }
    
    #specialties .flex.revealed:nth-child(1) { animation-delay: 0s; }
    #specialties .flex.revealed:nth-child(2) { animation-delay: 0.06s; }
    #specialties .flex.revealed:nth-child(3) { animation-delay: 0.12s; }
    #specialties .flex.revealed:nth-child(4) { animation-delay: 0.18s; }
    #specialties .flex.revealed:nth-child(5) { animation-delay: 0.24s; }
    #specialties .flex.revealed:nth-child(6) { animation-delay: 0.30s; }
}

/* About section reveal */
@media (prefers-reduced-motion: no-preference) {
    #about .space-y-5 > p {
        opacity: 0;
        transform: translateY(16px);
    }
    
    #about .space-y-5 > p.revealed {
        animation: revealUp 0.5s ease forwards;
    }
    
    #about .space-y-5 > p.revealed:nth-child(1) { animation-delay: 0.1s; }
    #about .space-y-5 > p.revealed:nth-child(2) { animation-delay: 0.2s; }
    #about .space-y-5 > p.revealed:nth-child(3) { animation-delay: 0.3s; }
}

/* Visit section reveal */
@media (prefers-reduced-motion: no-preference) {
    #visit .space-y-6 > div {
        opacity: 0;
        transform: translateY(16px);
    }
    
    #visit .space-y-6 > div.revealed {
        animation: revealUp 0.5s ease forwards;
    }
    
    #visit .space-y-6 > div.revealed:nth-child(1) { animation-delay: 0.1s; }
    #visit .space-y-6 > div.revealed:nth-child(2) { animation-delay: 0.2s; }
    #visit .space-y-6 > div.revealed:nth-child(3) { animation-delay: 0.3s; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
a:focus-visible, button:focus-visible {
    outline: 2px solid #2d4f2d;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Image loading */
img {
    image-rendering: -webkit-optimize-contrast;
}
