/* FastFoodEcon — styles. Light/dark theme via prefers-color-scheme. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --baseline: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;        /* sequential blue 450 */
  --accent-soft: #cde2fb;   /* sequential blue 100 */
  --good-text: #006300;
  --macro-protein: #2a78d6; /* categorical slot 1 */
  --macro-carbs: #008300;   /* categorical slot 2 */
  --macro-fat: #e87ba4;     /* categorical slot 3 */
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 4px 16px rgba(11, 11, 11, 0.05);
}
/* Dark palette — shared by the OS setting (unless the user forced light) and by
   an explicit [data-theme="dark"] toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --hairline: #2c2c2a;
    --baseline: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #104281;
    --good-text: #0ca30c;
    --macro-protein: #3987e5;
    --macro-carbs: #008300;
    --macro-fat: #d55181;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --hairline: #2c2c2a;
  --baseline: #383835;
  --ring: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-soft: #104281;
  --good-text: #0ca30c;
  --macro-protein: #3987e5;
  --macro-carbs: #008300;
  --macro-fat: #d55181;
  --shadow: none;
}
.theme-toggle {
  background: none; border: 1px solid var(--baseline); color: var(--ink-2);
  border-radius: 999px; width: 34px; height: 34px; font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--accent); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.site-header .inner {
  max-width: 1060px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -0.01em; }
.brand .bite { color: var(--accent); }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--ink-2); padding: 5px 10px; border-radius: 8px; font-weight: 500;
}
.site-nav a:hover { text-decoration: none; background: var(--page); color: var(--ink); }
.site-nav a.active { color: var(--ink); background: var(--page); }

#region-select {
  background: var(--page); color: var(--ink-2); border: 1px solid var(--baseline);
  border-radius: 8px; padding: 4px 8px; font: inherit; font-size: 12.5px;
}

main { max-width: 1060px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- meal planner ---------- */
.plan-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.plan-card {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.plan-card.best { border-color: var(--accent); }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-head a { color: var(--ink); font-weight: 600; }
.plan-cost { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-card.best .plan-cost { color: var(--accent); }
.plan-items { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.plan-items li { padding: 2px 0; }
.plan-items .cat { color: var(--muted); font-size: 12px; }
.plan-totals {
  margin-top: auto; padding-top: 8px; border-top: 1px solid var(--hairline);
  color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.filter-row label input[type="checkbox"] { accent-color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: 26px 0 8px; max-width: 720px; }
.hero h1 { font-size: 30px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.02em; }
.hero p { color: var(--ink-2); margin: 0 0 16px; font-size: 16px; }
.hero .stats { color: var(--muted); font-size: 13px; }

.search-row { margin: 18px 0 6px; }

/* homepage planner front-door + cross-chain "best" showcase */
.planner-cta {
  display: flex; gap: 22px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 16px;
  box-shadow: var(--shadow); padding: 18px 22px; margin: 20px 0 10px;
}
.planner-cta .pc-copy { max-width: 470px; }
.planner-cta h2 { margin: 0 0 5px; font-size: 19px; letter-spacing: -0.01em; }
.planner-cta p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
/* Compact variant used on the home page so the CTA reads as a secondary promo,
   not a second copy of the Planner page. */
.planner-cta.compact { padding: 14px 18px; margin: 26px 0 10px; background: transparent; box-shadow: none; border-style: dashed; }
.planner-cta.compact h2 { font-size: 16px; }
.planner-cta.compact p { font-size: 12.5px; }
.pc-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pc-form label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.pc-form input[type="number"] { width: 74px; }
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 10px 16px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn-primary:hover { opacity: 0.92; }
.btn-ghost {
  background: transparent; border: 1px solid var(--baseline); border-radius: 8px;
  padding: 6px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.showcase-tabs { display: flex; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.showcase-tabs button {
  background: transparent; border: 1px solid var(--baseline); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.showcase-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.showcase-tabs button:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.price-watch {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 12px;
  padding: 10px 16px; margin: 14px 0 2px; font-size: 13.5px; color: var(--ink-2);
}
.price-watch b { color: var(--ink); font-weight: 600; }

input[type="search"], input[type="number"], input[type="text"], select {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--baseline); border-radius: 9px;
  padding: 8px 12px; font: inherit; font-size: 14px;
}
input[type="search"] { width: min(420px, 100%); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* ---------- chain grid ---------- */
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 26px 0 12px; }
.chain-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.chain-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 14px;
  padding: 14px; color: var(--ink); box-shadow: var(--shadow);
  transition: border-color 120ms ease, transform 120ms ease;
}
.chain-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.chain-tile {
  flex: none; width: 44px; height: 44px; border-radius: 11px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: 0.01em;
}
.chain-card .meta { min-width: 0; }
.chain-card .name { display: block; font-weight: 600; }
.chain-card .sub { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.type-badge {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--baseline); color: var(--ink-2);
  border-radius: 999px; padding: 1px 8px; vertical-align: 1px;
}
/* "est" pill on combos whose nutrition is computed from components (disclosed estimate) */
.est-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: #8a6d00; background: #fff4cc; border: 1px solid #f0d98a;
  border-radius: 4px; padding: 0 4px; vertical-align: 1px; cursor: help;
}
/* "nat'l avg" pill on prices that are an estimated national average (no local collection) */
.nat-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 4px; padding: 0 4px; vertical-align: 1px; cursor: help; white-space: nowrap;
}

/* ---------- stat tiles ---------- */
.tile-row {
  display: grid; gap: 12px; margin: 18px 0 6px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.stat-tile {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat-tile .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat-tile .value { font-size: 24px; font-weight: 700; margin: 2px 0 1px; letter-spacing: -0.01em; }
.stat-tile .value .unit { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.stat-tile .item { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- filters ---------- */
.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 16px 0 12px;
}
.filter-row label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.filter-row input[type="number"] { width: 78px; }
.filter-row .spacer { flex: 1; }
.filter-row .count { color: var(--muted); font-size: 12.5px; }

/* ---------- table ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 14px;
  box-shadow: var(--shadow); overflow-x: auto;
}
table.items { border-collapse: collapse; width: 100%; min-width: 860px; }
table.items th, table.items td {
  padding: 9px 12px; text-align: right; white-space: nowrap;
  border-top: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}
table.items th {
  border-top: none; position: sticky; top: 0; background: var(--surface);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); cursor: pointer; user-select: none;
}
table.items th:hover { color: var(--ink); }
table.items th.sorted { color: var(--ink); }
table.items th .arrow { font-size: 10px; }
table.items th.name-col, table.items td.name-col { text-align: left; white-space: normal; min-width: 200px; }
table.items td.name-col { font-weight: 500; }
table.items td .cat { color: var(--muted); font-size: 12px; font-weight: 400; }
table.items tbody tr { cursor: pointer; }
table.items tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
table.items tr.top-pick td.name-col::before {
  content: "★ "; color: var(--accent); font-size: 12px;
}
.chain-cell { display: flex; align-items: center; gap: 8px; text-align: left; }
.chain-cell .mini-tile {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 10px;
}

/* meter bar inside table cells: value + thin sequential-blue bar */
.meter { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.meter .bar {
  width: 64px; height: 5px; border-radius: 4px; background: var(--hairline);
  overflow: hidden; flex: none;
}
.meter .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- expanded item detail ---------- */
tr.detail-row td { background: var(--page); cursor: default; padding: 14px 16px; white-space: normal; }
.detail-grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.detail-grid .facts { flex: 1; min-width: 260px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 18px; font-size: 13px; }
.detail-grid .facts b { font-variant-numeric: tabular-nums; }
.detail-grid .facts span { color: var(--muted); }
.macro-block { min-width: 240px; flex: 1; max-width: 420px; }
.macro-block .mb-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.macro-bar { display: flex; height: 14px; border-radius: 5px; overflow: hidden; gap: 2px; background: transparent; }
.macro-bar i { display: block; height: 100%; border-radius: 3px; }
.macro-bar .p { background: var(--macro-protein); }
.macro-bar .c { background: var(--macro-carbs); }
.macro-bar .f { background: var(--macro-fat); }
.macro-legend { display: flex; gap: 16px; margin-top: 7px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.macro-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.note-line { margin-top: 8px; color: var(--muted); font-size: 12.5px; font-style: italic; }
.price-slider { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--page); }
.price-slider .ps-head { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.ps-row { display: flex; align-items: center; gap: 8px; }
.ps-row .ps-slider { flex: 1; accent-color: var(--accent); cursor: pointer; }
.ps-row .ps-dollar { color: var(--muted); margin-left: 4px; }
.ps-row .ps-num { width: 78px; font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--baseline); border-radius: 6px; background: var(--surface); color: var(--ink); }
.ps-out { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.ps-out b { color: var(--ink); font-size: 15px; }
.ps-out .ps-unit { color: var(--muted); font-size: 11px; }
.price-report { margin-top: 10px; }
.pr-open { background: none; border: 1px dashed var(--baseline); color: var(--ink-2); border-radius: 6px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.pr-open:hover { border-color: var(--accent); color: var(--accent); }
.pr-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.pr-form input { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--baseline); border-radius: 6px; background: var(--surface); color: var(--ink); }
.pr-form .pr-price { width: 92px; }
.pr-form .pr-note { flex: 1; min-width: 140px; }
.pr-form button { font: inherit; font-size: 13px; padding: 4px 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; cursor: pointer; }
.pr-msg { color: var(--good-text); font-size: 12.5px; }

/* ---------- chain page header ---------- */
.chain-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 4px; }
.chain-head .chain-tile { width: 54px; height: 54px; border-radius: 13px; font-size: 21px; }
.chain-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.chain-head .sub { color: var(--muted); font-size: 13px; }
.back-link { font-size: 13px; color: var(--muted); display: inline-block; margin-bottom: 10px; }

/* ---------- methodology / prose ---------- */
.prose { max-width: 720px; }
.prose h1 { font-size: 26px; letter-spacing: -0.02em; }
.prose h2 { font-size: 18px; margin-top: 28px; }
.prose p, .prose li { color: var(--ink-2); }
.prose code { background: var(--surface); border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.callout {
  background: var(--surface); border: 1px solid var(--ring); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 16px; margin: 16px 0; color: var(--ink-2); font-size: 14px;
}

.footer-note { margin-top: 40px; color: var(--muted); font-size: 12.5px; max-width: 720px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 24px; }
  main { padding: 16px 14px 60px; }
  .site-header .inner { padding: 8px 14px; gap: 10px; flex-wrap: wrap; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 4px 7px; font-size: 13px; }
}
