/* ==========================================================================
   CookWithPrem — Elegant & Minimalist Aesthetic Style Sheets
   ========================================================================== */

:root {
    /* Refined, Earthy Color Palette -> Old School Vintage */
    --bg-main: #EFE9D9; /* Darker vintage background behind book */
    --bg-card: #FFFFFF;
    --white: #FFFFFF;
    --bg-cream: #FFF8F0;
    --primary: #8B4513; /* SaddleBrown (Old Ink) */
    --primary-light: #C4956A;
    --secondary: #654321; /* Dark Brown */
    --accent: #D2B48C; /* Tan */
    --brown-accent: #A0522D; /* Sienna */
    --brown-accent-dark: #5D3A1A;
    --primary-sage-dark: #4E6B5C;
    
    /* Text */
    --text-dark: #3E2723; /* Dark Sepia Ink */
    --text-muted: #5D4037; /* Lighter Sepia Ink */
    --border-color: #D7CCC8; /* Aged Border */
    
    /* Subtle Shadows */
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.1);
    
    /* Radii */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 30px;
}

.text-center {
    text-align: center;
}

/* Elegant Typography */
h1, h2, h3, .logo, .serif {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-dark);
}

/* ==========================================================================
   Animations
   ========================================================================== */
.reveal, .reveal-up {
    opacity: 0;
    transform: translateY(35px) scale(0.98);
    filter: blur(4px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                filter 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

/* Directional Reveal Variations */
.reveal-left {
    opacity: 0;
    transform: translateX(-45px) rotate(-1deg);
    filter: blur(4px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                filter 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal-right {
    opacity: 0;
    transform: translateX(45px) rotate(1deg);
    filter: blur(4px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                filter 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal-zoom {
    opacity: 0;
    transform: scale(0.88);
    filter: blur(6px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), 
                filter 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

.reveal-blur {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(15px);
    transition: opacity 0.8s ease-out, filter 0.8s ease-out, transform 0.8s ease-out;
}

/* Active State for all Reveal classes */
.reveal.active, 
.reveal-up.active, 
.reveal-left.active, 
.reveal-right.active, 
.reveal-zoom.active, 
.reveal-blur.active {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
    filter: blur(0px);
}

/* Dynamic Stagger Delays */
.delay-100 { transition-delay: 0.1s !important; }
.delay-200 { transition-delay: 0.2s !important; }
.delay-300 { transition-delay: 0.3s !important; }
.delay-400 { transition-delay: 0.4s !important; }
.delay-500 { transition-delay: 0.5s !important; }

/* Subheading Animated Underline Beam */
.sub-heading {
    position: relative;
    display: inline-block;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
}

.sub-heading::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.reveal.active .sub-heading::after,
.reveal-left.active .sub-heading::after,
.reveal-up.active .sub-heading::after,
.sub-heading.active::after {
    width: 100%;
}

/* Text Focus Shimmer Glow */
.text-shimmer {
    background: linear-gradient(120deg, #3E2723 0%, #8B4513 40%, #C4956A 50%, #8B4513 60%, #3E2723 100%);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    transition: background-position 1.2s ease;
}

.reveal.active .text-shimmer,
.reveal-up.active .text-shimmer,
.reveal-left.active .text-shimmer,
.reveal-right.active .text-shimmer,
.text-shimmer.active {
    animation: textShimmerGlow 3s infinite alternate ease-in-out;
}

@keyframes textShimmerGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal-up, .reveal-left, .reveal-right, .reveal-zoom, .reveal-blur {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
}

/* ==========================================================================
   Navbar (Clean, Delicate)
   ========================================================================== */
.navbar {
    background-color: rgba(249, 248, 246, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.logo-img {
    height: 42px;
    width: 42px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo:hover .logo-img {
    transform: rotate(5deg) scale(1.05);
}

.nav-links {
    display: flex;
    gap: 35px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.3s ease;
    padding: 6px 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

/* Mobile Hamburger Button Toggle */
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 120;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-bar {
    display: block;
    width: 24px;
    height: 2.5px;
    background-color: var(--text-dark);
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, background-color 0.3s ease;
}

.nav-toggle.open .hamburger-bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
    background-color: var(--primary);
}

.nav-toggle.open .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.nav-toggle.open .hamburger-bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
    background-color: var(--primary);
}

/* Mobile Book Tabs & Reader Styles */
.book-mobile-tabs {
    display: none;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.mobile-tab-btn {
    flex: 1;
    padding: 12px 14px;
    border-radius: 30px;
    border: 1.5px solid var(--border-color);
    background: #FFFFFF;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: var(--shadow-sm);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tab-btn.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(139, 69, 19, 0.25);
}

/* ==========================================================================
   Hero Section (Split Layout)
   ========================================================================== */
.homepage-hero {
    padding: 100px 0 80px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: 64px;
    line-height: 1.1;
    margin-bottom: 25px;
    color: var(--text-dark);
}

.hero-content h1 i {
    color: var(--primary);
    font-style: italic;
}

.hero-content p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 450px;
}

.cta-btn {
    display: inline-block;
    background-color: var(--text-dark);
    color: var(--bg-main);
    text-decoration: none;
    padding: 16px 45px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    transition: all 0.4s ease;
    border: 1px solid var(--text-dark);
}

.cta-btn:hover {
    background-color: transparent;
    color: var(--text-dark);
}

.hero-image-wrapper {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.hero-image-wrapper img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    border-radius: 200px 200px 0 0; /* Arch shape for aesthetic feel */
}

/* --- New UI/UX 3D Animations --- */
.homepage-hero {
    position: relative;
    overflow: hidden;
}
.floating-item {
    position: absolute;
    z-index: 1;
    pointer-events: none; /* Let clicks pass through */
    opacity: 0.8;
    animation: fallingVeggie linear infinite;
    top: -15%; /* Start above screen */
    will-change: transform, opacity; /* GPU compositing — keeps off main thread */
    contain: layout style; /* Isolated from page layout for performance */
}

@keyframes fallingVeggie {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.9; }
    90% { opacity: 0.9; }
    100% { transform: translateY(120vh) rotate(360deg); opacity: 0; }
}

.float-1 { left: 5%; animation-duration: 12s; animation-delay: 0s; font-size: 40px; }
.float-2 { left: 15%; animation-duration: 18s; animation-delay: -5s; font-size: 28px; }
.float-3 { left: 25%; animation-duration: 14s; animation-delay: -2s; font-size: 35px; }
.float-4 { left: 35%; animation-duration: 16s; animation-delay: -8s; font-size: 24px; }
.float-5 { left: 45%; animation-duration: 13s; animation-delay: -1s; font-size: 38px; }
.float-6 { left: 55%; animation-duration: 17s; animation-delay: -6s; font-size: 30px; }
.float-7 { left: 65%; animation-duration: 15s; animation-delay: -3s; font-size: 36px; }
.float-8 { left: 75%; animation-duration: 19s; animation-delay: -9s; font-size: 26px; }
.float-9 { left: 85%; animation-duration: 14s; animation-delay: -4s; font-size: 42px; }
.float-10 { left: 95%; animation-duration: 16s; animation-delay: -7s; font-size: 32px; }
.float-11 { left: 20%; animation-duration: 15s; animation-delay: -10s; font-size: 34px; }
.float-12 { left: 80%; animation-duration: 13s; animation-delay: -11s; font-size: 30px; }

.cooking-animation {
    width: 60px;
    height: 60px;
    margin-left: 20px;
}
.boiling-pot {
    width: 100%;
    height: 100%;
}
.bubble {
    animation: bubbleUp 1.5s infinite ease-in;
    opacity: 0;
}
.b1 { animation-delay: 0s; }
.b2 { animation-delay: 0.4s; }
.b3 { animation-delay: 0.8s; }

@keyframes bubbleUp {
    0% { transform: translateY(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-15px); opacity: 0; }
}

.steam {
    animation: steamRise 2s infinite ease-out;
    opacity: 0;
}
.s1 { animation-delay: 0s; }
.s2 { animation-delay: 0.6s; }
.s3 { animation-delay: 1.2s; }

@keyframes steamRise {
    0% { transform: translateY(0) scaleX(1); opacity: 0; }
    20% { opacity: 0.6; }
    100% { transform: translateY(-20px) scaleX(1.5); opacity: 0; }
}

#hero-img {
    transition: transform 0.1s ease-out;
    will-change: transform;
}
/* ----------------------------- */

/* ==========================================================================
   General Components
   ========================================================================== */
.section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.sub-heading {
    display: block;
    color: var(--secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 42px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

/* Page Banner */
.page-banner {
    background-color: var(--bg-card);
    padding: 80px 0;
    margin-bottom: 60px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.page-banner h1 {
    font-size: 48px;
    margin-bottom: 15px;
}

.page-banner p {
    font-size: 18px;
    color: var(--text-muted);
}

/* ==========================================================================
   Intro Section
   ========================================================================== */
.intro-image {
    width: 100%;
    height: 500px;
    object-fit: cover;
    border-radius: 4px;
}

.intro-text h2 {
    font-size: 40px;
    margin-bottom: 25px;
}

.intro-text p {
    font-size: 17px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.text-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    margin-top: 15px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.text-link:hover {
    border-color: var(--primary);
}

/* ==========================================================================
   3D Premium Pop-Up Categories Showcase
   ========================================================================== */
.categories-showcase-3d {
    background-color: #FAF8F5; /* Deeper creamy neutral to pop cards */
    padding: 100px 0;
    overflow: visible;
}

.category-3d-deck {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 35px;
    margin-top: 100px; /* Leave space for floating plates */
    perspective: 2000px;
    overflow: visible;
}

.card-3d-wrapper {
    text-decoration: none;
    color: inherit;
    display: block;
    outline: none;
    overflow: visible;
}

.card-3d {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    height: 280px;
    padding: 30px;
    transform-style: preserve-3d;
    transition: box-shadow 0.4s ease, transform 0.1s ease-out;
    box-shadow: 0 10px 25px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    overflow: visible;
}

.card-3d-bg {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #ffffff 0%, #FAF7F0 100%);
    z-index: 1;
    pointer-events: none;
}

.card-3d-glare {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 80%);
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.card-3d-content {
    position: relative;
    z-index: 2;
    transform-style: preserve-3d;
    transform: translateZ(40px);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

/* 3D Floating Plate styling */
.plate-3d-container {
    position: absolute;
    top: -190px;
    width: 150px;
    height: 150px;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    transform: translateZ(60px);
}

.plate-3d-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 6px solid #FFFFFF;
    box-shadow: 0 15px 35px rgba(101, 67, 33, 0.2);
    z-index: 2;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.plate-3d-shadow {
    position: absolute;
    bottom: -15px;
    left: 10%;
    width: 80%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(101, 67, 33, 0.3) 0%, rgba(0,0,0,0) 70%);
    z-index: 1;
    transform: rotateX(80deg) translateZ(-10px);
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s ease;
}

.card-3d-tag {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-light);
    letter-spacing: 0.15em;
    margin-bottom: 8px;
    transform: translateZ(20px);
    display: inline-block;
}

.card-3d h3 {
    font-size: 22px;
    color: var(--text-dark);
    margin-bottom: 10px;
    font-family: 'Playfair Display', Georgia, serif;
    transform: translateZ(30px);
}

.card-3d p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    transform: translateZ(10px);
    margin: 0;
}

/* Hover Animations */
.card-3d-wrapper:hover .card-3d {
    box-shadow: 0 30px 60px rgba(101, 67, 33, 0.12);
}

.card-3d-wrapper:hover .card-3d-glare {
    opacity: 1;
}

.card-3d-wrapper:hover .plate-3d-container {
    transform: translateZ(90px) translateY(-15px) scale(1.1) rotate(15deg);
}

.card-3d-wrapper:hover .plate-3d-shadow {
    transform: rotateX(80deg) translateZ(-10px) scale(1.3);
    opacity: 0.7;
}

@media (max-width: 1024px) {
    .category-3d-deck {
        grid-template-columns: repeat(2, 1fr);
        gap: 80px 30px;
        padding-top: 60px;
    }
    .plate-3d-container {
        width: 130px;
        height: 130px;
        top: -160px;
    }
    .card-3d {
        height: 250px;
    }
}

@media (max-width: 600px) {
    .category-3d-deck {
        grid-template-columns: 1fr;
        gap: 100px;
        padding-top: 60px;
    }
}

/* ==========================================================================
   Recipes Catalog Controls
   ========================================================================== */
.main-content {
    padding-bottom: 60px;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.category-filters {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-bottom: 25px;
}

.category-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8px 16px;
    background: rgba(93, 64, 55, 0.06); /* Extremely subtle sepia track background */
    border-radius: var(--radius-md);
    border: 1px solid rgba(215, 204, 200, 0.4);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* Ensure dynamic nested row has no double backgrounds */
#category-list.category-buttons-row {
    background: transparent;
    border: none;
    padding: 0;
    gap: 12px;
    box-shadow: none;
    /* Always horizontal scrollable — never wrap */
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    padding-bottom: 4px;
}

#category-list.category-buttons-row::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(215, 204, 200, 0.6);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 8px 18px;
    border-radius: var(--radius-sm); /* Keep matching the elegant vintage book/card feel */
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.filter-btn span {
    font-size: 15px;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

/* Hover State */
.filter-btn:hover {
    color: var(--primary);
    background: var(--white);
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(93, 64, 55, 0.08);
}

.filter-btn:hover span {
    transform: scale(1.35) rotate(8deg);
}

/* Active State */
.filter-btn.active {
    color: var(--white);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.3);
    transform: translateY(-1px);
}

.filter-btn.active span {
    transform: scale(1.15);
}

/* Pop effect on transition to active */
@keyframes buttonPop {
    0% { transform: translateY(-1px) scale(1); }
    50% { transform: translateY(-3px) scale(1.08); }
    100% { transform: translateY(-1px) scale(1); }
}

.filter-btn.active {
    animation: buttonPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.search-box {
    width: 100%;
    max-width: 600px;
}

.search-box input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 30px;
    font-size: 17px;
    border-radius: var(--radius-full);
    outline: none;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--secondary);
    box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   Recipe Book Layout (Interactive Flipbook)
   ========================================================================== */
.book-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 40px auto;
    max-width: 1200px;
}

/* On desktop: buttons appear left/right of the book as flex siblings */
.book-nav-btns-row {
    display: contents;
}
#prev-page { order: 1; }
.book-cover { order: 2; }
#next-page { order: 3; }


.book-nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--primary);
    font-size: 18px;
    font-weight: 500;
    font-family: 'Playfair Display', serif;
    cursor: pointer;
    padding: 20px 15px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    height: 100px;
    display: flex;
    align-items: center;
}

.book-nav-btn:hover:not(:disabled) {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    color: var(--text-dark);
}

.book-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
    box-shadow: none;
}

/* Book Cover Styling */
.book-cover {
    background-color: #3e2723; /* Dark brown vintage leather look */
    border-radius: 12px;
    padding: 10px 15px; /* Cover edges extending beyond the pages */
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 0 0 2px rgba(255, 255, 255, 0.05);
    position: relative;
    /* Simulated inner spine crease on the cover itself */
    background-image: linear-gradient(to right, 
        rgba(0,0,0,0.1) 0%, 
        rgba(0,0,0,0.5) 48%, 
        rgba(0,0,0,0.8) 50%, 
        rgba(0,0,0,0.5) 52%, 
        rgba(0,0,0,0.1) 100%);
    perspective: 2500px; /* Perspective applied to the cover */
}

.book-spread {
    display: flex;
    background-color: #F4EAD5; /* Vintage Pale Yellow Paper */
    background-image: 
        radial-gradient(circle at center, transparent 70%, rgba(139, 69, 19, 0.05) 100%),
        linear-gradient(to right, rgba(255,255,255,0.4) 0%, transparent 10%, transparent 90%, rgba(255,255,255,0.4) 100%);
    border-radius: 4px;
    box-shadow: 
        inset 0 0 0 1px rgba(139, 69, 19, 0.2),
        -1px 1px 0px 0px #e6d8bc,
        -2px 2px 0px 0px #e6d8bc,
        -3px 3px 0px 0px #e6d8bc,
        -4px 4px 0px 0px #e6d8bc,
        1px 1px 0px 0px #e6d8bc,
        2px 2px 0px 0px #e6d8bc,
        3px 3px 0px 0px #e6d8bc,
        4px 4px 0px 0px #e6d8bc; /* Layered page edges effect */
    width: 1150px;
    height: 650px; /* Optimized height for better aspect ratio */
    position: relative;
    transition: opacity 0.4s ease;
    font-family: 'Playfair Display', Georgia, serif; /* Old school serif for entire book */
    transform-style: preserve-3d;
}

/* 3D Page Turn Animation */
.flip-page {
    width: 50%;
    height: 100%;
    position: absolute;
    top: 0;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    z-index: 10;
}

.flip-page.next {
    right: 0;
    transform-origin: left center;
}

.flip-page.prev {
    left: 0;
    transform-origin: right center;
}

.flip-front, .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background-color: #F4EAD5;
    background-image: 
        radial-gradient(circle at center, transparent 70%, rgba(139, 69, 19, 0.05) 100%),
        linear-gradient(to right, rgba(255,255,255,0.4) 0%, transparent 10%, transparent 90%, rgba(255,255,255,0.4) 100%);
    box-shadow: inset 0 0 0 1px rgba(139, 69, 19, 0.2);
    overflow: hidden;
    padding: 50px 60px; /* Matching the page padding */
}

/* Dynamic Shadows for Flipping Page */
.flip-front::after, .flip-back::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    transition: background 0.8s, opacity 0.8s;
}

.flip-page.next .flip-front::after {
    background: linear-gradient(to right, rgba(0,0,0,0) 80%, rgba(0,0,0,0.1) 100%);
}

.flip-page.prev .flip-front::after {
    background: linear-gradient(to left, rgba(0,0,0,0) 80%, rgba(0,0,0,0.1) 100%);
}

.flip-page.next.is-flipping .flip-front::after {
    background: linear-gradient(to right, rgba(0,0,0,0) 50%, rgba(0,0,0,0.4) 100%);
}

.flip-page.prev.is-flipping .flip-front::after {
    background: linear-gradient(to left, rgba(0,0,0,0) 50%, rgba(0,0,0,0.4) 100%);
}

.flip-page.next .flip-back::after {
    background: linear-gradient(to left, rgba(0,0,0,0) 50%, rgba(0,0,0,0.4) 100%);
}

.flip-page.prev .flip-back::after {
    background: linear-gradient(to right, rgba(0,0,0,0) 50%, rgba(0,0,0,0.4) 100%);
}

.flip-page.next .flip-back {
    transform: rotateY(180deg);
}

.flip-page.prev .flip-back {
    transform: rotateY(-180deg);
}

.flip-page.next.is-flipping {
    transform: rotateY(-180deg);
}

.flip-page.prev.is-flipping {
    transform: rotateY(180deg);
}

.book-page {
    flex: 1;
    padding: 50px 60px; /* Elegant wide margins */
    overflow-y: auto; /* Allow smooth scrolling if content is long */
    position: relative;
}

.left-page {
    border-radius: 8px 0 0 8px;
}

.right-page {
    border-radius: 0 8px 8px 0;
}

/* Custom Scrollbar for pages */
.book-page::-webkit-scrollbar {
    width: 6px;
}
.book-page::-webkit-scrollbar-track {
    background: transparent;
    margin: 20px 0; /* padding for track */
}
.book-page::-webkit-scrollbar-thumb {
    background: rgba(139, 69, 19, 0.2);
    border-radius: 10px;
}
.book-page::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 69, 19, 0.4);
}

/* Book Binding (Spine) */
.book-spine {
    width: 50px;
    background: linear-gradient(to right, 
        rgba(0, 0, 0, 0.05) 0%,
        rgba(93, 64, 55, 0.4) 10%, 
        rgba(93, 64, 55, 0.7) 30%, 
        rgba(93, 64, 55, 0.9) 50%, 
        rgba(93, 64, 55, 0.7) 70%, 
        rgba(93, 64, 55, 0.4) 90%,
        rgba(0, 0, 0, 0.05) 100%);
    box-shadow: inset 4px 0 10px rgba(0,0,0,0.3), inset -4px 0 10px rgba(0,0,0,0.3);
    z-index: 2;
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(0, 0, 0, 0.2);
}

.left-page::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

.right-page::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 30px;
    background: linear-gradient(to right, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

/* Left Page Content Styling */
.book-recipe-title {
    font-size: 30px;
    margin-bottom: 10px;
    line-height: 1.1;
}

.book-recipe-badges {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.detail-badge {
    display: inline-block;
    background: var(--bg-cream);
    color: var(--secondary);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.book-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: transparent;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.book-meta-item {
    display: flex;
    flex-direction: column;
}

.book-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--secondary);
    letter-spacing: 0.1em;
    font-weight: 600;
}

.book-meta-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}

/* Right Page Content Styling */
.book-section-title {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.book-ingredients {
    list-style: none;
    margin-bottom: 20px;
}

.book-ingredients li {
    padding: 4px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.book-ingredients li span.qty {
    font-weight: 600;
    color: var(--secondary);
}

.book-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.book-step {
    display: flex;
    gap: 15px;
}

.book-step-num {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 24px;
    color: var(--primary);
    line-height: 1;
    min-width: 25px;
    font-style: italic;
}

.book-step-content h4 {
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.book-step-content p {
    font-size: 15px;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Empty / Loading states */
.empty-book {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
    font-size: 18px;
}

/* Responsive Book Layout */
@media(max-width: 1024px) {
    .book-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .book-cover {
        width: 100%;
        padding: 8px;
    }
    .book-spread {
        width: 100%;
        height: auto;
        flex-direction: column;
    }
    .book-spine {
        width: 100%;
        height: 20px;
        background: linear-gradient(to bottom, 
            rgba(0,0,0,0.05) 0%, 
            rgba(0,0,0,0.1) 50%, 
            rgba(0,0,0,0.05) 100%);
    }
    /* Prev/Next buttons: side by side, centered, equal width */
    .book-nav-btns-row {
        display: flex;
        width: 100%;
        gap: 15px;
        order: 2;
    }
    #prev-page,
    #next-page {
        flex: 1;
        height: 52px;
        justify-content: center;
        font-size: 16px;
        min-width: 0;
        order: unset;
    }
    .book-nav-btn {
        width: 100%;
        height: 52px;
        justify-content: center;
    }
    .book-cover {
        order: 1;
        width: 100%;
    }
}

/* ==========================================================================
   Chef's Special Layout with Stats
   ========================================================================== */
.chef-special-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

@media (max-width: 900px) {
    .chef-special-layout {
        flex-direction: column;
    }
}

/* ==========================================================================
   3D Rotating Featured Recipe Carousel
   ========================================================================== */
.carousel-3d-viewport {
    position: relative;
    width: 100%;
    height: 520px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
    overflow: visible; /* Need visible for 3D translations */
    padding: 20px 0;
}

.carousel-3d-stage {
    position: relative;
    width: 320px;
    height: 440px;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-3d-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    height: 440px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transition: opacity 0.5s ease, filter 0.5s ease, transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0.6;
    filter: grayscale(40%) blur(1px);
    pointer-events: none; /* Let active card capture mouse events */
}

/* Card positioning on the 3D ring (radius = 260px) */
.carousel-3d-card[data-index="0"] { transform: rotateY(0deg) translateZ(260px); }
.carousel-3d-card[data-index="1"] { transform: rotateY(72deg) translateZ(260px); }
.carousel-3d-card[data-index="2"] { transform: rotateY(144deg) translateZ(260px); }
.carousel-3d-card[data-index="3"] { transform: rotateY(216deg) translateZ(260px); }
.carousel-3d-card[data-index="4"] { transform: rotateY(288deg) translateZ(260px); }

/* Focused/Active card styling */
.carousel-3d-card.active {
    opacity: 1;
    filter: none;
    pointer-events: auto;
    z-index: 10;
}

/* Premium Card Elements */
.carousel-3d-card-inner {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    transform-style: preserve-3d;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    background: #000;
}

.carousel-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
    will-change: transform;
    pointer-events: none;
}

.carousel-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

.carousel-glare {
    position: absolute;
    top: 50%; left: 50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 60%);
    transform: translate(-50%, -50%) translate(0, 0);
    opacity: 0;
    pointer-events: none;
    z-index: 3;
}

.carousel-content {
    position: absolute;
    bottom: 40px;
    left: 30px;
    right: 30px;
    z-index: 4;
    transform: translateZ(30px);
    color: white;
    text-shadow: 0 4px 10px rgba(0,0,0,0.4);
    pointer-events: none;
}

.carousel-badge {
    display: inline-block;
    color: white;
    padding: 4px 10px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-weight: 700;
}

/* Unique badge styles */
.badge-popular { background: #E65100; }
.badge-signature { background: #1B5E20; }
.badge-trending { background: #0D47A1; }
.badge-choice { background: #4A148C; }
.badge-classic { background: #3E2723; }

.carousel-content h3 {
    font-size: 26px;
    color: white;
    margin-bottom: 8px;
    font-family: 'Playfair Display', Georgia, serif;
}

.carousel-content p {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    margin-bottom: 20px;
    line-height: 1.4;
}

.carousel-btn {
    pointer-events: auto;
    background: white;
    color: var(--text-dark);
    border: none;
    font-size: 12px;
    padding: 8px 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.carousel-btn:hover {
    background: var(--primary);
    color: white;
}

/* Navigation Buttons */
.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--text-dark);
    font-size: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.carousel-control:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.carousel-control.prev { left: 10%; }
.carousel-control.next { right: 10%; }

/* Indicator Dots */
.carousel-indicators {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 20;
}

.carousel-indicators .indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-indicators .indicator.active {
    background: var(--primary);
    transform: scale(1.3);
}

@media (max-width: 768px) {
    .carousel-control.prev { left: 2%; }
    .carousel-control.next { right: 2%; }
    .carousel-3d-viewport { height: 480px; }
}

/* Animated Blob Profile */
.blob-container {
    position: relative;
    width: 350px;
    height: 350px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blob-shape {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--brown-accent));
    animation: blob-bounce 6s infinite alternate ease-in-out;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2), inset 0 0 20px rgba(255,255,255,0.4);
    z-index: 1;
    overflow: hidden;
}

.blob-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    transform: scale(1.1); /* To cover the edges during animation */
}

@keyframes blob-bounce {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    33% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    66% { border-radius: 50% 50% 40% 60% / 60% 40% 50% 60%; }
    100% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}

.about-email-display {
    background: var(--white);
    padding: 12px 25px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: var(--text-dark);
    font-weight: 500;
    border: 2px solid var(--primary-light);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin: 20px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.about-email-display:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    border-color: var(--primary);
}

.about-enhanced-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    margin-bottom: 60px;
}

@media (max-width: 800px) {
    .about-enhanced-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* ==========================================================================
   3D Automatic Cooking Animation
   ========================================================================== */
.cooking-3d-showcase {
    background-color: var(--bg-card);
    overflow: hidden;
    padding: 100px 0;
}

.cooking-3d-scene-container {
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
    position: relative;
}

/* Three.js Canvas Container */
#threejs-cooking-canvas {
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    z-index: 10;
}
#threejs-cooking-canvas canvas {
    display: block;
    outline: none;
    cursor: grab;
}
#threejs-cooking-canvas canvas:active {
    cursor: grabbing;
}
/* Magic Frame Animation */
.intro-image-container {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 5;
}

.magic-frame {
    position: relative;
    border-radius: 20px;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    cursor: pointer;
}

.magic-frame:hover {
    transform: rotateY(-10deg) rotateX(10deg) scale(1.05);
    box-shadow: -20px 30px 60px rgba(0,0,0,0.3);
}

.magic-image {
    width: 100%;
    border-radius: 20px;
    display: block;
    position: relative;
    z-index: 2;
    transition: filter 0.5s;
}

.magic-frame:hover .magic-image {
    filter: contrast(1.1) saturate(1.2);
}

/* Dynamic Edge Glow */
.magic-glow {
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    background: linear-gradient(45deg, #ff4500, #ff8800, #ffcc00, #ff4500);
    background-size: 400%;
    z-index: 1;
    border-radius: 24px;
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.5s;
    animation: glowMove 3s linear infinite;
}

.magic-frame:hover .magic-glow {
    opacity: 0.8;
}

@keyframes glowMove {
    0% { background-position: 0 0; }
    50% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* ==========================================================================
   Chef's Special Section Cooking Animated Background
   ========================================================================== */
.special-3d-section {
    position: relative;
    overflow: hidden;
}

.special-3d-section .container {
    position: relative;
    z-index: 2;
}

.special-cooking-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.cooking-bg-item {
    position: absolute;
    opacity: 0.6;
    filter: drop-shadow(0 8px 16px rgba(139, 69, 19, 0.04));
    transition: opacity 0.5s ease;
}

/* Positions for background items */
.chef-whisk-bg {
    top: 15%;
    left: 6%;
}

.pot-boil-bg {
    top: 10%;
    right: 6%;
}

.pan-flip-bg {
    bottom: 12%;
    left: 8%;
}

.spice-particles-bg {
    bottom: 15%;
    right: 8%;
}

.rolling-board-bg {
    top: 48%;
    left: 4%;
    transform: translateY(-50%);
}

/* Animations */

/* 1. Pan flip & fire animation */
@keyframes panSway {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    40% { transform: translate(-2px, -6px) rotate(-3deg); }
    50% { transform: translate(0, -8px) rotate(0deg); }
    60% { transform: translate(2px, -6px) rotate(3deg); }
}
.bg-pan-group {
    animation: panSway 4s ease-in-out infinite;
    transform-origin: 80px 45px;
}

@keyframes foodFlip1 {
    0%, 45%, 100% { transform: translate(0, 0) scale(1) rotate(0); opacity: 0; }
    50% { opacity: 1; }
    70% { transform: translate(-10px, -35px) scale(1.2) rotate(-90deg); opacity: 1; }
    90% { opacity: 0.5; }
}
@keyframes foodFlip2 {
    0%, 47%, 100% { transform: translate(0, 0) scale(1) rotate(0); opacity: 0; }
    52% { opacity: 1; }
    72% { transform: translate(2px, -45px) scale(1.1) rotate(120deg); opacity: 1; }
    92% { opacity: 0.5; }
}
@keyframes foodFlip3 {
    0%, 43%, 100% { transform: translate(0, 0) scale(1) rotate(0); opacity: 0; }
    48% { opacity: 1; }
    68% { transform: translate(8px, -30px) scale(1.3) rotate(45deg); opacity: 1; }
    88% { opacity: 0.5; }
}
.bg-flip-food.f1 { animation: foodFlip1 4s ease-in-out infinite; }
.bg-flip-food.f2 { animation: foodFlip2 4s ease-in-out infinite; }
.bg-flip-food.f3 { animation: foodFlip3 4s ease-in-out infinite; }

/* 2. Pot Lid Jiggle & Steam */
@keyframes lidJiggle {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(0, -2px) rotate(1deg); }
    22% { transform: translate(-1px, -1px) rotate(-1deg); }
    24% { transform: translate(1px, -3px) rotate(1.5deg); }
    26% { transform: translate(-1px, -2px) rotate(-0.5deg); }
    28% { transform: translate(0, 0) rotate(0deg); }
}
.bg-lid {
    animation: lidJiggle 3s ease-in-out infinite;
    transform-origin: 50px 38px;
}

@keyframes bgSteamRise {
    0% { transform: translateY(10px) scaleX(0.8); opacity: 0; }
    15% { opacity: 0.5; }
    80% { opacity: 0; }
    100% { transform: translateY(-25px) scaleX(1.4); opacity: 0; }
}
.bg-steam {
    animation: bgSteamRise 3.5s infinite ease-out;
    transform-origin: bottom center;
}
.bg-steam.s1 { animation-delay: 0s; }
.bg-steam.s2 { animation-delay: 1.2s; }
.bg-steam.s3 { animation-delay: 2.4s; }

/* 3. Chef Hat & Whisk */
@keyframes hatFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(1.5deg); }
}
.bg-hat {
    animation: hatFloat 5s ease-in-out infinite;
    transform-origin: center;
}

@keyframes whiskStir {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(3px, -2px) rotate(12deg); }
}
.bg-whisk {
    animation: whiskStir 3.5s ease-in-out infinite;
    transform-origin: 50px 72px;
}

/* 4. Shaker tilt & spice particles */
@keyframes shakerTilt {
    0%, 100% { transform: rotate(0deg); }
    40% { transform: rotate(0deg); }
    55% { transform: rotate(-25deg) translate(-2px, -2px); }
    75% { transform: rotate(-25deg) translate(-2px, -2px); }
    85% { transform: rotate(0deg); }
}
.bg-shaker {
    animation: shakerTilt 4.5s ease-in-out infinite;
    transform-origin: 50px 70px;
}

@keyframes spiceFall {
    0%, 48% { transform: translate(0, 0); opacity: 0; }
    55% { opacity: 0.8; }
    75% { transform: translate(-12px, 28px); opacity: 0; }
    100% { transform: translate(-12px, 28px); opacity: 0; }
}
.bg-spice {
    animation: spiceFall 4.5s ease-in-out infinite;
}
.bg-spice.sp1 { animation-delay: 0s; }
.bg-spice.sp2 { animation-delay: 0.15s; }
.bg-spice.sp3 { animation-delay: 0.3s; }
.bg-spice.sp4 { animation-delay: 0.45s; }

/* 5. Pin Roll & Board float */
@keyframes pinRoll {
    0%, 100% { transform: translate(0, 0) rotate(15deg); }
    50% { transform: translate(-15px, 8px) rotate(5deg); }
}
.bg-pin {
    animation: pinRoll 6s ease-in-out infinite;
    transform-origin: center;
}

@keyframes boardFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.bg-board {
    animation: boardFloat 7s ease-in-out infinite;
    transform-origin: center;
}

/* ==========================================================================
   Recipe Mobile Optimization Styling (Base Styles)
   ========================================================================== */
.book-recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 10px;
}

.recipe-index-indicator {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Inter', sans-serif;
    background: rgba(139, 69, 19, 0.08);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    margin-top: 5px;
    border: 1px solid rgba(139, 69, 19, 0.15);
}

.book-mobile-tabs {
    display: none;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.mobile-tab-btn {
    flex: 1;
    background: rgba(93, 64, 55, 0.06);
    border: 1px solid rgba(215, 204, 200, 0.6);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mobile-tab-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
}

/* Responsiveness: hide background items on small screens to avoid clutter */
@media (max-width: 992px) {
    .cooking-bg-item {
        display: none;
    }
}

/* ==========================================================================
   Mobile Optimization Overrides
   ========================================================================== */

/* Navbar Hamburger Menu default hidden */
.nav-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* Navbar styling on mobile */
    .navbar {
        padding: 15px 0;
    }
    
    .navbar-container {
        position: relative;
    }

    .logo {
        font-size: 20px;
    }

    /* Hamburger bar toggle styling */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 26px;
        height: 18px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 110;
        padding: 0;
        outline: none;
    }

    .hamburger-bar {
        width: 100%;
        height: 3px;
        background-color: var(--text-dark);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    /* Transform hamburger into X on click */
    .nav-toggle.open .hamburger-bar:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg);
    }

    .nav-toggle.open .hamburger-bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.open .hamburger-bar:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }

    /* Collapsible Navigation links with smooth height/fade drop-down */
    .nav-links {
        display: flex; /* Always display flex, control height */
        flex-direction: column;
        gap: 0;
        position: absolute;
        top: calc(100% + 16px);
        left: -30px;
        right: -30px;
        background-color: rgba(249, 248, 246, 0.98);
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        padding: 0;
        z-index: 99;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.4s ease;
    }

    .nav-links.open {
        max-height: 300px;
        opacity: 1;
        padding: 10px 0;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 15px 0;
        font-size: 13px;
        border-bottom: 1px solid rgba(93, 64, 55, 0.05);
        transition: all 0.3s ease;
    }

    .nav-link.active {
        border-left: 4px solid var(--primary);
        background-color: rgba(139, 69, 19, 0.04);
        font-weight: 600;
        padding-left: 20px; /* Slight indent accent */
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    /* Grid stack overrides */
    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }

    /* Homepage Hero */
    .homepage-hero {
        padding: 60px 0 40px;
    }
    
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 38px;
        line-height: 1.2;
    }

    .hero-content p {
        margin: 0 auto 30px auto;
        font-size: 16px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 15px !important;
    }

    .cta-btn {
        width: 100%;
        text-align: center;
        padding: 14px 30px;
    }

    .hero-image-wrapper img {
        height: 350px;
        border-radius: 120px 120px 0 0;
    }
    
    /* Stats and Carousel sections */
    .section-header h2 {
        font-size: 32px;
    }
    
    .intro-text h2, .cooking-3d-text h2 {
        font-size: 32px;
    }
    
    .intro-image {
        height: 300px;
    }
    
    /* Story Section on About page */
    .story-section {
        padding: 35px 25px !important;
    }

    /* Contact Details layout */
    .contact-info, .contact-form-card {
        padding: 25px !important;
    }

    /* Reduce falling emojis to prevent cluttering text */
    .floating-item {
        opacity: 0.15 !important;
    }
    .float-4, .float-5, .float-6, .float-7, .float-8, .float-9, .float-10, .float-11, .float-12 {
        display: none !important;
    }

    /* Horizontal scrollable category row layout on phone views */
    #category-list.category-buttons-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        width: 100% !important;
        -webkit-overflow-scrolling: touch;
        padding: 4px 0 !important;
        gap: 10px !important;
        scrollbar-width: none;
    }
    #category-list.category-buttons-row::-webkit-scrollbar {
        display: none;
    }
    .category-buttons-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        width: 100% !important;
        -webkit-overflow-scrolling: touch;
        padding: 8px 12px !important;
        gap: 10px !important;
        scrollbar-width: none;
    }
    .category-buttons-row::-webkit-scrollbar {
        display: none;
    }
    .filter-btn {
        flex: 0 0 auto !important;
    }
    .category-filters {
        width: 100%;
        align-items: stretch !important;
    }
    .filter-label {
        text-align: center;
        margin-bottom: 5px;
    }

    /* Mobile tabs layout for recipe book */
    .book-mobile-tabs {
        display: flex;
    }

    /* Hide the non-active page on mobile */
    .book-spread.show-left .right-page {
        display: none !important;
    }
    .book-spread.show-right .left-page {
        display: none !important;
    }
    
    /* Make pages look clean without vertical dividers and stretch width */
    .book-page.left-page, .book-page.right-page {
        border-bottom: none !important;
        border-radius: 12px !important;
        width: 100% !important;
    }
}

/* 3D Carousel adjustments on small phone screens to prevent overflow */
@media (max-width: 600px) {
    .carousel-3d-viewport {
        height: 420px;
    }
    
    .carousel-3d-stage {
        width: 260px;
        height: 370px;
    }
    
    .carousel-3d-card {
        width: 260px;
        height: 370px;
    }
    
    .carousel-3d-card[data-index="0"] { transform: rotateY(0deg) translateZ(190px); }
    .carousel-3d-card[data-index="1"] { transform: rotateY(72deg) translateZ(190px); }
    .carousel-3d-card[data-index="2"] { transform: rotateY(144deg) translateZ(190px); }
    .carousel-3d-card[data-index="3"] { transform: rotateY(216deg) translateZ(190px); }
    .carousel-3d-card[data-index="4"] { transform: rotateY(288deg) translateZ(190px); }
    
    .carousel-content {
        bottom: 25px;
        left: 20px;
        right: 20px;
    }
    
    .carousel-content h3 {
        font-size: 20px;
    }
    
    .carousel-content p {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .carousel-btn {
        padding: 6px 14px;
        font-size: 11px;
    }
}

/* About Page styles */
.about-text {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

@media (max-width: 800px) {
    .about-text {
        align-items: center;
        text-align: center;
    }
    
    .about-text h2 {
        font-size: 32px !important;
    }
}

/* Responsive Book Layout adjustments */
@media (max-width: 1024px) {
    .book-page.left-page {
        border-bottom: 2px dashed rgba(139, 69, 19, 0.12) !important;
        border-radius: 12px 12px 0 0 !important;
        border-right: none !important;
    }
    .book-page.right-page {
        border-radius: 0 0 12px 12px !important;
        border-left: none !important;
    }
    .book-spine {
        display: none !important;
    }
}

/* Recipe Book tweaks under 600px */
@media (max-width: 600px) {
    .book-page {
        padding: 25px 20px !important;
    }
    
    .flip-front, .flip-back {
        padding: 25px 20px !important;
    }
    
    .book-recipe-title {
        font-size: 24px;
    }
    
    .detail-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
    
    .book-meta-grid {
        gap: 5px;
        padding: 10px 0;
    }
    
    .book-meta-label {
        font-size: 9px;
    }
    
    .book-meta-value {
        font-size: 13px;
    }
    
    .book-section-title {
        font-size: 18px;
        margin-top: 15px;
        margin-bottom: 10px;
    }
    
    .book-ingredients li {
        font-size: 14px;
        padding: 6px 0;
    }
    
    .book-step-content h4 {
        font-size: 14px;
    }
    
    .book-step-content p {
        font-size: 13px;
    }
    
    .book-step-num {
        font-size: 20px;
        min-width: 20px;
    }
    
    .category-buttons-row {
        padding: 6px 10px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background-color: #3E2723;
    color: #D7CCC8;
    padding: 60px 0 30px;
    margin-top: 60px;
    border-top: 4px solid var(--primary);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 50px;
    margin-bottom: 40px;
}

.footer-brand .logo {
    color: #FFF8F0;
    font-size: 22px;
    margin-bottom: 15px;
    display: inline-block;
}

.footer-brand p {
    font-size: 14px;
    color: #A1887F;
    line-height: 1.7;
    max-width: 320px;
}

.footer-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    color: #EFEBE9;
    margin-bottom: 18px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #A1887F;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-links a:hover {
    color: #FFF8F0;
    padding-left: 5px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #8D6E63;
}

.footer-bottom a {
    color: var(--primary-light);
    text-decoration: none;
}

.footer-bottom a:hover {
    color: #FFF8F0;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: center;
    }
    .footer-brand p {
        max-width: 100%;
        margin: 0 auto;
    }
}


/* ==========================================================================
   Profile Card Social Buttons (Theme Optimized)
   ========================================================================== */
.profile-social-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
    max-width: 360px;
}

.social-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 11px 22px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background: #FFFFFF;
    border: 1.5px solid var(--border-color);
    color: var(--text-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    letter-spacing: 0.02em;
}

.social-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.12);
}

.social-connect-btn .social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Instagram Theme Optimized */
.social-connect-btn.social-instagram {
    border-color: #D7CCC8;
    color: var(--text-dark);
}

.social-connect-btn.social-instagram:hover {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: 0 10px 25px rgba(225, 48, 108, 0.35);
}

.social-connect-btn.social-instagram:hover svg {
    stroke: #FFFFFF !important;
}

/* LinkedIn Theme Optimized */
.social-connect-btn.social-linkedin {
    border-color: #D7CCC8;
    color: var(--text-dark);
}

.social-connect-btn.social-linkedin:hover {
    background: #0A66C2;
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: 0 10px 25px rgba(10, 102, 194, 0.35);
}

.social-connect-btn.social-linkedin:hover svg path {
    fill: #FFFFFF !important;
}

/* Email Display Pill */
.social-connect-btn.social-email {
    border-color: #D7CCC8;
    color: var(--text-dark);
    cursor: default;
}

.social-connect-btn.social-email:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Mobile & Responsive UX Optimizations (Phones & Tablets)
   ========================================================================== */

/* Prevent horizontal scroll bleed on mobile & enable fast touch */
html {
    /* NOTE: Do NOT set overflow-x: hidden on html — it traps mouse scroll */
    width: 100%;
    scroll-behavior: auto; /* Let browser handle scroll natively for smooth mouse wheel */
}

body {
    overflow-x: hidden;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

body.nav-open {
    overflow: hidden !important;
}

/* Category Filter Bar - Horizontal Touch Scroll for Mobile */
#category-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 25px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

#category-list::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

#category-list .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
    touch-action: manipulation;
}

/* General Tablet & Mobile Breakpoint (< 768px) */
@media screen and (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    /* Navbar Mobile Header & Drawer Menu */
    .navbar {
        padding: 12px 0;
    }

    .logo {
        font-size: 20px;
    }

    .logo-img {
        height: 34px;
        width: 34px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 82vw;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: rgba(255, 252, 247, 0.98);

        flex-direction: column;
        justify-content: center;
        align-items: center;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        will-change: right;
        gap: 28px;
        padding: 40px 24px;
        box-shadow: -10px 0 35px rgba(0, 0, 0, 0.18);
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 115;
        border-left: 1px solid var(--border-color);
    }

    .nav-links.open {
        right: 0;
    }

    .nav-link {
        font-size: 16px;
        font-weight: 600;
        letter-spacing: 0.08em;
        width: 100%;
        text-align: center;
        padding: 10px 0;
        border-bottom: 1px dashed rgba(139, 69, 19, 0.15);
    }

    /* Backdrop overlay when mobile nav drawer is open */
    .nav-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 90;
    }

    .nav-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Search & Form Inputs Mobile Zoom Prevention */
    #search-input, 
    input[type="text"], 
    input[type="email"], 
    textarea, 
    select {
        font-size: 16px !important; /* Prevents auto-zoom on mobile focus */
        padding: 14px 18px;
    }

    /* Controls Panel & Search Box — full-width on mobile */
    .controls-panel {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .search-box {
        width: 100%;
        max-width: 100%;
    }

    .search-box input {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Hero Section Mobile Responsive Scaling */
    .homepage-hero {
        padding: 30px 0 25px;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 34px;
        line-height: 1.22;
    }

    .hero-content p {
        font-size: 15px;
        margin: 0 auto 20px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 15px !important;
        width: 100%;
    }

    .cta-btn {
        width: 100%;
        text-align: center;
        padding: 15px 30px;
    }

    .hero-image-wrapper {
        margin-top: 10px;
    }

    .hero-image-wrapper img {
        height: auto;
        max-height: 320px;
        width: 100%;
        border-radius: 120px 120px 0 0;
        object-fit: cover;
    }

    /* Three.js 3D Showcase height on mobile */
    #threejs-cooking-canvas, 
    .cooking-3d-scene-container {
        height: 260px !important;
    }

    /* Mobile Recipe Book Layout (< 768px) */
    .book-mobile-tabs {
        display: flex;
    }

    .book-spread {
        flex-direction: column;
        min-height: auto;
        border-radius: 16px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.1);
        overflow: hidden;
    }

    /* Mobile Tab Switching Visibility */
    .book-spread.show-left .right-page {
        display: none !important;
    }

    .book-spread.show-left .left-page {
        display: block !important;
        width: 100% !important;
    }

    .book-spread.show-right .left-page {
        display: none !important;
    }

    .book-spread.show-right .right-page {
        display: block !important;
        width: 100% !important;
    }

    .book-page {
        padding: 20px 16px;
        border-right: none;
    }

    .book-spine {
        display: none;
    }

    .book-page-title {
        font-size: 24px;
    }

    /* Prev/Next buttons — centered row below book on mobile */
    .book-container {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .book-nav-btns-row {
        display: flex;
        gap: 12px;
        width: 100%;
    }

    .book-nav-btn {
        flex: 1;
        height: 50px;
        font-size: 15px;
        justify-content: center;
        text-align: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.12);
        padding: 0 12px;
        white-space: nowrap;
    }

    #prev-page,
    #next-page {
        position: static;
        width: 100%;
    }

    .book-nav-btn.prev {
        left: unset;
    }

    .book-nav-btn.next {
        right: 0px;
    }

    /* Floating Emoji background reduction on budget phones */
    .floating-item {
        font-size: 22px !important;
        opacity: 0.4 !important;
    }

    /* Profile Section on Mobile (About Page) */
    .about-text h2 {
        font-size: 30px !important;
    }

    .profile-social-group {
        max-width: 100%;
        width: 100%;
    }

    .social-connect-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }


}

/* Small Mobile Screens (< 480px) */
@media screen and (max-width: 480px) {
    .hero-content h1 {
        font-size: 28px;
    }

    .book-page-title {
        font-size: 20px;
    }

    .meta-pills {
        gap: 6px;
    }

    .meta-pill {
        font-size: 11px;
        padding: 4px 8px;
    }

    .section-title {
        font-size: 24px !important;
    }

    /* Reduce floating item density on small mobile devices */
    .float-4, .float-5, .float-7, .float-9, .float-11 {
        display: none !important;
    }
}




