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

body {
    overflow-x: hidden;
}

::selection {
    background-color: rgba(27, 67, 50, 0.2);
    color: #1B4332;
}

/* ── Scroll Reveal (progressive enhancement) ── */
@media (prefers-reduced-motion: no-preference) {
    .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.revealed {
        opacity: 1;
        transform: translateY(0);
    }
    
    .reveal:nth-child(2) { transition-delay: 0.1s; }
    .reveal:nth-child(3) { transition-delay: 0.2s; }
    .reveal:nth-child(4) { transition-delay: 0.3s; }
}

/* Ensure content is visible even without JS */
.reveal {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(32px);
    }
}

/* ── Hero Fade-In (above the fold — always visible) ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    animation: fadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ── 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(27, 67, 50, 0.08);
}

#navbar.scrolled .nav-link {
    color: #1B4332;
}

#navbar.scrolled .nav-link:hover {
    color: #2d5a2d;
}

#navbar.scrolled a[href="#contact"] {
    color: #1B4332;
    border-color: #1B4332;
}

#navbar.scrolled a[href="#contact"]:hover {
    background: #1B4332;
    color: #FDFCF8;
}

#navbar.scrolled #nav-logo-box {
    border-color: rgba(27, 67, 50, 0.3);
    color: #1B4332;
}

#navbar:not(.scrolled) .nav-link {
    color: rgba(253, 252, 248, 0.8);
}

#navbar:not(.scrolled) .nav-link:hover {
    color: #FDFCF8;
}

#navbar:not(.scrolled) a[href="#contact"] {
    color: #FDFCF8;
    border-color: rgba(253, 252, 248, 0.4);
}

#navbar:not(.scrolled) a[href="#contact"]:hover {
    background: rgba(253, 252, 248, 0.15);
    border-color: rgba(253, 252, 248, 0.7);
}

#navbar:not(.scrolled) #nav-logo-box {
    border-color: rgba(253, 252, 248, 0.4);
    color: #FDFCF8;
}

#navbar:not(.scrolled) #nav-brand {
    color: #FDFCF8;
}

#navbar:not(.scrolled) .menu-line {
    background: #FDFCF8;
}

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

#mobile-menu a {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.2s ease;
}

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

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

/* ── Hamburger Animation ── */
.menu-line {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#menu-toggle[aria-expanded="true"] .menu-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

#menu-toggle[aria-expanded="true"] .menu-line:nth-child(2) {
    opacity: 0;
}

#menu-toggle[aria-expanded="true"] .menu-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
    width: 1.5rem;
    margin-right: 0;
}

/* ── Smooth anchor offset ── */
section[id] {
    scroll-margin-top: 80px;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #8fb38f;
}

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

/* ── Print styles ── */
@media print {
    #navbar, #menu-toggle, .reveal { display: none; }
    body { color: #000; background: #fff; }
}
