/* Food Robot Index — Data journalism theme (locked). Values come from css/tokens.css; load it first. */
/* Self-hosted fonts (SIL Open Font License; see fonts/README.txt). Latin subset only.
   Libre Baskerville and Source Sans 3 are variable fonts, so one file covers each weight range. */
@font-face {
  font-family: "Libre Baskerville";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/LibreBaskerville-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Libre Baskerville";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/LibreBaskerville-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/SourceSans3-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/SourceSans3-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Design tokens (colors, type, spacing, borders, sizes) live in css/tokens.css. Use var(--token); do not add literals here. */

* { box-sizing: border-box; }
html { font-size: var(--fs-root); }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  line-height: var(--lh-body);
}
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
.leaflet-marker-icon:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -3rem;
  background: var(--fg);
  color: var(--on-ink);
  padding: 0.4rem 0.7rem;
  z-index: var(--z-skip);
}
.skip-link:focus { top: var(--space-2); }
.skip-link.skip-map { position: absolute; left: -9999px; top: auto; }
.skip-link.skip-map:focus { position: static; display: inline-block; margin: 0 0 var(--space-2); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.example-banner,
.site-banner {
  background: var(--banner-bg);
  color: var(--banner-fg);
  text-align: center;
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  padding: 0.65rem var(--space-4);
  font-size: var(--fs-sm);
  border-bottom: var(--bw-hairline) solid var(--banner-border);
  font-family: var(--font);
}

.site-header {
  background: var(--header-bg);
  border-bottom: var(--rule-heavy);
  padding: 1.15rem 0 0.85rem;
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.site-header .wrap { align-items: center; }
.wordmark {
  font-family: var(--serif);
  font-weight: var(--fw-bold);
  text-decoration: none;
  color: inherit;
  font-size: var(--fs-wordmark);
  letter-spacing: var(--tracking-wordmark);
}
.wordmark { display: inline-flex; align-items: center; }
.wordmark img, .wordmark svg { display: block; height: 2.5rem; width: auto; }
.site-nav { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-left: auto; }
/* Light/dark toggle (js/theme.js). 44px square target. The moon shows in light mode (press for dark), the sun in dark mode. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; flex: none;
  background: var(--card-bg); color: var(--fg); border: var(--border-ink); border-radius: var(--radius); cursor: pointer;
}
.theme-toggle:hover { background: var(--row-hover); }
.theme-toggle[aria-pressed="true"] { background: var(--fg); color: var(--on-ink); }
.theme-toggle .i-sun, :root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
.site-nav a {
  text-decoration: none;
  color: var(--fg);
  font-size: var(--fs-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; }

main { padding: var(--space-6) 0 var(--space-12); }
.lede {
  font-size: var(--fs-lede);
  max-width: var(--lede-max);
  margin: 0 0 var(--space-8);
  color: var(--fg);
}
h1, h2, h3, .score-card h4, .log-week h3 {
  font-family: var(--serif);
  letter-spacing: 0;
  font-weight: var(--fw-bold);
  color: var(--fg);
}
h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  border-bottom: var(--border-ink);
  padding-bottom: 0.6rem;
  margin: 0 0 var(--space-3);
}
h2 {
  font-size: var(--fs-h2);
  font-style: italic;
  font-weight: var(--fw-regular);
  margin: 0 0 var(--space-3);
  border-bottom: var(--border-ink);
  padding-bottom: 0.35rem;
}
h3 { font-size: var(--fs-table); margin: 0 0 var(--space-2); font-style: normal; }

section { margin: 0 0 var(--space-9); }

/* While data loads, hold roughly the space the scoreboard will fill (about 85% of its height)
   so the map and table do not jump down when the cards render (CLS). The class is removed in app.js. */
.is-loading .scoreboard-grid { min-height: 7200px; }
.scoreboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6) var(--space-8);
}
.score-group {
  background: transparent;
  border: 0;
  border-top: var(--border-line);
  padding: var(--space-2) 0 0;
}
.score-cards { display: flex; flex-direction: column; gap: 0.9rem; }
.score-card h4 { margin: 0 0 0.4rem; font-size: var(--fs-base); }
.score-nums { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.score-nums div { min-width: 4.5rem; }
.score-nums .n {
  display: block;
  font-family: var(--serif);
  font-size: var(--fs-score);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: var(--lh-score);
}
.score-nums .l {
  display: block;
  font-size: var(--fs-label);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  font-weight: var(--fw-semibold);
}
.score-card .residual, .score-footnote, .empty-note, .table-count {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin: 0.6rem 0 0;
}

#map {
  height: var(--map-h);
  width: 100%;
  border: var(--border-ink);
  background:
    linear-gradient(var(--map-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--map-grid) 1px, transparent 1px),
    var(--map-bg);
  background-size: 32px 32px, 32px 32px, auto;
  position: relative;
}
#map.tiles-failed .map-fallback { display: block; }
.map-fallback {
  display: none;
  position: absolute;
  z-index: var(--z-map-note);
  left: 8px;
  bottom: 8px;
  background: var(--map-note-bg);
  border: var(--border-line);
  padding: 0.35rem 0.55rem;
  font-size: var(--fs-note);
  color: var(--muted);
  pointer-events: none;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-meta);
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  vertical-align: -0.05rem;
  border: var(--border-ink);
}
.legend .live { background: var(--live); }
.legend .piloting { background: var(--piloting); }
.legend .announced { background: var(--announced); }
.legend .removed { background: var(--removed); }
.legend .unconfirmed { background: var(--unconfirmed); border-style: dashed; }

/* Status labels: text is always present; color is supplementary. */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font);
  font-size: var(--fs-chip);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-chip);
  text-transform: uppercase;
  line-height: var(--lh-chip);
  white-space: nowrap;
  padding: 0.12rem 0.4rem 0.12rem 0.3rem;
  border: var(--bw-hairline) solid currentColor;
  border-radius: var(--radius);
  color: var(--fg);
  background: var(--unconfirmed-bg);
}
.status-chip::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  flex: 0 0 0.55rem;
  border: var(--border-ink);
  background: currentColor;
}
.status-chip.live { color: var(--live); background: var(--live-bg); }
.status-chip.live::before { background: var(--live); }
.status-chip.piloting { color: var(--piloting); background: var(--piloting-bg); }
.status-chip.piloting::before { background: var(--white); box-shadow: inset 0 0 0 2px var(--piloting); }
.status-chip.announced { color: var(--announced); background: var(--announced-bg); }
.status-chip.announced::before { border-radius: var(--radius-round); background: var(--announced); }
.status-chip.removed { color: var(--removed); background: var(--removed-bg); }
.status-chip.removed::before { background: var(--removed); transform: rotate(45deg) scale(0.75); }
.status-chip.unconfirmed { color: var(--unconfirmed); background: var(--unconfirmed-bg); }
.status-chip.unconfirmed::before { background: transparent; border-style: dashed; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}
.filters input[type="search"], .filters select {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: var(--border-ink);
  background: var(--card-bg);
  color: var(--fg);
  min-height: var(--control-h);
}
.filters input[type="search"] { min-width: 16rem; flex: 1; }
.table-wrap {
  overflow-x: auto;
  border: var(--border-ink);
  background: var(--card-bg);
  -webkit-overflow-scrolling: touch;
}
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
table.data th, table.data td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: var(--border-line);
  vertical-align: top;
}
table.data th {
  font-family: var(--serif);
  font-weight: var(--fw-regular);
  font-style: italic;
  font-size: var(--fs-th);
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg);
  background: var(--card-bg);
  white-space: nowrap;
  border-bottom: var(--border-ink);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--row-hover); }
#table-empty { font-size: var(--fs-meta); color: var(--muted); margin: var(--space-2) 0 0; }
.source-list { margin: 0; padding: 0; list-style: none; }
.source-list li { margin: 0 0 0.15rem; }
.muted { color: var(--muted); font-size: 0.85em; }

.log-week {
  background: var(--card-bg);
  border: var(--border-ink);
  padding: var(--space-4) 1.1rem;
  margin: 0 0 var(--space-4);
}
.log-week header { margin-bottom: var(--space-3); }
.log-week h3 { margin: 0 0 0.2rem; font-size: var(--fs-base); }
.log-meta { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.log-entry { border-top: var(--border-line); padding: var(--space-3) 0 var(--space-1); margin-top: var(--space-3); }
.log-entry h4 { margin: 0 0 0.35rem; font-size: var(--fs-sm); font-family: var(--mono); font-weight: var(--fw-semibold); word-break: break-word; }
.log-entry dl { margin: 0; display: grid; grid-template-columns: 9.5rem 1fr; gap: 0.2rem var(--space-3); font-size: var(--fs-small); }
.log-entry dt { color: var(--muted); }
.log-entry dd { margin: 0; }

.site-footer {
  border-top: var(--rule-heavy);
  padding: var(--space-5) 0 var(--space-8);
  color: var(--muted);
  font-size: var(--fs-small);
}
.site-footer p { margin: 0 0 0.4rem; max-width: var(--prose-max); }

.prose { max-width: var(--prose-max); }
.prose h2 { margin-top: var(--space-8); }
.prose h3 { margin-top: var(--space-5); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--fs-small); margin: var(--space-3) 0; }
.prose th, .prose td { border: var(--border-line); padding: 0.35rem var(--space-2); text-align: left; vertical-align: top; }
.prose code { font-family: var(--mono-code); font-size: 0.85em; }

.leaflet-container { font-family: var(--font); background: transparent; }
.leaflet-marker-icon.krl-icon { display: flex; align-items: center; justify-content: center; }
.krl-pin {
  width: var(--pin-size);
  height: var(--pin-size);
  border-radius: var(--radius-round);
  border: 2px solid var(--pin-ring);
  box-shadow: var(--pin-shadow);
  background: var(--pin-unconfirmed);
}
.krl-pin.live { background: var(--pin-live); }
.krl-pin.piloting { background: var(--pin-piloting); }
.krl-pin.announced { background: var(--pin-announced); }
.krl-pin.removed { background: var(--pin-removed); }
.krl-pin.unconfirmed { background: var(--pin-unconfirmed); }

@media (max-width: 800px) {
  .scoreboard-grid { grid-template-columns: 1fr; }
  .is-loading .scoreboard-grid { min-height: 10600px; }
  h1 { font-size: var(--fs-h1-narrow); }
  .wordmark { font-size: var(--fs-wordmark-narrow); }
  /* header: logo on top, nav below, toggle pinned top right (same layout as phones) */
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 0.6rem; position: relative; }
  .site-nav { margin-left: 0; }
  .theme-toggle { position: absolute; top: -0.2rem; right: var(--gutter); }
  #map { height: var(--map-h-narrow); }
  .filters input[type="search"], .filters select { min-width: 0; width: 100%; flex: 1 1 100%; }
  .log-entry dl { grid-template-columns: 1fr; }
  .log-entry dt { margin-top: 0.35rem; }
}

@media (max-width: 520px) {
  html { font-size: var(--fs-root-phone); }
  .is-loading .scoreboard-grid { min-height: 10000px; }
  .wrap { padding: 0 var(--gutter-phone); }
  h1 { font-size: var(--fs-h1-phone); }
  .lede { font-size: var(--fs-lede-phone); }
  #map { height: var(--map-h-phone); }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .theme-toggle { right: var(--gutter-phone); }
}

/* Small phones (360px): six nav links wrap onto two lines rather than run off the edge. */
@media (max-width: 420px) {
  .site-nav { gap: var(--space-2) 0.8rem; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .site-nav a { letter-spacing: 0.01em; font-size: 0.8125rem; white-space: nowrap; padding: 0.3rem 0; display: inline-block; }
}
@media (max-width: 340px) {
  .site-nav { flex-wrap: wrap; justify-content: flex-start; gap: var(--space-2) var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Browse directory in the footer (home page). Same links are on the makers, chains, and locations pages. */
.directory { margin: var(--space-4) 0 0; max-width: none; }
.directory h2 { font-size: var(--fs-base); border-bottom: var(--border-line); margin: 0 0 var(--space-2); }
.directory p { margin: 0 0 var(--space-2); }
.directory details { margin: 0 0 var(--space-2); }
.directory summary { cursor: pointer; font-weight: var(--fw-semibold); }
.dir-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; columns: 14rem; column-gap: var(--space-5); }
.dir-list li { margin: 0 0 0.25rem; break-inside: avoid; }

/* ---- Line art (process/build-art.py, sprites in /img/art/). Strokes use currentColor; solid parts use --art-fill, so both follow the theme. ---- */
.art { display: block; width: 100%; height: auto; color: var(--fg); --art-fill: var(--card-bg); overflow: visible; }
.art-g { display: inline-block; width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.28em; margin-right: 0.4em; color: inherit; }
.art-fig { margin: 0; }
.art-fig figcaption { margin-top: var(--space-2); font-size: var(--fs-meta); color: var(--muted); }

/* plain-English "How this works" block and label key (homepage and methodology summary) */
.h-how { margin: 0 0 var(--space-8); max-width: var(--prose-max, 46rem); }
.h-how > p { max-width: var(--prose-max, 46rem); }
.h-how h3 { margin: var(--space-4) 0 var(--space-2); font-size: var(--fs-lede); }
.h-labels { margin: 0 0 var(--space-3); display: grid; gap: var(--space-2); }
.h-labels > div { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: var(--space-3); align-items: start; padding: var(--space-2) 0; border-top: var(--border-line); }
.h-labels dt { margin: 0; }
.h-labels dd { margin: 0; }
.h-more { color: var(--muted); font-size: var(--fs-small); }
@media (max-width: 40rem) { .h-labels > div { grid-template-columns: 1fr; gap: var(--space-1); } }

/* ---------- instant search (header and home hero; js/search.js) ---------- */
.sx { position: relative; flex: 0 1 22rem; min-width: 0; }
.sx form { position: relative; display: flex; align-items: center; margin: 0; }
.sx-ico { position: absolute; left: 0.7rem; color: var(--muted); stroke: currentColor; fill: none; stroke-width: 2; pointer-events: none; }
.sx input { width: 100%; box-sizing: border-box; height: var(--control-h); padding: 0 2.2rem 0 2.35rem; font: inherit; font-size: var(--fs-sm); color: var(--fg); background: var(--card-bg); border: var(--border-ink); border-radius: var(--radius); }
.sx input::placeholder { color: var(--muted); opacity: 1; }
.sx input:focus-visible { outline: 3px solid var(--link); outline-offset: 1px; }
.sx-kbd { position: absolute; right: 0.6rem; font-size: var(--fs-note); border: var(--border-line); padding: 0 0.35rem; color: var(--muted); }
.sx-list { position: absolute; z-index: 700; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 0; list-style: none; background: var(--card-bg); border: var(--border-ink); box-shadow: 0 6px 18px rgba(0,0,0,.18); max-height: 26rem; overflow: auto; min-width: min(24rem, 100vw - 28px); }
.sx-list[hidden] { display: none; }
.sx-group { font-size: var(--fs-label); letter-spacing: var(--tracking-caps); text-transform: uppercase; font-weight: var(--fw-bold); color: var(--muted); padding: 0.55rem 0.8rem 0.2rem; background: var(--bg); border-top: var(--border-line); }
.sx-group:first-child { border-top: 0; }
.sx-list [role=option] a { display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline; padding: 0.5rem 0.8rem; min-height: 2.4rem; box-sizing: border-box; color: var(--fg); text-decoration: none; }
.sx-list [role=option]:hover a, .sx-list [role=option].on a { background: var(--row-hover); outline: 2px solid var(--fg); outline-offset: -2px; }
.sx-name mark { background: var(--live-bg); color: var(--live); font-weight: var(--fw-bold); }
.sx-sub { font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
.sx-none { padding: 0.8rem; font-size: var(--fs-small); color: var(--muted); }
.sx.big { flex: none; max-width: 36rem; }
.sx.big input { height: 3.1rem; font-size: 1.05rem; padding-left: 2.8rem; border-width: 2px; }
.sx.big .sx-ico { left: 0.9rem; width: 22px; height: 22px; }
.sx.big .sx-list { max-height: 24rem; }
.hero-search { margin: 0 0 var(--space-5); }
.hs-label { margin: 0 0 var(--space-2); font-size: var(--fs-label); letter-spacing: var(--tracking-caps); text-transform: uppercase; font-weight: var(--fw-semibold); color: var(--muted); }
.hs-try { margin: var(--space-2) 0 0; font-size: var(--fs-meta); color: var(--muted); }
.site-header .sx { flex: 0 1 15rem; }
.site-header .sx-list { right: 0; left: auto; width: 26rem; max-width: calc(100vw - 2rem); }
.hero-search .sx { max-width: 36rem; }
@media (max-width: 1100px) { .site-header .sx { flex: 1 1 100%; order: 5; } .site-header .sx-list { width: 100%; } .site-nav { margin-left: 0; } .site-header .wrap { justify-content: flex-start; } .theme-toggle { margin-left: auto; } }
@media (max-width: 800px) { .sx-kbd { display: none; } }
