/* Food Nutrition Database - Warm & Organic Theme on Pico CSS */

/* ── Pico CSS Variable Overrides ── */
:root {
    color-scheme: light only;
    --pico-font-size: 16px;
    --pico-font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
    --pico-border-radius: 0.625rem;

    /* Primary (Forest Green) */
    --pico-primary: #296148;
    --pico-primary-hover: #1B4332;
    --pico-primary-focus: rgba(41, 97, 72, 0.15);
    --pico-primary-inverse: #FFFFFF;

    /* Backgrounds */
    --pico-background-color: #FAF7F2;
    --pico-card-background-color: #FFFFFF;
    --pico-card-sectioning-background-color: #F7F3EC;

    /* Borders */
    --pico-border-color: #E0D8CC;
    --pico-muted-border-color: #E0D8CC;

    /* Text */
    --pico-color: #3D3229;
    --pico-muted-color: #5E554E;
    --pico-h1-color: #1B4332;
    --pico-h2-color: #1B4332;
    --pico-h3-color: #1B4332;
    --pico-h4-color: #1B4332;

    /* Form elements */
    --pico-form-element-background-color: #FFFFFF;
    --pico-form-element-border-color: #E0D8CC;
    --pico-form-element-focus-color: #296148;
}

/* ── Global ── */
body {
    background-color: #FAF7F2;
    color: #3D3229;
}

h1, h2, h3, h4 {
    color: #1B4332;
}

a {
    color: #296148;
    text-decoration-color: rgba(41, 97, 72, 0.3);
}
a:hover {
    color: #1B4332;
    text-decoration-color: #1B4332;
}

/* ── Site Header ── */
.site-header {
    background: #1B4332;
    border-bottom: 3px solid #B07D2B;
    margin-bottom: 0;
}
.site-header header {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.site-header nav {
    align-items: center;
}
.site-header a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}
.site-header a:hover {
    color: #FFFFFF;
}
.site-header .site-brand {
    color: #FFFFFF;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.site-header .site-brand .seedling {
    margin-right: 0.3rem;
}
.header-avatar {
    border-radius: 50%;
    margin-left: 0.4rem;
    vertical-align: middle;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ── Site Footer ── */
.site-footer {
    background: #F0EBE3;
    border-top: 1px solid #E0D8CC;
    margin-top: 2rem;
}
.site-footer footer {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    text-align: center;
}
.site-footer nav ul {
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.site-footer a {
    color: #296148;
    text-decoration: none;
    font-size: 0.9rem;
}
.site-footer a:hover {
    color: #1B4332;
    text-decoration: underline;
}
.site-footer .tagline {
    font-style: italic;
    color: #5E554E;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}
.site-footer p {
    color: #5E554E;
}

/* ── Hero Section (Home) ── */
.hero-section {
    background: linear-gradient(135deg, #FAF7F2 0%, #F0EBE3 100%);
    border: 1px solid #E0D8CC;
    border-radius: 0.625rem;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.hero-avatar {
    border-radius: 50%;
    margin-bottom: 0.75rem;
    border: 3px solid #E0D8CC;
    box-shadow: 0 2px 8px rgba(61, 50, 41, 0.1);
}
.hero-section p {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}
.hero-section form {
    max-width: 520px;
    margin: 1rem auto 0;
}
.hero-section input[type="search"] {
    border-radius: 2rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

/* ── Cards / Articles ── */
article {
    background: #FFFFFF;
    border: 1px solid #E0D8CC;
    box-shadow: 0 1px 3px rgba(61, 50, 41, 0.06);
    border-radius: 0.625rem;
}

/* ── Stat Cards ── */
.stat {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
    line-height: 1.2;
    color: #8B4E21;
}
.stat-container {
    background: #FAF7F2;
    border: 1px solid #E0D8CC;
    border-radius: 0.625rem;
    padding: 1rem;
    text-align: center;
}
.stat-container h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5E554E;
    margin-bottom: 0.25rem;
}

/* ── Category Grid ── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}
.category-grid a {
    display: block;
    padding: 0.5rem;
    background: #FFFFFF;
    border: 1px solid #E0D8CC;
    border-radius: 0.625rem;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.category-grid a:hover {
    transform: translateY(-2px);
    border-color: #296148;
    box-shadow: 0 4px 12px rgba(41, 97, 72, 0.1);
    background: #FFFFFF;
}
.category-grid a small {
    display: block;
    color: #5E554E;
}
.category-grid img.category-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.625rem;
    margin-bottom: 0.5rem;
}

/* Category hero image on individual pages */
.category-hero-img {
    float: right;
    margin: 0 0 0.5rem 1rem;
    border-radius: 0.625rem;
}

/* ── Byline ── */
.byline {
    font-size: 0.875rem;
    color: #5E554E;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Persona avatar in bylines */
.byline-avatar {
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0.35rem;
}

/* About page portrait */
.persona-portrait {
    border-radius: 0.625rem;
    max-width: 280px;
    height: auto;
}

/* ── Tables ── */
figure {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
figure figcaption {
    font-style: italic;
    color: #5E554E;
    font-size: 0.875rem;
}

table thead th {
    background: #1B4332;
    color: #FFFFFF;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    font-weight: 600;
}
table tbody tr:nth-child(even) {
    background: #FAF7F2;
}
table tbody tr:nth-child(odd) {
    background: #FFFFFF;
}

/* Daily Value indicators */
.dv-high { color: #296148; font-weight: bold; }
.dv-good { color: #536248; }
.dv-low { color: #665C4F; }

/* Table category rows */
.category-row td {
    background: var(--pico-card-background-color);
    border-bottom: 2px solid #296148;
}

/* Winner highlight in comparison tables */
td.winner {
    font-weight: bold;
    color: #296148;
}

/* ── Search Dropdown ── */
.search-dropdown {
    position: relative;
}
.search-dropdown ul {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #FFFFFF;
    border: 1px solid #E0D8CC;
    border-top: none;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0 0 0.625rem 0.625rem;
    box-shadow: 0 4px 12px rgba(61, 50, 41, 0.1);
}
.search-dropdown li {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #E0D8CC;
}
.search-dropdown li:hover {
    background: rgba(41, 97, 72, 0.08);
}
.search-dropdown li small {
    color: #5E554E;
    margin-left: 0.5rem;
}

/* ── Breadcrumbs ── */
nav[aria-label="breadcrumb"] ul {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 0.5rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}
nav[aria-label="breadcrumb"] li:not(:last-child)::after {
    content: "\203A";
    margin-left: 0.5rem;
    color: #5E554E;
}

/* ── FAQ / Details ── */
details {
    border: 1px solid #E0D8CC;
    border-radius: 0.625rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}
details summary {
    color: #296148;
    font-weight: 600;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}
details summary:hover {
    background: rgba(41, 97, 72, 0.05);
}
details[open] summary {
    border-bottom: 1px solid #E0D8CC;
    background: #FAF7F2;
}
details > *:not(summary) {
    padding: 0.5rem 1rem;
}

/* ── Trust Badge ── */
.trust-badge {
    text-align: center;
    padding: 0.25rem;
    background: #FFFFFF;
    border: 1px solid #E0D8CC;
    border-radius: 0.625rem;
}

/* ── Ad Slots ── */
.ad-slot {
    max-width: 728px;
    margin: 1.5rem auto;
    text-align: center;
    overflow: hidden;
}

/* ── Desktop/Mobile Column Toggle ── */
.mobile-col { display: none; }

/* ── Mobile (375px-768px) ── */
@media (max-width: 768px) {
    .desk-col { display: none; }
    .mobile-col { display: table-cell; font-size: 0.85rem; line-height: 1.6; }
    /* Header wrapping */
    .site-header nav {
        flex-direction: column;
        gap: 0;
    }
    .site-header nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    .site-header nav ul li {
        font-size: 0.95rem;
    }

    /* Hero section */
    .hero-section {
        padding: 1.25rem;
    }
    .hero-avatar {
        width: 160px;
        height: 160px;
    }

    /* Smaller stat cards */
    .stat {
        font-size: 1.5rem;
    }

    /* Table text */
    table {
        font-size: 0.95rem;
    }
    th, td {
        padding: 0.5rem 0.6rem;
    }

    /* Wide tables collapse to 2-3 columns on mobile */
    .table-wide {
        min-width: 0;
    }

    /* Category grid single column */
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    nav[aria-label="breadcrumb"] ul {
        font-size: 0.875rem;
    }

    /* Footer links stack */
    .site-footer nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
}

/* ── Very small screens ── */
@media (max-width: 480px) {
    :root {
        --pico-font-size: 16px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    table {
        font-size: 0.9rem;
    }
    th, td {
        padding: 0.4rem 0.5rem;
    }

    .persona-portrait,
    .category-hero-img {
        float: none;
        display: block;
        margin: 0 auto 1rem;
        max-width: 200px;
    }

    .hero-section {
        padding: 1rem;
    }
    .hero-avatar {
        width: 120px;
        height: 120px;
    }
}
