/* ── Base & Utilities ── */
*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background-color: #fefdf8;
}

/* ── Scroll Reveal (progressive enhancement) ── */
@media (prefers-reduced-motion: no-preference) {
    .scroll-reveal {
        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.revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fallback: ensure content is visible even without JS */
@supports not (animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1)) {
    .scroll-reveal {
        opacity: 1;
        transform: none;
    }
}

/* ── Floating Animations ── */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes float-delayed {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(-1deg); }
}

@keyframes float-delayed2 {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float-delayed 5s ease-in-out infinite;
    animation-delay: 1s;
}

.animate-float-delayed2 {
    animation: float-delayed2 4.5s ease-in-out infinite;
    animation-delay: 2s;
}

/* ── Navbar ── */
#navbar {
    background: transparent;
    transition: background 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

#navbar.scrolled {
    background: rgba(254, 253, 248, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(22, 101, 52, 0.08), 0 4px 24px rgba(22, 101, 52, 0.06);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #166534;
    transition: width 0.2s ease, left 0.2s ease;
    border-radius: 1px;
}

.nav-link:hover::after {
    width: 60%;
    left: 20%;
}

/* ── Mobile Menu ── */
#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-nav-link {
    display: block;
    width: 100%;
    text-align: left;
}

/* ── Back to Top ── */
#back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#back-to-top:not(.visible) {
    transform: translateY(8px);
}

/* ── Form Focus Styles ── */
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* ── Selection ── */
::selection {
    background: #aed0ad;
    color: #0d3b1e;
}

/* ── Print ── */
@media print {
    #navbar, #back-to-top, .scroll-reveal { display: none; }
    body { background: white; }
    section { page-break-inside: avoid; }
}
