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

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

body {
    margin: 0;
    overflow-x: hidden;
}

/* Scroll reveal — progressive enhancement, hidden only when JS enables it */
@media (prefers-reduced-motion: no-preference) {
    .scroll-reveal {
        opacity: 0;
        transform: translateY(24px);
        transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    .scroll-reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero animations — above the fold, always visible */
.hero-anim {
    opacity: 1;
    animation: heroFadeUp 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.hero-anim:nth-child(2) { animation-delay: 0.15s; }
.hero-anim:nth-child(3) { animation-delay: 0.3s; }
.hero-anim:nth-child(4) { animation-delay: 0.45s; }

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

/* Navbar transitions */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

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

#mobileMenu.closed {
    opacity: 0;
    pointer-events: none;
}

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

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

#mobileMenu.open .mobile-link:nth-child(1) { transition-delay: 0.1s; }
#mobileMenu.open .mobile-link:nth-child(2) { transition-delay: 0.2s; }
#mobileMenu.open .mobile-link:nth-child(3) { transition-delay: 0.3s; }

/* Hamburger animation */
#menuBtn.active #bar1 {
    transform: translateY(4px) rotate(45deg);
}

#menuBtn.active #bar2 {
    opacity: 0;
}

#menuBtn.active #bar3 {
    transform: translateY(-4px) rotate(-45deg);
    width: 1.5rem;
}

/* Image lazy load fallback */
img[loading="lazy"] {
    transition: opacity 0.4s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

img[loading="lazy"] {
    opacity: 0;
}

/* Selection color */
::selection {
    background: rgba(22, 101, 52, 0.2);
    color: #14532d;
}

/* Focus styles */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 1px solid #4ade80;
    outline-offset: 2px;
}

/* Subtle scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #86efac;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4ade80;
}
