/* ============================================
   Behavioral Educational Services — Custom Styles
   ============================================ */

/* Base */
*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    overflow-x: hidden;
}

/* Selection color */
::selection {
    background-color: rgba(13, 148, 136, 0.2);
    color: #0f766e;
}

/* ============================================
   Navbar scroll state
   ============================================ */
#navbar.scrolled {
    background: rgba(4, 47, 46, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 20px rgba(0, 0, 0, 0.3);
}

#navbar.scrolled .nav-text-white {
    color: #ffffff;
}

/* ============================================
   Hero animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in {
    animation-name: fadeIn;
    animation-duration: 0.8s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

/* ============================================
   Scroll indicator animation
   ============================================ */
@keyframes scrollIndicator {
    0%, 100% {
        opacity: 0.4;
        transform: scaleY(1);
    }
    50% {
        opacity: 1;
        transform: scaleY(1.2);
    }
}

.animate-scroll-indicator {
    animation: scrollIndicator 2s ease-in-out infinite;
    transform-origin: top;
}

/* ============================================
   Scroll reveal (progressive enhancement)
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
    .reveal-on-scroll {
        opacity: 0;
        transform: translateY(40px);
        transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .reveal-on-scroll.revealed {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger children */
    .reveal-on-scroll:nth-child(1) { transition-delay: 0s; }
    .reveal-on-scroll:nth-child(2) { transition-delay: 0.1s; }
    .reveal-on-scroll:nth-child(3) { transition-delay: 0.2s; }
    .reveal-on-scroll:nth-child(4) { transition-delay: 0.3s; }
    .reveal-on-scroll:nth-child(5) { transition-delay: 0.4s; }
    .reveal-on-scroll:nth-child(6) { transition-delay: 0.5s; }
}

/* Default visible state (no JS fallback) */
.reveal-on-scroll {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: no-preference) {
    .reveal-on-scroll {
        opacity: 0;
        transform: translateY(40px);
    }
}

/* ============================================
   Mobile menu
   ============================================ */
#mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav-link {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.3s ease;
}

#mobile-menu.open .mobile-nav-link {
    opacity: 1;
    transform: translateY(0);
}

#mobile-menu.open .mobile-nav-link:nth-child(1) { transition-delay: 0.1s; }
#mobile-menu.open .mobile-nav-link:nth-child(2) { transition-delay: 0.15s; }
#mobile-menu.open .mobile-nav-link:nth-child(3) { transition-delay: 0.2s; }
#mobile-menu.open .mobile-nav-link:nth-child(4) { transition-delay: 0.25s; }
#mobile-menu.open .mobile-nav-link:nth-child(5) { transition-delay: 0.3s; }
#mobile-menu.open .mobile-nav-link:nth-child(6) { transition-delay: 0.35s; }

/* ============================================
   Back to top button
   ============================================ */
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ============================================
   Form focus styles
   ============================================ */
input:focus,
textarea:focus,
select:focus {
    outline: none;
}

/* ============================================
   Smooth image loading
   ============================================ */
img {
    loading: lazy;
}

/* ============================================
   Responsive adjustments
   ============================================ */
@media (max-width: 767px) {
    .font-serif {
        line-height: 1.2;
    }
}

/* ============================================
   Print styles
   ============================================ */
@media print {
    header, footer, #back-to-top, .reveal-on-scroll {
        display: none !important;
    }
    
    body {
        color: #000;
        background: #fff;
    }
    
    section {
        page-break-inside: avoid;
    }
}
