/* Casera shopper pages. Tokens and components from prototypes/stall-page/pilot.html (branch
   prototype/stall-page), which takes them from docs/concept.html. One phone column, max 30rem. */
:root {
  --bg: #F3F4F0; --surface: #FFFFFF; --sunk: #E9E9E2; --fg: #1E1A23; --muted: #5B5664; --line: #D9D8D1;
  --accent: #A8175A; --accent-soft: #F6E2EB; --on-accent: #FFFFFF;
  --mayor: #26408B; --mayor-soft: #E3E8F6; --on-mayor: #FFFFFF;
  --ok: #1D7A4E; --ok-soft: #DFF0E6; --warn: #8A5300; --warn-soft: #FBEBD0;
  --brand: #A8175A; --on-dark: #FFFFFF;
  --photo-btn: rgba(255, 255, 255, 0.94); --photo-btn-ink: #1E1A23; --photo-shadow: rgba(0, 0, 0, 0.22); --photo-scrim: rgba(0, 0, 0, 0.66); --shadow: rgba(30, 26, 35, 0.16);
  --font-display: "Alfa Slab One", Rockwell, "Roboto Slab", Georgia, serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gl: max(16px, env(safe-area-inset-left, 0px)); --gr: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141218; --surface: #1E1B23; --sunk: #27242C; --fg: #EDE9F0; --muted: #A39DAA; --line: #34303B;
    --accent: #F0699F; --accent-soft: #3A1E2C; --on-accent: #1E1A23;
    --mayor: #93A9F2; --mayor-soft: #1F2846; --on-mayor: #0F1733;
    --ok: #5CC48A; --ok-soft: #16301F; --warn: #F0B45A; --warn-soft: #3A2A10;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font: 400 15px/1.45 var(--font-body); margin: 0; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button, .chip, .scard, .saved-row a { transition: transform .1s ease-out; }
button:active, .chip:active, .scard:active, .saved-row a:active { transform: scale(.96); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
p, li { text-wrap: pretty; }
a { color: var(--accent); font-weight: 700; text-underline-offset: 3px; }
.col { max-width: 30rem; margin: 0 auto; padding-bottom: 24px; }
.pad { padding-left: var(--gl); padding-right: var(--gr); }
.muted { color: var(--muted); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph { background: var(--sunk); position: relative; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; font: 700 20px/1.2 var(--font-body); padding-block: 12px 10px; }

/* tags: one shape, colour by meaning */
.tag { display: inline-flex; align-items: center; gap: 4px; font: 800 11px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px; border-radius: 4px; white-space: nowrap; }
.tag-mayor { background: var(--mayor); color: var(--on-mayor); }
.tag-out { background: var(--fg); color: var(--bg); }

/* app bar */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px 10px; }
.wordmark { font: 400 26px/1 var(--font-display); color: var(--accent); letter-spacing: .01em; text-decoration: none; }
.lang { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { padding: 6px 11px; font-weight: 700; font-size: 13px; color: var(--muted); min-height: 44px; min-width: 44px; }
.lang button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* home */
.market { display: grid; gap: 6px; padding-block: 4px 14px; }
.market h1 { font: 400 28px/1.1 var(--font-display); }
.promise { display: flex; gap: 10px; align-items: flex-start; padding-block: 4px; font-weight: 600; }
.promise .ico { color: var(--ok); margin-top: 1px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; min-height: 48px; margin-block: 12px; }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; padding: 12px 0; }
a.ptile { color: inherit; text-decoration: none; font-weight: 400; transition: transform .1s ease-out; }
a.ptile:active { transform: scale(.96); }
.ptile .at { font-size: 13px; color: var(--muted); }
.more { padding-block: 4px 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-block: 2px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: inherit; text-decoration: none; font-weight: 600; font-size: 14px; }
.chip[aria-current] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip.mayor[aria-current] { background: var(--mayor); border-color: var(--mayor); color: var(--on-mayor); }
.stalls { display: grid; gap: 14px; }
.scard { display: block; background: var(--surface); border-radius: 14px; overflow: hidden; border: 1.5px solid var(--line); color: inherit; text-decoration: none; font-weight: 400; }
.scard .ph { aspect-ratio: 16 / 10; }
.scard .tag { position: absolute; top: 10px; left: 10px; }
.scard .body { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 12px 14px 14px; }
.scard .name { font: 800 18px/1.15 var(--font-body); }
.scard .name .muted { font-weight: 600; font-size: 15px; }
.scard .meta { font-size: 13.5px; color: var(--muted); }
.mono-av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; object-fit: cover; background: var(--brand); font: 400 22px/1 var(--font-display); color: var(--on-dark); flex: none; border: 3px solid var(--surface); }
.saved-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.saved-row a { flex: none; display: flex; align-items: center; gap: 8px; min-height: 44px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 14px 4px 4px; color: inherit; text-decoration: none; }
.saved-row .mono-av { width: 36px; height: 36px; font-size: 16px; border: 0; }

/* stall page */
.hero { position: relative; aspect-ratio: 16 / 10; }
.hero .ph { position: absolute; inset: 0; }
.hero-btns { position: absolute; top: 10px; left: var(--gl); right: var(--gr); display: flex; justify-content: flex-end; }
.rb { width: 44px; height: 44px; border-radius: 50%; background: var(--photo-btn); color: var(--photo-btn-ink); display: grid; place-items: center; box-shadow: 0 2px 8px var(--photo-shadow); }
.rb[aria-pressed="true"] { color: var(--brand); }
.rb[aria-pressed="true"] .ico { fill: currentColor; }
.ident { position: relative; display: grid; gap: 8px; padding-block: 0 14px; }
.ident .mono-av { width: 64px; height: 64px; font-size: 28px; margin-top: -32px; border-width: 4px; border-color: var(--bg); }
.ident h1 { font: 400 30px/1.05 var(--font-display); }
.ident .where { font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.rep { font-weight: 700; color: var(--fg); }
ul.trust { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.trust li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.trust .ico { color: var(--accent); margin-top: 1px; }
.trust b { display: block; }
.trust small { color: var(--muted); font-size: 13px; }
.tabs { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1.5px solid var(--line); margin-top: 14px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; padding: 13px 12px 11px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; min-height: 48px; }
.tabs button[aria-pressed="true"] { color: var(--fg); border-color: var(--accent); }
.tabs button.mayor[aria-pressed="true"] { color: var(--mayor); border-color: var(--mayor); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; padding-block: 0 14px; }
.ptile { display: grid; gap: 6px; align-content: start; text-align: left; }
.ptile[aria-disabled] { cursor: default; }
.ptile .ph { aspect-ratio: 1; border-radius: 12px; }
.ptile .tags { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.ptile .pn { font-weight: 700; line-height: 1.2; }
.ptile .gl { font-size: 12.5px; color: var(--muted); }
.price { font-size: 15px; }
.price b { font: 700 16px/1 var(--font-body); }
.price span { color: var(--muted); }
.ptile.out .ph img { filter: grayscale(1) contrast(.8) brightness(1.1); opacity: .55; }
.ptile.out .pn, .ptile.out .price { color: var(--muted); }
.credit { font-size: 11.5px; color: var(--muted); padding-block: 4px 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 32px); text-align: center; }
.toast:empty { display: none; }

/* pages and forms */
.page-h { padding-block: 14px 8px; }
.page-h h1 { font: 400 26px/1.1 var(--font-display); }
.stack { display: grid; gap: 12px; padding-block: 6px 16px; }
.lbl { font: 700 15px/1.3 var(--font-body); display: block; margin-bottom: -4px; }
.field { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); min-height: 48px; font-size: 17px; }
.field:focus { border-color: var(--accent); outline: 0; }
.field::placeholder { color: var(--muted); opacity: 1; }
.code { font-size: 26px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.help { font-size: 13.5px; color: var(--muted); }
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; border-radius: 14px; font-weight: 800; font-size: 16px; padding: 12px 16px; }
.btn-p { background: var(--accent); color: var(--on-accent); }
.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.notice.warn { background: var(--warn-soft); }
.pick { display: flex; gap: 10px; align-items: flex-start; padding-block: 4px; font-weight: 600; }
.pick input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }

/* short terms and the FAQ */
.terms { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; margin: 0; padding: 10px 12px 10px 30px; display: grid; gap: 8px; font-size: 14px; }
.prose { display: grid; gap: 10px; padding-block: 4px 16px; }
.prose h2 { font: 800 18px/1.2 var(--font-body); padding-top: 12px; }
.prose ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

/* product sheet: a native <dialog>, so focus, Escape and the scrim come free */
.ptile .plus, .ptile .qty { position: absolute; right: 8px; bottom: 8px; height: 40px; border-radius: 999px; display: grid; place-items: center; box-shadow: 0 2px 8px var(--photo-shadow); }
.ptile .plus { width: 40px; background: var(--surface); color: var(--fg); }
.ptile .qty { min-width: 40px; padding: 0 12px; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.sheet { position: fixed; inset: auto 0 0; margin: 0 auto; width: 100%; max-width: 30rem; max-height: 90vh; border: 0; border-radius: 18px 18px 0 0; padding: 0; background: var(--surface); color: var(--fg); overflow-y: auto; }
.sheet::backdrop { background: rgba(30, 26, 35, 0.5); } /* literal: older browsers don't pass variables to ::backdrop */
body:has(.sheet[open]) { overflow: hidden; }
.sheet-ph { position: relative; }
.sheet-ph .ph { aspect-ratio: 16 / 10; }
.sheet .x { position: absolute; top: 10px; right: 10px; }
.sheet-b { display: grid; gap: 16px; padding-block: 14px calc(20px + env(safe-area-inset-bottom, 0px)); }
.sheet h2 { font: 800 22px/1.15 var(--font-body); }
.sheet .lbl { margin-bottom: 8px; }
.unit { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 56px; }
.unit .un { font-weight: 700; }
.unit .ug { font-size: 13px; color: var(--muted); display: block; }
.unit .up { font: 700 15px/1 var(--font-body); white-space: nowrap; display: grid; gap: 6px; justify-items: end; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--line); display: grid; place-items: center; background: var(--surface); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper .q { font-weight: 800; font-size: 18px; min-width: 7ch; text-align: center; }
.cap { font-size: 13px; color: var(--muted); margin-top: 6px; }
.btn-s { border: 2px solid var(--line); background: var(--surface); }
.linkish { position: relative; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.linkish::after { content: ""; position: absolute; inset: -16px -8px -10px; }

/* the bag bar: sticky at the foot of the column, so it never covers the last Products */
.bagbar { position: sticky; bottom: 0; z-index: 20; padding-block: 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
.bagbar a { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--accent); color: var(--on-accent); border-radius: 14px; padding: 12px 16px; min-height: 56px; box-shadow: 0 8px 24px var(--shadow); text-decoration: none; transition: transform .1s ease-out; }
.bagbar a:active { transform: scale(.96); }
.bagbar b { font-size: 16px; }
.bagbar small { display: block; font-size: 13px; font-weight: 400; opacity: .9; }
.bagbar .tot { font: 700 18px/1 var(--font-body); white-space: nowrap; }
body:has(.bagbar:not([hidden])) .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* basket */
.group { background: var(--surface); border-radius: 14px; border: 1.5px solid var(--line); margin-block: 10px; overflow: hidden; }
.group-h { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.group-h .mono-av { width: 34px; height: 34px; font-size: 15px; border: 0; }
.group-h b { display: block; line-height: 1.15; }
.group-h small { color: var(--muted); }
.line { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 10px 12px; align-items: center; }
.line .ph { width: 52px; height: 52px; border-radius: 8px; }
.line .ln { font-weight: 700; line-height: 1.2; }
.line .lq { font-size: 13.5px; color: var(--muted); }
.line .lnote { font-size: 13px; font-style: italic; }
.line .lp { font: 700 15px/1 var(--font-body); text-align: right; white-space: nowrap; }
.line .edit { font-size: 13px; margin-top: 4px; display: block; }
.line.out .ph img { filter: grayscale(1); opacity: .55; }
.line.out .ln, .line.out .lp { text-decoration: line-through; color: var(--muted); }
.block { padding-block: 10px; }
.block .notice { margin-bottom: 10px; }
.opts { display: grid; gap: 8px; }
.opt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--surface); min-height: 60px; cursor: pointer; }
.opt:has(:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.opt b { display: block; }
.opt small { color: var(--muted); font-size: 13px; }
.opt .op { font: 700 15px/1 var(--font-body); white-space: nowrap; }
.sum { display: grid; gap: 6px; margin: 0; padding-block: 14px; }
.sum div { display: flex; justify-content: space-between; }
.sum dt, .sum dd { margin: 0; }
.sum dd { font-weight: 600; white-space: nowrap; }
.sum .big { font-weight: 800; font-size: 18px; border-top: 1.5px solid var(--line); padding-top: 8px; }
.sum .big dd { font-weight: 800; }
.empty { text-align: center; padding-block: 48px; display: grid; gap: 8px; justify-items: center; }
.empty .btn { max-width: 16rem; text-decoration: none; }

/* checkout */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled { display: none; } /* Pickup: no zone or door */
legend { padding: 0; }
textarea.field { resize: vertical; }
a.btn { text-decoration: none; }
.door summary, .cancel summary { font-weight: 700; padding-block: 10px; min-height: 44px; cursor: pointer; }
.center { text-align: center; }

/* Basket status */
.notice.ok { background: var(--ok-soft); }
.ostatus { display: grid; gap: 12px; padding-block: 4px 8px; }
.ostatus h2 { font: 800 18px/1.2 var(--font-body); }
.tl { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tl li { display: grid; gap: 6px; align-content: start; font-size: 11.5px; line-height: 1.2; color: var(--muted); }
.tl li::before { content: ""; height: 5px; border-radius: 3px; background: var(--line); }
.tl li.done, .tl li.now { color: var(--fg); font-weight: 700; }
.tl li.done::before { background: var(--ok); }
.tl li.now::before { background: var(--accent); }
.wait { padding: 12px; background: var(--sunk); color: var(--muted); font-weight: 600; font-size: 14px; }
.wait.ok { background: var(--ok-soft); color: var(--fg); }
.pack { aspect-ratio: 4 / 3; margin: 0; }
.cap2 { position: absolute; left: 10px; bottom: 10px; background: var(--photo-scrim); color: var(--on-dark); font-size: 12.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.notice.info { background: var(--accent-soft); }
.group .notice { margin: 0 12px 12px; }
/* change requests (.acts is below) */
.change summary { font-weight: 700; padding-block: 10px; min-height: 44px; cursor: pointer; }
.vreply { display: grid; gap: 8px; padding: 12px; background: var(--sunk); border-radius: 12px; }
.vreply audio { width: 100%; }
/* "Quitar" and Replacements, under an Order's Lines */
.remove { padding: 0 12px 4px; }
.remove summary { font-weight: 700; padding-block: 10px; min-height: 44px; cursor: pointer; }
.remove .pick { justify-content: space-between; align-items: center; }
.remove .pick .btn { width: auto; min-height: 44px; }
.acts { display: grid; gap: 4px; padding: 0 12px 12px; }
.repl { display: grid; grid-template-columns: 44px 1fr 4rem auto; gap: 8px; align-items: center; padding-block: 6px; }
.repl .ph { width: 44px; height: 44px; border-radius: 8px; }
.repl small { display: block; color: var(--muted); font-size: 13px; }
.repl .field { min-height: 44px; padding: 8px; text-align: center; }
.repl button { padding: 8px 12px; border-radius: 10px; border: 2px solid var(--accent); color: var(--accent); font-weight: 800; min-height: 44px; }

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