/* Base Styles */
body { 
    font-family: 'Montserrat', sans-serif; 
    background-color: #F9F8F3; 
    color: #332D2D; 
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
h1, h2, h3, .serif { font-family: 'Playfair Display', serif; }
.accent-color { color: #C47D5E; }
.accent-border { border-color: #C47D5E; }
.bg-dark { background-color: #1a1817; }
.mobile-menu-active { overflow: hidden; }

/* Refined Auto Slider */
.slider-track {
    display: flex;
    white-space: nowrap;
    animation: scroll 60s linear infinite;
    width: fit-content;
}
.slider-track:hover { animation-play-state: paused; }
.slider-mask {
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-33.33%); }
}

/* Nav Animations */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}
.nav-link::after {
    content: '';
    position: absolute;
    width: 0; height: 1px;
    bottom: -4px; left: 0;
    background-color: currentColor;
    transition: width 0.3s ease;
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: #C47D5E; }

#main-nav { transition: padding 0.4s ease, background-color 0.4s ease, box-shadow 0.4s ease; }
.nav-scrolled {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
    background-color: rgba(249, 248, 243, 1) !important;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
}

/* Components */
#scroll-progress {
    position: absolute;
    top: 0; left: 0; height: 3px;
    background: linear-gradient(to right, #E5B299, #C47D5E);
    box-shadow: 0 0 10px rgba(196, 125, 94, 0.5);
    width: 0%; z-index: 60;
}
.pulse-active { animation: progress-pulse 2s infinite ease-in-out; }
@keyframes progress-pulse {
    0%, 100% { filter: brightness(1); transform: scaleY(1); }
    50% { filter: brightness(1.4); transform: scaleY(1.5); }
}

.grain-texture {
    position: fixed;
    inset: -5%; width: 110%; height: 110%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04; pointer-events: none; z-index: 10000;
}

.shimmer-btn { position: relative; overflow: hidden; }
.shimmer-btn::before {
    content: ''; position: absolute; top: 0; left: -150%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-25deg); animation: shimmer 4s infinite;
}
@keyframes shimmer { 0% { left: -150%; } 20%, 100% { left: 150%; } }

/* Modal & Drawer */
#quick-view-modal { transition: opacity 0.4s ease, visibility 0.4s ease; }
#modal-card { transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease; }
#modal-img { transition: filter 0.4s ease, transform 0.7s ease; }

#cart-drawer { transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.cart-drawer-open { overflow: hidden; }

.wiggle { animation: wiggle 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes wiggle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.3) rotate(-15deg); }
    50% { transform: scale(1.3) rotate(15deg); }
}

/* Smooth Page Intro Animations */
.page-intro {
    opacity: 0;
    transform: translateY(30px);
    animation: pageIntro 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.page-intro.delay-1 { animation-delay: 0.15s; }
.page-intro.delay-2 { animation-delay: 0.3s; }
.page-intro.delay-3 { animation-delay: 0.45s; }
@keyframes pageIntro {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Smooth Page Loader */
#page-loader {
    position: fixed;
    inset: 0;
    background: #F9F8F3;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Ingredient Badges */
.ingredient-badge {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 50px; height: 50px; background: white; border: 1px solid #E5E1DA;
    border-radius: 4px; font-size: 1.25rem; transition: all 0.3s ease;
}
.ingredient-badge:hover { border-color: #C47D5E; background: #F9F8F3; }

@media (min-width: 1024px) {
    .ingredient-badge { position: relative; }
    .ingredient-badge::after {
        content: attr(data-tooltip); position: absolute; bottom: 115%; left: 50%;
        transform: translateX(-50%) translateY(5px); background: #1a1817; color: #F9F8F3;
        padding: 4px 10px; border-radius: 4px; font-size: 9px; text-transform: uppercase;
        white-space: pre-wrap; opacity: 0; visibility: hidden; transition: all 0.3s ease;
    }
    .ingredient-badge:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
}

/* Stock & Spinner */
.spinner {
    width: 14px; height: 14px; border: 2px solid rgba(196, 125, 94, 0.2);
    border-top-color: #C47D5E; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stock-item { opacity: 0; animation: fadeInUp 0.5s ease forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

#toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
    background: #1a1817; color: #F9F8F3; padding: 0.75rem 1.5rem; border-radius: 2px;
    font-size: 10px; text-transform: uppercase; z-index: 10005; opacity: 0;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1); pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Desktop Cursor */
@media (min-width: 1024px) {
    body { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><circle cx="8" cy="8" r="3" fill="%23C47D5E"/></svg>') 8 8, auto; }
    a, button { cursor: pointer; }
}

/* Mobile Responsive Fixes */
@media (max-width: 767px) {
    #main-nav { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    #quick-view-modal { align-items: flex-end; padding: 0; }
    #modal-card {
        max-height: 90vh; overflow-y: auto; border-radius: 24px 24px 0 0;
        transform: translateY(100%); transition: transform 0.5s ease;
    }
    #quick-view-modal.opacity-100 #modal-card { transform: translateY(0) !important; }
}