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

body {
    overflow-x: hidden;
}

::selection {
    background-color: rgba(16, 185, 129, 0.3);
    color: #064e3b;
}

/* ─── Scroll Reveal ─── */
.scroll-reveal {
    opacity: 1;
    transform: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal[data-reveal="up"] {
    opacity: 0;
    transform: translateY(32px);
    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[data-reveal="left"] {
    opacity: 0;
    transform: translateX(-32px);
    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[data-reveal="right"] {
    opacity: 0;
    transform: translateX(32px);
    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: none;
}

/* Stagger children */
.grid .scroll-reveal[data-reveal="up"]:nth-child(1) { transition-delay: 0.05s; }
.grid .scroll-reveal[data-reveal="up"]:nth-child(2) { transition-delay: 0.1s; }
.grid .scroll-reveal[data-reveal="up"]:nth-child(3) { transition-delay: 0.15s; }
.grid .scroll-reveal[data-reveal="up"]:nth-child(4) { transition-delay: 0.2s; }
.grid .scroll-reveal[data-reveal="up"]:nth-child(5) { transition-delay: 0.25s; }
.grid .scroll-reveal[data-reveal="up"]:nth-child(6) { transition-delay: 0.3s; }

/* ─── Mobile Nav Transition ─── */
#mobile-nav.open {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

#mobile-nav:not(.open) {
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px);
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #ecfdf5;
}
::-webkit-scrollbar-thumb {
    background: #047857;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #059669;
}

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

/* ─── Focus Visible ─── */
:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ─── 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='%23047857' stroke-width='2.5' 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;
}

/* ─── Form Input Autofill ─── */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #fefcf3 inset !important;
    -webkit-text-fill-color: #064e3b !important;
}
