/* Base styles */
html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

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

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

/* Fallback: always visible if JS is disabled or reduced-motion preferred */
@media (prefers-reduced-motion: reduce) {
    .scroll-reveal {
        opacity: 1;
        transform: none;
    }
}

/* Navigation scroll state */
#site-header.scrolled {
    background: rgba(253, 252, 248, 0.95);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(46, 81, 36, 0.08), 0 4px 20px rgba(0, 0, 0, 0.04);
}

#site-header.scrolled .font-serif,
#site-header.scrolled a:not(.bg-forest-700):not(.bg-cream-50\/90) {
    color: #1f361a;
}

/* Mobile menu transitions */
#mobile-menu {
    animation: slideDown 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile link hover */
.mobile-link {
    position: relative;
}

.mobile-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #50813a;
    transition: width 0.3s ease;
}

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

/* Subtle grain texture overlay for hero */
.hero-grain {
    position: relative;
}

.hero-grain::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    opacity: 0.4;
}

/* Selection color */
::selection {
    background: #9dbe82;
    color: #1f361a;
}

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

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

::-webkit-scrollbar-thumb {
    background: #c6d9b3;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9dbe82;
}

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

/* Smooth image loading */
img {
    image-rendering: auto;
    transition: opacity 0.3s ease;
}

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

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

/* Print styles */
@media print {
    #site-header,
    #mobile-menu,
    .scroll-reveal {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
