/*
 * FoodHQ shell styles.
 *
 * Mobile-first throughout: the base rules are the phone layout and the media
 * queries add width, not the other way round. This is a site people read with
 * one hand while something is on the heat.
 *
 * The width contract is `--measure`, applied by `.page` and by nothing else. No
 * template sets its own max-width. Wide content escapes the measure through
 * `.bleed`, which stays inside the same page system rather than breaking out of
 * it, so tables can be wide without the site appearing to change width.
 */

:root {
  /* The one measure. Every substantial page is this wide. */
  --measure: 46rem;
  --measure-wide: 66rem;
  --gutter: 1.25rem;

  --ink: #16211c;
  --ink-soft: #4a5a52;
  --paper: #fbfaf7;
  --line: #dcd8cf;
  --brand: #1c3f2f;
  --brand-ink: #ffffff;
  --urgent: #8a2b1f;
  --focus: #0b5cd5;
  /* Focus ring for use on the dark brand header, where the blue one measures
     1.95:1 and is effectively invisible. Found by measuring, not by looking. */
  --focus-on-brand: #ffd54a;

  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--step-0)/1.6 ui-serif, Georgia, "Times New Roman", serif;
}

/* ---------------------------------------------------------- width contract */

.page {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Deliberate wider treatment, inside the same page system. */
.bleed {
  max-width: var(--measure-wide);
  margin-inline: auto;
  overflow-x: auto;
}

/* ------------------------------------------------------------ focus + skip */

/*
 * Focus must be visible on both grounds.
 *
 * A single blue ring measured 1.95:1 against the brand header — below the 3:1
 * that WCAG 1.4.11 requires and, in practice, invisible exactly where keyboard
 * users start. The header carries its own ring colour rather than every surface
 * carrying a compromise colour that suits neither.
 */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-header :focus-visible {
  outline-color: var(--focus-on-brand);
}

.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 0.75rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 0; top: 0; }

main:focus { outline: none; }

/* ----------------------------------------------------------------- header */

.site-header {
  background: var(--brand);
  color: var(--brand-ink);
  border-bottom: 1px solid var(--brand);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding-block: 0.75rem;
}

.brand {
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--brand-ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.primary { flex: 1 1 100%; order: 3; }

.primary ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary a {
  display: inline-block;
  color: var(--brand-ink);
  text-decoration: none;
  /* Touch target: comfortably over the 24px minimum, one-handed. */
  padding: 0.6rem 0.15rem;
  min-height: 2.75rem;
  border-bottom: 3px solid transparent;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
}

.primary a:hover { border-bottom-color: rgba(255, 255, 255, 0.4); }

/*
 * The active state, keyed on aria-current and nothing else — so the visual state
 * and the announced state are physically the same fact and cannot drift.
 *
 * Matches the attribute rather than a value: `page` when the nav link is the
 * current page, `true` when it owns the section the page sits in. Both highlight
 * identically; only the announcement differs.
 */
.primary a[aria-current] {
  border-bottom-color: var(--brand-ink);
  font-weight: 700;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

.search-link,
.urgent-link {
  color: var(--brand-ink);
  text-decoration: none;
  padding: 0.55rem 0.7rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0.25rem;
}

.urgent-link {
  background: var(--urgent);
  border-color: var(--urgent);
  font-weight: 700;
}

/* ------------------------------------------------------------------- text */

main { padding-block: 1.5rem 3rem; }

h1 { font-size: var(--step-3); line-height: 1.2; margin: 0 0 0.75rem; }
h2 { font-size: var(--step-2); line-height: 1.25; margin: 2rem 0 0.5rem; }

.kicker {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 0.25rem;
}

.lead { font-size: var(--step-1); color: var(--ink-soft); }
.note, .empty { color: var(--ink-soft); font-size: 0.95rem; }

a { color: var(--brand); }

/* --------------------------------------------------------------- notices */

.notice {
  border-left: 4px solid var(--line);
  background: #fff;
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}
.notice--thin { border-left-color: #b08b2e; }
.notice--stub { border-left-color: var(--ink-soft); }

/* ---------------------------------------------------------------- claims */

.claims { list-style: none; margin: 0; padding: 0; }

.claim {
  border-bottom: 1px solid var(--line);
  padding-block: 0.9rem;
}
.claim:last-child { border-bottom: none; }
.claim__text { margin: 0 0 0.4rem; }

/* Layer 3: small by design. It informs; it does not compete with the answer. */
.ev { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.82rem; }

.ev summary {
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  min-height: 2.25rem;
  list-style-position: inside;
}

.ev__badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
}

.ev[data-strength="strong"] .ev__badge { border-color: #2c6b4a; color: #2c6b4a; }
.ev[data-strength="weak"] .ev__badge { border-color: #8a6d1f; color: #8a6d1f; }

/* Contested surfaces at layer 3, not only inside the disclosure. */
.ev__contested {
  font-weight: 700;
  color: var(--urgent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
}

.ev__detail { margin: 0.5rem 0 0; padding: 0.75rem; background: #fff; border: 1px solid var(--line); }
.ev__detail dt { font-weight: 700; margin-top: 0.5rem; }
.ev__detail dt:first-child { margin-top: 0; }
.ev__detail dd { margin: 0.15rem 0 0; }
.ev__detail ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.ev__locator { color: var(--ink-soft); }
.ev__quality { color: var(--ink-soft); font-style: italic; }

/* --------------------------------------------------------------- urgent */

.urgent {
  border: 2px solid var(--urgent);
  border-radius: 0.35rem;
  padding: 1rem;
  background: #fff;
}
.urgent h1 { margin-top: 0.25rem; }
.urgent__lead { font-size: var(--step-1); margin: 0 0 0.75rem; }
.urgent__safety { border-top: 1px solid var(--line); padding-top: 0.75rem; }
.signpost { margin: 0; font-size: 0.95rem; }

/*
 * Nothing competes with the first screen on an urgent page. Belt and braces
 * alongside the render-time suppression: even if a placement were somehow
 * emitted into this markup, it does not draw.
 */
.is-urgent [data-monetisation],
.is-urgent .newsletter { display: none !important; }

/* ---------------------------------------------------------------- lists */

.index-list, .related { list-style: none; margin: 0; padding: 0; }
.index-list li, .related li { padding-block: 0.5rem; border-bottom: 1px solid var(--line); }
.index-list a, .related a { display: inline-block; min-height: 2.5rem; padding-block: 0.4rem; }
.index__note { color: var(--ink-soft); font-size: 0.9rem; }

/* --------------------------------------------------------------- search */

.search { display: grid; gap: 0.5rem; margin-block: 1rem 1.5rem; }
.search label { font-weight: 700; }
.search input {
  font: inherit;
  padding: 0.7rem 0.8rem;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: #fff;
}
.search button {
  font: inherit;
  min-height: 2.75rem;
  padding: 0.7rem 1.1rem;
  border: none;
  border-radius: 0.25rem;
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  justify-self: start;
}

.results:empty { display: none; }
.results ul { list-style: none; margin: 0; padding: 0; }
.results li { padding-block: 0.6rem; border-bottom: 1px solid var(--line); }
.results .type { color: var(--ink-soft); font-size: 0.85rem; }
/* Why this result came back: the signal or action the query matched. Its own
   line, so a long signal phrase does not crowd the title on a narrow screen. */
.results .result__why { display: block; color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.15rem; }

/* ---------------------------------------------------------------- share */

.share { margin-top: 2rem; display: flex; align-items: center; gap: 0.75rem; }
.share__button {
  font: inherit;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  min-height: 2.75rem;
  padding: 0.6rem 1rem;
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 0.25rem;
  color: var(--brand);
  cursor: pointer;
}
.share__status { font-size: 0.85rem; color: var(--ink-soft); }

/* --------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-block: 1.5rem 2.5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.site-footer ul { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.site-footer a { color: var(--ink-soft); }
.site-footer__note { margin: 0; }

/* ------------------------------------------------------------ wider view */

@media (min-width: 48rem) {
  :root { --gutter: 2rem; }
  .primary { flex: 0 1 auto; order: 0; }
  .primary ul { gap: 1.25rem; }
}

/* --------------------------------------------------------- preferences */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --ink-soft: #303b35; --line: #9a958a; }
}

/* ------------------------------------------------------ reading experience
 *
 * Added in Batch 16, when the corpus first had enough published pages to be
 * read rather than merely rendered. Everything here stays inside the existing
 * `.page` container: `.bleed` is the one deliberate escape and it widens content
 * within the page system rather than changing the site's outer measure.
 */

.crumbs { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.82rem; margin-bottom: 1rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: 0.35rem; color: var(--ink-soft); }
.crumbs [aria-current="page"] { color: var(--ink-soft); }

/* Explanatory journeys back up the graph. Prose links, not a card feed. */
.block--journey .journey { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.block--journey .journey li { padding-block: 0.35rem; }
.block--journey .journey a { display: inline-block; min-height: 2.25rem; padding-block: 0.3rem; }

/* Comparison. Scrolls inside its own container; the page never scrolls sideways. */
/* Measured composition. Wide content scrolls inside its own container so the
   page container keeps the one width token every substantial page shares. */
.table-scroll { overflow-x: auto; }
.composition { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.composition caption { text-align: left; color: var(--ink-soft); font-size: 0.85rem; padding-bottom: 0.5rem; }
.composition th, .composition td { border-bottom: 1px solid var(--line); padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; }
.composition thead th { border-bottom: 2px solid var(--ink-soft); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.82rem; }
.composition tbody th { font-weight: 400; white-space: nowrap; }

.compare { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.compare th, .compare td { border-bottom: 1px solid var(--line); padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; }
.compare thead th { border-bottom: 2px solid var(--ink-soft); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.82rem; }
.compare tbody th { font-weight: 400; color: var(--ink-soft); white-space: nowrap; }
.block--compare .note { margin-top: 0.6rem; }

/* What the page does not cover. Distinct from the below-floor notice. */
.notice--gap { border-left-color: var(--ink-soft); }

/* Hub. Sections a reader chooses between, not a list of URLs. */
.hub { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1rem; }
.hub li { border: 1px solid var(--line); border-radius: 0.35rem; background: #fff; padding: 1rem; }
.hub h2 { margin: 0 0 0.3rem; font-size: var(--step-1); }
.hub h2 a { text-decoration: none; }
.hub p { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.95rem; }
.hub .count { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.8rem; color: var(--ink-soft); }
.hub .examples { font-size: 0.92rem; margin: 0.5rem 0 0; }

@media (min-width: 40rem) {
  .hub { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------------------- consent */

/*
 * The consent surface, injected by `site.js` only when analytics is activated
 * and only until the reader has decided.
 *
 * Deliberately not a modal. There is no overlay, no focus trap and nothing to
 * dismiss before reading: the page underneath stays fully usable and fully
 * keyboard-navigable while the banner is open, because a reader who ignores it
 * has still made a valid choice — no consent — and should not be held hostage to
 * express it.
 *
 * The two buttons are visually identical and "No measurement" comes first in
 * both the DOM and the tab order. Neither is pre-selected. A consent surface
 * where the accepting control is louder is a dark pattern whichever way the
 * copy is worded.
 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.consent {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 2px solid var(--brand);
  box-shadow: 0 -0.25rem 1rem rgba(22, 33, 28, 0.12);
  padding: 1rem 0;
  z-index: 20;
}

.consent__inner { display: grid; gap: 0.6rem; }
.consent__heading { font-size: var(--step-1); margin: 0; }
.consent__body { margin: 0; color: var(--ink); }

.consent__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.consent__button {
  font: inherit;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--brand);
  border-radius: 0.25rem;
  padding: 0.6rem 1rem;
  min-height: 44px;
  cursor: pointer;
}

.consent__button:hover { background: var(--brand); color: var(--brand-ink); }
.consent__link { min-height: 44px; display: inline-flex; align-items: center; }

.consent-settings {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
}

.consent__button:focus-visible,
.consent-settings:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
