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

body {
    overflow-x: hidden;
}

::selection {
    background-color: rgba(5, 55, 38, 0.15);
    color: #022C22;
}

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

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

    /* Stagger children */
    .scroll-reveal.stagger > * {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .scroll-reveal.stagger.revealed > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
    .scroll-reveal.stagger.revealed > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
    .scroll-reveal.stagger.revealed > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
    .scroll-reveal.stagger.revealed > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
}

/* When JS is disabled, ensure all content is visible */
.no-js .scroll-reveal {
    opacity: 1;
    transform: none;
}

/* === Navbar === */
#navbar.scrolled {
    background-color: rgba(255, 253, 248, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(2, 44, 34, 0.08);
}

/* === Hero gradient animation === */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

#hero .bg-gradient-to-br {
    background-size: 200% 200%;
    animation: gradientShift 12s ease infinite;
}

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

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

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

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

::-webkit-scrollbar-thumb {
    background: rgba(2, 44, 34, 0.2);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(2, 44, 34, 0.4);
}

/* === Focus styles === */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(5, 55, 38, 0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

/* === Print === */
@media print {
    #navbar, #contact, .scroll-reveal { display: none; }
    body { color: #000; background: #fff; }
}
