/* ============================================
   Fancy Wheat Field Bakery — Custom Styles
   ============================================ */

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

body {
    overflow-x: hidden;
}

::selection {
    background: #8B2E3F;
    color: #FEFDFB;
}

/* --- Grain Texture Overlay --- */
.hero-grain {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* --- Hero --- */
.hero-bg {
    will-change: transform;
}

.hero-overlay {
    background: linear-gradient(
        180deg,
        rgba(26, 10, 14, 0.45) 0%,
        rgba(26, 10, 14, 0.55) 40%,
        rgba(26, 10, 14, 0.75) 100%
    );
}

/* --- Navbar --- */
#navbar {
    transition: background-color 0.5s ease, backdrop-filter 0.5s ease, box-shadow 0.5s ease;
}

#navbar.scrolled {
    background-color: rgba(254, 253, 251, 0.95);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(139, 46, 63, 0.08);
}

#navbar.scrolled .nav-link {
    color: #3D2B1F;
}

#navbar.scrolled .menu-line {
    background-color: #3D2B1F;
}

#navbar.scrolled .font-serif {
    color: #3D2B1F;
}

/* --- Hero Animations --- */
@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    animation: heroFadeUp 0.8s ease forwards;
    animation-delay: 0.3s;
}

.hero-headline {
    animation: heroFadeUp 0.8s ease forwards;
    animation-delay: 0.5s;
}

.hero-desc {
    animation: heroFadeUp 0.8s ease forwards;
    animation-delay: 0.7s;
}

.hero-ctas {
    animation: heroFadeUp 0.8s ease forwards;
    animation-delay: 0.9s;
}

/* --- Scroll Indicator --- */
@keyframes scrollLine {
    0% {
        transform: scaleY(0);
        transform-origin: top;
        opacity: 0;
    }
    50% {
        transform: scaleY(1);
        transform-origin: top;
        opacity: 1;
    }
    100% {
        transform: scaleY(0);
        transform-origin: bottom;
        opacity: 0;
    }
}

.animate-scroll-line {
    animation: scrollLine 1.8s ease-in-out infinite;
}

/* --- Reveal on Scroll --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Marquee --- */
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes marquee2 {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

.animate-marquee {
    animation: marquee 30s linear infinite;
}

.animate-marquee2 {
    animation: marquee2 30s linear infinite;
}

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

#mobile-menu:not(.open) {
    opacity: 0;
    pointer-events: none;
}

/* Mobile menu link transitions */
.mobile-nav-link {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.3s ease;
}

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

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

/* --- Hamburger Animation --- */
.menu-toggle.active .menu-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.menu-toggle.active .menu-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.active .menu-line:nth-child(3) {
    width: 1.5rem;
    transform: rotate(-45deg) translate(4px, -4px);
}

/* --- Menu Cards --- */
#menu ul li:last-child {
    border-bottom: none !important;
}

/* --- Form --- */
#contact-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B2E3F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

/* --- Focus visible --- */
*:focus-visible {
    outline: 2px solid #8B2E3F;
    outline-offset: 2px;
}

/* --- Reduced Motion --- */
@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-on-scroll {
        opacity: 1;
        transform: none;
    }
    
    .animate-marquee,
    .animate-marquee2 {
        animation: none;
    }
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .hero-headline {
        font-size: 2.25rem;
    }
}
