/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Palette pulled from mockup/main_page_design.png */
    --primary-color: #1f4836;        /* deep forest green for buttons, links, headings */
    --secondary-color: #2d5a44;      /* slightly lighter green for hovers */
    --accent-color: #bf9b30;         /* gold accent for ratings, highlight chips */
    --sage-color: #9caf88;           /* sage green for category chips */
    --text-color: #2d3a32;           /* warm dark for body text */
    --muted-text: #6b7263;           /* secondary text */
    --header-text-color: #1f4836;
    --cream-bg: #f5efe1;             /* cream background for hero & detail page */
    --light-gray: #f5efe1;           /* alias kept so existing rules pick up cream */
    --white: #ffffff;
    --card-shadow: 0 4px 14px rgba(31, 72, 54, 0.08);
    --card-shadow-hover: 0 10px 24px rgba(31, 72, 54, 0.15);
    --heading-font: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
    --body-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: all 0.3s ease;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--header-text-color);
    font-family: var(--heading-font);
    font-weight: 600;
    letter-spacing: -0.01em;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    line-height: 1.6;
    color: var(--text-color);
    overflow-x: hidden;
    background-color: var(--cream-bg);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Navigation */
/* Navigation */
/* Scoped to the page header specifically. As a bare tag selector this
   also caught any <header> inside content - an attempt-log card used one
   and got pinned over the real site header, full width, at the top of the
   viewport. Every page puts its site header directly inside <body>. */
body > header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.primary-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
    background: white;
}

/* Mobile Navigation Handing */
@media (max-width: 768px) {

    .primary-nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        position: relative;
        /* Anchor for absolute positioning */
        min-height: 60px;
        /* Ensure height for absolute elements */
        justify-content: center;
    }

    .secondary-nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 1rem;
    }

    /* Hide links by default on mobile */
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        /* Space below the header row */
        gap: 0;
        background-color: var(--white);
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    /* Show links when active */
    .nav-links.active {
        display: flex;
        animation: fadeIn 0.3s ease;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #f1f5f9;
        margin: 0;
    }

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

    .nav-links a {
        display: block;
        padding: 12px 16px;
        color: var(--text-color);
        font-size: 1rem;
        transition: background-color 0.2s, color 0.2s;
        text-align: center;
    }

    .nav-links a:hover {
        background-color: #f8fafc;
        color: var(--primary-color);
    }

    .logo {
        width: 100%;
        display: flex;
        justify-content: center;
        /* Center the logo */
        align-items: center;
        z-index: 1001;
    }

    .hamburger {
        display: block;
        cursor: pointer;
        width: 30px;
        height: 25px;
        z-index: 1100;

        /* Absolute Position: Left */
        position: absolute;
        top: 0.8rem;
        left: 1rem;
        /* Padding from left edge */
        right: auto;
        /* Reset right */
    }

    .hamburger span {
        display: block;
        width: 100%;
        height: 3px;
        background-color: var(--primary-color);
        margin: 5px 0;
        transition: 0.3s;
        border-radius: 3px;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    /* Mobile User Menu - HIDDEN (Moved to Header) */
    .user-menu-container {
        display: none !important;
    }

    /* Mobile Header Auth Actions */
    .mobile-auth-actions {
        display: flex !important;
        align-items: center;
        gap: 15px;

        /* Absolute Position: Right */
        position: absolute;
        top: 0.8rem;
        right: 1rem;
        /* Padding from right edge */
        left: auto;
        z-index: 1100;
    }

    #mobile-login-btn {
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 20px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 0.9rem;
    }

    /* Ensure legacy profile link is VISIBLE on mobile (restored) */
    #profile-nav-item {
        display: block !important;
    }

    /* Mobile Dropdown Styling */
    .mobile-dropdown-content {
        position: absolute;
        top: 100%;
        right: 0;
        background-color: white;
        min-width: 160px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        z-index: 1200;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid #e2e8f0;
        margin-top: 10px;
        flex-direction: column;
    }

    .mobile-dropdown-content a {
        color: var(--text-color);
        padding: 12px 16px;
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 0.95rem;
        transition: background-color 0.2s;
        border-bottom: 1px solid #f1f5f9;
        white-space: nowrap;
    }

    .mobile-dropdown-content a:last-child {
        border-bottom: none;
    }

    .mobile-dropdown-content a:hover {
        background-color: #f8fafc;
        color: var(--primary-color);
    }
}

@media (min-width: 769px) {
    .mobile-auth-actions {
        display: none !important;
    }

    .primary-nav {
        max-width: 100%;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 2rem;
    }

    .secondary-header {
        background: #f8fafc;
        border-bottom: 1px solid #e5e7eb;
    }

    .secondary-nav {
        max-width: 100%;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        padding: 0 2rem;
    }

    .nav-links {
        display: flex;
        gap: 2rem;
        align-items: center;
    }

    .nav-links.primary-links {
        gap: 2rem;
    }

    .nav-links.secondary-links {
        gap: 0;
        /* Tabs usually have no gap if using padding, or small gap */
    }

    .nav-links.secondary-links li a {
        display: block;
        padding: 1rem 1.5rem;
        color: #64748b;
        font-weight: 500;
        border-bottom: 3px solid transparent;
        transition: all 0.3s ease;
        font-size: 0.95rem;
    }

    .nav-links.secondary-links li a:hover,
    .nav-links.secondary-links li a.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        background: #f1f5f9;
    }

    .nav-links.secondary-links li a i {
        margin-right: 0.5rem;
    }

    .logo {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--primary-color);
    }

    .nav-links a {
        font-weight: 500;
        transition: var(--transition);
        position: relative;
        text-decoration: none;
        color: var(--text-color);
    }

    .primary-links a:hover {
        color: var(--primary-color);
    }

    .user-menu-container {
        position: relative;
    }

    .user-dropdown {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background-color: var(--white);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        padding: 0.5rem 0;
        min-width: 200px;
        z-index: 1100;
        margin-top: 0.5rem;
    }

    /* User Dropdown Arrow */
    .user-dropdown::before {
        content: '';
        position: absolute;
        top: -0.5rem;
        left: 0;
        width: 100%;
        height: 0.5rem;
        background: transparent;
    }

    .user-menu-container.logged-in:hover .user-dropdown {
        display: block;
        animation: fadeIn 0.3s ease;
    }

    .user-dropdown a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1.5rem;
        color: var(--text-color);
        font-weight: 500;
        text-decoration: none;
        transition: var(--transition);
    }

    .user-dropdown a:hover {
        background-color: var(--light-gray);
        color: var(--primary-color);
    }

    .user-dropdown a::after {
        display: none;
    }


}

/* Hero Section */
/* Main Tab Content Logic */
.main-tab-content {
    display: none;
    /* !important guards against section-specific `padding` shorthands
       (.featured-recipes, .meal-planner, #meal-planner, .shopping-list,
       .import-section, .map-section, etc.) silently clobbering the offset
       and tucking content behind the fixed header. The mobile media query
       at line ~2224 is also !important and overrides this on small screens. */
    padding-top: 180px !important;
    min-height: 100vh;
}

.main-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Hero Section override for tab view */
.hero {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    /* Padding is now handled by main-tab-content, but we need some internal spacing */
    padding: 180px 1rem 4rem 1rem !important;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: #4b5563;
}

.hero-filter-section {
    margin: 2rem 0;
}

.hero-filter-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-weight: 600;
}

/* Sections */
section {
    padding: 6rem 2rem;
}

section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-color);
}

/* Filter Tabs (used in hero section) */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.filter-tab {
    background-color: var(--white);
    color: var(--text-color);
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.filter-tab.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.filter-tab.active:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--white);
}

/* Featured Recipes Section */
.featured-recipes {
    background-color: var(--white);
    padding: 4rem 2rem;
}

/* Meal Planner Section */
.meal-planner {
    background-color: var(--light-gray);
    padding: 4rem 10rem;
}

.meal-planner-container {
    max-width: 1400px;
    margin: 0 auto;
}

.week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--secondary-color);
}

.meal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
}

.day-column {
    background: var(--white);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.day-column h4 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.meal-slot {
    margin-bottom: 1rem;
}

.meal-type {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meal-content {
    background: var(--light-gray);
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #6b7280;
}

.meal-content:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.selected-meal {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.selected-meal strong {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.selected-meal small {
    color: #6b7280;
    font-size: 0.75rem;
    font-style: italic;
}

.empty-slot {
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Meal Selection Dropdown */
.meal-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-content {
    background: var(--white);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    max-width: 90vw;
}

.dropdown-content h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.2rem;
}

#meal-selector {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    background: var(--white);
    color: var(--text-color);
}

#meal-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dropdown-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.dropdown-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-btn.confirm {
    background: var(--primary-color);
    color: white;
}

.dropdown-btn.confirm:hover {
    background: var(--secondary-color);
}

.dropdown-btn.cancel {
    background: #e5e7eb;
    color: var(--text-color);
}

.dropdown-btn.cancel:hover {
    background: #d1d5db;
}

/* My Recipes Button in Header */
.login-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.login-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Restored My Account Button Style */
.my-account-btn {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-radius: 6px;
    margin: 0.5rem 1rem;
    justify-content: center;
    text-align: center;
    width: auto !important;
    padding: 0.5rem 1rem !important;
}

.my-account-btn:hover {
    background-color: var(--secondary-color) !important;
    color: white !important;
    transform: translateY(-1px);
}


/* My Recipes Modal */
.my-recipes-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 15px;
    width: 90vw;
    max-width: 1000px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: none;
}

.modal-header h2 {
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: #9ca3af;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--text-color);
}

.modal-tabs {
    display: flex;
    background: #f8fafc;
    padding: 0.5rem 0.5rem 0 0.5rem;
    gap: 0.25rem;
    margin: 0 2rem;
    border-radius: 10px 10px 0 0;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #6b7280;
    font-weight: 500;
    border-radius: 8px;
    position: relative;
}

.tab-btn.active {
    color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.tab-btn:hover:not(.active) {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-color);
}

.modal-body {
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
    background: var(--white);
}

.tab-content {
    padding: 2rem;
    min-height: 300px;
}

.tab-content:not(.active) {
    display: none;
}

.tab-content.active {
    display: block;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 1.5rem;
}

.recipe-grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.author-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    gap: 1rem;
}

.recipe-card-mini {
    background: var(--light-gray);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.recipe-card-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.recipe-card-mini.favorite {
    border-left-color: #ef4444;
}

.recipe-card-mini.weekly-menu {
    border-left-color: #10b981;
}

.recipe-card-mini h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.recipe-card-mini p {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 3rem;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.meal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.meal-actions .action-btn {
    background: var(--primary-color);
    margin-top: inherit;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meal-actions .action-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Shopping List Section */
.shopping-list {
    background: var(--white);
    padding: 4rem 2rem;
}

.shopping-container {
    max-width: 1000px;
    margin: 0 auto;
}

.list-header {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.list-header .action-btn {
    background: var(--primary-color);
    margin-top: inherit;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-header .action-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.shopping-categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.category-section {
    background: var(--light-gray);
    border-radius: 10px;
    padding: 0.75rem;
    min-width: 0;
    /* Prevents overflow */
}

.category-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-size: 1rem;
    /* Slightly smaller font */
    white-space: nowrap;
    /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
}

.shopping-items {
    list-style: none;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.shopping-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.shopping-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.shopping-item label {
    flex: 1;
    cursor: pointer;
}

.shopping-item input[type="checkbox"]:checked+label {
    text-decoration: line-through;
    color: #6b7280;
}

.remove-item {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.remove-item:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Contributors Section */
.profile {
    background: var(--light-gray);
    padding: 4rem 2rem;
}

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
}

.favorites-section,
.weekly-menu-section {
    background: var(--white);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.favorites-section h3,
.weekly-menu-section h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.favorites-section h3 i {
    color: #ef4444;
}

.weekly-menu-section h3 i {
    color: #10b981;
}

.favorites-list,
.weekly-menu-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.favorite-item,
.weekly-menu-item {
    background: var(--light-gray);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
    border-left: 4px solid var(--primary-color);
}

.favorite-item {
    border-left-color: #ef4444;
}

.weekly-menu-item {
    border-left-color: #10b981;
}

.contributors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.contributor-card {
    background: var(--white);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.contributor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.contributor-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.contributor-avatar i {
    font-size: 3rem;
    color: var(--primary-color);
}

.contributor-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.contributor-info p {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.contributor-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.contributor-stat {
    text-align: center;
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 8px;
}

.contributor-stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.contributor-stat-label {
    color: #6b7280;
    font-size: 0.8rem;
}

.contributor-recipes {
    margin-top: 1rem;
}

.contributor-recipes h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.recipe-list {
    list-style: none;
}

.recipe-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    color: #6b7280;
    font-size: 0.9rem;
}

.recipe-list li:last-child {
    border-bottom: none;
}

.recipe-origin-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.origin-tag {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Import Section */
.import-section {
    background: var(--white);
    padding: 4rem 2rem;
}

.import-container {
    max-width: 1200px;
    margin: 0 auto;
}

.import-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.import-card {
    background: var(--light-gray);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
}

.import-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.import-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.import-card h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.import-card p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.import-form {
    display: flex;
    gap: 0.5rem;
}

.import-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.9rem;
}

.import-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    z-index: 10;
}

.import-btn:hover {
    background: var(--secondary-color);
}

.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.file-label:hover {
    background: var(--secondary-color);
}

.recipe-showcase {
    max-width: 85%;
    margin: 0 auto;
    display: -ms-inline-grid;
    justify-content: center;
    gap: 2rem;
}

.recipe-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    width: 95%;
    max-width: 1650px;
    margin: 0 auto;
    padding: 0;
}

/* Ensure the image area keeps a consistent aspect ratio inside the card */
.recipe-card .recipe-image {
    width: 85%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-card .recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #f8f9fa;
}

.recipe-actions {
    position: absolute;
    bottom: 1rem;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.favorite-toggle,
.weekly-menu-toggle {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-toggle:hover,
.weekly-menu-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.favorite-toggle i,
.weekly-menu-toggle i {
    font-size: 1.2rem;
    color: #d1d5db;
    transition: var(--transition);
}

/* Recipe Detail Page Styles */
.recipe-detail-section {
    padding: 2rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.recipe-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.recipe-header {
    display: block;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 8rem 1.5rem 1.5rem 1.5rem;
    background: #f8fafc;
    color: var(--text-color);
    margin-top: 0;
    width: 100%;
}

.recipe-image img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
}

.recipe-info h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--header-text-color);
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.recipe-meta span {
    background: rgba(6, 78, 59, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    color: var(--text-color);
}

.recipe-actions {
    display: block;
    gap: 1rem;
}

.btn-favorite,
.btn-weekly-menu {
    padding: 0.75rem 1.5rem;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-favorite:hover,
.btn-weekly-menu:hover {
    background: white;
    color: var(--primary-color);
}

.btn-favorite.active,
.btn-weekly-menu.active {
    background: white;
    color: var(--primary-color);
}

.recipe-actions-section {
    padding: 1rem 2rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.recipe-content {
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 0;
}

.ingredients-section,
.instructions-section,
.nutrition-section {
    margin-bottom: 2rem;
}

.ingredients-section h2,
.instructions-section h2,
.nutrition-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ingredients-section {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

#ingredients-list {
    list-style: none;
    padding: 0;
}

#ingredients-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#ingredients-list li:last-child {
    border-bottom: none;
}

#ingredients-list li i {
    color: var(--success-color);
}

.instructions-list {
    counter-reset: step-counter;
    padding-left: 0;
    list-style: none;
}

.instructions-list li {
    counter-increment: step-counter;
    margin-bottom: 1rem;
    padding: 1rem 1rem 1rem 2.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    position: relative;
    list-style: none;
}

.instructions-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.nutrition-section {
    grid-column: 1 / -1;
    background: #f0f9ff;
    padding: 1.5rem;
    border-radius: 10px;
    border: 2px solid #bae6fd;
}

/* Recipe Parts Styling */
.recipe-part {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.recipe-part h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.part-ingredients,
.part-instructions {
    margin-bottom: 1rem;
}

.part-ingredients h4,
.part-instructions h4 {
    color: #374151;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.part-ingredients .ingredients-list {
    list-style: none;
    padding: 0;
    margin-left: 1rem;
}

.part-ingredients .ingredients-list li {
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.part-ingredients .ingredients-list li i {
    color: var(--success-color);
    font-size: 0.9rem;
}

.part-instructions .instructions-list {
    margin-left: 1rem;
    counter-reset: part-step-counter;
    list-style: none;
    padding-left: 0;
}

.part-instructions .instructions-list li {
    counter-increment: part-step-counter;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.5rem 0.5rem 2rem;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #e5e7eb;
    position: relative;
    list-style: none;
}

.part-instructions .instructions-list li::before {
    content: counter(part-step-counter);
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    background: #6b7280;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Assembly Section Styling */
.recipe-assembly {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
    border-radius: 15px;
    border: 2px solid #f59e0b;
}

.recipe-assembly h3 {
    color: #92400e;
    margin-bottom: 1rem;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    justify-content: center;
}

.assembly-list {
    counter-reset: assembly-counter;
    padding-left: 0;
    max-width: 800px;
    margin: 0 auto;
    list-style: none;
}

.assembly-list li {
    counter-increment: assembly-counter;
    margin-bottom: 1rem;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
    position: relative;
    font-weight: 500;
    list-style: none;
}

.assembly-list li::before {
    content: counter(assembly-counter);
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    background: #f59e0b;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .recipe-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .recipe-content {
        grid-template-columns: 1fr;
    }

    .recipe-actions {
        flex-direction: column;
    }

    .recipe-info h1 {
        font-size: 2rem;
    }

    .recipe-part {
        padding: 1rem;
    }

    .recipe-assembly {
        padding: 1.5rem;
    }
}

.favorite-toggle.favorited i {
    color: #ef4444;
}

.weekly-menu-toggle.added i {
    color: #10b981;
}

.favorite-toggle:hover i {
    color: #ef4444;
}

.weekly-menu-toggle:hover i {
    color: #10b981;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.recipe-image {
    width: 100%;
    height: 400px;
    border-radius: 15px 0 0 15px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
}

.recipe-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.recipe-info {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.recipe-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.recipe-author i {
    font-size: 1.2rem;
}

.recipe-author-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
    color: #6c757d;
    font-size: 0.9rem;
    flex-wrap: wrap;
    font-weight: 500;
}

.recipe-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
}

.recipe-date i {
    color: var(--primary-color);
    font-size: 1rem;
}

.recipe-info h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.main-ingredient {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    font-style: italic;
}

.recipe-continent {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    font-style: italic;
}

.recipe-country {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    font-style: italic;
}

.recipe-info p {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.recipe-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipe-meta span:not(.meta-label) {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.recipe-meta i {
    color: var(--primary-color);
}

.recipe-button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    align-self: flex-start;
}

.recipe-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* View Recipe Button Styling */
.view-recipe-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: inline-block;
    width: auto;
    text-transform: none;
    letter-spacing: 0.3px;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.view-recipe-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.view-recipe-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* About Section */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Services Section */
.services {
    background-color: var(--light-gray);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.service-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.service-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.service-card h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Contact Section */
.contact {
    max-width: 600px;
    margin: 0 auto;
}

#contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#contact-form input,
#contact-form textarea {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 1rem;
    transition: var(--transition);
}

#contact-form input:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

#contact-form textarea {
    min-height: 150px;
    resize: vertical;
}

/* Buttons */
.cta-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 5px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    text-align: center;
}

.cta-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* Footer */
footer {
    background-color: var(--text-color);
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.social-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-links a {
    font-size: 1.5rem;
    color: var(--white);
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* Mobile Menu */
.hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
}

.line {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: var(--transition);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: block;
        z-index: 1001;
        /* Ensure above the menu */
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        background-color: var(--white);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        transition: var(--transition);
        z-index: 1000;
        padding: 60px 0 1rem 0;
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links li a {
        display: block;
        padding: 10px 16px;
        line-height: 1.3;
    }

    .nav-links.active {
        left: 0;
    }

    .user-menu-container {
        position: relative;
        /* Ensure dropdown is positioned correctly on mobile */
        width: auto;
    }

    .hamburger.active .line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .hamburger.active .line:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .line:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    /* Fix header fixed positioning overlapping content */
    body {
        padding-top: 0;
        /* Reset if set elsewhere, handled by section padding */
    }

    /* Ensure specific sections adjust padding on mobile */
    .hero,
    .main-tab-content {
        padding-top: 100px !important;
        /* Adjust for header height */
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .recipe-card {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .recipe-image {
        height: 250px;
        border-radius: 15px 15px 0 0;
        order: -1;
        /* Ensure image is on top */
    }


    .recipe-info {
        padding: 1.5rem;
    }

    .recipe-meta {
        gap: 1rem;
    }

    .filter-tabs {
        gap: 0.75rem;
    }

    .filter-tab {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .meal-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .day-column {
        margin-bottom: 1rem;
    }

    .meal-actions {
        flex-direction: column;
        align-items: center;
    }

    .contributors-grid {
        grid-template-columns: 1fr;
    }

    .contributor-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .contributor-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .import-methods {
        grid-template-columns: 1fr;
    }

    .import-form {
        flex-direction: column;
    }

    .recipe-showcase {
        grid-template-columns: 1fr;
    }

    /* Profile Page Mobile */
    .user-profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .user-info-large h1 {
        font-size: 1.8rem;
    }

    .profile-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
    }

    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
        flex: 0 0 auto;
        /* Don't shrink */
    }

    /* Account Page Mobile */
    .account-container {
        padding: 1rem;
        padding-top: 80px;
    }

    .profile-tabs {
        margin-bottom: 1.5rem;
    }

    /* Modals Mobile */
    .modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 1.5rem;
        max-height: 80vh;
        overflow-y: auto;
    }

    .my-recipes-modal .modal-content {
        width: 95%;
        height: 80vh;
        margin: 0;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        max-height: calc(80vh - 120px);
    }

    /* Recipe Detail Mobile Fixes */
    .recipe-header {
        padding-top: 11rem;
    }

    .recipe-info h1 {
        font-size: 1.8rem !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .recipe-content {
        padding: 1rem !important;
        margin-top: 1rem !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .recipe-actions-section {
        flex-direction: column;
        padding: 1rem;
    }

    .servings-control {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .servings-control>div {
        width: 100%;
        justify-content: space-between;
    }

    /* Import Section Mobile */
    .import-card {
        padding: 1.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.animate {
    animation: fadeIn 1s ease-out forwards;
}

/* Page-specific override: maximize images inside their containers without cropping (contain) */
.recipe-card .recipe-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* Ensure images scale to the largest possible size inside the div, keep aspect ratio, no cropping */
.recipe-card .recipe-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
}

/* Ensure images are vertically and horizontally centered inside their containers */
.recipe-card .recipe-image,
.recipe-image {

    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make sure images are centered (object-position) and constrained to container */
.recipe-card .recipe-image img,
.recipe-image img {
    object-position: center center;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.recipe-card-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f3f4f6;
}

.recipe-card-actions .btn-favorite,
.recipe-card-actions .btn-weekly-menu,
.recipe-card-actions .btn-follow {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    background: transparent;
    color: #4b5563;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.recipe-card-actions .btn-favorite:hover {
    background: #fecdd3;
    border-color: #fb7185;
    color: #be123c;
}

.recipe-card-actions .btn-weekly-menu:hover {
    background: #ede9fe;
    border-color: #d8b4fe;
    color: #7c3aed;
}

.recipe-card-actions .btn-follow:hover {
    background: #cffafe;
    border-color: #67e8f9;
    color: #0891b2;
}

.recipe-card-actions .btn-favorite.active {
    background: #f43f5e;
    border-color: #f43f5e;
    color: white;
}

.recipe-card-actions .btn-weekly-menu.added {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
}

.recipe-card-actions .btn-follow.active {
    background: #06b6d4;
    border-color: #06b6d4;
    color: white;
    cursor: not-allowed;
}

/* Login Modal */
.login-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.login-modal .modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
}

.login-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.login-modal .close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.login-modal .form-group {
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.login-modal .form-group label {
    display: block;
    margin-bottom: 5px;
}



.login-modal .form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.login-modal .btn-login,
.login-modal .btn-create-account {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}


.recipe-card-actions .btn-view-recipe {
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.3px;
}

.recipe-card-actions .btn-view-recipe:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}



@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal .modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal .close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.modal .close:hover,
.modal .close:focus {
    color: #000;
}

.modal h2 {
    margin-top: 0;
    color: var(--text-color);
}

.modal form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.modal input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.modal input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal button[type="submit"]:hover {
    background-color: var(--secondary-color);
}

.modal p {
    text-align: center;
    margin-top: 15px;
}

.modal p a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal p a:hover {
    text-decoration: underline;
}

/* Manual Entry Modal Styles */
.recipe-modal {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background-color: var(--header-text-color);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Profile Page Recipe Card Buttons */
.recipe-card .action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    text-decoration: none;
}

.recipe-card .action-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    color: white;
}

/* Override the .btn-favorite styles from detail page if they leak */
.recipe-card .btn-favorite,
.recipe-card .btn-weekly-menu {
    border: none;
    color: white;
}

/* Active state (Remove) - Red for remove */
.recipe-card .action-btn.active {
    background-color: #ef4444;
}

.recipe-card .action-btn.active:hover {
    background-color: #dc2626;
}

/* Filter Dropdowns in Hero Section */
.filter-select {
    background-color: var(--white);
    color: var(--text-color);
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.65em auto;
    padding-right: 2.5rem;
    /* Space for arrow */
    min-width: 150px;
}

.filter-select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Account Page Buttons */
.remove-recipe-btn {
    background: var(--primary-color) !important;
    color: white !important;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    position: absolute;
    /* Positive offsets so the button sits inside the container. Negative
       offsets combined with the card's `overflow: hidden` were clipping
       half the button on the top-right corner. */
    top: 6px;
    right: 6px;
    z-index: 2;
    transition: background 0.3s ease;
}

.remove-recipe-btn:hover {
    background: var(--header-text-color) !important;
}

#clear-weekly-menu {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
    margin-top: 1rem;
}

#clear-weekly-menu:hover {
    background-color: var(--header-text-color);
}

/* Shopping List Toggles */
.list-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

@media (min-width: 600px) {
    .list-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.shopping-toggles {
    display: flex;
    background: #e0e0e0;
    border-radius: 20px;
    padding: 4px;
    gap: 0;
}

.shopping-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    transition: all 0.2s ease;
}

.shopping-toggle-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.shopping-toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
    color: #333;
}

.list-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Contributors Controls */
.contributors-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-group label {
    font-weight: 600;
    color: var(--text-color);
}

.toggle-buttons {
    display: flex;
    background: #f3f4f6;
    border-radius: 25px;
    padding: 4px;
}

.toggle-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 20px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn:hover:not(.active) {
    color: var(--text-color);
}

@media (max-width: 600px) {
    .contributors-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Map Section Styles */
.map-section {
    padding: 2rem;
    background: #f9fafb;
    border-radius: 15px;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.map-wrapper {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

#world-map {
    width: 100%;
    height: auto;
    display: block;
}

#world-map path {
    fill: #e8dfc8;              /* warm parchment for countries with no recipes */
    stroke: #f5efe1;            /* cream background separators */
    stroke-width: 0.5;
    transition: fill 0.3s ease;
    cursor: default;
}

#world-map path.has-recipes {
    /* Inline fill set by map.js getColorForCount (sage→forest scale).
       Default fallback if JS color isn't applied yet. */
    fill: #9caf88;
    cursor: pointer;
}

#world-map path.has-recipes:hover {
    fill: #2d5a44 !important;   /* secondary forest green on hover */
}

#world-map path.active-country {
    fill: #bf9b30 !important;   /* gold accent for selected country */
}

.map-tooltip {
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.2s ease;
    font-size: 0.85rem;
    white-space: nowrap;
}

#map-results-container {
    padding-top: 2rem;
    border-top: 1px solid #eee;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Map Recipe List - Override Grid */
#map-recipes-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem;
    grid-template-columns: none !important;
}

/* Map Recipe Card Styles */
.map-recipe-card {
    display: flex;
    flex-direction: row;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid #eee;
    align-items: center;
    width: 100%;
}

.map-recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.map-recipe-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.map-recipe-info {
    flex: 1;
}

.map-recipe-title {
    font-size: 1.2rem;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    font-family: var(--heading-font);
}

.map-recipe-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.map-recipe-title a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.map-recipe-meta {
    font-size: 0.9rem;
    color: #6b7280;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.map-recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.map-recipe-meta i {
    color: var(--primary-color);
}

.map-recipe-actions {
    margin-left: 2rem;
    display: flex;
    gap: 0.5rem;
}

/* Hide legacy elements in map card context if reusing classes */
.map-recipe-card .recipe-image {
    display: none;
}

/* Map Recipe Card Buttons */
.map-recipe-actions button {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    background: transparent;
    color: #4b5563;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.map-recipe-actions .btn-favorite:hover {
    background: #fecdd3;
    border-color: #fb7185;
    color: #be123c;
}

.map-recipe-actions .btn-weekly-menu:hover {
    background: #ede9fe;
    border-color: #d8b4fe;
    color: #7c3aed;
}

.map-recipe-actions button.active.btn-favorite {
    background: #f43f5e;
    border-color: #f43f5e;
    color: white;
}

.map-recipe-actions button.active.btn-weekly-menu {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
}

/* Nutrition Tooltips */
.nutrition-item {
    position: relative;
    cursor: help;
}

.nutrition-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    width: 220px;
    z-index: 9999;
    border: 1px solid #cbd5e1;
    margin-bottom: 12px;
    pointer-events: none;
    white-space: normal;
    text-align: left;
}

.nutrition-item:hover .nutrition-tooltip {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

/* Arrow */
.nutrition-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.nutrition-tooltip strong {
    display: block;
    color: #334155;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0.25rem;
}

.nutrition-tooltip ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nutrition-tooltip li {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #64748b;
    padding: 4px 0;
    border-bottom: 1px solid #f8fafc;
}

.nutrition-tooltip li:last-child {
    border-bottom: none;
}

.nutrition-tooltip li span:first-child {
    font-weight: 500;
    text-transform: capitalize;
}

.nutrition-tooltip li span:last-child {
    font-family: monospace;
    font-weight: 600;
}

/* Cooking Mode Drawer */
.cooking-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cooking-drawer.open {
    transform: translateX(0);
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-color);
    color: white;
}

.drawer-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#close-drawer-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

.drawer-controls {
    padding: 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.drawer-controls label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #475569;
    font-weight: 500;
}

.drawer-controls input[type="time"] {
    padding: 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    color: #1e293b;
}

.time-set-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.time-set-btn:hover {
    background: #059669;
    /* Darker primary */
}

.timeline-steps {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.timeline-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.timeline-step::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 30px;
    bottom: -24px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-step:last-child::before {
    display: none;
}

.step-time-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.step-calculated-time {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
    background: #e0f2fe;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.step-duration-edit {
    font-size: 0.75rem;
    color: #64748b;
    border: none;
    background: transparent;
    width: 40px;
    text-align: center;
    border-bottom: 1px dashed #cbd5e1;
}

.step-content {
    flex: 1;
    padding-top: 2px;
}

.step-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #334155;
}

.drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.total-time-summary {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    color: #1e293b;
}

/* Shopping List Tooltip */
.shopping-item {
    position: relative;
    cursor: help;
}

.shopping-item:hover::after {
    content: "From: " attr(data-source);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 5px;
    opacity: 0;
    animation: fadeInTooltip 0.2s forwards;
}

.shopping-item:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    margin-bottom: -5px;
    opacity: 0;
    animation: fadeInTooltip 0.2s forwards;
}

@keyframes fadeInTooltip {
    to {
        opacity: 1;
    }
}

/* Servings Control in Weekly Menu */
.servings-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 12px;
}

.serv-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

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

.servings-display {
    font-weight: 600;
    color: #4b5563;
    min-width: 45px;
    text-align: center;
}

/* Custom Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background-color: #1f2937;
    color: white;
    font-size: 0.85rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    margin-bottom: -6px;
    /* Overlap slightly */
    z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Compact Recipe Card (Shared between Profile and Account) */
.recipe-card-compact {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.recipe-card-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-color: #d1d5db;
}

.recipe-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .recipe-list {
        grid-template-columns: 1fr;
    }
}

/* High specificity to override any legacy styles */
/* High specificity to override any legacy styles */
body .recipe-card-compact img,
.compact-thumb {
    width: 90px !important;
    height: 60px !important;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid #f3f4f6;
    max-width: none;
    /* Prevent responsive constraints */
}

.recipe-card-compact .compact-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.recipe-card-compact h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: #1f2937;
    font-weight: 600;
}

.recipe-card-compact .compact-meta {
    font-size: 0.85rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recipe-card-compact .attempt-badge {
    color: var(--primary-color, #10b981);
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Import Section Styles - Added to fix Upload Button sizing */
.import-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.import-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

.import-card:hover {
    transform: translateY(-5px);
}

.import-card i.fa-file-upload,
.import-card i.fa-link,
.import-card i.fa-edit {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.import-card h3 {
    margin: 0;
    color: var(--header-text-color);
}

.import-card p {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.file-upload {
    width: 100%;
    display: flex;
    justify-content: center;
}

.file-upload input[type='file'] {
    display: none;
}

.file-label,
.import-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 3rem;
    /* Extra padding for icon space */
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    width: auto;
    min-width: 200px;
    /* Ensure enough width for the layout */
    text-decoration: none;
    text-align: center;
}

.file-label i,
.import-btn i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.file-label:hover,
.import-btn:hover {
    background-color: var(--secondary-color);
}

.import-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.import-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

/* Mobile Meal Planner Fixes */
@media (max-width: 768px) {
    .meal-planner {
        padding: 2rem 1rem;
    }

    .meal-planner-container {
        width: 100%;
        padding: 0;
    }

    /* Keep prev / "This Week" / next on one compact row instead of three
       stacked full-width buttons. */
    .week-header {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .week-header h3 {
        font-size: 1rem;
        margin: 0;
        flex: 1;
        text-align: center;
    }

    .nav-btn {
        width: auto;
        padding: 0.4rem 0.7rem;
        flex-shrink: 0;
    }

    /* The 7-day × 3-meal grid can't fit in a phone viewport without cells
       becoming unusable. Wrap in a horizontal scroll and keep a min column
       width so day cells are readable. */
    .mp-layout {
        padding: 1rem;
        border-radius: 14px;
    }

    /* Whole week on one screen. Seven day-columns cannot fit a phone, so the
       grid is rotated: days run down the left, the three meals across. Each
       element is placed by its data-day / data-meal attribute, so no markup
       reordering is needed and the drag-drop / tap-to-assign handlers keep
       targeting the same cells. */
    .mp-grid-wrap {
        overflow-x: visible;
        margin: 0;
        padding: 0;
    }

    .mp-grid {
        min-width: 0;
        grid-template-columns: 46px repeat(3, minmax(0, 1fr));
        grid-auto-rows: minmax(56px, auto);
        gap: 3px;
        padding: 3px;
    }

    /* Row 1: corner + the three meal headings. */
    .mp-corner                           { grid-column: 1; grid-row: 1; }
    .mp-row-label[data-meal="breakfast"] { grid-column: 2; grid-row: 1; }
    .mp-row-label[data-meal="lunch"]     { grid-column: 3; grid-row: 1; }
    .mp-row-label[data-meal="dinner"]    { grid-column: 4; grid-row: 1; }

    /* Column 1: the seven days. */
    .mp-day-header[data-day="monday"]    { grid-column: 1; grid-row: 2; }
    .mp-day-header[data-day="tuesday"]   { grid-column: 1; grid-row: 3; }
    .mp-day-header[data-day="wednesday"] { grid-column: 1; grid-row: 4; }
    .mp-day-header[data-day="thursday"]  { grid-column: 1; grid-row: 5; }
    .mp-day-header[data-day="friday"]    { grid-column: 1; grid-row: 6; }
    .mp-day-header[data-day="saturday"]  { grid-column: 1; grid-row: 7; }
    .mp-day-header[data-day="sunday"]    { grid-column: 1; grid-row: 8; }

    /* Cells: row from the day, column from the meal. */
    .mp-cell[data-day="monday"]    { grid-row: 2; }
    .mp-cell[data-day="tuesday"]   { grid-row: 3; }
    .mp-cell[data-day="wednesday"] { grid-row: 4; }
    .mp-cell[data-day="thursday"]  { grid-row: 5; }
    .mp-cell[data-day="friday"]    { grid-row: 6; }
    .mp-cell[data-day="saturday"]  { grid-row: 7; }
    .mp-cell[data-day="sunday"]    { grid-row: 8; }
    .mp-cell[data-meal="breakfast"] { grid-column: 2; }
    .mp-cell[data-meal="lunch"]     { grid-column: 3; }
    .mp-cell[data-meal="dinner"]    { grid-column: 4; }

    /* Meal labels are vertical-rl on desktop; upright as column headings. */
    .mp-row-label {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 0.62rem;
        padding: 0.3rem 0.15rem;
        letter-spacing: 0.02em;
    }

    /* Day names shortened to fit a 46px column. */
    .mp-day-header {
        font-size: 0.6rem;
        padding: 0.3rem 0.15rem;
        min-width: 0;
        line-height: 1.1;
        overflow: hidden;
    }

    /* Abbreviate day names - "Wednesday" cannot fit a 46px column. The full
       name stays in the markup for screen readers and for desktop. */
    .mp-day-header { font-size: 0; }
    .mp-day-header::before {
        font-size: 0.62rem;
        font-weight: 600;
    }
    .mp-day-header[data-day="monday"]::before    { content: "Mon"; }
    .mp-day-header[data-day="tuesday"]::before   { content: "Tue"; }
    .mp-day-header[data-day="wednesday"]::before { content: "Wed"; }
    .mp-day-header[data-day="thursday"]::before  { content: "Thu"; }
    .mp-day-header[data-day="friday"]::before    { content: "Fri"; }
    .mp-day-header[data-day="saturday"]::before  { content: "Sat"; }
    .mp-day-header[data-day="sunday"]::before    { content: "Sun"; }

    .mp-cell {
        min-height: 56px;
        padding: 2px;
        min-width: 0;
    }

    .mp-cell.empty::before { font-size: 0.95rem; }

    /* A filled cell only has room for the thumbnail and a clipped title. */
    .mp-cell-recipe img { height: 58%; }
    .mp-cell-recipe .lbl {
        font-size: 0.55rem;
        padding: 0.1rem 0.15rem 0;
        line-height: 1.1;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .mp-cell-recipe .time,
    .mp-cell-recipe .mp-servings { display: none; }

    .meal-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }


    .day-column {
        padding: 1rem;
    }

    /* Shopping List Mobile Fixes */
    .shopping-list {
        padding: 160px 1rem 2rem 1rem;
        /* Increase top padding to clear fixed header */
    }

    .shopping-categories {
        grid-template-columns: 1fr;
        /* Stack categories vertically */
        gap: 1.5rem;
    }

    /* Hardware acceleration for smoother scrolling */
    .shopping-item {
        transform: translateZ(0);
        will-change: transform;
        opacity: 1 !important;
        /* Force visibility */
        visibility: visible !important;
    }

    /* Aggressive overrides to prevent clipping */
    .shopping-list,
    .shopping-container,
    .shopping-categories,
    .category-section {
        height: auto !important;
        overflow: visible !important;
        opacity: 1 !important;
    }

    .shopping-items {
        display: block !important;
        /* Prevent grid collapse */
        height: auto !important;
        overflow: visible !important;
    }

    .list-header {
        flex-direction: column;
        gap: 1rem;
    }

    .list-header .action-btn {
        width: 100%;
        justify-content: center;
    }

    /* Mobile Header/User Menu Fixes */
    .nav-links li {
        width: 100%;
        display: block;
    }

    .user-menu-container {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .login-btn,
    .my-account-btn {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        padding: 0.75rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* Ensure dropdown is visible/inline on mobile if needed, or rely on existing click hover? 
       Actually, for mobile, it's better to just show the links directly or ensure the hover/click works.
       Let's force the dropdown to be relative/block if the container is active/hovered, or just style the account button to go to account page directly if logic permits.
       For now, let's just make sure the container and button are visible.
    */
    .user-dropdown {
        position: static;
        /* Stack properly in mobile menu */
        width: 100%;
        box-shadow: none;
        border: 1px solid #e5e7eb;
        background: #f8fafc;
        display: none;
        /* Controlled by JS or hover */
    }

    .user-menu-container.logged-in:hover .user-dropdown,
    .user-menu-container.logged-in .user-dropdown {
        display: block;
        /* Ensure it can be seen when interacting */
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--white);
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid #e5e7eb;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

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

.close-modal {
    color: #6b7280;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #1f2937;
    text-decoration: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.secondary-btn {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background-color: #e5e7eb;
}

/* Recipe Thumbnail Title Scaling — wraps to fit full title */
.recipe-info h3,
.recipe-card-mini h4,
.compact-content h4,
.map-recipe-card h4,
.wide-title {
    overflow: visible;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: clamp(14px, 3.5vw, 1.25rem) !important;
    line-height: 1.3;
}

/* Ingredient Tooltip Styles */
.ingredient-tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-bottom: 1px dashed var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

.ingredient-tooltip .tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 250px;
    background-color: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.ingredient-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

/* Click-only reveal. Previously used `:hover` too, but combined with the
   click toggle the tooltip could never be dismissed on touch devices (sticky
   :hover persisted after `.active` was removed). */
.ingredient-tooltip.active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* =============================================================
   Mockup design language (Collective Cooks reskin) — applied 2026-06-09
   Matches mockup/{main_page,recipe_detail,contributors,meal_planner}*.png
   Only CSS, no HTML/JS structure changes.
   ============================================================= */

/* Header: clean white bar, serif logo */
body > header { background: var(--white); box-shadow: 0 1px 0 rgba(31, 72, 54, 0.08); }
.primary-header { padding: 1rem 0; }
.logo a, .logo { font-family: var(--heading-font) !important; font-weight: 700; color: var(--primary-color) !important; }
.nav-links a, .nav-links li a { color: var(--text-color) !important; font-weight: 500; }
.nav-links a:hover, .nav-links li a:hover, .nav-links a.active { color: var(--primary-color) !important; }

/* Hero: cream background, serif title, pill search */
.hero-merged, .hero { background: var(--cream-bg) !important; padding: 4rem 1rem 3rem !important; text-align: center; border-radius: 0 0 28px 28px; }
.hero-merged h1, .hero h1, .hero-content h1 {
    font-family: var(--heading-font);
    font-size: clamp(2.5rem, 6vw, 4.5rem) !important;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem !important;
    letter-spacing: -0.02em;
}
.hero-merged p, .hero p, .hero-content > p { color: var(--muted-text); font-size: 1.05rem; margin-bottom: 1.75rem; }

/* Pill-shaped search bar (matches mockup) */
.search-input { border-radius: 999px !important; border: 1px solid rgba(31, 72, 54, 0.12) !important; box-shadow: 0 2px 12px rgba(31, 72, 54, 0.05) !important; }
.search-input:focus { border-color: var(--primary-color) !important; box-shadow: 0 0 0 3px rgba(31, 72, 54, 0.15) !important; }

/* Category / dietary tags as pills */
.filter-select { border-radius: 999px !important; border-color: rgba(31, 72, 54, 0.15) !important; background: var(--white) !important; color: var(--text-color); padding: 0.5rem 1rem !important; }
.dietary-filter { accent-color: var(--primary-color) !important; }
.dietary-label { color: var(--text-color); }

/* Recipe cards: rounded, soft shadow, large rounded image */
.recipe-card, .recipe-card-wide, .recipe-card-compact {
    border-radius: 16px !important;
    box-shadow: var(--card-shadow) !important;
    background: var(--white) !important;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.recipe-card:hover, .recipe-card-wide:hover, .recipe-card-compact:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover) !important;
}
.recipe-card .recipe-image, .recipe-card .recipe-image img,
.wide-image, .wide-image img { border-radius: 12px; }

/* Card titles use the serif heading font */
.recipe-card h3, .recipe-card h4, .compact-content h4, .wide-title, .recipe-info h3 {
    font-family: var(--heading-font);
    font-weight: 600;
    color: var(--header-text-color);
}

/* Buttons: forest-green primary pill, outlined secondary */
.btn-view-recipe, button.import-btn, .action-btn.primary,
button[type="submit"], .dropdown-btn.confirm {
    background: var(--primary-color) !important;
    color: var(--white) !important;
    border: 1px solid var(--primary-color) !important;
    border-radius: 999px !important;
    padding: 0.65rem 1.5rem !important;
    font-weight: 600 !important;
    font-family: var(--body-font);
    transition: background 0.2s, transform 0.05s;
}
.btn-view-recipe:hover, button.import-btn:hover, .action-btn.primary:hover,
button[type="submit"]:hover, .dropdown-btn.confirm:hover { background: var(--secondary-color) !important; }

.btn-favorite, .btn-weekly-menu, .action-btn:not(.primary):not(.btn-view-recipe) {
    background: var(--white) !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.1rem !important;
    font-weight: 600;
}
.btn-favorite.active, .btn-favorite:hover,
.btn-weekly-menu.active, .btn-weekly-menu:hover {
    background: rgba(31, 72, 54, 0.06) !important;
}

/* Star ratings + gold accents */
.fa-star { color: var(--accent-color) !important; }

/* Section headings */
.featured-recipes h2, .main-tab-content > h2, section > h2 {
    font-family: var(--heading-font);
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Recipe detail page polish — matches recipe_detail_formatting.png */
.recipe-header { background: var(--cream-bg) !important; }
#recipe-title { font-family: var(--heading-font) !important; color: var(--primary-color) !important; font-weight: 600 !important; }
.recipe-meta { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem !important; }
.recipe-section h3, .ingredients-section h3, .instructions-section h3 {
    font-family: var(--body-font);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-color);
    font-size: 0.95rem;
    font-weight: 700;
}

/* Footer */
footer { background: var(--white); color: var(--muted-text); text-align: center; padding: 1.5rem 0; border-top: 1px solid rgba(31, 72, 54, 0.08); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* Contributors grid — matches contributors_formatting.png */
.contributors-grid, .author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.contributor-card, .author-card {
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    position: relative;
}
.contributor-card h3, .author-card h3 { font-family: var(--heading-font); color: var(--header-text-color); }
.contributor-tag, .cuisine-pill { display: inline-block; padding: 0.25rem 0.8rem; border-radius: 999px; background: rgba(156, 175, 136, 0.2); color: var(--primary-color); font-size: 0.85rem; font-weight: 600; }
.gold-badge { display: inline-block; padding: 0.25rem 0.8rem; border-radius: 999px; background: var(--accent-color); color: var(--white); font-size: 0.85rem; font-weight: 600; margin-left: 0.4rem; }

/* ---- Meal Planner drag-and-drop layout (matches mockup/meal_planner_design.png) ---- */
#meal-planner.main-tab-content { padding: 1.5rem; }
.mp-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    background: var(--white);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    align-items: start;
}
@media (max-width: 900px) {
    .mp-layout { grid-template-columns: 1fr; }
}

/* Sidebar */
.mp-sidebar { display: flex; flex-direction: column; gap: 0.75rem; border-right: 1px solid rgba(31, 72, 54, 0.1); padding-right: 1.25rem; max-height: 720px; overflow-y: auto; }
@media (max-width: 900px) { .mp-sidebar { border-right: none; border-bottom: 1px solid rgba(31, 72, 54, 0.1); padding: 0 0 1rem 0; max-height: 360px; } }
.mp-sidebar h3 { font-family: var(--heading-font); color: var(--header-text-color); margin: 0; font-size: 1.4rem; }
.mp-sidebar-search { position: relative; }
.mp-sidebar-search i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted-text); font-size: 0.85rem; }
.mp-sidebar-search input { width: 100%; padding: 0.55rem 0.75rem 0.55rem 2.2rem; border: 1px solid rgba(31, 72, 54, 0.15); border-radius: 8px; background: var(--cream-bg); font-family: var(--body-font); font-size: 0.9rem; }
.mp-sidebar-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.mp-sidebar-filters select { padding: 0.45rem 0.6rem; border: 1px solid rgba(31, 72, 54, 0.15); border-radius: 8px; background: var(--cream-bg); font-size: 0.85rem; font-family: var(--body-font); }
.mp-sidebar-filters select:nth-child(3) { grid-column: 1 / -1; }
.mp-saved-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }
.mp-empty { color: var(--muted-text); font-size: 0.9rem; padding: 1rem 0.5rem; text-align: center; }

/* Draggable recipe card in sidebar */
.mp-recipe {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.1);
    border-radius: 10px;
    overflow: hidden;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.05s;
    user-select: none;
}
.mp-recipe:hover { box-shadow: var(--card-shadow); }
.mp-recipe:active, .mp-recipe.dragging { cursor: grabbing; opacity: 0.6; transform: scale(0.97); }
.mp-recipe img { width: 100%; height: 90px; object-fit: cover; display: block; }
.mp-recipe .mp-recipe-title { font-family: var(--body-font); font-size: 0.85rem; padding: 0.4rem 0.6rem 0.5rem; color: var(--text-color); font-weight: 500; line-height: 1.2; }
.mp-recipe .mp-recipe-meta { padding: 0 0.6rem 0.5rem; font-size: 0.75rem; color: var(--accent-color); font-weight: 700; letter-spacing: 0.04em; }

/* Right side: week header + grid */
.mp-grid-wrap { display: flex; flex-direction: column; gap: 1rem; }
.mp-grid {
    display: grid;
    grid-template-columns: 90px repeat(7, 1fr);
    grid-auto-rows: minmax(110px, auto);
    gap: 6px;
    background: rgba(245, 239, 225, 0.4);
    padding: 6px;
    border-radius: 12px;
}
.mp-corner { background: transparent; }
.mp-day-header {
    background: var(--white);
    border-radius: 8px;
    padding: 0.55rem 0.4rem;
    text-align: center;
    font-family: var(--body-font);
    font-weight: 600;
    color: var(--header-text-color);
    font-size: 0.85rem;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mp-row-label {
    background: transparent;
    color: var(--muted-text);
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drop-zone cell */
.mp-cell {
    background: rgba(255, 255, 255, 0.7);
    border: 2px dashed transparent;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
    overflow: hidden;
    min-height: 110px;
}
.mp-cell.empty { background: rgba(255, 255, 255, 0.4); border-color: rgba(31, 72, 54, 0.2); }
.mp-cell.drop-target { background: rgba(156, 175, 136, 0.25) !important; border-color: var(--primary-color) !important; }
.mp-cell.empty::before {
    content: '+';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(31, 72, 54, 0.25);
    font-size: 1.8rem;
    font-weight: 200;
    pointer-events: none;
}

/* Recipe pinned inside a cell */
.mp-cell-recipe {
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: 100%;
    position: relative;
}
.mp-cell-recipe img { width: 100%; height: 55%; object-fit: cover; flex-shrink: 0; }
.mp-cell-recipe .lbl { padding: 0.3rem 0.4rem 0.1rem; font-size: 0.72rem; line-height: 1.2; color: var(--text-color); font-weight: 500; }
.mp-cell-recipe .time { padding: 0 0.4rem 0.15rem; font-size: 0.7rem; color: var(--muted-text); }

/* Compact servings stepper inside a planner cell */
/* Long titles must not push the stepper out of the cell. */
.mp-cell-recipe .lbl {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mp-cell-recipe .mp-servings {
    margin-top: auto;
    padding: 0.2rem 0.35rem 0.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}
.mp-cell-recipe .mp-servings .serv-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(31, 72, 54, 0.25);
    background: var(--white);
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.mp-cell-recipe .mp-servings .serv-btn:hover {
    background: rgba(31, 72, 54, 0.08);
    border-color: var(--primary-color);
}
.mp-cell-recipe .mp-servings .servings-display {
    font-size: 0.7rem;
    color: var(--muted-text);
    font-weight: 600;
    white-space: nowrap;
}

/* ---- Fixed-header clearance for every page ----
   `header { position: fixed }` covers the top of the viewport, so any page's
   first heading or content needs extra top padding to not be hidden under it.
   `.main-tab-content` (index page sections) already has its own offset; this
   rule covers profile.html / anything else that uses <main>.   */
main:not(.main-tab-content) {
    padding-top: 180px;
}
@media (max-width: 768px) {
    main:not(.main-tab-content) {
        padding-top: 130px;
    }
}
.mp-cell-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    display: none;
}
.mp-cell:hover .mp-cell-remove { display: block; }

/* ---- Weekly Menu tile grid (profile.html → Recipe Collections tab) ----
   Matches the "Saved Recipes" sidebar style from mockup/meal_planner_design.png:
   small square thumbnail on top, recipe name below, soft hover lift, X to remove. */
.wm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.wm-tile {
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.08);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.18s, transform 0.05s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.wm-tile:hover { box-shadow: var(--card-shadow); transform: translateY(-2px); }
.wm-tile img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--cream-bg);
}
.wm-tile .wm-name {
    padding: 0.5rem 0.6rem 0.2rem;
    font-family: var(--body-font);
    font-size: 0.85rem;
    line-height: 1.25;
    color: var(--text-color);
    font-weight: 500;
    /* clamp to 2 lines so layout stays uniform */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wm-tile .wm-meta {
    padding: 0 0.6rem 0.55rem;
    font-size: 0.72rem;
    color: var(--muted-text);
    display: flex;
    align-items: center;
    gap: 4px;
}
.wm-tile .wm-meta .fa-clock { font-size: 0.7rem; }
.wm-tile .wm-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}
.wm-tile:hover .wm-remove { opacity: 1; }

/* --------------------------------------------------------------------- */
/* Recipe card polish: touch targets + responsive image ratios            */
/* --------------------------------------------------------------------- */

/* Touch targets — 44×44 minimum per iOS HIG / Material tap-target
   guidance. Applies to the primary icon toggles on recipe cards and to
   the small text-action buttons (Share, Edit, Delete, Feature). */
.favorite-toggle,
.weekly-menu-toggle {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px;
}
.favorite-toggle i,
.weekly-menu-toggle i { font-size: 1.15rem; }

.action-text-btn {
    min-height: 44px;
    padding: 10px 14px;
}

/* Small remove X buttons: keep the compact circle visually but expand
   the hit-area on touch viewports so a finger can actually land on them. */
@media (max-width: 768px) {
    .remove-recipe-btn,
    .wm-tile .wm-remove,
    .mp-cell-remove {
        min-width: 44px;
        min-height: 44px;
        /* Center the small visual icon inside the enlarged tap area */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    /* Reveal the wm-remove overlay by default on touch — hover isn't
       reliable, and the enlarged target is now easy to hit. */
    .wm-tile .wm-remove { opacity: 1; }
}

/* Consistent aspect-ratio + object-fit: cover on card images so layouts
   don't shift with each photo's native ratio. Detail-page hero image
   and the recipe-detail carousel keep their existing `contain` behavior
   because users need to see the whole photo there. */
.recipe-card .recipe-image {
    aspect-ratio: 16 / 9;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden;
    background: #f8f9fa;
    display: block;
    padding: 0;
}
.recipe-card .recipe-image img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center;
    display: block;
    margin: 0;
}

.recipe-card-mini img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #f8f9fa;
}

/* Only style the <img> inside .wide-image — the container's width is set
   by the .recipe-card-wide flex layout (30% desktop, 100% mobile). Setting
   width on the container itself would break that layout and push the info
   / details columns off-screen. */
.wide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    background: #f8f9fa;
}
/* On mobile the wide card stacks vertically; give the image a stable 16:9
   frame instead of a fixed 250px height that squishes tall photos. */
@media (max-width: 768px) {
    .wide-image {
        height: auto !important;
        aspect-ratio: 16 / 9;
    }
}

.compact-thumb {
    object-fit: cover !important;
    object-position: center center;
}

/* Prevent compact-card content from pushing the card wider than its
   container. Without min-width:0 the flex child sizes to its content's
   min-content width, which for long titles / metadata causes the trailing
   text to be clipped off the right edge of the card. */
.recipe-card-compact .compact-content {
    min-width: 0;
    flex: 1 1 auto;
}
.recipe-card-compact .compact-content h4,
.recipe-card-compact .compact-meta {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Featured Recipes section — full-viewport-width safety net on mobile.
   Without this, one of the conflicting `.recipes-container` /
   `.recipe-showcase` width rules can leave a strip on the right where the
   body's cream background shows through the section's white. */
@media (max-width: 900px) {
    html, body { max-width: 100vw; overflow-x: hidden; }
    .featured-recipes {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    #recipes-container,
    .recipe-showcase,
    .recipes-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box;
    }
    .recipe-card-wrapper {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .recipe-card-wide {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Header login/user button on narrow viewports: cap width, truncate
   the username, and let the primary-links row shrink so the whole
   header fits inside the viewport. */
@media (max-width: 768px) {
    .primary-nav {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .nav-links.primary-links {
        flex-shrink: 1;
        min-width: 0;
    }
    .user-menu-container {
        max-width: 100%;
    }
    #login-btn {
        max-width: 100%;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }
    /* Small phones: hide the username text, leaving just the avatar +
       chevron. Dropdown still contains My Account / Edit Profile / Logout. */
    @media (max-width: 480px) {
        #login-btn span,
        #login-btn { max-width: 44px; }
    }
}

/* --------------------------------------------------------------------- */
/* Mobile touch fallbacks                                                */
/* --------------------------------------------------------------------- */

/* Meal-planner: tap-to-assign bottom sheet (replaces drag-drop on ≤768px).
   Hidden by default; JS toggles `.open` when a sidebar recipe is tapped. */
.mp-assign-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: flex-end;
}
.mp-assign-modal.open { display: flex; }
.mp-assign-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.mp-assign-sheet {
    position: relative;
    background: var(--white, #fff);
    width: 100%;
    max-width: 520px;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    animation: mp-slide-up 0.22s ease-out;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
}
@keyframes mp-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.mp-assign-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    position: sticky;
    top: 0;
    background: var(--white, #fff);
    z-index: 1;
}
.mp-assign-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-family: var(--body-font);
    color: var(--header-text-color, #1f4836);
}
.mp-assign-recipe-name {
    margin: 0.25rem 0 0;
    color: var(--muted-text, #6b7280);
    font-size: 0.85rem;
}
.mp-assign-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--muted-text, #6b7280);
    cursor: pointer;
    padding: 0 0.25rem;
}
.mp-assign-body { padding: 0.75rem 1.25rem 1.25rem; }
.mp-assign-day-block { margin-top: 0.9rem; }
.mp-assign-day-block:first-child { margin-top: 0; }
.mp-assign-day-name {
    font-weight: 600;
    color: var(--header-text-color, #1f4836);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}
.mp-assign-meals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.mp-assign-slot-btn {
    padding: 0.65rem 0.4rem;
    border: 1px solid rgba(31, 72, 54, 0.2);
    border-radius: 10px;
    background: var(--white, #fff);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--body-font);
    color: var(--text-color);
    transition: background 0.15s, border-color 0.15s;
    min-height: 44px; /* iOS tap target */
}
.mp-assign-slot-btn:active,
.mp-assign-slot-btn:hover {
    background: rgba(31, 72, 54, 0.08);
    border-color: var(--primary-color);
}
.mp-assign-slot-btn.occupied {
    background: rgba(156, 175, 136, 0.22);
    border-color: var(--primary-color);
    font-weight: 600;
}
.mp-assign-slot-btn.occupied::after {
    content: ' • filled';
    color: var(--muted-text, #6b7280);
    font-weight: 400;
    font-size: 0.75em;
}
/* Belt-and-braces: never show the sheet on desktop even if `.open` sticks. */
@media (min-width: 769px) {
    .mp-assign-modal.open { display: none; }
}

/* Map: segmented view toggle + mobile-friendly country list. */
.map-view-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 auto 1.5rem;
    background: rgba(31, 72, 54, 0.08);
    padding: 4px;
    border-radius: 12px;
    max-width: 320px;
}
.map-view-btn {
    flex: 1;
    padding: 0.55rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 40px;
}
.map-view-btn.active {
    background: var(--white, #fff);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.map-view-btn i { font-size: 0.85em; }

.map-view-list {
    max-width: 600px;
    margin: 0 auto 1.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
}
.map-list-search {
    position: relative;
    margin-bottom: 0.9rem;
}
.map-list-search i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
    pointer-events: none;
}
.map-list-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem 0.65rem 2.4rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    font-size: 1rem;
    font-family: var(--body-font);
    background: var(--white, #fff);
}
.map-country-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 65vh;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    background: var(--white, #fff);
}
.map-country-list li {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.15s;
    min-height: 48px;
    box-sizing: border-box;
}
.map-country-list li:last-child { border-bottom: none; }
.map-country-list li:active,
.map-country-list li:hover { background: rgba(31, 72, 54, 0.06); }
.map-country-list .country-name {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-color);
    font-weight: 500;
}
.map-country-list .country-name img {
    width: 24px;
    height: 18px;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.map-country-list .country-count {
    color: var(--muted-text, #6b7280);
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(31, 72, 54, 0.08);
    padding: 3px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}
.map-country-list-empty {
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--muted-text, #6b7280);
    cursor: default !important;
}

/* Inline username links (recipe author bylines, "Shared by", etc.).
   Match the app's primary color and stay clickable but understated. */
.author-link-inline {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}
.author-link-inline:hover { text-decoration: underline; color: var(--secondary-color); }

/* CTA at the bottom of each contributor card — takes the visitor straight
   to that user's profile page. */
.view-profile-btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s, transform 0.05s;
}
.view-profile-btn:hover { background: var(--header-text-color); color: #fff; }
.view-profile-btn:active { transform: translateY(1px); }
.view-profile-btn i { font-size: 0.8em; }

/* Desktop user dropdown — shown from the primary-nav login button once the
   user is logged in. My Account + Logout live here (previously "My Account"
   was a top-level nav item). Toggled by `toggleUserDropdown` in script.js. */
.user-menu-container {
    position: relative;
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.4rem;
    display: none;
    z-index: 1000;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s;
}
.user-dropdown a:hover { background: rgba(31, 72, 54, 0.08); color: var(--primary-color); }
.user-dropdown a i { width: 16px; color: var(--primary-color); }

/* Shopping-list explanatory note (top of #shopping-list section) */
.shopping-note {
    background: rgba(156, 175, 136, 0.18);
    border-left: 4px solid var(--primary-color);
    color: var(--text-color);
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    margin: 0.5rem 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.55;
}
.shopping-note i.fa-info-circle { color: var(--primary-color); margin-right: 0.45rem; }
.shopping-note a { color: var(--primary-color); font-weight: 600; text-decoration: underline; }
.shopping-note a:hover { color: var(--secondary-color); }
.shopping-note strong { color: var(--primary-color); }

/* ---- Map: country recipes grid (below the world map) ----
   Cards include a thumbnail, title, author, country, time, difficulty, date.
   Replaces the earlier flat blue text list. */
.map-country-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 0 !important;
}
.map-country-card {
    display: flex;
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(31, 72, 54, 0.06);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.map-country-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(31, 72, 54, 0.18);
}
.map-country-card .mcc-image {
    flex: 0 0 110px;
    background: var(--cream-bg);
    position: relative;
    overflow: hidden;
}
.map-country-card .mcc-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.map-country-card:hover .mcc-image img { transform: scale(1.04); }
.map-country-card .mcc-body {
    flex: 1;
    padding: 0.85rem 1rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}
.map-country-card .mcc-title {
    font-family: var(--heading-font);
    font-size: 1.2rem;
    color: var(--header-text-color);
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.map-country-card .mcc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--muted-text);
    align-items: center;
}
.map-country-card .mcc-meta span { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.map-country-card .mcc-meta i { color: var(--primary-color); font-size: 0.78rem; }
.map-country-card .mcc-country { color: var(--accent-color); font-weight: 600; }
.map-country-card .mcc-country i { color: var(--accent-color); }
@media (max-width: 600px) {
    .map-country-card .mcc-image { flex: 0 0 92px; }
    .map-country-card .mcc-title { font-size: 1.05rem; }
}

/* ---- "What Can I Cook?" tab ------------------------------------------ */
.cook-with {
    background: var(--white);
    padding: 4rem 1rem;
}

.cw-panel {
    max-width: 700px;
    margin: 0 auto 2rem;
    background: var(--cream-bg);
    border: 1px solid rgba(31, 72, 54, 0.12);
    border-radius: 16px;
    padding: 1.5rem;
    box-sizing: border-box;
}

.cw-label {
    display: block;
    font-weight: 600;
    color: var(--header-text-color);
    margin-bottom: 0.5rem;
}

.cw-entry {
    display: flex;
    gap: 0.5rem;
}

.cw-entry input {
    flex: 1;
    min-width: 0;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(31, 72, 54, 0.2);
    border-radius: 999px;
    font-family: var(--body-font);
    font-size: 1rem;
    background: var(--white);
}

.cw-entry input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 72, 54, 0.12);
}

.cw-add-btn {
    flex-shrink: 0;
    padding: 0.7rem 1.4rem;
    min-height: 44px;
    border: none;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    font-family: var(--body-font);
    cursor: pointer;
    transition: background 0.15s;
}

.cw-add-btn:hover { background: var(--secondary-color); }

.cw-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--muted-text);
}

.cw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    min-height: 2rem;
}

.cw-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem 0.35rem 0.9rem;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.18);
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.cw-chip-x {
    border: none;
    background: none;
    color: var(--muted-text);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    min-width: 28px;
    min-height: 28px;
}

.cw-chip-x:hover { color: #e74c3c; }

.cw-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(31, 72, 54, 0.1);
}

.cw-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
}

.cw-check input { accent-color: var(--primary-color); }

.cw-clear-btn {
    border: 1px solid rgba(31, 72, 54, 0.2);
    background: var(--white);
    color: var(--text-color);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    min-height: 36px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.cw-clear-btn:hover { border-color: #e74c3c; color: #e74c3c; }

.cw-results {
    max-width: 820px;
    margin: 0 auto;
}

.cw-count {
    color: var(--muted-text);
    font-size: 0.9rem;
    margin: 0 0 1rem;
}

.cw-empty {
    color: var(--muted-text);
    font-style: italic;
}

.cw-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.1);
    border-radius: 14px;
    padding: 0.9rem;
    margin-bottom: 0.9rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--card-shadow);
    transition: transform 0.18s, box-shadow 0.18s;
}

.cw-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.cw-thumb {
    width: 110px;
    height: 82px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 10px;
    background: #f8f9fa;
}

.cw-body { min-width: 0; flex: 1; }

.cw-title {
    margin: 0 0 0.4rem;
    font-family: var(--heading-font);
    font-size: 1.15rem;
    color: var(--header-text-color);
    overflow-wrap: anywhere;
}

.cw-score {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.cw-badge {
    background: rgba(156, 175, 136, 0.28);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 999px;
}

.cw-sub {
    font-size: 0.8rem;
    color: var(--muted-text);
}

.cw-missing {
    font-size: 0.85rem;
    color: var(--muted-text);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.cw-missing strong { color: var(--text-color); }

.cw-have-all {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

@media (max-width: 640px) {
    .cook-with { padding: 3rem 0.75rem; }
    .cw-panel { padding: 1rem; }
    .cw-entry { flex-wrap: wrap; }
    .cw-entry input { width: 100%; }
    .cw-add-btn { width: 100%; }
    .cw-card { flex-direction: column; }
    .cw-thumb { width: 100%; height: 150px; }
}

/* Logged-out prompt in the main-page hero. Hidden by updateLoginButton()
   once the visitor signs in. Uses the site's primary pill button so it reads
   as part of the same design language as the rest of the CTAs. */
.hero-signup-note {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin: 0 auto 2rem;
}

.hero-signup-text {
    color: var(--muted-text);
    font-size: 1.05rem;
}

.hero-signup-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: var(--white);
    border: 1px solid var(--primary-color);
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 1rem;
    min-height: 44px;
    cursor: pointer;
    transition: background 0.2s, transform 0.05s;
}

.hero-signup-btn:hover { background: var(--secondary-color); }
.hero-signup-btn:active { transform: translateY(1px); }

/* =====================================================================
   SITE-WIDE REDESIGN — modelled on the supplied mobile mockup.
   Appended last so it wins on equal specificity. Everything here is
   presentational; no layout mechanism the JS depends on is changed.
   ===================================================================== */

/* ---- 1. Section rhythm ------------------------------------------------ */
.main-tab-content > h2,
section > h2 {
    font-family: var(--heading-font);
    letter-spacing: -0.01em;
}

/* ---- 2. Cards: one radius, one shadow, one hover ---------------------- */
.recipe-card,
.recipe-card-wide,
.recipe-card-compact,
.recipe-card-mini,
.contributor-card,
.map-country-card,
.cw-card,
.wm-tile,
.mp-recipe {
    border-radius: 16px !important;
    border: 1px solid rgba(31, 72, 54, 0.08);
    box-shadow: 0 1px 3px rgba(31, 72, 54, 0.06), 0 8px 24px -12px rgba(31, 72, 54, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recipe-card:hover,
.recipe-card-wide:hover,
.recipe-card-compact:hover,
.contributor-card:hover,
.map-country-card:hover,
.cw-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(31, 72, 54, 0.08), 0 16px 32px -14px rgba(31, 72, 54, 0.22);
}

/* Card imagery: soft rounding, never stretched. */
.recipe-card-compact img,
.cw-thumb,
.recipe-card-mini img,
.wm-tile img,
.mp-recipe img {
    border-radius: 12px;
    object-fit: cover;
}

/* ---- 3. Inputs and selects ------------------------------------------- */
input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input[type="password"],
textarea,
select {
    font-family: var(--body-font);
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(31, 72, 54, 0.12);
}

/* ---- 4. Mobile ------------------------------------------------------- */
@media (max-width: 768px) {

    /* 4a. Section navigation as a scrollable pill row.
       Previously every nav link lived behind the hamburger, so moving between
       sections took two taps and gave no sense of place. The mockup puts the
       sections on screen as pills; this does the same. The primary nav (logo /
       account) stays in the hamburger. */
    .nav-links.secondary-links {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        gap: 0.45rem;
        margin: 0;
        padding: 0.6rem 1rem;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .nav-links.secondary-links::-webkit-scrollbar { display: none; }

    .nav-links.secondary-links li {
        width: auto;
        flex: 0 0 auto;
        border-bottom: none;
        text-align: left;
    }

    .nav-links.secondary-links li a {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        white-space: nowrap;
        padding: 0.5rem 0.95rem !important;
        border-radius: 999px;
        background: #f4f6f3;
        border: 1px solid rgba(31, 72, 54, 0.12);
        font-size: 0.85rem;
        font-weight: 600;
        min-height: 40px;
        box-sizing: border-box;
    }

    .nav-links.secondary-links li a.active {
        background: var(--primary-color);
        border-color: var(--primary-color);
        color: var(--white) !important;
    }

    .nav-links.secondary-links li a.active i { color: var(--white) !important; }

    .secondary-nav {
        flex-direction: row;
        align-items: center;
        padding: 0;
        width: 100%;
    }

    .secondary-header { padding: 0; }

    /* 4b. Tighter section padding — the old 4rem/6rem wasted most of a phone
       screen before any content appeared. */
    section,
    .main-tab-content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .featured-recipes,
    .shopping-list,
    .cook-with,
    .map-section,
    .profile {
        padding-top: 1.5rem;
        padding-bottom: 2.5rem;
    }

    .main-tab-content > h2,
    section > h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    /* 4c. One card per row; stop the 400px minimum forcing overflow. */
    .recipe-grid,
    .recipes-container,
    .recipe-showcase,
    .contributors-grid,
    .author-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* 4d. Hero */
    .hero-merged h1,
    .hero h1,
    .hero-content h1 {
        font-size: 2rem !important;
    }

    .hero-merged,
    .hero {
        padding: 2.5rem 1rem 2rem !important;
    }

    /* 4e. Filter controls as a scrollable row rather than a stacked block. */
    .filter-tabs {
        gap: 0.5rem !important;
    }

    .filter-select {
        font-size: 0.85rem !important;
        padding: 0.45rem 0.9rem !important;
    }
}

/* =====================================================================
   Hamburger fix: keep the section pills out of the slide-in drawer.
   At <=768px `.nav-links` becomes a fixed full-screen drawer, and the
   hamburger toggles `.active` on *every* .nav-links list. Since the
   section nav is now permanently visible as pills, it was also being
   turned into a second full-screen overlay on top of the first.
   ===================================================================== */
@media (max-width: 768px) {
    .nav-links.secondary-links,
    .nav-links.secondary-links.active {
        position: static !important;
        left: auto !important;
        top: auto !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        z-index: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow-y: visible !important;
        transition: none !important;
        padding: 0.55rem 1rem !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* The drawer itself only ever holds the account menu. */
    .nav-links.primary-links {
        z-index: 1200;
    }

    /* Keep the hamburger and the account button above the drawer. */
    .hamburger,
    .mobile-auth-actions {
        z-index: 1300 !important;
    }

    /* The user dropdown belongs to the account button, not the drawer. */
    .user-dropdown {
        z-index: 1400 !important;
    }
}

@media (max-width: 768px) {
    /* The drawer only ever contained the account button, which the person
       icon in .mobile-auth-actions already provides, and the section links
       are now permanently visible as pills. So the hamburger opened a
       full-screen overlay duplicating what was already on screen. Remove
       both; delete this rule to bring the drawer back. */
    .hamburger { display: none !important; }

    .nav-links.primary-links,
    .nav-links.primary-links.active {
        display: none !important;
    }
}


/* =====================================================================
   Header clearance driven by the measured header height (--header-h,
   set in script.js). Falls back to a sane value before JS runs.
   ===================================================================== */
:root { --header-h: 132px; }

.main-tab-content,
.hero,
.profile-container,
main:not(.main-tab-content) {
    padding-top: calc(var(--header-h) + 1rem) !important;
}

.recipe-header {
    padding-top: calc(var(--header-h) + 1rem) !important;
}

@media (max-width: 768px) {
    /* Smaller pills so the header stays short and the row is less likely to
       wrap onto a second line. */
    .nav-links.secondary-links {
        padding: 0.4rem 0.75rem !important;
        gap: 0.35rem !important;
        row-gap: 0.35rem !important;
    }

    .nav-links.secondary-links li a {
        padding: 0.32rem 0.7rem !important;
        font-size: 0.78rem !important;
        min-height: 32px !important;
        gap: 0.3rem;
    }

    .nav-links.secondary-links li a i {
        font-size: 0.75em;
    }

    .primary-header {
        padding: 0.5rem 0 !important;
    }

    .logo a,
    .logo {
        font-size: 1.25rem !important;
    }

    .main-tab-content,
    .hero,
    .profile-container,
    main:not(.main-tab-content) {
        padding-top: calc(var(--header-h) + 0.75rem) !important;
    }
}

/* =====================================================================
   Meal planner, phone layout: a card per day with three meal pills.
   Supersedes the rotated grid — same cells, different presentation.
   ===================================================================== */
@media (max-width: 768px) {

    /* The original grid scaffolding is replaced by the day cards. */
    .mp-hidden-on-cards { display: none !important; }

    .mp-grid[data-day-cards="1"] {
        display: flex !important;
        flex-direction: column;
        gap: 0.6rem;
        background: transparent;
        padding: 0;
        min-width: 0;
    }

    .mp-day-card {
        background: var(--white);
        border: 1px solid rgba(31, 72, 54, 0.14);
        border-radius: 14px;
        padding: 0.6rem 0.7rem 0.7rem;
        box-shadow: 0 1px 2px rgba(31, 72, 54, 0.05);
    }

    .mp-day-name {
        font-family: var(--body-font);
        font-weight: 700;
        font-size: 0.95rem;
        color: var(--header-text-color);
        margin-bottom: 0.45rem;
    }

    .mp-day-meals {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
        align-items: start;
    }

    .mp-slot { min-width: 0; }

    .mp-slot-label {
        font-size: 0.62rem;
        font-weight: 600;
        color: var(--muted-text);
        text-align: center;
        margin-bottom: 0.25rem;
    }

    /* Each meal slot renders as a pill rather than a grid cell. */
    .mp-day-card .mp-cell {
        min-height: 34px !important;
        height: auto;
        padding: 0 !important;
        border-radius: 999px !important;
        border: 1px dashed rgba(31, 72, 54, 0.28) !important;
        background: var(--white) !important;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Empty slot: outlined "+ Meal" pill. */
    .mp-day-card .mp-cell.empty::before {
        content: "+" !important;
        position: static !important;
        font-size: 0.85rem !important;
        color: var(--muted-text) !important;
        font-weight: 600;
    }

    /* Filled slot: solid green pill with thumbnail and title. */
    .mp-day-card .mp-cell:not(.empty) {
        border-style: solid !important;
        border-color: var(--primary-color) !important;
        background: var(--primary-color) !important;
    }

    .mp-day-card .mp-cell-recipe {
        flex-direction: row !important;
        align-items: center;
        gap: 5px;
        height: auto !important;
        width: 100%;
        background: transparent !important;
        box-shadow: none !important;
        padding: 3px 7px 3px 3px;
        border-radius: 999px;
        overflow: hidden;
    }

    .mp-day-card .mp-cell-recipe img {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px;
        border-radius: 50% !important;
        object-fit: cover;
        flex-shrink: 0;
    }

    .mp-day-card .mp-cell-recipe .lbl {
        padding: 0 !important;
        font-size: 0.62rem !important;
        line-height: 1.15;
        color: #fff !important;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: unset;
    }

    .mp-day-card .mp-cell-recipe .time,
    .mp-day-card .mp-cell-recipe .mp-servings { display: none !important; }

    .mp-day-card .mp-cell-remove {
        top: 2px;
        right: 2px;
        width: 15px;
        height: 15px;
        font-size: 9px;
    }

    /* ---- Saved Recipes strip: 3 across, much smaller ---- */
    .mp-saved-list {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
        margin-top: 0.4rem !important;
    }

    .mp-saved-list .mp-empty { grid-column: 1 / -1; }

    .mp-recipe img {
        height: 52px !important;
    }

    .mp-recipe .mp-recipe-title {
        font-size: 0.62rem !important;
        padding: 0.25rem 0.3rem 0.3rem !important;
        line-height: 1.15;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Cook time is noise at this size. */
    .mp-recipe .mp-recipe-meta { display: none !important; }

    .mp-sidebar {
        max-height: none !important;
        padding-bottom: 0.75rem !important;
    }
}


/* =====================================================================
   Meal slots: photo-only tiles matching the Saved Recipes thumbnails.
   The name is hidden until the slot is tapped, so a full week stays
   readable at a glance. Overrides the earlier pill treatment.
   ===================================================================== */
@media (max-width: 768px) {
    .mp-day-card .mp-cell {
        min-height: 56px !important;
        border-radius: 10px !important;
        border: 1px dashed rgba(31, 72, 54, 0.28) !important;
        background: var(--white) !important;
        position: relative;
        overflow: hidden;
        display: block;
    }

    .mp-day-card .mp-cell.empty {
        min-height: 44px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mp-day-card .mp-cell:not(.empty) {
        border-style: solid !important;
        border-color: rgba(31, 72, 54, 0.14) !important;
        background: var(--white) !important;
        padding: 0 !important;
    }

    .mp-day-card .mp-cell-recipe {
        flex-direction: column !important;
        gap: 0;
        height: auto !important;
        width: 100%;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 10px;
        overflow: hidden;
    }

    /* Same proportions as .mp-recipe img in the Saved Recipes strip. */
    .mp-day-card .mp-cell-recipe img {
        width: 100% !important;
        height: 56px !important;
        min-width: 0;
        border-radius: 0 !important;
        object-fit: cover !important;
        display: block;
        flex-shrink: 0;
    }

    /* Name hidden by default; slides over the photo when tapped. */
    .mp-day-card .mp-cell-recipe .lbl {
        display: none !important;
        position: absolute;
        inset: 0;
        margin: 0;
        padding: 4px 5px !important;
        background: rgba(31, 72, 54, 0.92);
        color: #fff !important;
        font-size: 0.58rem !important;
        font-weight: 600;
        line-height: 1.2;
        align-items: center;
        justify-content: center;
        text-align: center;
        overflow: hidden;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    .mp-day-card .mp-cell.show-name .mp-cell-recipe .lbl {
        display: flex !important;
    }

    .mp-day-card .mp-cell-recipe .time,
    .mp-day-card .mp-cell-recipe .mp-servings { display: none !important; }

    .mp-day-card .mp-cell-remove {
        display: block;
        top: 3px;
        right: 3px;
        width: 17px;
        height: 17px;
        font-size: 10px;
        z-index: 3;
    }

    /* ---- Shopping list, now embedded under the weekly menu ---- */
    .mp-shopping-embedded {
        padding: 1.25rem 0 0 !important;
        margin-top: 1.5rem;
        border-top: 1px solid rgba(31, 72, 54, 0.12);
        background: transparent !important;
    }
}

/* Embedded shopping list: no longer a standalone tab, so it should not
   carry the full-page section padding or its own top offset. */
.mp-shopping-embedded {
    padding: 1.5rem 0 0 !important;
    margin-top: 2rem;
    border-top: 1px solid rgba(31, 72, 54, 0.12);
    background: transparent !important;
    min-height: 0 !important;
}

.mp-shopping-embedded > h2 {
    text-align: left;
}


/* =====================================================================
   Servings stepper fixes.
   Desktop: the cell was min-height 110px with overflow:hidden, but the
   photo (55%) + title + time + stepper needed ~121px, so the stepper was
   clipped off the bottom. Give the row real height and pin the photo to a
   fixed size so the text and stepper always fit.
   ===================================================================== */
.mp-grid {
    grid-auto-rows: minmax(158px, auto);
}

.mp-cell {
    min-height: 158px;
}

.mp-cell-recipe {
    justify-content: flex-start;
}

.mp-cell-recipe img {
    height: 66px !important;
    flex-shrink: 0;
}

.mp-cell-recipe .mp-servings {
    margin-top: auto;
    flex-shrink: 0;
    padding-bottom: 2px;
}

@media (max-width: 768px) {
    /* Phone: the stepper joins the tap-to-reveal overlay, so a meal's
       servings can be changed without leaving the week view. */
    .mp-day-card .mp-cell.show-name .mp-cell-recipe .lbl {
        inset: 0 0 24px 0;
        -webkit-line-clamp: 2;
    }

    .mp-day-card .mp-cell.show-name .mp-cell-recipe .mp-servings {
        display: flex !important;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 4;
        margin: 0;
        padding: 2px 4px;
        gap: 6px;
        background: rgba(20, 48, 36, 0.96);
        justify-content: center;
        align-items: center;
    }

    .mp-day-card .mp-cell.show-name .mp-servings .serv-btn {
        width: 18px;
        height: 18px;
        min-width: 18px;
        font-size: 0.75rem;
        background: rgba(255, 255, 255, 0.9);
        border-color: transparent;
        color: var(--primary-color);
    }

    .mp-day-card .mp-cell.show-name .mp-servings .servings-display {
        color: #fff;
        font-size: 0.56rem;
    }

    /* Hint that tapping does something, since the photo alone gives no cue. */
    .mp-day-card .mp-cell:not(.empty)::after {
        content: "";
        position: absolute;
        right: 4px;
        bottom: 4px;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.85);
        box-shadow: 0 0 0 1px rgba(31, 72, 54, 0.35);
        pointer-events: none;
    }

    .mp-day-card .mp-cell.show-name::after { display: none; }
}


/* =====================================================================
   Mobile bottom navigation + the meal-planner tap hint.
   ===================================================================== */
.bottom-nav { display: none; }

.mp-tap-hint { display: none; }

@media (max-width: 768px) {
    .bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        background: var(--primary-color);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        /* Clear the iOS home indicator. */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -2px 10px rgba(31, 72, 54, 0.18);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 56px;
        padding: 6px 2px;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.72);
        font-size: 0.6rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        transition: color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item i { font-size: 1.05rem; }

    .bottom-nav-item.active,
    .bottom-nav-item:active { color: #fff; }

    /* Sections are reachable from the bar, so the header strip is redundant
       and its height is better spent on content. */
    .secondary-header { display: none !important; }

    /* Nothing should end up trapped under the fixed bar. */
    body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

    .mp-tap-hint {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        margin: 0 0 0.75rem;
        padding: 0.5rem 0.65rem;
        background: rgba(31, 72, 54, 0.06);
        border-left: 3px solid var(--primary-color);
        border-radius: 0 6px 6px 0;
        font-size: 0.72rem;
        line-height: 1.3;
        color: var(--text-color);
    }

    .mp-tap-hint i { color: var(--primary-color); }
}


/* =====================================================================
   Blank-space cleanup + slimmer mobile header.
   ===================================================================== */

/* The fixed-header clearance is applied to .main-tab-content, .hero and
   .profile-container alike, but #recipes wraps a .hero and #profile wraps a
   .profile-container -- so those two tabs reserved the header's height twice
   and opened a gap. The outer section already clears the header; the inner
   element only needs its own breathing room. */
.main-tab-content .hero {
    padding-top: 1.5rem !important;
}

.main-tab-content .profile-container {
    padding-top: 0 !important;
}

@media (max-width: 768px) {
    .main-tab-content .hero {
        padding-top: 1rem !important;
    }

    /* Only one tab is on screen at a time, so the global 6rem section padding
       left ~96px of dead space under every tab and squeezed the sides. */
    section {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: 2rem;
    }

    /* Header trimmed to the wordmark and the account button: the section
       links now live in the bottom bar, so this only has to identify the
       site. Less chrome, more content. */
    .primary-header {
        padding: 0.3rem 0 !important;
    }

    .primary-nav {
        padding-top: 0.15rem !important;
        padding-bottom: 0.15rem !important;
        align-items: center;
        flex-wrap: nowrap;
    }

    .logo a,
    .logo {
        font-size: 1.05rem !important;
        line-height: 1.2 !important;
    }

    .mobile-auth-actions button,
    #mobile-user-menu-btn,
    #mobile-login-btn {
        font-size: 1.15rem !important;
        padding: 0.25rem 0.35rem !important;
        line-height: 1 !important;
    }
}


/* =====================================================================
   Mobile header height.
   Trimming the padding was not enough: .primary-nav carries
   `min-height: 60px`, set back when the nav stacked its links vertically
   and needed room for them. The links now live in the bottom bar and the
   only in-flow child is the wordmark, so that floor is just empty space.
   Header goes from roughly 70px to roughly 48px.
   ===================================================================== */
@media (max-width: 768px) {
    .primary-nav {
        min-height: 42px !important;
        padding: 0.1rem 0.9rem !important;
    }

    .primary-header {
        padding: 0.15rem 0 !important;
    }

    /* The account button is absolutely positioned and was pinned 0.8rem from
       a much taller header's top edge. Centre it instead so it stays put at
       whatever height the header settles on. Absolute elements do not add to
       the parent's height, so a 40px target costs nothing. */
    .mobile-auth-actions {
        top: 50% !important;
        transform: translateY(-50%) !important;
        right: 0.75rem !important;
    }

    /* No `display` here on purpose: updateLoginButton() toggles these two
       via inline style, and an !important display would outrank it and
       leave the Login button showing next to the account button. */
    .mobile-auth-actions button,
    #mobile-user-menu-btn,
    #mobile-login-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        align-items: center;
        justify-content: center;
    }
}


/* Mobile header "add a recipe" button: same footprint as the account
   button beside it, filled so it reads as the primary action. */
@media (max-width: 768px) {
    #mobile-add-recipe-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        background: var(--primary-color);
        color: #fff;
        text-decoration: none;
        font-size: 1rem;
        line-height: 1;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    #mobile-add-recipe-btn:active {
        opacity: 0.85;
    }

    /* Two 40px buttons need less air between them than the old single one. */
    .mobile-auth-actions {
        gap: 8px !important;
    }
}


/* =====================================================================
   Header: wordmark hard left, the two round buttons matched in size.
   ===================================================================== */
@media (max-width: 768px) {
    /* .primary-nav is a *column* flex on mobile, so the align-items:center
       added with the height trim was centring the wordmark horizontally.
       Lay it out as a row and start it at the left edge. */
    .primary-nav {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding-left: 0.5rem !important;
    }

    /* .logo is itself a flex row with `width: 100%; justify-content: center`
       (set back when the wordmark was meant to be centred), so text-align
       could never move it — the <a> is a flex item, not text flow. Shrink
       the box to its contents and start it at the left. */
    .logo {
        width: auto !important;
        justify-content: flex-start !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
        text-align: left !important;
    }

    /* The account control is a glyph (fa-user-circle draws its own ring)
       while the upload control is a plus on a filled background. Matching
       the boxes alone would still leave two different-looking circles, so
       size the glyph up until its ring matches the filled circle: both now
       read as the same 34px button. */
    /* fa-user-circle renders at 1em wide, so the glyph's ring diameter is
       its font-size. Setting it to exactly the upload button's 34px makes
       the two circles identical; px not rem, so a changed root size cannot
       drift them apart again. */
    .mobile-auth-actions #mobile-user-menu-btn {
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
        font-size: 34px !important;
        line-height: 1 !important;
        overflow: visible !important;
    }

    .mobile-auth-actions #mobile-user-menu-btn i {
        font-size: inherit !important;
        line-height: 1 !important;
    }

    #mobile-add-recipe-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.95rem !important;
    }
}


/* Desktop "Add Recipe" pill in the primary nav. Matches .hero-signup-btn,
   the site's existing call-to-action treatment, at a size that sits
   comfortably in a header row rather than a hero. */
.add-recipe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--primary-color);
    color: var(--white) !important;
    border: 1px solid var(--primary-color);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
    min-height: 38px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, transform 0.05s;
}

.add-recipe-btn:hover {
    background: #16352a;
    color: var(--white) !important;
}

.add-recipe-btn:active {
    transform: scale(0.98);
}

/* .nav-links a is coloured by a site-wide !important rule; the pill needs
   its own contrast against the filled background. */
.nav-links .add-recipe-btn,
.nav-links li a.add-recipe-btn {
    color: var(--white) !important;
}

#desktop-add-recipe-item {
    display: flex;
    align-items: center;
    margin-right: 0.75rem;
}

/* Phones use the round + beside the account icon instead; the whole
   primary-links list is hidden there anyway, but be explicit. */
@media (max-width: 768px) {
    #desktop-add-recipe-item {
        display: none !important;
    }
}


/* =====================================================================
   Recipe detail, styled to the mockup: photo up top, title, a row of
   icon actions, a servings stepper, then tabbed content.
   ===================================================================== */

/* ---- Action toolbar -------------------------------------------------
   The five buttons already exist with the right icons, but their labels
   are sentences ("Add to Favorites") and recipe-detail.js rewrites that
   text when state changes. So the short label comes from CSS instead of
   markup: zero the button's font-size to drop the text node, restore it
   on the icon, and supply the caption with ::after. Survives every
   innerHTML rewrite. */
.recipe-actions-section {
    gap: 0 !important;
    border-bottom: 1px solid rgba(31, 72, 54, 0.12);
    padding-bottom: 0.85rem;
    flex-wrap: nowrap;
}

.recipe-actions-section .action-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--primary-color) !important;
    flex: 1 1 0;
    min-width: 0;
    padding: 0.35rem 0.15rem !important;
    border-radius: 10px !important;
    font-size: 0 !important;
    flex-direction: column;
    gap: 0.3rem !important;
    line-height: 1.1;
}

.recipe-actions-section .action-btn i {
    font-size: 1.25rem;
    line-height: 1;
}

.recipe-actions-section .action-btn::after {
    font-family: var(--body-font);
    font-size: 0.66rem;
    font-weight: 600;
    white-space: nowrap;
}

#favorite-btn::after     { content: "Favorite"; }
#weekly-menu-btn::after  { content: "Menu"; }
#attempted-btn::after    { content: "Log Attempt"; }
#share-btn::after        { content: "Share"; }
#fork-recipe-btn::after  { content: "Remix"; }

/* The weekly-menu button was the one filled control in the row; flatten it
   so the five read as one toolbar. */
#weekly-menu-btn {
    background: none !important;
    color: var(--primary-color) !important;
}

.recipe-actions-section .action-btn:active {
    background: rgba(31, 72, 54, 0.07) !important;
}

/* ---- Servings stepper ----------------------------------------------- */
.rd-servings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--cream-bg, #f6f3e9);
    border: 1px solid rgba(31, 72, 54, 0.14);
    border-radius: 12px;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.85rem;
}

.rd-serv-btn {
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.22);
    color: var(--primary-color);
    border-radius: 9px;
    min-width: 44px;
    min-height: 38px;
    font-family: var(--body-font);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

.rd-serv-btn:active { transform: scale(0.97); }

.rd-serv-count {
    flex: 1 1 auto;
    text-align: center;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-color);
}

/* ---- Tabs ------------------------------------------------------------ */
.rd-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid rgba(31, 72, 54, 0.14);
    margin-bottom: 1rem;
}

.rd-tab {
    flex: 1 1 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 0.35rem;
    font-family: var(--body-font);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted-text);
    cursor: pointer;
    margin-bottom: -1px;
}

.rd-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.rd-panel { display: none; }
.rd-panel.active { display: block; }

/* ---- Tick-off ingredients -------------------------------------------- */
#ingredients-list li {
    display: flex !important;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* The stock bullet is a check-circle glyph; the mockup wants a checkbox. */
#ingredients-list li > i {
    display: none !important;
}

#ingredients-list li::before {
    content: "";
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 1.5px solid rgba(31, 72, 54, 0.35);
    border-radius: 4px;
    background: var(--white);
    transition: background 0.12s, border-color 0.12s;
}

#ingredients-list li.rd-checked::before {
    background: var(--primary-color);
    border-color: var(--primary-color);
    /* Font Awesome check, drawn inside the filled box. */
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ingredients-list li.rd-checked {
    color: var(--muted-text);
    text-decoration: line-through;
    text-decoration-color: rgba(31, 72, 54, 0.45);
}

/* =====================================================================
   Wide screens: same components, but all three panels at once — a recipe
   is easier to cook from with ingredients and steps both visible.
   ===================================================================== */
@media (min-width: 769px) {
    .rd-tabs { display: none; }

    .rd-panels {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
        gap: 2.5rem;
        align-items: start;
    }

    .rd-panel { display: block !important; }

    /* Description reads across the full width above the two columns. */
    #rd-panel-desc { grid-column: 1 / -1; }

    .recipe-actions-section {
        max-width: 640px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .recipe-actions-section .action-btn i { font-size: 1.4rem; }
    .recipe-actions-section .action-btn::after { font-size: 0.75rem; }

    .rd-servings {
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* =====================================================================
   Phone layout: full-bleed photo, tighter type.
   ===================================================================== */
@media (max-width: 768px) {
    /* The photo is the page's opening image in the mockup: edge to edge,
       cropped, no card chrome. Inline styles on the element force these. */
    #recipe-image {
        max-height: 240px !important;
        object-fit: cover !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .recipe-visuals {
        margin-left: -1rem !important;
        margin-right: -1rem !important;
        max-width: calc(100% + 2rem) !important;
        margin-top: 0 !important;
    }

    #recipe-title {
        font-size: 1.75rem !important;
        line-height: 1.15 !important;
        margin-bottom: 0.5rem !important;
        text-align: left;
    }

    .recipe-header { padding-bottom: 0 !important; }

    .recipe-detail-section { padding-left: 1rem; padding-right: 1rem; }

    /* Original-servings note and the metric toggle are secondary; keep them
       available but out of the stepper's way. */
    .servings-control > label { display: none !important; }

    .servings-control > div {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        font-size: 0.8rem;
    }

    #servings-input,
    #scale-servings-btn { display: none !important; }

    #recipe-description {
        text-align: left !important;
        font-size: 0.95rem !important;
        margin-top: 0 !important;
    }
}


/* The page's own <style> block makes .servings-control a flex *row* with
   space-between, which would sit the new stepper beside the old controls
   instead of above them. Stack it, and stop that block's <=600px
   "servings-control button { flex: 1 }" rule from stretching the keys. */
.servings-control {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
}

.rd-servings { width: 100%; }

.servings-control .rd-serv-btn {
    flex: 0 0 auto !important;
}


/* =====================================================================
   Mobile header, tidied.

   What was wrong: a 1.05rem wordmark sat against two solid dark-green
   34px discs, so the buttons outweighed the brand; the left inset
   (0.5rem) did not match the right (0.75rem); the bar was 48px tall so
   34px controls had ~7px of air; and a drop shadow plus a hairline
   border drew the boundary twice.

   Fixes: balanced insets, a slightly larger wordmark, one separator,
   room around the controls, and a primary/secondary split so the two
   buttons stop competing.
   ===================================================================== */
@media (max-width: 768px) {
    header {
        box-shadow: none !important;
    }

    .primary-header {
        padding: 0.3rem 0 !important;
        border-bottom: 1px solid rgba(31, 72, 54, 0.1) !important;
        background: var(--white);
    }

    .primary-nav {
        min-height: 46px !important;
        padding: 0.1rem 0.9rem !important;
    }

    .logo a,
    .logo {
        font-size: 1.2rem !important;
        letter-spacing: 0.005em;
        line-height: 1.2 !important;
    }

    .mobile-auth-actions {
        right: 0.9rem !important;
        gap: 10px !important;
    }

    /* Primary action: solid, so "add a recipe" is the one thing that
       draws the eye. */
    #mobile-add-recipe-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.9rem !important;
        background: var(--primary-color);
        color: #fff;
        border: 1px solid var(--primary-color);
        box-shadow: 0 1px 2px rgba(31, 72, 54, 0.18);
    }

    /* Secondary action: same footprint, lighter weight. The stock
       fa-user-circle is a filled disc, which read as a second heavy blob
       next to the + button, so swap in a plain user glyph inside an
       outlined circle. Markup is static here, so CSS can own the icon. */
    .mobile-auth-actions #mobile-user-menu-btn {
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        background: var(--white) !important;
        border: 1.5px solid rgba(31, 72, 54, 0.28) !important;
        color: var(--primary-color) !important;
        font-size: 0.95rem !important;
        line-height: 1 !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        overflow: visible !important;
    }

    .mobile-auth-actions #mobile-user-menu-btn > i {
        display: none !important;
    }

    .mobile-auth-actions #mobile-user-menu-btn::before {
        content: "\f007";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 0.95rem;
        line-height: 1;
    }

    /* Signed out, the login control is the only button, so it takes the
       solid treatment the + button has when signed in. */
    #mobile-login-btn {
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
        background: var(--primary-color) !important;
        color: #fff !important;
        border: 1px solid var(--primary-color) !important;
        font-size: 0.9rem !important;
        line-height: 1 !important;
        align-items: center;
        justify-content: center;
    }
}


/* =====================================================================
   Recipe action toolbar: force the compact icon row.

   Two rules were defeating the earlier attempt:

     1. "@media (max-width: 768px) { .recipe-actions-section {
        flex-direction: column } }" — the toolbar never set row, so the
        five buttons stacked and flex:1 stretched each to full width.
     2. ".action-btn:not(.primary):not(.btn-view-recipe)" is three
        classes (0,3,0) with !important, so it outranked the earlier
        ".recipe-actions-section .action-btn" (0,2,0) and kept repainting
        the pill background, border and 1.1rem padding.

   Matching that selector inside .recipe-actions-section gives (0,4,0),
   which wins without needing to touch the shared rule that other pages
   rely on.
   ===================================================================== */
.recipe-actions-section {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 0 !important;
    padding: 0 0 0.7rem !important;
    margin-bottom: 1rem !important;
}

.recipe-actions-section .action-btn,
.recipe-actions-section .action-btn:not(.primary):not(.btn-view-recipe) {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    background: none !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    color: var(--primary-color) !important;
    padding: 0.3rem 0.1rem !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.25rem !important;
    font-size: 0 !important;
    line-height: 1.05 !important;
}

/* Remix is hidden until the viewer is signed in and not the author;
   never let the toolbar rule force it visible. */
#fork-recipe-btn[style*="display: none"] {
    display: none !important;
}

.recipe-actions-section .action-btn i {
    font-size: 1.05rem !important;
    line-height: 1 !important;
}

.recipe-actions-section .action-btn::after {
    font-size: 0.56rem !important;
    font-weight: 600;
    font-family: var(--body-font);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

@media (min-width: 769px) {
    .recipe-actions-section {
        max-width: 520px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .recipe-actions-section .action-btn i { font-size: 1.2rem !important; }
    .recipe-actions-section .action-btn::after { font-size: 0.68rem !important; }
}


/* Map "Match by" chips. Multi-select toggles, so they read as chips rather
   than a segmented control (which would imply one choice). */
.map-mode-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0 auto 1.25rem;
    max-width: 1000px;
}

.mmf-label {
    font-family: var(--body-font);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted-text);
    margin-right: 0.15rem;
}

.mmf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.25);
    color: var(--primary-color);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    min-height: 36px;
    font-family: var(--body-font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mmf-btn i { font-size: 0.85em; opacity: 0.85; }

.mmf-btn:hover { background: rgba(31, 72, 54, 0.06); }

.mmf-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

@media (max-width: 768px) {
    .map-mode-filters {
        justify-content: flex-start;
        gap: 0.35rem;
        margin-bottom: 1rem;
    }

    .mmf-label { width: 100%; margin-bottom: 0.1rem; }

    .mmf-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
        min-height: 34px;
    }
}


/* Recipes / Chefs switch. A segmented control, because unlike the Match-by
   chips these are mutually exclusive. */
.map-result-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    max-width: 320px;
    margin: 0 auto 0.85rem;
    border: 1px solid rgba(31, 72, 54, 0.25);
    border-radius: 999px;
    overflow: hidden;
    background: var(--white);
}

.mrt-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    min-height: 40px;
    font-family: var(--body-font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.mrt-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* Chef result cards */
.map-chef-card {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.14);
    border-radius: 12px;
    padding: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, transform 0.05s;
}

.map-chef-card:hover {
    box-shadow: 0 4px 12px rgba(31, 72, 54, 0.12);
}

.mcf-avatar {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.9rem;
}

.mcf-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mcf-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.mcf-name {
    font-family: var(--body-font);
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.mcf-bio {
    font-size: 0.78rem;
    color: var(--muted-text);
    font-style: italic;
    overflow: hidden;
}

.mcf-flags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2px; }

.mcf-flag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    color: #666;
}

.mcf-flag img { border-radius: 2px; }

.mcf-counts { font-size: 0.72rem; color: #888; margin-top: 2px; }

.map-no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted-text);
    padding: 1.5rem 0;
}

@media (max-width: 768px) {
    .map-result-toggle { max-width: 100%; margin-bottom: 0.7rem; }
    .mcf-avatar { width: 40px; height: 40px; font-size: 1.6rem; }
    .mcf-name { font-size: 0.88rem; }
}


/* Recipe origin describes a recipe, so it is withdrawn when the map is
   listing chefs; only the three profile fields remain. */
.map-mode-filters.chefs-mode .mmf-btn[data-mode="recipe"] {
    display: none;
}


/* =====================================================================
   Card styling shared by the phone tiles.

   These were originally unscoped, which condensed the desktop card too:
   it lost its 280px height, its large photo and its description. Desktop
   is back to the stylesheet's own wide card — big image, full description,
   2x2 meta grid, labelled buttons — so everything here is confined to the
   phone, where the two-across tiles depend on it.

   Kept rather than deleted because the tiles need the scaffolding: the
   line clamp needs display:-webkit-box, the chips need their pill
   styling, and the Save/Plan labels are CSS-generated because
   toggleRecipeFavorite() rewrites those buttons' innerHTML on every click.
   ===================================================================== */
@media (max-width: 768px) {
    .recipe-card-wide .wide-info {
        border-right: none !important;
    }

    .recipe-card-wide .wide-title {
        font-family: var(--heading-font);
        margin: 0 !important;
        color: var(--primary-color);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .recipe-card-wide .wide-author-row { margin: 0 !important; }

    /* The full text lives on the recipe page; a tile has no room for it. */
    .recipe-card-wide .wide-description { display: none !important; }

    .recipe-card-wide .wide-details {
        display: flex;
        flex-direction: column;
    }

    .recipe-card-wide .wide-meta-grid {
        display: flex !important;
        margin: 0 !important;
    }

    .recipe-card-wide .wide-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        background: rgba(31, 72, 54, 0.06);
        border-radius: 999px;
        color: var(--primary-color);
        margin: 0 !important;
        white-space: nowrap;
    }

    .recipe-card-wide .wide-meta-item i { opacity: 0.75; }

    /* Specificity is deliberately high: the shared
       ".action-btn:not(.primary):not(.btn-view-recipe)" rule is three
       classes with !important and would otherwise win. */
    .recipe-card-wide .wide-actions .action-btn.btn-favorite,
    .recipe-card-wide .wide-actions .action-btn.btn-weekly-menu {
        display: inline-flex !important;
        align-items: center;
        gap: 0.25rem;
        border-radius: 999px !important;
        font-size: 0 !important;
        line-height: 1 !important;
        min-height: 0 !important;
    }

    .recipe-card-wide .wide-actions .action-btn::after {
        font-family: var(--body-font);
        font-weight: 600;
    }

    .recipe-card-wide .wide-actions .action-btn.btn-favorite::after { content: "Save"; }
    .recipe-card-wide .wide-actions .action-btn.btn-favorite.active::after { content: "Saved"; }
    .recipe-card-wide .wide-actions .action-btn.btn-weekly-menu::after { content: "Plan"; }
    .recipe-card-wide .wide-actions .action-btn.btn-weekly-menu.active::after { content: "Planned"; }

    .recipe-card-wide .wide-actions .action-btn.active {
        background: var(--primary-color) !important;
        color: #fff !important;
        border-color: var(--primary-color) !important;
    }
}

/* =====================================================================
   Share now sits in the actions row beside Save and Plan, not floating
   over the photo. search-filter.js clears its inline positioning when it
   moves the button, so all of its appearance comes from here.
   ===================================================================== */
.recipe-card-wide .wide-actions .wide-share-btn {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    background: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-family: var(--body-font);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    min-height: 0;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.recipe-card-wide .wide-actions .wide-share-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.recipe-card-wide .wide-actions .wide-share-btn i {
    font-size: 0.75rem;
    margin-right: 0 !important;
}

/* =====================================================================
   Phone card: two-across photo tiles.

   Two earlier attempts missed opposite ways. A full-width 16:9 photo made
   the image the focal point but fitted barely two cards on screen. A
   104px thumbnail row was dense but demoted the photo to an afterthought.
   Two tiles per row gives both: at a 390px viewport each photo is about
   170x128 — far larger than the thumbnail — while six tiles fit where two
   used to. It also matches the tile grids already used on the profile.

   This is the single authoritative mobile layout for the card: last card
   rule in the file, stating every property that matters, so no earlier
   rule can half-apply and leave a broken hybrid.
   ===================================================================== */
@media (max-width: 768px) {
    /* search-filter.css has ".recipe-showcase { grid-template-columns: 1fr
       !important }" — same specificity, but it loads after this file, so a
       plain ".recipe-showcase" here loses the tie and the tiles stayed one
       per row. The id and the doubled class outrank it, so order stops
       mattering. */
    #recipes-container,
    .recipe-showcase.recipe-showcase {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.6rem !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto !important;
        padding: 0 !important;
        align-items: start;
    }

    .recipe-card-wrapper { margin: 0 !important; }

    .recipe-card-wide {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: 0;
        margin: 0 !important;
        overflow: hidden;
    }

    /* The photo leads: full tile width, fixed 4:3, never shrinkable. */
    .recipe-card-wide .wide-image {
        order: -1;
        width: 100% !important;
        height: auto !important;
        min-height: 0;
        aspect-ratio: 4 / 3;
        flex: 0 0 auto !important;
        border-radius: 0 !important;
    }

    .recipe-card-wide .wide-image img {
        width: 100%;
        height: 100%;
        object-fit: cover !important;
    }

    .recipe-card-wide .wide-info {
        width: auto !important;
        padding: 0.45rem 0.55rem 0.15rem !important;
        gap: 0.1rem;
        /* search-filter.css's <=900px block draws a dashed rule under the
           info column, which cuts each tile in half. */
        border-right: none !important;
        border-bottom: none !important;
    }

    .recipe-card-wide .wide-title {
        font-size: 0.85rem !important;
        line-height: 1.22 !important;
        -webkit-line-clamp: 2;
    }

    .recipe-card-wide .wide-author-row {
        font-size: 0.68rem !important;
        gap: 0.25rem !important;
    }

    .recipe-card-wide .wide-author-row img {
        width: 14px !important;
        height: 14px !important;
        margin-right: 2px !important;
    }

    /* At tile width every extra line pushes the photo up the page. The
       date, the origin chips and the floating share button all lose to
       keeping the image large. */
    .recipe-card-wide .wide-date { display: none !important; }
    /* share lives in the actions row; nothing to hide */

    .recipe-card-wide .wide-details {
        width: auto !important;
        padding: 0 0.55rem 0.5rem !important;
        gap: 0.3rem;
        justify-content: flex-start;
    }

    .recipe-card-wide .wide-meta-grid {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.22rem !important;
    }

    /* ---- Actions share the cook-time line ---------------------------
       Off the photo, which the picture is better without, and still free
       of extra height because they sit on a row that already exists.
       search-filter.js moves the node into .wide-details at this width. */
    .recipe-card-wide .wide-details {
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        gap: 0.4rem !important;
    }

    .recipe-card-wide .wide-actions {
        position: static;
        z-index: auto;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        flex: 0 0 auto;
    }

    .recipe-card-wide .wide-actions .action-btn.btn-favorite,
    .recipe-card-wide .wide-actions .action-btn.btn-weekly-menu,
    .recipe-card-wide .wide-actions .wide-share-btn {
        flex: 0 0 auto !important;
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 1px solid rgba(31, 72, 54, 0.22) !important;
        border-radius: 50% !important;
        background: var(--white) !important;
        color: var(--primary-color) !important;
        box-shadow: none;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        font-size: 0 !important;
    }

    /* The Save/Plan word labels are CSS-generated; drop them so only the
       glyph remains at this size. */
    .recipe-card-wide .wide-actions .action-btn::after { content: none !important; }

    .recipe-card-wide .wide-actions .action-btn i,
    .recipe-card-wide .wide-actions .wide-share-btn i {
        font-size: 0.6rem !important;
        margin: 0 !important;
        line-height: 1;
    }

    .recipe-card-wide .wide-actions .action-btn.active {
        background: var(--primary-color) !important;
        color: #fff !important;
    }

    /* ---- Only cook time survives from the tag grid ------------------ */
    .recipe-card-wide .wide-meta-grid {
        display: flex !important;
        margin: 0 !important;
    }

    .recipe-card-wide .wide-meta-item {
        display: none !important;
    }

    .recipe-card-wide .wide-meta-item[title="Cook Time"] {
        display: inline-flex !important;
        background: none !important;
        padding: 0 !important;
        font-size: 0.66rem !important;
        color: var(--muted-text) !important;
        gap: 0.25rem;
        white-space: nowrap;
    }

    .recipe-card-wide .wide-meta-grid { flex: 0 1 auto; }

    .recipe-card-wide .wide-actions {
        margin-top: 0.3rem !important;
        gap: 0.25rem !important;
        flex-wrap: nowrap;
    }

    .recipe-card-wide .wide-actions .action-btn.btn-favorite,
    .recipe-card-wide .wide-actions .action-btn.btn-weekly-menu {
        flex: 1 1 0;
        justify-content: center;
        padding: 0.25rem 0.3rem !important;
    }

    .recipe-card-wide .wide-actions .action-btn i { font-size: 0.7rem !important; }
    .recipe-card-wide .wide-actions .action-btn::after { font-size: 0.6rem; }
}


/* =====================================================================
   Home hero on phones: shrink the tan block to just the filters.

   It opened with a 2rem "Welcome to Collective Cooks", a tagline, a heading
   reading "Filter recipes by:" and 2.5rem of padding — most of a phone
   screen before a single recipe. The greeting goes, the tagline moves up
   into the header beside the wordmark, and the filters move to the top.

   Desktop keeps the full hero; everything here is inside the phone query.
   ===================================================================== */

/* Header tagline: present in the markup on every width, shown only on
   phones, where it replaces the hero copy rather than duplicating it. */
.logo-tagline { display: none; }

@media (max-width: 768px) {
    .logo {
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        line-height: 1.1;
    }

    .logo-tagline {
        display: block;
        font-family: var(--body-font);
        font-size: 0.56rem;
        font-weight: 500;
        letter-spacing: 0.01em;
        color: var(--muted-text);
        margin-top: 1px;
        white-space: nowrap;
    }

    /* The greeting and the tagline both go: the wordmark above already
       says the name, and the tagline now lives beside it. */
    .hero-merged h1,
    .hero-content h1,
    .hero-merged > .hero-content > p,
    .hero-content > p {
        display: none !important;
    }

    /* Just enough tan to frame the filters. */
    .hero-merged,
    .hero {
        padding: 0.75rem 0.75rem 0.9rem !important;
        margin-bottom: 0.9rem !important;
        border-radius: 0 0 18px 18px !important;
    }

    .hero-filter-section { margin: 0 !important; }

    /* Six labelled dropdowns each already name their filter, so the
       heading above them was a third line saying the same thing. */
    .hero-filter-section h3 { display: none !important; }

    /* Two per row: six selects in three tidy rows instead of a ragged
       wrap, and each stays wide enough to read its label. */
    .hero-merged .filter-tabs,
    .hero-filter-section .filter-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.4rem !important;
        justify-content: stretch !important;
    }

    .hero-filter-section .filter-select {
        width: 100%;
        min-width: 0;
        font-size: 0.78rem !important;
        padding: 0.4rem 0.7rem !important;
        border-width: 1px !important;
    }

    /* Logged-out CTA sits between the filters and the top of the block;
       keep it, but stop it adding a third of the hero's height. */
    .hero-signup-note {
        margin: 0 0 0.6rem !important;
        gap: 0.4rem !important;
    }

    .hero-signup-text { font-size: 0.78rem !important; }

    .hero-signup-btn {
        font-size: 0.8rem !important;
        padding: 0.45rem 1rem !important;
        min-height: 38px !important;
    }
}


/* =====================================================================
   Private recipes: the form option, and the badge on a private card.
   ===================================================================== */
.private-recipe-option {
    margin: 1rem 0 1.25rem;
    padding: 0.85rem 1rem;
    background: rgba(31, 72, 54, 0.04);
    border: 1px solid rgba(31, 72, 54, 0.16);
    border-radius: 10px;
}

.private-recipe-option .pro-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
    margin: 0;
}

.private-recipe-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    flex: 0 0 auto;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.private-recipe-option .pro-text { display: flex; flex-direction: column; gap: 2px; }

.private-recipe-option strong {
    font-family: var(--body-font);
    font-size: 0.92rem;
    color: var(--primary-color);
    font-weight: 700;
}

.private-recipe-option small {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--muted-text);
}

/* Badge: only the owner ever sees these cards, but they should be able to
   tell at a glance which of their recipes are not public. */
.is-private-recipe { position: relative; }

.is-private-recipe::after {
    content: "\f023  Private";
    font-family: "Font Awesome 6 Free", var(--body-font);
    font-weight: 900;
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    background: rgba(20, 48, 36, 0.92);
    color: #fff;
    font-size: 0.6rem;
    letter-spacing: 0.02em;
    padding: 3px 7px;
    border-radius: 999px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .is-private-recipe::after {
        font-size: 0.55rem;
        padding: 2px 5px;
        top: 4px;
        left: 4px;
    }
}


/* =====================================================================
   Phone tile trimmings: the NEW flash and the View Recipe pill. Both are
   phone-only; the desktop card keeps its own layout.
   ===================================================================== */
.wide-new-badge { display: none; }
.wide-cta { display: none; }

@media (max-width: 768px) {
    .recipe-card-wide .wide-image { position: relative; }

    .wide-new-badge {
        display: inline-block;
        position: absolute;
        top: 6px;
        left: 6px;
        z-index: 4;
        background: rgba(255, 255, 255, 0.95);
        color: var(--primary-color);
        font-family: var(--body-font);
        font-size: 0.52rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        padding: 2px 7px;
        border-radius: 999px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    }

    /* The whole card is the link; this is the affordance for it, so it is
       styled as a button but is deliberately not one. */
    .wide-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        margin-top: 0.45rem;
        padding: 0.32rem 0.5rem;
        background: var(--primary-color);
        color: #fff;
        border-radius: 999px;
        font-family: var(--body-font);
        font-size: 0.6rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .wide-cta i { font-size: 0.55rem; }
}


/* =====================================================================
   Recipe stats: average taste rating and attempt tally.
   Rendered on every card so the tiles in a two-column grid keep a common
   height; an unrated recipe says so rather than showing empty stars.
   ===================================================================== */
.wide-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.15rem;
    font-family: var(--body-font);
    font-size: 0.7rem;
    color: var(--muted-text);
}

.ws-stars {
    display: inline-flex;
    gap: 1px;
    color: var(--accent-color, #d97706);
}

.ws-stars i { font-size: 0.66rem; }

.ws-avg {
    font-weight: 700;
    color: var(--text-color);
}

.ws-attempts { white-space: nowrap; }

@media (max-width: 768px) {
    .wide-stats {
        font-size: 0.62rem;
        gap: 0.25rem;
        margin-top: 0.1rem;
    }

    .ws-stars i { font-size: 0.58rem; }

    /* At tile width the star row and the tally will not share a line. */
    .ws-attempts { width: 100%; }
}



/* =====================================================================
   Attempt log: what used to be Community Feedback. Each entry is one
   person cooking the recipe once - their ratings and their write-up
   together, because they describe the same cook.
   ===================================================================== */
.feedback-prompt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.14);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.feedback-prompt p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted-text);
}

.feedback-prompt-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
    border-radius: 999px;
    padding: 0.5rem 1.15rem;
    min-height: 44px;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
}

.al-item {
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.12);
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
}

.al-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.al-who {
    font-family: var(--body-font);
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.al-when { font-size: 0.75rem; color: #94a3b8; }

.al-ratings {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-bottom: 0.4rem;
}

.al-rating {
    font-size: 0.75rem;
    color: var(--muted-text);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.al-stars { color: #f59e0b; display: inline-flex; gap: 1px; }
.al-stars i { font-size: 0.72rem; }

.al-text { margin: 0; font-size: 0.9rem; line-height: 1.45; color: var(--text-color); }

.al-changes {
    margin: 0.4rem 0 0;
    font-size: 0.84rem;
    color: var(--muted-text);
    padding-top: 0.4rem;
    border-top: 1px dashed rgba(31, 72, 54, 0.14);
}

.al-empty { color: var(--muted-text); font-size: 0.9rem; margin: 0; }

@media (max-width: 768px) {
    .feedback-prompt { flex-direction: column; align-items: stretch; text-align: center; }
    .feedback-prompt-btn { justify-content: center; }
}


/* Attempt photo inside a log entry. */
.al-photo {
    display: block;
    margin: 0.5rem 0;
    border-radius: 10px;
    overflow: hidden;
    max-width: 260px;
}

.al-photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
}

@media (max-width: 768px) {
    .al-photo { max-width: 100%; }
}

/* The feedback heading inherits the global centred 2.5rem section h2, which
   is a banner above a list of short entries. Bring it back to page scale. */
#feedback-section > .comments-header h2 {
    font-size: 1.35rem !important;
    text-align: left !important;
    margin: 0 !important;
}

@media (max-width: 768px) {
    #feedback-section > .comments-header h2 { font-size: 1.15rem !important; }
    #feedback-section { padding: 1.25rem !important; }
}


/* =====================================================================
   Nutrition facts on a phone.

   The panels are built in JS with an inline
   "grid-template-columns: repeat(5, 1fr)", which forces five columns at
   any width and pushes the last ones off the right edge. Inline styles
   can only be overridden with !important, hence the attribute selector.
   ===================================================================== */
@media (max-width: 768px) {
    #nutrition-results { overflow-x: hidden; }

    #nutrition-results [style*="grid-template-columns"] {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
    }

    #nutrition-results .nutrition-item {
        min-width: 0;
        padding: 0.5rem 0.25rem !important;
    }

    #nutrition-results .nutrition-item * { min-width: 0; overflow-wrap: anywhere; }

    /* The macro legend is a three-item space-between row; let it wrap. */
    #nutrition-results [style*="space-between"] {
        flex-wrap: wrap;
        gap: 0.35rem 0.75rem;
        font-size: 0.75rem !important;
    }

    /* A fixed 250px tooltip overflows a 390px screen once centred. */
    .nutrition-tooltip { width: min(250px, 78vw) !important; }

    #nutrition-results h4 {
        font-size: 0.78rem !important;
        letter-spacing: 0.5px !important;
        line-height: 1.35;
    }

    .nutrition-section { padding-left: 1rem; padding-right: 1rem; }
}

/* The basis line under the Nutrition Facts heading. */
.nutrition-basis {
    margin: 0 0 1.5rem;
    color: var(--muted-text);
    font-family: var(--body-font);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .nutrition-basis { font-size: 0.78rem; margin-bottom: 1.1rem; }
}

/* Where the nutrition numbers come from, stated under the heading. */
.nutrition-caveat {
    margin: 0 0 1.5rem;
    color: var(--muted-text);
    font-family: var(--body-font);
    font-size: 0.78rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .nutrition-caveat { font-size: 0.72rem; margin-bottom: 1.1rem; }
}



/* =====================================================================
   Mobile header: add-recipe left, wordmark centred, account right.

   The two buttons live together inside .mobile-auth-actions, which was
   absolutely positioned on the right. `display: contents` dissolves that
   wrapper so its children become grid items of .primary-nav directly and
   can sit on opposite sides of the wordmark — without touching the markup
   that updateLoginButton() toggles.
   ===================================================================== */
@media (max-width: 768px) {
    body > header .primary-header {
        background: var(--white, #fff) !important;
        border-bottom: none !important;
        border-radius: 0 0 18px 18px;
        padding: 0.25rem 0 !important;
    }

    body > header .primary-nav {
        display: grid !important;
        grid-template-columns: 40px 1fr 40px;
        align-items: center;
        justify-content: initial !important;
        gap: 0.5rem;
        padding: 0.15rem 0.75rem !important;
        min-height: 48px !important;
    }

    /* The wrapper stops being a box; its buttons become grid items. */
    body > header .mobile-auth-actions {
        display: contents !important;
        position: static !important;
    }

    body > header #mobile-add-recipe-btn {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    body > header .mobile-user-menu,
    body > header #mobile-login-btn {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
    }

    body > header .logo {
        grid-column: 2;
        grid-row: 1;
        width: auto !important;
        justify-content: center !important;
        justify-self: center;
        align-items: center !important;
        flex-direction: column !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body > header .logo a,
    body > header .logo {
        font-size: 1.3rem !important;
        line-height: 1.15 !important;
        white-space: nowrap;
    }

    /* The tagline sat under a left-aligned wordmark; centred and beneath a
       larger mark it crowds the row. */
    .logo-tagline { display: none !important; }
}

/* =====================================================================
   Sprig beside the wordmark.

   thyme.jpg is the same image the site falls back to when a recipe has no
   photo. It is a photograph on a white background, which is now also the
   header background, so it sits flush without any blending trick - the
   multiply blend this used against the cream is no longer needed.

   Drawn with ::after on the logo so no page markup changes, and placed on
   a flex row so the mark and the wordmark centre together as one unit.
   ===================================================================== */
@media (max-width: 768px) {
    body > header .logo {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.4rem;
    }

    body > header .logo::after {
        content: "";
        flex: 0 0 auto;
        width: 44px;
        height: 24px;
        background: url("thyme.jpg") center/contain no-repeat;
        pointer-events: none;
    }

    body > header .primary-nav { min-height: 52px !important; }

    body > header .logo a,
    body > header .logo {
        font-size: 1.22rem !important;
    }
}


/* =====================================================================
   Search bar and the filter pill row.

   The pills scroll sideways as one line rather than wrapping: a wrapping
   bar changes height as filters are chosen, which shifts the recipes
   underneath while you are still choosing.
   ===================================================================== */
.fb-search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    max-width: 640px;
    margin: 0 auto 0.7rem;
    padding: 0.55rem 1rem;
    background: rgba(31, 72, 54, 0.07);
    border: 1px solid transparent;
    border-radius: 999px;
    transition: border-color 0.15s, background 0.15s;
}

.fb-search:focus-within {
    background: var(--white);
    border-color: rgba(31, 72, 54, 0.28);
}

.fb-search i { color: var(--primary-color); font-size: 0.9rem; opacity: 0.75; }

.fb-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: none;
    outline: none;
    font-family: var(--body-font);
    font-size: 0.92rem;
    color: var(--text-color);
}

.fb-search input::placeholder { color: var(--muted-text); }
.fb-search input::-webkit-search-cancel-button { cursor: pointer; }

/* ---- pill row ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: 4px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

.filter-bar::-webkit-scrollbar { height: 4px; }
.filter-bar::-webkit-scrollbar-track { background: transparent; }
.filter-bar::-webkit-scrollbar-thumb {
    background: rgba(31, 72, 54, 0.22);
    border-radius: 2px;
}

.filter-bar .fb-pill,
.fb-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.22);
    border-radius: 999px;
    padding: 0.42rem 0.85rem;
    font-family: var(--body-font);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.fb-pill i { font-size: 0.62rem; opacity: 0.6; }

.fb-pill:hover { border-color: rgba(31, 72, 54, 0.4); }

.fb-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.fb-pill.active i { opacity: 0.9; }

/* ---- the menu a pill opens ---- */
.fb-menu {
    position: fixed;   /* on <body>, so no scrolling ancestor can clip it */
    z-index: 1200;
    min-width: 190px;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.3rem;
    background: var(--white);
    border: 1px solid rgba(31, 72, 54, 0.16);
    border-radius: 12px;
    box-shadow: 0 12px 28px -10px rgba(31, 72, 54, 0.3);
}

.fb-opt {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-family: var(--body-font);
    font-size: 0.85rem;
    color: var(--text-color);
    white-space: nowrap;
    cursor: pointer;
}

.fb-opt:hover { background: rgba(31, 72, 54, 0.07); }

.fb-opt.active {
    background: rgba(31, 72, 54, 0.1);
    color: var(--primary-color);
    font-weight: 700;
}

.fb-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px dashed rgba(31, 72, 54, 0.3);
    border-radius: 999px;
    padding: 0.42rem 0.8rem;
    font-family: var(--body-font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted-text);
    white-space: nowrap;
    cursor: pointer;
}

.fb-clear:hover { color: var(--primary-color); border-color: var(--primary-color); }

@media (max-width: 768px) {
    .fb-search {
        margin-bottom: 0.55rem;
        padding: 0.5rem 0.85rem;
    }

    .fb-search input { font-size: 0.85rem; }

    .filter-bar {
        gap: 0.4rem;
        /* Bleed to the screen edges so the row reads as scrollable. */
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .fb-pill { font-size: 0.76rem; padding: 0.38rem 0.75rem; }

    .fb-menu {
        min-width: 170px;
        max-height: 220px;
    }

    /* Off-screen menus are handled when positioning, not with a selector. */
}

/* A fade on the right edge, so it is visible that the row continues. Removed
   by JS once the row is scrolled to the end. */
.filter-bar-shell { position: relative; max-width: 640px; margin: 0 auto; }

.filter-bar-shell::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 6px;
    width: 34px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255,255,255,0), var(--cream-bg, #f6f3e9));
    opacity: 1;
    transition: opacity 0.15s;
}

.filter-bar-shell.at-end::after { opacity: 0; }

.filter-bar-shell .filter-bar { margin-left: 0; margin-right: 0; }

@media (max-width: 768px) {
    .filter-bar-shell::after { width: 26px; }
}

/* =====================================================================
   Desktop: the row wraps instead of scrolling.

   There is room for every pill on a wide screen, and a horizontal
   scrollbar with a mouse is worse than a second line. Scrolling stays on
   phones, where the row genuinely cannot fit.
   ===================================================================== */
@media (min-width: 769px) {
    .filter-bar {
        flex-wrap: wrap;
        overflow: visible;
        max-width: 860px;
        padding-bottom: 0;
        row-gap: 0.45rem;
    }

    .filter-bar-shell { max-width: 860px; }

    /* Nothing is cut off, so nothing needs to hint that it is. */
    .filter-bar-shell::after { display: none; }

    .fb-search { max-width: 860px; }
}

/* "Collective Cooks" is considerably wider than the old name, and the
   mobile wordmark is nowrap beside the sprig. On a narrow phone that would
   push past the account button, so step the type down and let the mark
   shrink rather than letting the row overflow. */
@media (max-width: 400px) {
    body > header .logo a,
    body > header .logo {
        font-size: 1.02rem !important;
    }

    body > header .logo::after {
        width: 34px;
        height: 19px;
    }

    body > header .primary-nav {
        grid-template-columns: 36px 1fr 36px;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* Premium option in the recipe form, and the note shown when the two
   mutually exclusive options are toggled against each other. */
.private-recipe-option .pro-row + .pro-row {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(31, 72, 54, 0.14);
}

.pro-premium strong { color: #8a6a12; }
.pro-premium strong i { color: var(--accent-color, #bf9b30); }

.pro-premium small em {
    display: block;
    margin-top: 0.25rem;
    color: #8a6a12;
    font-style: italic;
}

.pro-exclusive-note {
    margin: 0.5rem 0 0;
    padding: 0 0 0 0.2rem;
    font-family: var(--body-font);
    font-size: 0.78rem;
    color: var(--primary-color);
    min-height: 1em;
}

/* =====================================================================
   Premium: a badge on the thumbnail, and the paywall on the recipe page.
   ===================================================================== */
.is-premium-recipe { position: relative; }

.is-premium-recipe::before {
    content: "\f005  PREMIUM";
    font-family: "Font Awesome 6 Free", var(--body-font);
    font-weight: 900;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
    background: rgba(191, 155, 48, 0.95);
    color: #fff;
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    padding: 3px 7px;
    border-radius: 999px;
    pointer-events: none;
}

.premium-lock {
    max-width: 620px;
    margin: 2rem auto 4rem;
    padding: 2rem 1.75rem;
    text-align: center;
    background: var(--cream-bg, #f5efe1);
    border: 1px solid rgba(31, 72, 54, 0.16);
    border-radius: 16px;
}

.pl-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-color, #bf9b30);
    color: #fff;
    font-family: var(--body-font);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.premium-lock h2 {
    font-family: var(--heading-font);
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0 0 0.75rem;
}

.premium-lock p {
    margin: 0 auto 1.25rem;
    max-width: 46ch;
    color: var(--muted-text);
    line-height: 1.5;
}

.pl-cta {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.75rem;
    font-family: var(--body-font);
    font-size: 0.95rem;
    font-weight: 700;
    min-height: 48px;
    cursor: pointer;
}

.pl-cta:hover { background: #16352a; }

.pl-foot { font-size: 0.85rem; margin: 1rem 0 0 !important; }
.pl-foot a { color: var(--primary-color); font-weight: 600; }

@media (max-width: 768px) {
    .premium-lock { padding: 1.5rem 1rem; margin: 1.5rem auto 2.5rem; }
    .premium-lock h2 { font-size: 1.2rem; }
    .is-premium-recipe::before { font-size: 0.52rem; padding: 2px 5px; }
}


/* The premium option is shown but switched off until the Collective Pass
   exists. Greyed rather than hidden, so creators can see it is coming. */
.pro-row.is-disabled {
    opacity: 0.62;
    cursor: default;
}

.pro-row.is-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.pro-soon {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(31, 72, 54, 0.1);
    color: var(--primary-color);
    font-family: var(--body-font);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* =====================================================================
   Contributor avatar.

   The container had no size of its own, only a rule for the fallback
   icon. The <img> inside carries an inline width:100%/height:100%, which
   then resolved against a parent with no width: as a flex item in the
   desktop row it collapsed to nothing, and in the stacked mobile layout
   it stretched to the full column. Giving the container a fixed circle
   fixes both, and the !important is needed to beat the inline styles the
   card renderer writes onto the image.
   ===================================================================== */
.contributor-avatar {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contributor-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.contributor-avatar i {
    font-size: 2.6rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .contributor-avatar {
        width: 64px;
        height: 64px;
    }
    .contributor-avatar i { font-size: 2.2rem; }
}

/* The text column of a contributor card is a flex item, and a flex item will
   not shrink below its content's minimum width unless told to. The flag row
   ("Lives: / From: / Specialty:") is itself a nowrap flex row, so its minimum
   was wide enough to push the whole column past the edge of the card — the
   bio then wrapped at that inflated width and every line was clipped by the
   card boundary. min-width: 0 lets the column shrink to the card again. */
.contributor-info {
    min-width: 0;
}

/* With the column now narrow, a long unbroken word (a URL in a bio, say)
   would be the next thing to overflow. Break it instead. */
.contributor-info p,
.contributor-info h3 {
    overflow-wrap: break-word;
}


/* =====================================================================
   One avatar treatment everywhere.

   #profile-avatar already had a white ring and a soft shadow, while the
   contributor thumbnails and the map chef cards were plain circles — so
   the same person looked different depending on where you met them. Same
   ring, same shadow, same neutral fill behind a transparent PNG. Only the
   diameter changes with context.
   ===================================================================== */
.contributor-avatar,
.mcf-avatar {
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(31, 72, 54, 0.16);
    background: #eee;
    box-sizing: border-box;
}

/* The ring is drawn inside the box, so the sizes step up to keep the
   visible circle as large as it was before. */
.contributor-avatar {
    width: 78px;
    height: 78px;
}

.mcf-avatar {
    width: 52px;
    height: 52px;
}

/* Match the profile page's placeholder rather than inventing a second one. */
.contributor-avatar i,
.mcf-avatar i {
    color: #aaa;
}

@media (max-width: 768px) {
    .contributor-avatar {
        width: 70px;
        height: 70px;
    }

    .mcf-avatar {
        width: 46px;
        height: 46px;
    }
}
