/* Somerset County Regional Farmers Market — Custom Styles */

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

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

body {
    overflow-x: hidden;
}

/* Selection color */
::selection {
    background-color: rgba(123, 45, 59, 0.2);
    color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #fdf8f0;
}
::-webkit-scrollbar-thumb {
    background: #d4a8b8;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #c22d4a;
}

/* ========== HERO ANIMATIONS ========== */
.hero-title {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeUp 1s ease-out 0.3s forwards;
}

.hero-subtitle {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 1s ease-out 0.15s forwards;
}

.hero-description {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 1s ease-out 0.45s forwards;
}

.hero-cta {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 1s ease-out 0.6s forwards;
}

.scroll-line {
    animation: scrollPulse 2s ease-in-out infinite;
}

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

@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; transform: scaleY(0.5); transform-origin: top; }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ========== SCROLL REVEAL ANIMATIONS ========== */
/* Default state: visible (progressive enhancement) */
.reveal-up,
.reveal-left,
.reveal-right {
    opacity: 1;
    transform: none;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* When JS is enabled and user prefers motion, set hidden state */
.js-enabled .reveal-up,
.js-enabled .reveal-left,
.js-enabled .reveal-right {
    opacity: 0;
}

.js-enabled .reveal-up {
    transform: translateY(40px);
}

.js-enabled .reveal-left {
    transform: translateX(-40px);
}

.js-enabled .reveal-right {
    transform: translateX(40px);
}

/* ========== NAVIGATION ========== */
#site-header {
    background: transparent;
    transition: background 0.5s ease, box-shadow 0.5s ease, backdrop-filter 0.5s ease;
}

#site-header.scrolled {
    background: rgba(254, 253, 251, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(123, 45, 59, 0.08);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: currentColor;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

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

.mobile-nav-link {
    position: relative;
}

.mobile-nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

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

/* Menu button animation */
.menu-line {
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
}

#menu-btn.active .menu-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

#menu-btn.active .menu-line:nth-child(2) {
    opacity: 0;
}

#menu-btn.active .menu-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
    width: 20px;
}

/* ========== BUTTONS ========== */
button, a[type="submit"] {
    cursor: pointer;
}

/* ========== INPUT FOCUS STYLES ========== */
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* ========== IMAGE LAZY LOAD ========== */
img[data-src] {
    opacity: 0;
    transition: opacity 0.6s ease;
}

img[data-src].loaded {
    opacity: 1;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 640px) {
    .font-serif {
        line-height: 1.2;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .reveal-up,
    .reveal-left,
    .reveal-right {
        opacity: 1;
        transform: none;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    #site-header,
    .scroll-line,
    button {
        display: none;
    }

    body {
        color: #1a1a1a;
        background: white;
    }

    a {
        color: #7B2D3B;
    }
}
