/* homeview-barcode-scan-p1 parity: styles for app/details.js (owned by that module).
   Colours are the app's default palette (assets/config/colors_pink.json,
   light): error / warning / success and their on-tint text inks, the tertiary
   greys. Sizes are in em so they follow the page's vmin type scale (one
   product readable across a kitchen at 448x364 and at phone width). */

.blk-allergens, .blk-ingredients, .blk-environment, .blk-source, .blk-footer {
  --dt-error: #c62828;
  --dt-error-ink: #a31d1d;
  --dt-warning: #e65100;
  --dt-warning-ink: #8a3f00;
  --dt-success: #388e3c;
  --dt-success-ink: #1b5e20;
  --dt-secondary: #5a4450;
  --dt-tertiary: #6d5560;
}
/* Dark mode: the app's dark palettes (colors_dark_pink.json, colors_dark.json):
   error, warningText, successText, textSecondary, textTertiaryAccessible. On a
   dark tint the ink IS the hue (the light inks are darkened hues), except the
   error ink: #ef5350 text on its tint over the kiwi card is 4.23:1, under AA for
   allergen copy, so the text takes the lighter red #ff8a80 (6.46:1 kiwi, 6.89:1
   pink); borders and glyphs keep #ef5350. */
:root[data-mode="dark"] :is(.blk-allergens, .blk-ingredients, .blk-environment, .blk-source, .blk-footer) {
  --dt-error: #ef5350;
  --dt-error-ink: #ff8a80;
  --dt-warning: #ffa726;
  --dt-warning-ink: #ffa726;
  --dt-success: #66bb6a;
  --dt-success-ink: #66bb6a;
  --dt-secondary: #dcb8c2;
  --dt-tertiary: #bc9aa4;
}
:root[data-pal="kiwi"][data-mode="dark"] :is(.blk-allergens, .blk-ingredients, .blk-environment, .blk-source, .blk-footer) {
  --dt-secondary: #c0c0c0;
  --dt-tertiary: #a0a0a0;
}
/* Golden (?palette=golden, owner 2026-12-01): its own inks from colors_golden.json and
   colors_dark_golden.json; every one >= 5:1 on golden's card (light 5.12-9.20, dark 5.05-7.01).
   Dark keeps the lighter error ink the other dark palettes use (#ff8a80, 6.16:1 on golden's card). */
:root[data-pal="golden"] :is(.blk-allergens, .blk-ingredients, .blk-environment, .blk-source, .blk-footer) {
  --dt-error: #c62828;
  --dt-warning-ink: #c2410c;
  --dt-success-ink: #2f5417;
  --dt-secondary: #5d4037;
  --dt-tertiary: #6d5549;
}
:root[data-pal="golden"][data-mode="dark"] :is(.blk-allergens, .blk-ingredients, .blk-environment, .blk-source, .blk-footer) {
  --dt-error: #f47373;
  --dt-error-ink: #ff8a80;
  --dt-warning: #ff7043;
  --dt-warning-ink: #ff7043;
  --dt-success: #8fbf5e;
  --dt-success-ink: #8fbf5e;
  --dt-secondary: #c4b5a0;
  --dt-tertiary: #b0a18c;
}

.glyph { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }

/* ---- 90: Allergens & dietary ---- */
.dt { display: flex; flex-direction: column; gap: 0.5em; }
.dt-title { display: flex; align-items: center; gap: 0.25em; }
.dt-title h2 { flex: 1; margin: 0; font-size: 1.1em; }
.dt-info {
  background: transparent; color: var(--dt-secondary); border-radius: 50%;
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.dt-info:focus-visible, .dt-expand:focus-visible, .env-pipbtn:focus-visible, .env-method:focus-visible, .dt-gotit:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* The crowd confidence line: a small icon + caption, never a chip. */
.dt-verify { display: flex; align-items: center; gap: 0.4em; font-size: 0.8em; }
.dt-verify.dt-success { color: var(--dt-success-ink); }
.dt-verify.dt-warning { color: var(--dt-warning-ink); }
.dt-verify.dt-muted { color: var(--dt-tertiary); }

.dt-wrap { display: flex; flex-wrap: wrap; gap: 0.4em; }

/* _chip: the flat red and may-contain pills. */
.dt-pill {
  display: inline-block; padding: 0.3em 0.65em; border-radius: 0.9em; font-size: 0.8em; color: var(--ink);
}
.dt-pill.dt-error { background: rgba(198, 40, 40, 0.12); border: 1px solid rgba(198, 40, 40, 0.4); }
.dt-pill.dt-warning { background: rgba(230, 81, 0, 0.12); border: 1px solid rgba(230, 81, 0, 0.4); }

/* DietaryPositiveChip: green check; a label-only claim is unfilled with a label glyph and a `*`. */
.dt-pos {
  display: inline-flex; align-items: center; gap: 0.25em; padding: 0.25em 0.5em; border-radius: 0.3em;
  font-size: 0.85em; font-weight: 600; color: var(--dt-success-ink);
  background: rgba(56, 142, 60, 0.1); border: 1px solid rgba(56, 142, 60, 0.3);
}
.dt-pos.dt-labelonly { background: transparent; border-color: rgba(56, 142, 60, 0.45); }

/* AllergenChip / IngredientGroupChip: red warning glyph, expands to the words. */
/* Side by side, wrapping, as the app's BalancedWrap (dietary_allergen_section.dart:777, _unattributedWrap)
   lays them: a column left the boxes stacked with whitespace beside them on HomeView (owner 2026-11-21).
   An opened box grows alone; its neighbours keep their own height. */
.dt-tier { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 0.4em; }
.dt-t1 { display: flex; align-items: flex-start; gap: 0.1em; max-width: 100%; }
.dt-allergen {
  display: inline-flex; flex-direction: column; align-items: flex-start; text-align: start;
  padding: 0.35em 0.5em; border-radius: 0.3em; font: inherit; font-size: 0.82em; font-weight: 600;
  color: var(--dt-error-ink); background: rgba(198, 40, 40, 0.1); border: 1px solid rgba(198, 40, 40, 0.3);
  max-width: 100%;
}
button.dt-allergen { cursor: pointer; min-height: 44px; justify-content: center; }
.dt-row { display: inline-flex; align-items: center; gap: 0.3em; }
.dt-chev { transition: transform 0.2s ease; }
.dt-expand[aria-expanded="true"] .dt-chev, .env-method[aria-expanded="true"] .dt-chev { transform: rotate(90deg); }
[dir="rtl"] .dt-expand[aria-expanded="false"] .dt-chev, [dir="rtl"] .env-method[aria-expanded="false"] .dt-chev { transform: scaleX(-1); }
.dt-words { list-style: none; margin: 0.25em 0 0; padding: 0; font-weight: 400; }
.dt-words li::before { content: '\2022\00a0'; }
.dt-words[hidden] { display: none; }
/* 🔴 UNREACHABLE while details.js's PRODUCT_LABEL_ATTRIBUTION_SHOWS_PICTURES is
   false (owner ruling 2026-11-22: a barcode's allergen attribution never shows
   ingredient pictures). Kept so the switch alone restores the layout.
   The attributed word's picture (English labels): the extension's DietaryChips
   `.bn-chip-food` / `.bn-warn-pic` (browser-extension/assets/blocks.css), a
   32 px square, 6 px corner, contain-fit, and the centred dot while there is
   no picture. The dot box is the same size, so the swap never reflows. */
.dt-words li.dt-food { display: flex; align-items: center; gap: 0.5em; margin-top: 0.25em; }
.dt-words li.dt-food::before { content: none; }
.dt-pic { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; flex: none; }
.dt-pic-empty { display: flex; align-items: center; justify-content: center; }
.dt-pic-empty::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dt-error-ink); }

/* Tier 2 / 3 headings: a small caption with its own (i). */
.dt-badge { display: flex; align-items: center; margin-top: 0.3em; }
.dt-badge h3 { margin: 0; font-size: 0.8em; font-weight: 600; color: var(--dt-secondary); }
.dt-badge .dt-info { min-width: 44px; min-height: 44px; }

.dt-note { font-size: 0.78em; color: var(--dt-tertiary); }

/* The sheets (DietaryDataInfoSheet, the provenance (i), the environmental about sheet). */
.dt-sheet { display: flex; flex-direction: column; gap: 0.75em; }
.dt-body { line-height: 1.5; }
.dt-fine { font-size: 0.8em; line-height: 1.45; color: var(--dt-tertiary); }
.dt-fine a { color: inherit; }
.dt-gotit {
  align-self: stretch; min-height: 52px; border-radius: 14px; margin-top: 0.5em;
  background: var(--accent); color: var(--on-accent); font-weight: 800;
}

/* ---- 100: Ingredients ---- */
.ing-title { margin: 0 0 0.35em; font-size: 0.82em; font-weight: 600; color: var(--dt-secondary); }
.ing-body { line-height: 1.45; overflow-wrap: anywhere; }
.ing-missing { color: var(--dt-tertiary); font-style: italic; }

/* ---- 110: Environmental score ---- */
.env { display: flex; flex-direction: column; }
.env-head { display: flex; align-items: center; justify-content: center; }
.env-ghost { width: 44px; height: 44px; flex: none; }
.env-title {
  margin: 0; text-align: center; font-size: 0.62em; font-weight: 700; letter-spacing: 0.05em; color: var(--dt-secondary);
}
.env-center { display: flex; justify-content: center; }
.env-pipbtn { background: transparent; border-radius: 999px; padding: 0.2em 0.6em; }
.env-pips { display: inline-flex; align-items: center; gap: 4px; }
.env-pip {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; line-height: 1; color: rgba(255, 255, 255, 0.92);
  background: color-mix(in srgb, var(--c) 42%, transparent);
}
.env-pip.env-active {
  width: 56px; height: 56px; margin: 0 -13px; position: relative; z-index: 1;
  font-size: 22px; font-weight: 800; color: #fff; background: var(--c);
  border: 2.5px solid var(--card); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}
.env-origin { margin-top: 0.6em; font-size: 0.8em; line-height: 1.4; color: var(--dt-secondary); }
.env-origin[hidden] { display: none; }
.env-foot { margin-top: 0.5em; font-size: 0.7em; line-height: 1.5; color: var(--dt-tertiary); }
.env-method {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 0.3em; min-height: 44px;
  background: transparent; color: var(--dt-secondary); font-size: 0.7em; padding: 0;
}
.env-method-body { font-size: 0.7em; line-height: 1.5; color: var(--dt-tertiary); }
.env-method-body[hidden] { display: none; }

/* ---- 120: Database reference + the barcode ---- */
.src-title { margin: 0 0 0.35em; font-size: 0.82em; font-weight: 600; color: var(--dt-secondary); }
.src-entry + .src-entry { margin-top: 0.6em; }
.src-sub { font-size: 0.85em; color: var(--dt-secondary); }
.bc { display: flex; justify-content: center; padding: 0.5em 0; margin-top: 1em; }
.bc-svg { width: 100%; max-width: 320px; height: auto; fill: var(--ink); }
.bc-svg text { font-size: 14px; font-variant-numeric: tabular-nums; font-family: inherit; }
.bc-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; text-align: center; }

/* ---- 130: the footer disclaimer ---- */
.dt-footer { font-size: 0.78em; color: var(--dt-tertiary); }
