/* FreshBTM: one stylesheet. "Neighbourhood produce counter": photos carry the colour,
   labels explain the purchase. Tokens and scale per designer.md. */
:root {
  --surface: #fbf8f2;
  --surface-2: #ffffff;
  --photo-bg: #f3efe6;
  --text: #1f2421;
  --muted: #5b625d;
  --line: #e3ddd1;
  --brand: #1f6b3a;
  --brand-dark: #17532d;
  --accent: #a8612d;
  --ok: #1f6b3a;
  --warn: #8a5a00;
  --err: #a12a1f;
  --radius: 8px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Mukta", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--text); font: 100%/1.5 var(--font); } /* follows the reader's text size */
body.has-basket { padding-bottom: 72px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: var(--s5) 0 var(--s2); }
h2 { font-size: 1.15rem; margin: var(--s5) 0 var(--s3); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1168px; margin: 0 auto; padding: 0 var(--s4); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s4); top: var(--s2); background: var(--surface-2); padding: var(--s2); z-index: 30; }
.ne { font-weight: 400; color: var(--muted); }
input, select, button { font: inherit; }
input[type=search], input[type=number], select { min-height: 44px; border: 1px solid #b9b2a4; border-radius: var(--radius); padding: 0 var(--s3); background: #fff; color: var(--text); }

/* Header: phone = logo + basket, search below; wide = one row. */
.top { background: var(--surface-2); border-bottom: 1px solid var(--line); }
/* Phone: wrapping flex, so at large text the basket drops under the logo instead of overflowing. */
.top-grid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; column-gap: var(--s3); padding-top: var(--s2); padding-bottom: var(--s3); }
.top-grid .search { order: 3; flex: 1 1 100%; min-width: 0; }
@media (min-width: 720px) { .top-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "logo search basket"; column-gap: var(--s5); padding-top: var(--s3); } .top-grid .search { order: 0; } }
.logo { grid-area: logo; display: inline-flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--s2); min-height: 44px; align-content: center; text-decoration: none; }
.logo-mark { font-size: 1.35rem; font-weight: 800; color: var(--brand); letter-spacing: -0.02em; }
.logo-mark span { color: var(--accent); }
.logo-place { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.search { grid-area: search; display: flex; gap: var(--s2); margin-top: var(--s2); }
@media (min-width: 720px) { .search { margin-top: 0; max-width: 560px; } }
.search input { flex: 1; min-width: 0; width: 0; }
.basket-link { grid-area: basket; display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s2); font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.count { background: var(--brand); color: #fff; border-radius: 999px; min-width: 1.6em; padding: 0 var(--s2); text-align: center; font-size: 0.9rem; }

/* Buttons */
.search button, .btn { min-height: 44px; border: 0; border-radius: var(--radius); padding: 0 var(--s4); background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover, .search button:hover { background: var(--brand-dark); }
.btn[disabled] { background: #9aa39d; cursor: not-allowed; }
.btn-wide { width: 100%; margin-top: var(--s4); }
.btn-quiet { min-height: 44px; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 var(--s3); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }

/* Messages */
.notice { padding: var(--s3) var(--s4); border-radius: var(--radius); background: #f3ecdc; margin: var(--s4) 0; }
.notice.success { background: #e5f1e8; }
.notice.error { background: #f8e4e1; color: var(--err); }
.empty { color: var(--muted); padding: var(--s5) 0; }

/* Intro and category tiles */
.intro h1 { margin-top: var(--s4); }
.intro p { margin: 0; color: var(--muted); }
.cat-nav { display: flex; gap: var(--s3); overflow-x: auto; padding: var(--s4) 0 var(--s1); }
.cat-tile { display: inline-flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s1) var(--s4) var(--s1) var(--s1); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; max-width: 100%; }
.cat-tile[aria-current] { border: 2px solid var(--brand); color: var(--brand-dark); }
.cat-tile[aria-current] .cat-label::after { content: " ✓"; }
.cat-thumb { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--bg, var(--photo-bg)); flex: none; }
.cat-thumb img { width: 100%; height: 100%; object-fit: var(--fit, cover); object-position: var(--focus, center); }
.count-line { color: var(--muted); margin: var(--s3) 0; }

/* Product grid: rem-based columns, so larger text gets fewer columns instead of clipping. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: var(--s3); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, max(13rem, 22%)), 1fr)); gap: var(--s4); } }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card-img { display: block; aspect-ratio: 1 / 1; background: var(--bg, var(--photo-bg)); text-decoration: none; }
.card-img img { width: 100%; height: 100%; object-fit: var(--fit, cover); object-position: var(--focus, center); }
.card-img img[style], .card-img { overflow: hidden; }
.no-photo { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 8rem; color: var(--muted); font-size: 0.85rem; background: var(--photo-bg); }
.card-body { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s1); flex: 1; }
.card-name { font-size: 1rem; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.card-name a { color: var(--text); text-decoration: none; }
.card-name .ne { display: block; font-size: 0.95rem; }

/* Price: the selected pack's amount is the strongest number. Without JS every pack price is listed. */
.price { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.price strong { font-size: 1.15rem; }
.price s { color: var(--muted); }
.unit { color: var(--muted); white-space: nowrap; }
.cmp { display: block; color: var(--muted); font-size: 0.85rem; }
.js .opt-price:not(.current) { display: none; }
.tbc { color: var(--warn); font-weight: 600; margin: 0; }
.price-note { font-size: 0.85rem; color: var(--muted); margin: var(--s1) 0 0; }
.status { margin: 0; font-size: 0.9rem; font-weight: 600; }
.status::before { content: "● "; }
.status-in, .status-available { color: var(--ok); }
.status-low { color: var(--warn); }
.status-out, .status-paused { color: var(--err); }
.sample { margin: 0; font-size: 0.75rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }

/* Add form: pack, then count + Add (one row when there's room). */
.add { display: flex; flex-direction: column; gap: var(--s2); margin-top: auto; padding-top: var(--s2); }
.field-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.add select { width: 100%; padding: 0 var(--s2); }
.pack-static { margin: 0; font-size: 0.95rem; }
.add-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.qty { display: flex; flex: 1 1 8rem; min-width: 0; }
.qty input { width: 100%; min-width: 2.5em; text-align: center; }
.step { display: none; min-width: 44px; min-height: 44px; border: 1px solid #b9b2a4; background: #fff; font-size: 1.2rem; cursor: pointer; color: var(--text); }
.js .step { display: block; }
.js .qty input { border-radius: 0; }
.step:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.step:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.add-row .btn { flex: 1 1 5rem; }
.add-msg { margin: 0; font-size: 0.9rem; min-height: 0; }
.add-msg:empty { display: none; }
.add-msg.ok { color: var(--ok); }
.add-msg.error { color: var(--err); font-weight: 600; }
.add-off { margin: auto 0 0; color: var(--muted); font-size: 0.9rem; padding-top: var(--s2); }

/* Product detail: photo and buying information side by side when wide. */
.crumbs { margin-top: var(--s4); font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.detail { display: grid; gap: var(--s5); margin-top: var(--s3); }
@media (min-width: 720px) { .detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.detail-img { margin: 0; background: var(--bg, var(--photo-bg)); border-radius: var(--radius); overflow: hidden; }
.detail-img img { width: 100%; height: auto; }
.detail-img .no-photo { aspect-ratio: 4 / 3; }
.detail-img figcaption { font-size: 0.8rem; color: var(--muted); padding: var(--s2) var(--s3); background: var(--surface-2); overflow-wrap: anywhere; }
.detail-body h1 { margin-top: 0; overflow-wrap: anywhere; }
.detail-body .ne { display: block; font-size: 1.2rem; }
.detail-body .price strong { font-size: 1.5rem; }
.detail .add { max-width: 420px; }
.lede { font-size: 1.05rem; color: var(--muted); margin-top: 0; }

/* Basket */
.lines { list-style: none; padding: 0; margin: 0; }
.line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "thumb main total" "thumb form form"; gap: var(--s2) var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.line-problem { background: #fbf0ee; padding-left: var(--s3); padding-right: var(--s3); }
.line-thumb { grid-area: thumb; width: 64px; height: 64px; border-radius: var(--radius); overflow: hidden; background: var(--bg, var(--photo-bg)); }
.line-thumb img { width: 100%; height: 100%; object-fit: var(--fit, cover); object-position: var(--focus, center); }
.line-main { grid-area: main; min-width: 0; }
.line-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.line-pack { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.line-total { grid-area: total; margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.line-form { grid-area: form; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.line-form input { width: 5em; }
.totals { padding: var(--s4) 0; }
.total { font-size: 1.2rem; margin: 0; }
.closed { padding: var(--s6) 0; max-width: 560px; }
.credits { padding-left: var(--s5); }
.credits li { margin-bottom: var(--s2); overflow-wrap: anywhere; }

/* Sticky basket bar: phones only; body padding keeps it off content and the footer. */
.basket-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: var(--s4); padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom)); background: var(--brand); color: #fff; text-align: center; font-weight: 700; text-decoration: none; z-index: 15; }
@media (min-width: 720px) { .basket-bar { display: none; } body.has-basket { padding-bottom: 0; } }

.foot { margin-top: var(--s7); border-top: 1px solid var(--line); padding: var(--s5) 0; color: var(--muted); font-size: 0.95rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.about { margin-top: var(--s6); max-width: 46rem; }
.about p { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }
.filters a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600; }
.filters a[aria-current] { border: 2px solid var(--brand); color: var(--brand-dark); }
.filters a[aria-current]::after { content: " ✓"; }
.explainer, .guide { max-width: 46rem; }
.explainer { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--line); }
.explainer p, .guide p { color: var(--muted); }
.guide h2 { margin-top: var(--s5); }
.detail-links { font-size: 0.95rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.section-head a { font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.cat-tile:not(:has(.cat-thumb)) { padding-left: var(--s4); }
/* Category chips wrap onto several rows (10 departments); a chip keeps its natural width and only
   wraps its own label when it's wider than the screen (large text). */
.cat-nav { flex-wrap: wrap; overflow: visible; gap: var(--s2); }
.cat-tile { flex: 0 1 auto; min-height: 44px; gap: var(--s2); padding: var(--s1) var(--s3) var(--s1) var(--s1); font-size: 0.95rem; }
.cat-tile:not(:has(.cat-thumb)) { padding-left: var(--s3); }
.cat-thumb { width: 36px; height: 36px; }
.cat-tile .ne { font-size: 0.85rem; }
