/* ============================================
   Recipe Collection — Thanksgiving Theme
   Holiday redesign: deep burgundy + burnt orange
   + amber gold accents on a warm cream backdrop.
   Function unchanged. All class names preserved.

   Modern CSS protocols applied (see references/modern-css-protocols-and-styling-2026.md):
   - Cascade layers (@layer) for deterministic cascade management (§5.1)
   - OKLCH perceptually-uniform color with sRGB fallbacks (§3, §9.1)
   - Fluid typography via clamp() (§8)
   - Native CSS nesting (§4.3)
   - Relational :has() enhancement (§5.2)
   - Scroll-driven reveal, guarded by @supports (§6.1 — outside Baseline in Firefox)
   - Public-domain images (CC0) applied via ::before/::after pseudo-elements
     so no HTML markup changes are required.
   ============================================ */

/* Cascade order: later layers win regardless of specificity (§5.1) */
@layer reset, base, components, utilities;

/* --------------------------------------------
   Reset
   -------------------------------------------- */
@layer reset {
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
}

/* --------------------------------------------
   Base — Thanksgiving design tokens + fluid type
   Palette: deep burgundy, burnt orange, amber gold,
   warm cream, and rich brown inks.
   -------------------------------------------- */
@layer base {
    html {
        scroll-behavior: smooth;
    }

    :root {
        /* Warm cream backdrop — OKLCH with sRGB fallback */
        --bg: #fdf6ec;
        --bg: oklch(97% 0.012 72);

        /* Surfaces */
        --surface: #fffdf8;
        --surface-2: #fbf1e2;
        --surface-2: oklch(94% 0.02 75);

        /* Rich brown inks (replaces warm charcoal) */
        --ink: #3d2417;
        --ink: oklch(26% 0.04 30);
        --ink-2: #5c3d2a;
        --ink-2: oklch(40% 0.045 30);
        --muted: #8a6b52;
        --muted: oklch(58% 0.04 40);

        /* Borders */
        --border: #ecdcc6;
        --border: oklch(88% 0.025 72);

        /* Accent — deep burgundy family (primary) */
        --accent: #7b1f2c;
        --accent: oklch(42% 0.16 20);
        --accent-2: #9e2b3a;
        --accent-2: oklch(50% 0.18 20);
        --accent-soft: #f7e6e0;
        --accent-soft: oklch(92% 0.03 20);
        --accent-ink: #5a1420;
        --accent-ink: oklch(32% 0.14 20);

        /* Secondary — burnt orange / amber gold */
        --secondary: #c8622d;
        --secondary: oklch(62% 0.17 45);
        --secondary-2: #e08a3c;
        --secondary-2: oklch(72% 0.16 48);
        --secondary-soft: #fdf0e0;
        --secondary-soft: oklch(94% 0.03 50);

        /* Semantic */
        --success: #3d6b3a;
        --success: oklch(52% 0.12 130);
        --success-color: #3d6b3a;
        --success-soft: #e8f3e6;
        --success-soft: oklch(90% 0.03 130);
        --warning: #b7791f;
        --warning: oklch(58% 0.14 72);
        --warning-soft: #fdf6e3;
        --warning-soft: oklch(94% 0.03 80);
        --danger: #a82c2c;
        --danger: oklch(50% 0.19 25);

        /* Text on dark backgrounds */
        --text-light: #fdf6ec;
        --text-medium: #8a6b52;
        --text-medium: oklch(58% 0.04 40);

        /* Elevation — OKLCH with alpha channel (§3.4) */
        --shadow-sm: 0 1px 2px oklch(30% 0.03 30 / 0.08);
        --shadow-md: 0 4px 14px oklch(30% 0.03 30 / 0.12);
        --shadow-lg: 0 12px 32px oklch(30% 0.03 30 / 0.16);

        /* Radius */
        --radius-sm: 8px;
        --radius-md: 14px;
        --radius-lg: 20px;
        --radius-pill: 999px;

        /* Motion */
        --ease: cubic-bezier(0.22, 1, 0.36, 1);
        --dur: 0.24s;
    }

    body {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        line-height: 1.7;
        color: var(--ink);
        background-color: var(--bg);
        min-height: 100vh;
        /* Fluid type — scales between breakpoints without media queries (§8) */
        font-size: clamp(0.95rem, 0.85rem + 0.4vw, 1.1rem);
        -webkit-font-smoothing: antialiased;
        text-wrap: pretty;
    }
}

/* --------------------------------------------
   Component rules (home page) — Thanksgiving theme
   Kept identical selectors to preserve JS-generated markup.
   -------------------------------------------- */
@layer components {
    header {
        background: rgba(255, 253, 248, 0.92);
        border-bottom: 1px solid var(--border);
        padding: 1.4rem 1rem;
        text-align: center;
        position: sticky;
        top: 0;
        z-index: 10;
        backdrop-filter: blur(12px);
        position: relative;
    }

    header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--accent), var(--secondary), var(--secondary-2), var(--accent));
    }

    header h1 {
        font-family: 'Fraunces', Georgia, serif;
        /* Fluid heading (§8) */
        font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem);
        margin-bottom: 0.35rem;
        letter-spacing: -0.5px;
        color: var(--accent);
        font-weight: 700;
        text-wrap: balance;
    }

    header p {
        opacity: 0.82;
        max-width: 560px;
        margin: 0 auto;
        font-size: 0.98rem;
        color: var(--ink-2);
    }

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

    .stats-bar {
        background: var(--surface);
        border-radius: 16px;
        padding: 1.6rem;
        margin-bottom: 2.2rem;
        box-shadow: var(--shadow-md);
        border: 1px solid var(--border);
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 1rem;
    }

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

    .stat-value {
        font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.9rem);
        font-weight: 700;
        color: var(--secondary);
        display: block;
    }

    .stat-label {
        font-size: 0.82rem;
        opacity: 0.6;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        font-weight: 600;
        color: var(--ink-2);
    }

    .filters {
        display: flex;
        gap: 0.5rem;
        margin-bottom: 2.2rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-btn {
        padding: 0.6rem 1.3rem;
        border: 1.5px solid var(--border);
        background: var(--surface);
        color: var(--ink-2);
        border-radius: var(--radius-pill);
        cursor: pointer;
        font-weight: 500;
        font-size: 0.88rem;
        transition: all var(--dur) var(--ease);
    }

    .filter-btn:hover {
        border-color: var(--secondary);
        color: var(--secondary);
        transform: translateY(-1px);
    }

    .filter-btn.active {
        background: var(--secondary);
        border-color: var(--secondary);
        color: var(--surface);
        box-shadow: 0 4px 12px oklch(62% 0.17 45 / 0.30);
    }

    .recipe-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 1.6rem;
    }

    /* Native nesting (§4.3) — existing classes nested under the card wrapper */
    .recipe-card-link {
        text-decoration: none;
        color: inherit;
        display: block;
        transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
        border-radius: var(--radius-md);
        overflow: hidden;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border);

        .card-header {
            padding: 1.3rem;
            border-bottom: 1px solid var(--surface-2);
        }

        .recipe-name {
            font-size: 1.25rem;
            margin-bottom: 0.6rem;
            color: var(--ink);
            font-weight: 600;
            line-height: 1.3;
            text-wrap: balance;
        }

        .category-tag {
            display: inline-block;
            padding: 0.28rem 0.8rem;
            background: var(--secondary-soft);
            color: var(--accent-ink);
            border-radius: var(--radius-pill);
            font-size: 0.74rem;
            text-transform: capitalize;
            font-weight: 600;
            letter-spacing: 0.02em;
        }

        .card-body { padding: 1.3rem; }

        .recipe-meta {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.8rem;
        }

        .meta-item {
            text-align: center;
            padding: 0.6rem;
            background: var(--surface-2);
            border-radius: var(--radius-sm);
        }

        .meta-value {
            font-weight: 700;
            color: var(--secondary);
            display: block;
        }

        .meta-label {
            font-size: 0.72rem;
            opacity: 0.6;
            text-transform: uppercase;
            letter-spacing: 0.03em;
            color: var(--ink-2);
        }

        .recipe-footer {
            padding: 1rem 1.3rem;
            background: var(--surface-2);
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-top: 1px solid var(--surface-2);
        }

        .difficulty-badge {
            padding: 0.3rem 0.85rem;
            border-radius: var(--radius-pill);
            font-size: 0.78rem;
            font-weight: 600;
            text-transform: capitalize;
        }

        .difficulty-easy { background: #e2f0df; color: #2d5a29; }
        .difficulty-medium { background: #fdf0d5; color: #8a5a12; }
        .difficulty-hard { background: #f7e0dd; color: #8c2222; }

        .cost-display { font-weight: 600; color: var(--success); }

        &:hover {
            transform: translateY(-4px);
            box-shadow: var(--shadow-lg);
            border-color: transparent;
            cursor: pointer;
        }
    }

    .loading, .error-message {
        text-align: center;
        padding: 3rem;
        font-size: 1.1rem;
        color: var(--ink-2);
    }

    .error-message { color: var(--danger); }

    footer {
        text-align: center;
        padding: 2.5rem 1rem;
        opacity: 0.7;
        margin-top: 3rem;
        font-size: 0.9rem;
        color: var(--ink-2);
    }

    /* :has() progressive enhancement (§5.2) — ingredient selection feedback.
       Coexists with the JS toggle in recipe-detail.js; works even if JS fails. */
    @supports (selector(:has(*))) {
        .ingredients-list li:has(input:checked) {
            label {
                text-decoration: line-through;
                color: var(--muted);
            }
        }

        .ingredients-list input:checked {
            accent-color: var(--secondary);
        }
    }
}

/* --------------------------------------------
   Recipe Detail Page — Thanksgiving theme
   -------------------------------------------- */
@layer components {
    .site-header {
        background: rgba(255, 253, 248, 0.95);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 10;
        backdrop-filter: blur(12px);
    }

    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
    }

    .logo a {
        font-family: 'Fraunces', Georgia, serif;
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--accent);
        text-decoration: none;
    }

    .main-nav { display: flex; gap: 1.5rem; }

    .nav-link {
        color: var(--ink-2);
        text-decoration: none;
        font-weight: 500;
        font-size: 0.95rem;
        padding: 0.3rem 0;
        border-bottom: 2px solid transparent;
        transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
    }

    .nav-link:hover { color: var(--secondary); border-color: var(--secondary); }
    .nav-link.active { color: var(--secondary); border-color: var(--secondary); }

    /* Main content wrapper — constrained + scrollable */
    .main-content {
        max-width: 900px;
        margin: 2rem auto;
        padding: 0 1rem 4rem;
    }

    .recipe-detail-page {
        background: var(--surface);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border);
        padding: 2.5rem 2rem;
        overflow-y: auto;
    }

    .back-to-home {
        display: inline-block;
        color: var(--secondary);
        font-weight: 600;
        text-decoration: none;
        margin-bottom: 1.5rem;
        transition: color var(--dur) var(--ease);
    }

    .back-to-home:hover { color: var(--accent-ink); text-decoration: underline; }

    .recipe-header { margin-bottom: 2rem; }

    .recipe-title {
        font-family: 'Fraunces', Georgia, serif;
        /* Fluid heading (§8) */
        font-size: clamp(1.8rem, 1.4rem + 1.8vw, 2.2rem);
        font-weight: 700;
        color: var(--accent);
        line-height: 1.2;
        margin-bottom: 0.75rem;
        text-wrap: balance;
    }

    .recipe-intro {
        font-size: 1.05rem;
        color: var(--ink-2);
        max-width: 680px;
    }

    .recipe-meta-bar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .meta-stat {
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 0.9rem 0.75rem;
        text-align: center;
    }

    .meta-stat-value {
        display: block;
        font-size: clamp(1.15rem, 1rem + 0.6vw, 1.35rem);
        font-weight: 700;
        color: var(--secondary);
    }

    .meta-stat-label {
        display: block;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--muted);
        font-weight: 600;
        margin-top: 0.2rem;
    }

    .nutrition-badge {
        display: inline-block;
        padding: 0.25rem 0.7rem;
        border-radius: var(--radius-pill);
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: capitalize;
        background: var(--success-color);
        color: white;
    }

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

    @media (min-width: 900px) {
        .recipe-content-grid {
            grid-template-columns: 1fr 1fr;
            align-items: start;
        }
    }

    .section-heading {
        font-family: 'Fraunces', Georgia, serif;
        font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.35rem);
        font-weight: 700;
        color: var(--ink);
        margin-bottom: 1.25rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .section-heading-icon { font-size: 1.2em; }

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

    .ingredients-list li {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--surface-2);
    }

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

    .ingredient-checkbox {
        width: 1.1rem;
        height: 1.1rem;
        accent-color: var(--secondary);
        flex-shrink: 0;
    }

    .ingredients-list label {
        color: var(--ink);
        cursor: pointer;
    }

    .instructions-steps { display: flex; flex-direction: column; gap: 1.25rem; }

    .instruction-step {
        display: flex;
        gap: 1rem;
        align-items: flex-start;
    }

    .step-number-badge {
        flex-shrink: 0;
        width: 2rem;
        height: 2rem;
        border-radius: 50%;
        background: var(--secondary);
        color: var(--surface);
        font-weight: 700;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .step-text {
        color: var(--ink);
        line-height: 1.65;
        padding-top: 0.15rem;
    }

    .shopping-list-group h4 {
        font-size: 1rem;
        font-weight: 600;
        color: var(--secondary);
        margin: 1rem 0 0.5rem;
    }

    .shopping-list-group ul { list-style: none; }

    .shopping-list-group li {
        padding: 0.35rem 0;
        color: var(--ink);
        border-bottom: 1px dashed var(--border);
    }

    .recipe-notes {
        margin-top: 2.5rem;
        background: var(--accent-soft);
        border: 1px solid #e8c4b8;
        border-radius: var(--radius-md);
        padding: 1.5rem;
    }

    .recipe-notes h4 {
        color: var(--accent-ink);
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .recipe-notes p { color: var(--accent-ink); line-height: 1.7; }

    .recipe-notes ul {
        margin-top: 0.75rem;
        padding-left: 1.25rem;
        color: var(--accent-ink);
    }

    .recipe-notes li { margin-bottom: 0.4rem; }

    .btn {
        display: inline-block;
        padding: 0.8rem 1.6rem;
        border-radius: var(--radius-pill);
        font-weight: 600;
        font-size: 0.95rem;
        text-decoration: none;
        cursor: pointer;
        border: 1.5px solid transparent;
        transition: all var(--dur) var(--ease);
    }

    .btn-primary {
        background: var(--accent);
        color: var(--text-light);
    }

    .btn-primary:hover { background: #5a1420; }

    .btn-secondary {
        background: var(--surface);
        color: var(--secondary);
        border-color: var(--secondary);
    }

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

    .site-footer {
        background: rgba(255, 253, 248, 0.95);
        border-top: 1px solid var(--border);
        margin-top: 3rem;
    }

    .footer-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        padding: 2rem 1rem;
        color: var(--ink-2);
        font-size: 0.9rem;
    }

    .footer-nav { display: flex; align-items: center; gap: 0.75rem; }

    .footer-nav a {
        color: var(--secondary);
        text-decoration: none;
        font-weight: 500;
    }

    .footer-nav a:hover { text-decoration: underline; }

    .separator { color: var(--muted); }
}

/* --------------------------------------------
   About Page — Thanksgiving theme
   -------------------------------------------- */
@layer components {
    .about-page {
        max-width: 1000px;
        padding-top: 2rem;
        padding-bottom: 4rem;
    }

    .about-hero {
        background: var(--surface);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border);
        padding: 2.5rem 2rem;
        margin-bottom: 2rem;
        text-align: center;
    }

    .about-hero h2 {
        font-family: 'Fraunces', Georgia, serif;
        font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2rem);
        font-weight: 700;
        color: var(--accent);
        margin-bottom: 1rem;
        text-wrap: balance;
    }

    .lead-paragraph {
        font-size: 1.1rem;
        color: var(--ink-2);
        max-width: 680px;
        margin: 0 auto;
        line-height: 1.75;
    }

    .about-section {
        background: var(--surface);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border);
        padding: 2.5rem 2rem;
        margin-bottom: 2rem;
    }

    .about-section h3 {
        font-family: 'Fraunces', Georgia, serif;
        font-size: clamp(1.3rem, 1.15rem + 0.7vw, 1.5rem);
        font-weight: 700;
        color: var(--ink);
        margin-bottom: 1.5rem;
        text-wrap: balance;
    }

    .feature-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .feature-card {
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 1.5rem;
        transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    }

    .feature-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 24px oklch(30% 0.03 30 / 0.14);
    }

    .feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }

    .feature-card h4 {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--ink);
        margin-bottom: 0.5rem;
    }

    .feature-card p {
        color: var(--ink-2);
        font-size: 0.95rem;
        line-height: 1.65;
    }

    .section-note {
        color: var(--ink-2);
        font-size: 0.95rem;
        background: var(--secondary-soft);
        border: 1px solid #e8c4b8;
        border-radius: var(--radius-sm);
        padding: 1rem 1.25rem;
    }

    .section-note strong { color: var(--accent-ink); }

    .categories-overview {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .category-item {
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 0.85rem 1rem;
        color: var(--ink);
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .category-item strong { color: var(--secondary); }

    .category-emoji { margin-right: 0.4rem; }

    .contact-box {
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 1.75rem;
    }

    .contact-box p {
        color: var(--ink-2);
        line-height: 1.7;
        margin-bottom: 1.25rem;
    }

    .contact-links {
        display: flex;
        align-items: center;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .link-text {
        color: var(--secondary);
        text-decoration: none;
        font-weight: 500;
    }

    .link-text:hover { text-decoration: underline; }
}

/* --------------------------------------------
   Scroll-driven reveal (§6.1 — outside Baseline in Firefox)
   Progressive enhancement: guarded by @supports so
   non-supporting browsers simply skip the effect.
   -------------------------------------------- */
@layer components {
    @supports (animation-timeline: view()) {
        .recipe-card-link {
            animation: card-reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 40%;
        }

        @media (prefers-reduced-motion: reduce) {
            .recipe-card-link { animation: none; }
        }
    }
}

@keyframes card-reveal {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------
   Responsive — mobile layout
   -------------------------------------------- */
@layer utilities {
    @media (max-width: 768px) {
        header h1 { font-size: 1.7rem; }
        .recipe-grid { grid-template-columns: 1fr; }
        .stats-bar { flex-direction: column; gap: 1rem; }

        .recipe-detail-page { padding: 1.75rem 1.25rem; }
        .recipe-title { font-size: 1.8rem; }
        .header-content { flex-direction: column; gap: 1rem; }

        .about-hero { padding: 1.75rem 1.25rem; }
        .about-hero h2 { font-size: 1.6rem; }
        .about-section { padding: 1.75rem 1.25rem; }
        .feature-grid { grid-template-columns: 1fr; }
    }
}

/* --------------------------------------------
   Search by Ingredients Page — Thanksgiving theme
   Two-column filter/results layout. Scoped under
   .search-layout so it doesn't affect other pages.
   All classes here are unique to this page.
   -------------------------------------------- */
@layer components {
    /* Shared .container becomes a 2-column grid on the search page */
    .container.search-layout {
        max-width: 1400px;
        grid-template-columns: 350px 1fr;
        gap: 2rem;
    }

    @media (max-width: 968px) {
        .container.search-layout {
            grid-template-columns: 1fr;
        }
    }

    .filter-panel {
        background: var(--surface);
        border-radius: 12px;
        padding: 1.5rem;
        box-shadow: var(--shadow-md);
        height: fit-content;
        position: sticky;
        top: 2rem;
    }

    .filter-panel h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        color: var(--accent);
        border-bottom: 2px solid var(--border);
        padding-bottom: 0.75rem;
    }

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

    .group-title {
        font-weight: 600;
        color: var(--accent-ink);
        margin-bottom: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 6px;
        transition: background-color var(--dur) var(--ease);
    }

    .group-title:hover { background-color: var(--surface-2); }

    .group-title::before {
        content: '▼';
        font-size: 0.7rem;
        transition: transform var(--dur) var(--ease);
        margin-left: auto;
    }

    .group-title.collapsed::before { transform: rotate(-90deg); }

    .ingredient-list {
        padding-left: 1rem;
        display: grid;
        gap: 0.4rem;
        max-height: 300px;
        overflow-y: auto;
        border-top: 1px solid var(--border);
        margin-top: 0.5rem;
    }

    .ingredient-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
        cursor: pointer;
        padding: 0.3rem 0.5rem;
        border-radius: 6px;
        transition: background-color var(--dur) var(--ease);
    }

    .ingredient-item:hover { background-color: var(--surface-2); }

    .ingredient-item input[type="checkbox"] {
        cursor: pointer;
        accent-color: var(--secondary);
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .ingredient-label { flex-grow: 1; word-break: break-word; }

    .recipe-count-badge {
        background: var(--surface-2);
        color: var(--ink-2);
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
        border-radius: 10px;
        margin-left: auto;
        flex-shrink: 0;
    }

    .selected-count {
        background: var(--secondary);
        color: var(--surface);
        padding: 0.25rem 0.75rem;
        border-radius: var(--radius-pill);
        font-size: 0.9rem;
        margin-bottom: 1rem;
        display: inline-block;
    }

    .clear-btn {
        background: var(--surface-2);
        color: var(--ink);
        border: none;
        padding: 0.6rem 1.5rem;
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-weight: 500;
        transition: all var(--dur) var(--ease);
        margin-bottom: 1rem;
    }

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

    .results-panel h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        color: var(--ink-2);
        border-bottom: 2px solid var(--border);
        padding-bottom: 0.75rem;
    }

    .matched-ingredients {
        padding: 0.5rem 1.2rem;
        background: var(--surface-2);
        border-top: 1px solid var(--border);
        font-size: 0.85rem;
        color: var(--muted);
    }

    .matched-ingredient-tag {
        display: inline-block;
        background: var(--secondary-soft);
        color: var(--accent-ink);
        padding: 0.15rem 0.4rem;
        border-radius: 6px;
        margin-right: 0.3rem;
        font-size: 0.8rem;
    }

    /* Scoped to search page — span both grid columns */
    .search-layout .loading,
    .search-layout .error-message {
        grid-column: span 2;
    }

    .search-layout footer {
        grid-column: span 2;
    }
}

/* --------------------------------------------
   Search by Ingredients — page header (Thanksgiving)
   The search page uses a bare <header> (no
   .site-header class), so give it its own warm
   treatment with an autumn-leaf gradient.
   -------------------------------------------- */
@layer components {
    .search-layout header {
        background: linear-gradient(135deg, var(--accent-soft), var(--surface));
        color: var(--ink);
        padding: 2rem 1rem;
        text-align: center;
        box-shadow: 0 2px 8px oklch(30% 0.03 30 / 0.10);
        position: relative;
        overflow: hidden;
    }

    .search-layout header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--secondary), var(--secondary-2), var(--accent));
    }

    .search-layout header h1 {
        font-family: 'Fraunces', Georgia, serif;
        font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.5rem);
        margin-bottom: 0.5rem;
        letter-spacing: -0.5px;
        color: var(--accent);
        text-wrap: balance;
    }

    .search-layout header p {
        opacity: 0.85;
        max-width: 600px;
        margin: 0 auto;
        color: var(--ink-2);
    }
}

/* --------------------------------------------
   Thanksgiving — Public-Domain Decorative Images
   Two CC0 images from Wikimedia Commons are applied
   purely via ::before / ::after pseudo-elements so
   NO HTML markup changes are required. They degrade
   gracefully: browsers that ignore them still get
   the full gradient theme.

   Sources (both CC0 — no attribution required):
     - images/thanksgiving-table.jpg  (dinner table)
     - images/autumn-leaves.jpg       (fall foliage)
   See images/LICENSE.txt for details.
   -------------------------------------------- */
@layer components {
    /* Home page header: warm autumn-leaf gradient backdrop with a
       faint Thanksgiving table scene behind the title. */
    header::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background-image: url('images/thanksgiving-table.jpg');
        background-size: cover;
        background-position: center;
        opacity: 0.14;
        filter: saturate(1.2);
    }

    /* About page hero: full-bleed Thanksgiving table scene with a
       warm overlay to keep the heading readable. */
    .about-hero {
        position: relative;
        overflow: hidden;
    }

    .about-hero::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background-image: url('images/thanksgiving-table.jpg');
        background-size: cover;
        background-position: center;
        opacity: 0.22;
    }

    .about-hero::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background: linear-gradient(135deg, rgba(255, 253, 248, 0.92), rgba(247, 230, 224, 0.85));
    }

    /* Recipe detail page: subtle autumn-leaves watermark in the top-right
       corner of the card for a seasonal touch. */
    .recipe-detail-page {
        position: relative;
    }

    .recipe-detail-page::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 45%;
        height: 120px;
        background-image: url('images/autumn-leaves.jpg');
        background-size: cover;
        background-position: top right;
        opacity: 0.18;
        pointer-events: none;
    }

    /* Search page header: autumn-leaf gradient with faint table scene. */
    .search-layout header::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background-image: url('images/autumn-leaves.jpg');
        background-size: cover;
        background-position: center;
        opacity: 0.12;
    }
}

/* --------------------------------------------
   Responsive: tone down decorative images on
   small screens to keep text legible and reduce
   paint cost.
   -------------------------------------------- */
@layer utilities {
    @media (max-width: 768px) {
        header::before { opacity: 0.08; }
        .about-hero::before { opacity: 0.12; }
        .recipe-detail-page::before { display: none; }
    }
}
