/* What to Eat — "the specials aisle": shelf-sticker deals, shelf-tag prices, photo-first cards. */
:root {
  --bg: #f1f3ee;
  --surface: #ffffff;
  --surface-2: #e8ebe4;
  --ink: #1c1b22;
  --muted: #6b6a73;
  --line: #e2e5dc;
  --primary: #1e4d3a;
  --on-primary: #ffffff;
  --sticker: #ffd02f;
  --on-sticker: #1c1b22;
  --hot: #e43d30;
  --fresh: #12855a;
  --fresh-bg: #e1f3ea;
  --photo: #ffffff;
  --shadow: 0 1px 2px rgba(28, 27, 34, .05), 0 8px 24px rgba(28, 27, 34, .06);
  --c-woolworths: #111111;
  --c-checkers: #00a3ad;
  --c-pnp: #e3141f;
  --c-spar: #00843d;
  --c-foodlovers: #f08a00;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-lg: 24px;
  --r-md: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111311; --surface: #1a1d1a; --surface-2: #232723; --ink: #eef0ea; --muted: #a2a69c;
    --line: #2b2f2a; --primary: #8fdcb1; --on-primary: #0d2a1d; --hot: #ff6b5e; --fresh: #6fd9a2;
    --fresh-bg: #16301f; --photo: #f4f4f1; --shadow: none; --c-woolworths: #e9e9e9; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111311; --surface: #1a1d1a; --surface-2: #232723; --ink: #eef0ea; --muted: #a2a69c;
  --line: #2b2f2a; --primary: #8fdcb1; --on-primary: #0d2a1d; --hot: #ff6b5e; --fresh: #6fd9a2;
  --fresh-bg: #16301f; --photo: #f4f4f1; --shadow: none; --c-woolworths: #e9e9e9; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--body);
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 720px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 0; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.02em; }
h1 { font-size: 30px; font-weight: 800; line-height: 1.05; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--sticker); outline-offset: 2px; border-radius: 10px; }
button { font: inherit; color: inherit; }

/* ---------- headers ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 10px 2px 4px; }
.eyebrow { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.eyebrow svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.fresh { margin: 0 2px 14px; color: var(--muted); font-size: 13px; }
.lede { color: var(--muted); margin: 6px 2px 16px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 10px 2px; }

.status {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--surface);
  box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; flex: none;
}
.status span { width: 10px; height: 10px; border-radius: 50%; background: var(--fresh); box-shadow: 0 0 0 4px var(--fresh-bg); }
.status.warn span { background: #e0a100; box-shadow: 0 0 0 4px #fff1c9; }
.status.bad span { background: var(--hot); box-shadow: 0 0 0 4px #ffe1de; }

/* ---------- search ---------- */
.search-row { position: sticky; top: 0; z-index: 4; padding: 6px 0 10px; background: linear-gradient(var(--bg) 70%, transparent); }
.search {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 999px;
  padding: 0 18px; box-shadow: var(--shadow); border: 1.5px solid transparent;
}
.search:focus-within { border-color: var(--primary); }
.search svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { border: 0; background: none; color: inherit; font: inherit; font-size: 16px; padding: 14px 0; width: 100%; outline: none; }

/* ---------- category bubbles ---------- */
.cats { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; margin: 0 -16px; padding-inline: 16px; }
.cats::-webkit-scrollbar, .rail::-webkit-scrollbar, .stores::-webkit-scrollbar, .days::-webkit-scrollbar { display: none; }
.cat { flex: none; display: grid; justify-items: center; gap: 6px; border: 0; background: none; cursor: pointer; width: 62px; }
.cat .bubble {
  width: 58px; height: 58px; border-radius: 20px; background: var(--surface); display: grid; place-items: center;
  font-size: 27px; box-shadow: var(--shadow); transition: transform .15s, background .15s;
}
.cat .label { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.15; }
.cat[aria-pressed="true"] .bubble { background: var(--primary); transform: translateY(-2px); }
.cat[aria-pressed="true"] .label { color: var(--ink); }

/* ---------- ending-soon rail ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px 10px; }
.hint { color: var(--muted); font-size: 12.5px; }
.rail { list-style: none; display: flex; gap: 12px; overflow-x: auto; margin: 0 -16px 18px; padding: 2px 16px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail .card { flex: 0 0 208px; scroll-snap-align: start; }

/* ---------- filter bar ---------- */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; flex: none; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.sort { flex: 1; min-width: 0; }
.sort select {
  width: 100%; appearance: none; border: 0; border-radius: 999px; padding: 11px 34px 11px 14px; font: inherit; font-weight: 600; font-size: 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6a73' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--ink); box-shadow: var(--shadow);
}
.stores { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px 4px; scrollbar-width: none; }
.store-chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line);
  background: transparent; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.store-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--chain); }
.store-chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.count { margin: 4px 2px 10px; color: var(--muted); font-size: 13px; }
.cheapest {
  display: flex; gap: 12px; align-items: center; background: var(--fresh-bg); color: var(--ink);
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 12px;
}
.cheapest b { font-family: var(--display); color: var(--fresh); font-size: 20px; white-space: nowrap; }
.cheapest small { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- product cards ---------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.card > a { color: inherit; text-decoration: none; display: block; height: 100%; }
.card:active { transform: scale(.985); }
.photo { position: relative; aspect-ratio: 1; background: var(--photo); margin: 8px 8px 0; border-radius: 18px; overflow: hidden; display: grid; place-items: center; }
.photo img { width: 82%; height: 82%; object-fit: contain; }
.photo .emoji { font-size: 54px; }
.photo.tint { background: var(--tint); }
.sticker {
  position: absolute; top: 8px; left: 8px; background: var(--sticker); color: var(--on-sticker);
  font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: -.01em; text-transform: uppercase;
  padding: 5px 9px 4px; border-radius: 9px; transform: rotate(-5deg); box-shadow: 0 2px 0 rgba(0,0,0,.12);
  max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sticker.today { background: var(--hot); color: #fff; }
.store-tag {
  position: absolute; bottom: 8px; left: 8px; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.92); color: #1c1b22; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
}
.store-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--chain); }
.body { padding: 10px 12px 13px; }
.name { font-size: 13.5px; font-weight: 500; line-height: 1.3; height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.price-line { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.price { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.price sup { font-size: .5em; vertical-align: .65em; margin: 0 1px; letter-spacing: 0; }
.price .per { font-family: var(--body); font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.was { color: var(--muted); text-decoration: line-through; font-size: 12.5px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.meta .card-req { color: var(--primary); font-weight: 600; }
.meta .soon { color: var(--hot); font-weight: 600; }

.empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty b { display: block; font-family: var(--display); font-size: 20px; color: var(--ink); margin-bottom: 4px; }

.btn { font-weight: 600; border-radius: 999px; padding: 13px 20px; cursor: pointer; border: 0; background: var(--surface); box-shadow: var(--shadow); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.ghost { background: transparent; box-shadow: none; border: 1.5px solid var(--line); }
.btn.wide { width: 100%; margin: 14px 0; }

/* ---------- menu (meals) ---------- */
.days { display: flex; gap: 8px; overflow-x: auto; margin: 6px -16px 16px; padding: 2px 16px; scrollbar-width: none; }
.day {
  flex: none; border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 16px; padding: 8px 14px; cursor: pointer;
  display: grid; justify-items: center; min-width: 58px;
}
.day small { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; }
.day b { font-family: var(--display); font-size: 20px; }
.day[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.day[aria-pressed="true"] small { color: inherit; opacity: .8; }

.hero {
  background: var(--primary); color: var(--on-primary); border-radius: var(--r-lg); padding: 20px 20px 18px; position: relative; overflow: hidden;
}
.hero .kicker { font-size: 12.5px; font-weight: 600; opacity: .8; margin: 0 0 6px; }
.hero h2 { font-size: 23px; line-height: 1.15; }
.hero .rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hero .rules span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--on-primary) 14%, transparent); }
.hero .sticker { position: static; display: inline-block; margin-bottom: 10px; }

.buys { list-style: none; display: flex; gap: 10px; overflow-x: auto; margin: 14px -16px 4px; padding: 2px 16px 8px; scrollbar-width: none; }
.buy { flex: 0 0 172px; background: var(--surface); border-radius: var(--r-md); padding: 12px; box-shadow: var(--shadow); }
.buy .price { font-size: 20px; }
.buy p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.buy .who { font-size: 13px; font-weight: 600; margin-top: 6px; line-height: 1.25; }

.meal { margin-top: 22px; }
.meal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.meal-head .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); font-size: 19px; }
.dish { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.dish-top { display: flex; gap: 12px; }
.dish-pic { flex: none; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 32px; background: var(--tint, var(--surface-2)); }
.dish h3 { font-size: 16.5px; line-height: 1.2; }
.dish .facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dish .facts span { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.dish p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.dish details { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.dish summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--primary); list-style: none; }
.dish summary::-webkit-details-marker { display: none; }
.dish summary::after { content: " ›"; }
.dish details[open] summary::after { content: " ⌄"; }
.ing { list-style: none; padding: 0; margin: 8px 0 0; }
.ing li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.ing li:last-child { border-bottom: 0; }
.ing .src { color: var(--muted); font-size: 12.5px; text-align: right; }
.ing .src b { color: var(--hot); font-weight: 600; }
.steps { margin: 10px 0 0; padding-left: 20px; font-size: 14px; }
.steps li { margin-bottom: 4px; }

.shop { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px 14px 8px; margin-bottom: 10px; }
.shop h4 { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-size: 15px; }
.shop h4 i { width: 10px; height: 10px; border-radius: 50%; background: var(--chain); }
.shop h4 small { margin-left: auto; color: var(--muted); font-weight: 500; }
.item { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.item input { appearance: none; width: 22px; height: 22px; border-radius: 8px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; margin: 0; }
.item input:checked { background: var(--primary); border-color: var(--primary); }
.item input:checked::after { content: ""; width: 10px; height: 6px; border: 2.5px solid var(--on-primary); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.item input:checked + span { text-decoration: line-through; color: var(--muted); }
.item .r { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 4px; }
.total .price { font-size: 26px; }
.notes { color: var(--muted); font-size: 13.5px; padding-left: 18px; margin: 4px 0 20px; }
.notes li { margin-bottom: 4px; }

/* ---------- ask ---------- */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.preset { text-align: left; border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--r-md); padding: 12px; cursor: pointer; font-size: 13.5px; line-height: 1.3; }
.preset span { display: block; font-size: 22px; margin-bottom: 6px; }
.composer { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 4px; border: 1.5px solid transparent; }
.composer:focus-within { border-color: var(--primary); }
.composer textarea { width: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 16px; padding: 12px; resize: vertical; outline: none; }
.composer-foot { display: flex; gap: 14px; flex-wrap: wrap; padding: 6px 12px 10px; border-top: 1px solid var(--line); }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.ask-actions { display: flex; gap: 10px; margin-top: 14px; }
.ask-actions .primary { flex: 1; }
.preview summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.preview pre { white-space: pre-wrap; font-size: 12px; background: var(--surface); padding: 12px; border-radius: var(--r-md); max-height: 320px; overflow: auto; }

/* ---------- dock ---------- */
.dock {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(360px, calc(100% - 32px)); display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  background: var(--ink); border-radius: 26px; padding: 7px; box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.dock button {
  border: 0; background: none; color: var(--bg); opacity: .7; border-radius: 20px; padding: 9px 4px;
  display: flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.dock svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock button[aria-selected="true"] { background: var(--sticker); color: #1c1b22; opacity: 1; }

dialog { border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); width: min(92vw, 440px); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { font-size: 20px; margin-bottom: 8px; }
.src-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.src-row small { color: var(--muted); }
.src-row .bad { color: var(--hot); font-weight: 600; }

#toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 11;
}
#toast.show { opacity: 1; }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; min-height: 250px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
