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

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

body {
    overflow-x: hidden;
}

::selection {
    background-color: rgba(6, 78, 59, 0.15);
    color: #064E3B;
}

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

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

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

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

/* Hamburger animation */
#menu-toggle[aria-expanded="true"] .menu-line:first-child {
    transform: translateY(4px) rotate(45deg);
}
#menu-toggle[aria-expanded="true"] .menu-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
#menu-toggle[aria-expanded="true"] .menu-line:last-child {
    transform: translateY(-4px) rotate(-45deg);
    width: 1.5rem;
}

/* Scroll reveal base — content is visible by default */
.reveal {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Reduced motion — disable all animations */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    html {
        scroll-behavior: auto;
    }
    #scroll-progress {
        display: none;
    }
    .animate-bounce {
        animation: none;
    }
}

/* Progressive enhancement: reveal below fold only when JS is active and motion preferred */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(24px);
    }
    .reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth image loading */
img {
    background-color: rgba(6, 78, 59, 0.04);
    transition: opacity 0.4s ease;
}

img[data-loaded="true"] {
    opacity: 1;
}

img:not([data-loaded]) {
    opacity: 0;
}

/* Header transition */
#site-header.scrolled {
    box-shadow: 0 1px 0 rgba(6, 78, 59, 0.06);
}

/* Custom scrollbar */
@media (min-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
    }
    ::-webkit-scrollbar-track {
        background: #FDF9F3;
    }
    ::-webkit-scrollbar-thumb {
        background: rgba(6, 78, 59, 0.2);
        border-radius: 3px;
    }
    ::-webkit-scrollbar-thumb:hover {
        background: rgba(6, 78, 59, 0.4);
    }
}

/* Modal animation */
#success-modal.active {
    opacity: 1;
    pointer-events: all;
}
#success-modal.active .bg-cream-50 {
    transform: scale(1);
}
