* {
    scroll-behavior: smooth;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.gradient-text {
    background: linear-gradient(135deg, #b8a070 0%, #7a6842 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-bg {
    background: linear-gradient(135deg, #fdfcfa 0%, #f9f6f0 50%, #f3ede0 100%);
}

.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px);
}

.btn-primary {
    background: linear-gradient(135deg, #9a8352 0%, #7a6842 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7a6842 0%, #5c5035 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(122, 104, 66, 0.3);
}

.nav-link {
    position: relative;
}

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

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

.section-divider {
    height: 4px;
    background: linear-gradient(90deg, transparent, #c9a961, transparent);
    border-radius: 2px;
}

.rating-star {
    display: inline-block;
    opacity: 0.3;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rating-star.active {
    opacity: 1;
    transform: scale(1);
}

/* Floating Cookies */
@keyframes cookieFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(-10deg);
    }
    25% {
        transform: translate(8px, -18px) rotate(-4deg);
    }
    50% {
        transform: translate(-4px, -30px) rotate(8deg);
    }
    75% {
        transform: translate(-10px, -12px) rotate(4deg);
    }
}

.floating-cookie {
    position: absolute;
    line-height: 1;
    opacity: 0.4;
    animation: cookieFloat 9s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(122, 104, 66, 0.15));
    will-change: transform;
    user-select: none;
}

/* When the physics engine is running, it drives position via transform.
   The CSS keyframes below remain as a no-JS / pre-init fallback. */
.physics-active .floating-cookie {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .floating-cookie {
        animation: none;
    }
}

/* --- Pac-Man cursor --- */
#hero.pacman-active,
#hero.pacman-active * {
    cursor: none !important;
}

.hero-pacman {
    position: fixed;
    top: 0;
    left: 0;
    width: 46px;
    height: 46px;
    pointer-events: none;
    z-index: 60;
    will-change: transform;
}

.pacman-body {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 34%, #ffed80 0%, #ffd400 55%, #f2b400 100%);
    box-shadow:
        inset -3px -4px 8px rgba(214, 138, 0, 0.35),
        0 0 14px rgba(255, 215, 0, 0.55),
        0 4px 10px rgba(90, 60, 0, 0.25);
    animation: chomp 0.45s linear infinite;
}

.pacman-body.gulp {
    transform: scale(1.4);
}

.pacman-eye {
    position: absolute;
    top: 10%;
    right: 22%;
    width: 20%;
    height: 20%;
    border-radius: 50%;
    background: #1c1c1c;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

@keyframes chomp {
    0%, 100% {
        clip-path: polygon(50% 50%, 100% 44%, 0% 0%, 0% 100%, 100% 56%, 50% 50%);
    }
    25%, 75% {
        clip-path: polygon(50% 50%, 100% 26%, 0% 0%, 0% 100%, 100% 74%, 50% 50%);
    }
    50% {
        clip-path: polygon(50% 50%, 100% 8%, 0% 0%, 0% 100%, 100% 92%, 50% 50%);
    }
}

@keyframes cookieEaten {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    35% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.floating-cookie.cookie-eaten {
    animation: cookieEaten 0.3s ease-in forwards;
}

/* --- Baking Process Timeline --- */
.process-flow {
    position: relative;
    max-width: 56rem;
    margin: 0 auto;
}

.process-line,
.process-progress {
    position: absolute;
    left: 50%;
    top: 0;
    width: 4px;
    transform: translateX(-50%);
    border-radius: 9999px;
}

.process-line {
    bottom: 0;
    background: #f3ede0;
}

.process-progress {
    height: 0;
    background: linear-gradient(180deg, #c9a961, #9a8352);
    box-shadow: 0 0 10px rgba(201, 169, 97, 0.5);
}

.process-cookie {
    position: absolute;
    left: 50%;
    top: 0;
    font-size: 1.5rem;
    z-index: 3;
    animation: cookieBob 1.6s ease-in-out infinite;
    filter: drop-shadow(0 3px 5px rgba(122, 104, 66, 0.35));
}

@keyframes cookieBob {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(-8deg);
    }
    50% {
        transform: translate(-50%, calc(-50% - 10px)) rotate(10deg);
    }
}

.process-steps .process-step {
    position: relative;
    width: 50%;
    padding-right: 3rem;
}

.process-steps .process-step:nth-child(even) {
    margin-left: 50%;
    padding-right: 0;
    padding-left: 3rem;
}

.process-dot {
    position: absolute;
    top: 0.75rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #f3ede0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(122, 104, 66, 0.15);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.process-steps .process-step:nth-child(odd) .process-dot {
    right: -1.375rem;
}

.process-steps .process-step:nth-child(even) .process-dot {
    left: -1.375rem;
}

.process-step.in-view .process-dot {
    border-color: #c9a961;
    box-shadow: 0 0 0 6px rgba(201, 169, 97, 0.18), 0 4px 12px rgba(122, 104, 66, 0.15);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

.process-card {
    background: #fff;
    border: 1px solid #f3ede0;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 10px 30px rgba(122, 104, 66, 0.08);
}

/* Cards start hidden only when JS is active; JS adds .in-view on scroll. */
.js .process-card {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.process-step.in-view .process-card {
    opacity: 1;
    transform: translateY(0);
}

.step-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9a8352;
    background: #f9f6f0;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.5rem;
}

/* Trust badges under the timeline */
.process-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
}

.process-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #f3ede0;
    border-radius: 9999px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #5c5035;
    box-shadow: 0 4px 12px rgba(122, 104, 66, 0.08);
}

@media (max-width: 768px) {
    .process-line,
    .process-progress,
    .process-cookie {
        left: 1.25rem;
    }

    .process-steps .process-step,
    .process-steps .process-step:nth-child(even) {
        width: 100%;
        margin-left: 0;
        padding: 0 0 0 3.25rem;
    }

    .process-steps .process-step:nth-child(odd) .process-dot,
    .process-steps .process-step:nth-child(even) .process-dot {
        left: calc(1.25rem - 1.375rem);
        right: auto;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .js .process-card {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .process-cookie,
    .process-dot {
        animation: none;
    }
}

/* Cookie crumb burst when eaten */
.crumb {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 35;
    animation: crumbFly 0.5s ease-out forwards;
}

@keyframes crumbFly {
    to {
        transform: translate(var(--dx), var(--dy)) scale(0.3);
        opacity: 0;
    }
}
