*, *::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;
}

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

/* Scroll reveal animations - progressive enhancement, only active when JS loads */
.reveal {
    opacity: 1;
    transform: none;
    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);
}

.reveal[data-reveal="delay-1"] { transition-delay: 0.1s; }
.reveal[data-reveal="delay-2"] { transition-delay: 0.2s; }
.reveal[data-reveal="delay-3"] { transition-delay: 0.3s; }

.reveal.hidden-reveal {
    opacity: 0;
    transform: translateY(24px);
}

/* Hero animations */
.hero-anim {
    opacity: 1;
    transform: none;
    animation: heroSlideUp 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.hero-anim:nth-child(1) { animation-delay: 0.1s; }
.hero-anim:nth-child(2) { animation-delay: 0.25s; }
.hero-anim:nth-child(3) { animation-delay: 0.4s; }
.hero-anim:nth-child(4) { animation-delay: 0.55s; }
.hero-anim:nth-child(5) { animation-delay: 0.7s; }

.hero-cards {
    animation: heroCards 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s both;
}

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

@keyframes heroCards {
    from {
        opacity: 0;
        transform: translate(-8px, -50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translate(0, -50%) translateY(0);
    }
}

/* Navbar scroll state */
.navbar-scrolled #navbar {
    background-color: rgba(250, 248, 244, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(6, 78, 59, 0.06);
}

.navbar-scrolled #navbar .font-serif {
    color: #064e3b;
}

/* Mobile menu */
.mobile-menu-open {
    overflow: hidden;
}

#mobile-menu.menu-open {
    opacity: 1;
    pointer-events: all;
}

#mobile-menu.menu-open .mobile-link {
    animation: mobileLinkIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

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

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

/* Menu line animation */
.menu-line {
    display: block;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.25s ease;
}

#menu-toggle.active .menu-line:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

#menu-toggle.active .menu-line:nth-child(2) {
    opacity: 0;
}

#menu-toggle.active .menu-line:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
    width: 1.25rem;
}

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

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

/* Smooth image loading */
img {
    background-color: #e8dfc8;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #064e3b;
}
