*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    overflow-x: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #faf8f3;
}
::-webkit-scrollbar-thumb {
    background: #c6d9c8;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9cb99e;
}

/* Selection color */
::selection {
    background-color: #c6d9c8;
    color: #1f2e24;
}

/* Fade-in animations */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }

/* Header scroll state */
header.scrolled {
    background: rgba(253, 252, 249, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(61, 90, 66, 0.08), 0 4px 20px rgba(61, 90, 66, 0.04);
}

header.scrolled #site-header {
    border-bottom: 1px solid rgba(61, 90, 66, 0.06);
}

/* Mobile menu transitions */
#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);
    }
}

/* Hero parallax-like subtle animation */
@keyframes slowZoom {
    from { transform: scale(1.05); }
    to { transform: scale(1); }
}

section#top > div:first-child img {
    animation: slowZoom 20s ease-out forwards;
}

/* Button ripple effect */
button, a {
    -webkit-tap-highlight-color: transparent;
}

/* Focus visible styles */
:focus-visible {
    outline: 2px solid #537558;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .fade-in { opacity: 1; transform: none; transition: none; }
    section#top > div:first-child img { animation: none; }
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Touch device adjustments */
@media (hover: none) and (pointer: coarse) {
    .group:hover { transform: none; }
    .group:hover > div { background-color: initial; }
}
