/* Base & Reset */
*, *::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;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #fdfcf8;
}
::-webkit-scrollbar-thumb {
    background: #065f46;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

/* Selection */
::selection {
    background: #065f46;
    color: #fdfcf8;
}

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

@keyframes float {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(6, 95, 70, 0.3);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(6, 95, 70, 0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ember {
    animation: float 3s ease-in-out infinite;
}

/* Scroll Reveal — progressive enhancement */
@media (prefers-reduced-motion: no-preference) {
    .scroll-reveal {
        opacity: 0;
        transform: translateY(40px);
        transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .scroll-reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Default visible state for reduced-motion users */
@media (prefers-reduced-motion: reduce) {
    .scroll-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Navbar */
#navbar {
    background: transparent;
}

#navbar.scrolled {
    background: rgba(253, 252, 248, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(6, 95, 70, 0.08);
}

#navbar.scrolled .font-serif {
    color: #065f46 !important;
}

#navbar.scrolled .text-forest-600 {
    color: #047857 !important;
}

#navbar.scrolled .menu-line {
    background: #065f46 !important;
}

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

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

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

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

/* Menu button active state */
.menu-btn-active .menu-line:nth-child(1) {
    transform: rotate(45deg) translate(3px, 3px);
}
.menu-btn-active .menu-line:nth-child(2) {
    opacity: 0;
}
.menu-btn-active .menu-line:nth-child(3) {
    width: 24px;
    margin-left: 0;
    transform: rotate(-45deg) translate(3px, -3px);
}

/* Button pulse on hero */
.hero-cta-btn {
    animation: pulse-glow 2.5s ease-in-out infinite;
}

/* Image hover */
img {
    max-width: 100%;
    height: auto;
}

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

/* Smooth image loading */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Print styles */
@media print {
    nav, #contactForm, .scroll-reveal { display: none; }
    body { background: white; }
    a { color: black; }
}
