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

body {
    overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #FAF8F3;
}
::-webkit-scrollbar-thumb {
    background: #a3b792;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #5a7a44;
}

/* ===== Selection ===== */
::selection {
    background: #a3b792;
    color: #12180d;
}

/* ===== Navigation ===== */
.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: #5a7a44;
    transition: width 0.3s ease;
}
.nav-link:hover::after {
    width: 100%;
}

/* ===== Header scroll state ===== */
#site-header {
    background: transparent;
    transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}
#site-header.scrolled {
    background: rgba(250, 248, 243, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(52, 74, 41, 0.08);
}
#site-header.scrolled .font-display,
#site-header.scrolled .text-forest-950 {
    color: #24301b !important;
}
#site-header.scrolled .text-forest-600 {
    color: #5a7a44 !important;
}
#site-header.scrolled .nav-link {
    color: #364b29;
}

/* ===== Mobile menu ===== */
#mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}
#mobile-menu.open .mobile-menu-link {
    animation: menuLinkIn 0.4s ease forwards;
    opacity: 0;
    transform: translateY(16px);
}
#mobile-menu.open .mobile-menu-link:nth-child(1) { animation-delay: 0.05s; }
#mobile-menu.open .mobile-menu-link:nth-child(2) { animation-delay: 0.1s; }
#mobile-menu.open .mobile-menu-link:nth-child(3) { animation-delay: 0.15s; }
#mobile-menu.open .mobile-menu-link:nth-child(4) { animation-delay: 0.2s; }
#mobile-menu.open .mobile-menu-link:nth-child(5) { animation-delay: 0.25s; }

@keyframes menuLinkIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Hero animations ===== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-fade-up {
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ===== Scroll line animation ===== */
@keyframes scrollLine {
    0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scaleY(1); transform-origin: top; opacity: 0; }
}
.animate-scroll-line {
    animation: scrollLine 2s ease-in-out infinite;
}

/* ===== Reveal on 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);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal[data-delay="100"] { transition-delay: 0.1s; }
.reveal[data-delay="200"] { transition-delay: 0.2s; }
.reveal[data-delay="300"] { transition-delay: 0.3s; }

/* ===== Back to top ===== */
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ===== Form select arrow ===== */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a7a44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ===== Input autofill ===== */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #FAF8F3 inset !important;
    -webkit-text-fill-color: #24301b !important;
}

/* ===== Image hover ===== */
img {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Utility ===== */
.writing-mode-vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 767px) {
    .font-display.text-5xl {
        font-size: 2.5rem;
        line-height: 1.15;
    }
}

@media (min-width: 768px) {
    .font-display.text-4xl {
        font-size: 3rem;
    }
}
