/* Foods section: nutrition search, food profiles, and printed-label replicas. */

.foods-hero {
    background:
        radial-gradient(circle at top right, rgba(25, 135, 84, .20), transparent 36%),
        radial-gradient(circle at bottom left, rgba(253, 126, 20, .12), transparent 32%),
        linear-gradient(135deg, rgba(248, 249, 250, .96), rgba(255, 255, 255, .98));
    border: 1px solid rgba(25, 135, 84, .10);
    border-radius: 1.5rem;
    box-shadow: var(--site-elevation-shadow);
    margin-top: 1.5rem;
}

.foods-panel {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 1.5rem;
    box-shadow: var(--site-elevation-shadow);
}

.foods-search-input {
    border: 2px solid rgba(25, 135, 84, .45);
    border-radius: 999px 0 0 999px !important;
    padding-left: 1.25rem;
}

.foods-search-input:focus {
    border-color: rgba(25, 135, 84, .85);
    box-shadow: 0 0 0 .25rem rgba(25, 135, 84, .15);
}

.foods-search-button {
    border-radius: 0 999px 999px 0 !important;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.foods-scan-button {
    background: rgba(255, 255, 255, .92);
    border: 2px solid rgba(25, 135, 84, .45);
    border-left: 0;
    border-radius: 0 !important;
    color: #146c43;
    padding-left: 1rem;
    padding-right: 1rem;
}

.foods-scan-button:hover,
.foods-scan-button:focus-visible {
    background: rgba(25, 135, 84, .10);
    border-color: rgba(25, 135, 84, .85);
    color: #146c43;
}

/* Camera scanner dialog */
.foods-scanner {
    border: 0;
    border-radius: 1.5rem;
    box-shadow: var(--site-elevation-shadow);
}

.foods-scanner-viewport {
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
}

.foods-scanner-viewport video {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

/* A barcode-shaped target with a moving scan line. */
.foods-scanner-guide {
    border: 3px solid rgba(255, 255, 255, .9);
    border-radius: .75rem;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
    height: 38%;
    left: 12%;
    pointer-events: none;
    position: absolute;
    top: 31%;
    width: 76%;
}

.foods-scanner-guide::after {
    animation: foods-scan-line 1.8s ease-in-out infinite alternate;
    background: rgba(25, 135, 84, .95);
    box-shadow: 0 0 .75rem rgba(25, 135, 84, .9);
    content: '';
    height: 2px;
    left: 4%;
    position: absolute;
    right: 4%;
    top: 10%;
}

@keyframes foods-scan-line {
    to { top: 88%; }
}

@media (prefers-reduced-motion: reduce) {
    .foods-scanner-guide::after {
        animation: none;
        top: 50%;
    }
}

.foods-chip {
    background: rgba(255, 255, 255, .85);
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 999px;
    color: var(--bs-body-color);
    display: inline-flex;
    font-size: .9rem;
    font-weight: 600;
    gap: .35rem;
    padding: .35rem .85rem;
    text-decoration: none;
}

.foods-chip:hover,
.foods-chip:focus-visible {
    border-color: rgba(25, 135, 84, .40);
    color: var(--bs-body-color);
}

.foods-scope .nav-link {
    border-radius: 999px;
    color: var(--bs-body-color);
    font-weight: 600;
}

.foods-scope .nav-link.active {
    background-color: #198754;
    color: #fff;
}

.foods-card {
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 1.25rem;
    box-shadow: var(--site-elevation-shadow);
    color: inherit;
    display: block;
    height: 100%;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.foods-card:hover,
.foods-card:focus-visible {
    border-color: rgba(25, 135, 84, .30);
    box-shadow: var(--site-elevation-shadow-hover);
    color: inherit;
    transform: translateY(-.2rem);
}

.foods-card-image {
    align-items: center;
    background: linear-gradient(180deg, rgba(248, 249, 250, .95), rgba(255, 255, 255, .98));
    border-bottom: 1px solid rgba(15, 23, 42, .06);
    border-radius: 1.25rem 1.25rem 0 0;
    display: flex;
    height: 11rem;
    justify-content: center;
    overflow: hidden;
    padding: .75rem;
}

.foods-card-image img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.foods-icon {
    align-items: center;
    background: linear-gradient(135deg, rgba(25, 135, 84, .14), rgba(253, 126, 20, .16));
    border-radius: 1rem;
    color: #146c43;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 1.35rem;
    height: 3rem;
    justify-content: center;
    width: 3rem;
}

.foods-macro {
    background: var(--bs-tertiary-bg);
    border-radius: .75rem;
    font-size: .8rem;
    padding: .35rem .6rem;
    text-align: center;
}

.foods-macro strong {
    display: block;
    font-size: .95rem;
}

.foods-gallery-main {
    align-items: center;
    background: linear-gradient(180deg, rgba(248, 249, 250, .95), rgba(255, 255, 255, .98));
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 1.25rem;
    display: flex;
    justify-content: center;
    min-height: 16rem;
    overflow: hidden;
    padding: 1rem;
}

.foods-gallery-main img {
    max-height: 22rem;
    max-width: 100%;
    object-fit: contain;
}

.foods-image-credit {
    font-size: .78rem;
}

.foods-nutri-score {
    border-radius: .5rem;
    color: #fff;
    display: inline-block;
    font-weight: 800;
    min-width: 2rem;
    padding: .15rem .5rem;
    text-align: center;
    text-transform: uppercase;
}

.foods-nutri-score-a { background: #038141; }
.foods-nutri-score-b { background: #85bb2f; }
.foods-nutri-score-c { background: #fecb02; color: #212529; }
.foods-nutri-score-d { background: #ee8100; }
.foods-nutri-score-e { background: #e63e11; }

.foods-rank {
    align-items: center;
    background: linear-gradient(135deg, rgba(25, 135, 84, .16), rgba(253, 126, 20, .18));
    border-radius: .9rem;
    color: #146c43;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 1.15rem;
    font-weight: 800;
    height: 2.75rem;
    justify-content: center;
    width: 2.75rem;
}

.foods-rank-bar {
    background: var(--bs-tertiary-bg);
    border-radius: 999px;
    height: .4rem;
}

/* Sortable nutrient table */
.foods-sort-button {
    align-items: center;
    background: none;
    border: 0;
    color: inherit;
    display: inline-flex;
    font-weight: 700;
    gap: .35rem;
    padding: 0;
}

.foods-sort-button:hover,
.foods-sort-button:focus-visible {
    color: #146c43;
}

.foods-sort-icon {
    color: var(--bs-secondary-color);
    font-size: .85em;
}

.foods-sort-button.active .foods-sort-icon {
    color: #198754;
}

.foods-sortable .foods-group-row th {
    background: rgba(25, 135, 84, .07);
    border-bottom-color: rgba(25, 135, 84, .18);
    color: #146c43;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding-top: .6rem;
    text-transform: uppercase;
}

/* Collapsible "Sources and citations" card */
.foods-collapse-toggle {
    align-items: center;
    background: none;
    border: 0;
    border-radius: 1.5rem;
    color: inherit;
    display: flex;
    font-weight: 500;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    text-align: left;
    width: 100%;
}

.foods-collapse-toggle:hover,
.foods-collapse-toggle:focus-visible {
    color: #146c43;
}

.foods-collapse-icon {
    transition: transform .2s ease;
}

.foods-collapse-toggle:not(.collapsed) .foods-collapse-icon {
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .foods-collapse-icon {
        transition: none;
    }
}

.foods-citation {
    border-left: 3px solid rgba(25, 135, 84, .45);
    font-size: .9rem;
    padding-left: .85rem;
}

/* ------------------------------------------------------------------
   U.S. Nutrition Facts panel (FDA 2016 format). The label is always black on white, like a package.
   ------------------------------------------------------------------ */

.nutrition-facts {
    background: #fff;
    border: 1px solid #000;
    color: #000;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    max-width: 22rem;
    padding: .35rem .5rem;
}

.nutrition-facts * {
    color: #000;
}

.nutrition-facts-title {
    font-family: "Franklin Gothic Heavy", "Arial Black", "Helvetica Neue", Arial, sans-serif;
    font-size: 2.35rem;
    font-weight: 900;
    letter-spacing: -.02em;
    line-height: 1;
    margin: 0;
}

.nutrition-facts-servings {
    font-size: 1rem;
    margin: .1rem 0 0;
}

.nutrition-facts-serving-size {
    display: flex;
    font-size: 1.1rem;
    font-weight: 800;
    gap: .75rem;
    justify-content: space-between;
}

.nutrition-facts-serving-size span:first-child {
    white-space: nowrap;
}

.nutrition-facts-serving-size span:last-child {
    text-align: right;
}

.nutrition-facts-bar-thick {
    border-top: 10px solid #000;
    margin: .2rem 0;
}

.nutrition-facts-bar-medium {
    border-top: 5px solid #000;
    margin: .15rem 0;
}

.nutrition-facts-calories {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
}

.nutrition-facts-calories .label {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.nutrition-facts-calories .value {
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1;
}

.nutrition-facts-row {
    border-top: 1px solid #000;
    display: flex;
    font-size: .9rem;
    justify-content: space-between;
    padding: .1rem 0;
}

.nutrition-facts-row.no-rule {
    border-top: 0;
}

.nutrition-facts-row.indent { padding-left: 1rem; }
.nutrition-facts-row.indent-2 { padding-left: 2rem; }

.nutrition-facts-row .dv {
    font-weight: 800;
}

.nutrition-facts-footnote {
    border-top: 5px solid #000;
    display: flex;
    font-size: .72rem;
    gap: .25rem;
    line-height: 1.25;
    padding-top: .3rem;
}

.nutrition-facts-gapfill {
    color: #6c757d !important;
    font-size: .7em;
    vertical-align: super;
}

/* ------------------------------------------------------------------
   EU / UK nutrition declaration: a plain table, as printed on European packaging.
   ------------------------------------------------------------------ */

.nutrition-declaration {
    background: #fff;
    border: 2px solid #000;
    color: #000;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: .9rem;
    max-width: 30rem;
    width: 100%;
}

.nutrition-declaration caption {
    caption-side: top;
    color: #000;
    font-size: 1.15rem;
    font-weight: 800;
    padding: .4rem .6rem;
}

.nutrition-declaration th,
.nutrition-declaration td {
    border-top: 1px solid #000;
    padding: .3rem .6rem;
}

.nutrition-declaration thead th {
    background: #000;
    color: #fff;
    font-weight: 700;
    vertical-align: bottom;
}

.nutrition-declaration td:not(:first-child),
.nutrition-declaration thead th:not(:first-child) {
    text-align: right;
    white-space: nowrap;
}

.nutrition-declaration .sub {
    padding-left: 1.4rem;
}

.nutrition-declaration tfoot td {
    font-size: .75rem;
    text-align: left !important;
    white-space: normal;
}

@media (max-width: 575.98px) {
    .nutrition-facts {
        max-width: 100%;
    }
}

@media print {
    .foods-no-print {
        display: none !important;
    }

    /* Printed pages always include the sources. */
    .foods-collapse-card .collapse {
        display: block !important;
    }
}

.foods-targets-prompt {
    background: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius-lg);
    padding: 0.625rem 0.875rem;
}
