/*
 * Wyndr Local shop.
 *
 * Tokens, type and components are taken from docs/mockup.html unchanged. The
 * mock-up wrapped the app in a phone frame on a marketing page; here the app is
 * the page, mobile first, with the same styling centred in a column on wider
 * screens.
 */

:root {
  --paper: #EEF2EC; --surface: #FFFFFF; --ink: #17221D; --muted: #56635C; --line: #D3DBD3;
  --tile: #1E4D3F; --on-tile: #FFFFFF; --tile-soft: #D9E7DF;
  --orange: #E8590C; --on-orange: #FFFFFF; --orange-soft: #FDE3D3;
  --kraft: #C9A574; --kraft-dark: #9C7646;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101814; --surface: #18221D; --ink: #E7EDE8; --muted: #9BAAA2; --line: #2C3A33;
    --tile: #7CC2A6; --on-tile: #0E1A15; --tile-soft: #1E3A2F;
    --orange: #FF7B35; --on-orange: #1A0E06; --orange-soft: #3A2114;
    --kraft: #B8925F; --kraft-dark: #8A6A40;
  }
}
:root[data-theme="dark"] {
  --paper: #101814; --surface: #18221D; --ink: #E7EDE8; --muted: #9BAAA2; --line: #2C3A33;
  --tile: #7CC2A6; --on-tile: #0E1A15; --tile-soft: #1E3A2F;
  --orange: #FF7B35; --on-orange: #1A0E06; --orange-soft: #3A2114;
  --kraft: #B8925F; --kraft-dark: #8A6A40;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.55;
}
img, svg { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.02; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }

/* The app is the page. On a wide screen it stays a column rather than stretching. */
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: 18px 18px 110px; }
.screen.no-bar { padding-bottom: 28px; }

/* Wraps rather than overflows: beside a wide town logo at 375px the pill drops whole to its own line. */
.app-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.app-head .wm { font-family: var(--display); font-weight: 800; font-size: 18px; font-stretch: 85%; }
.app-head .wm span { color: var(--orange); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  background: var(--tile-soft); color: var(--ink); font-size: 12.5px; padding: 5px 10px;
  font-weight: 600; white-space: nowrap;
}
.back { border: 0; background: none; padding: 6px 0; font-weight: 600; cursor: pointer; color: var(--muted); font-size: 14px; }
.s-title { font-size: 32px; font-weight: 800; font-stretch: 80%; margin: 4px 0 6px; }
.s-sub { color: var(--muted); font-size: 14.5px; }

.btn {
  display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%;
  border: 0; border-radius: 16px; padding: 15px 18px; font-weight: 700; font-size: 16px;
  cursor: pointer; background: var(--orange); color: var(--on-orange);
}
.btn.alt { background: var(--tile); color: var(--on-tile); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.field { width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; font-size: 16px; }
label.lbl { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }

/* ---------- welcome ---------- */
.welcome-art { margin: 6px -18px 0; background: var(--tile); border-radius: 0 0 28px 28px; padding: 18px 0 0; overflow: hidden; }
.welcome-art svg { display: block; margin: 0 auto; }
.welcome h2 { font-size: 38px; font-weight: 800; font-stretch: 76%; margin: 22px 0 8px; line-height: .95; }
.check-row { display: flex; gap: 8px; margin-top: 10px; }
.check-row .field { text-transform: uppercase; }
.check-row .btn { width: auto; white-space: nowrap; }
.result { margin-top: 12px; border-radius: 14px; padding: 12px 14px; font-size: 14.5px; }
.result.ok { background: var(--tile-soft); }
.result.no { background: var(--orange-soft); }
.week-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.week-strip div { background: var(--surface); border-radius: 16px; padding: 12px; }
.week-strip b { font-family: var(--display); font-size: 24px; font-stretch: 80%; display: block; line-height: 1.05; }
.week-strip span { font-size: 12.5px; color: var(--muted); }

/* ---------- shelf ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 14px; padding: 4px; margin: 12px 0 14px; }
.seg button { border: 0; background: none; border-radius: 11px; padding: 10px; font-weight: 600; cursor: pointer; font-size: 14.5px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.basket { background: var(--surface); border-radius: 22px; margin-bottom: 14px; overflow: hidden; }
.basket-top { padding: 16px 16px 10px; }
.basket h3 { font-size: 27px; font-weight: 800; font-stretch: 78%; }
.basket .kicker { font-weight: 600; font-size: 14px; color: var(--orange); }
.basket .who { font-size: 13px; color: var(--muted); margin-top: 4px; }
.basket .row-art { display: flex; gap: 2px; padding: 0 10px; background: var(--tile-soft); overflow: hidden; }
.basket .row-art svg { width: 62px; height: 62px; flex: none; }
.basket .contents { font-size: 13.5px; padding: 10px 16px 0; }
.basket-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px 16px; }
.basket-foot .price { font-family: var(--display); font-weight: 700; font-size: 24px; font-stretch: 85%; margin-right: auto; line-height: 1; }
.basket-foot .price s { display: block; font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 500; }
.basket-foot .btn { width: auto; padding: 11px 14px; font-size: 14.5px; border-radius: 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 12px; padding: 2px 18px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--tile); background: var(--tile); color: var(--on-tile); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { background: var(--surface); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; text-align: left; border: 0; padding: 0; cursor: pointer; }
.card .art { background: var(--tile-soft); display: grid; place-items: center; height: 118px; }
.card .art svg, .card .art img { width: 104px; height: 104px; object-fit: contain; }
.card .info { padding: 9px 11px 11px; display: flex; flex-direction: column; flex: 1; }
.card .mk { font-size: 12px; color: var(--muted); }
.card .nm { font-weight: 700; font-size: 14px; line-height: 1.25; margin: 2px 0; }
.card .sz { font-size: 12px; color: var(--muted); }
.card .bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.card .pr { font-weight: 700; }
.nofit { opacity: .35; }
/* On the shelf to explain itself, not to be bought. */
.card.unavailable .art, .card.unavailable .nm, .card.unavailable .pr { opacity: .5; }
/* The tag standing in for the add button, greyed so it never reads as one. */
.tag.off { background: var(--line); color: var(--muted); margin-top: 0; text-align: right; max-width: 70%; }
.btn.off { background: var(--line); color: var(--muted); cursor: default; }

.add { width: 34px; height: 34px; border-radius: 11px; border: 0; background: var(--orange); color: var(--on-orange); font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.stepper { display: inline-flex; align-items: center; background: var(--ink); color: var(--paper); border-radius: 11px; height: 34px; }
.stepper button { border: 0; background: none; color: inherit; width: 30px; height: 34px; font-size: 19px; cursor: pointer; }
.stepper span { min-width: 18px; text-align: center; font-weight: 700; font-size: 14px; }

.tag { display: inline-block; background: var(--orange-soft); color: var(--ink); border-radius: 8px; font-size: 12.5px; font-weight: 600; padding: 3px 8px; margin-top: 6px; }

/* ---------- bottom bar ---------- */
.bar {
  position: fixed; bottom: 12px; z-index: 20; background: var(--ink); color: var(--paper);
  border-radius: 22px; padding: 10px 12px 10px 10px; display: flex; align-items: center;
  gap: 10px; border: 0; cursor: pointer; text-align: left;
  left: 50%; transform: translateX(-50%); width: min(calc(100% - 20px), 460px);
}
.bar svg { width: 46px; height: 46px; flex: none; }
.bar .t1 { font-weight: 700; font-size: 15px; }
.bar .t2 { font-size: 12.5px; opacity: .75; }
.bar .go { margin-left: auto; background: var(--orange); color: var(--on-orange); border-radius: 13px; padding: 10px 13px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.bar[hidden] { display: none; }

/* ---------- box ---------- */
.box-hero { display: flex; gap: 14px; align-items: center; background: var(--surface); border-radius: 22px; padding: 14px; margin: 12px 0; }
.box-hero svg { width: 112px; height: 112px; flex: none; }
.box-hero b { font-family: var(--display); font-size: 28px; font-stretch: 80%; display: block; line-height: 1; }
.box-hero .s { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.meter { height: 8px; border-radius: 9px; background: var(--line); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--tile); border-radius: 9px; transition: width .35s ease; }
.meter.full i { background: var(--orange); }

.maker-group { background: var(--surface); border-radius: 18px; padding: 4px 14px; margin-bottom: 10px; }
.maker-group h4 { margin: 10px 0 2px; font-size: 14px; font-family: var(--body); }
.maker-group .from { font-size: 12.5px; color: var(--muted); }
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.line svg { width: 44px; height: 44px; flex: none; background: var(--tile-soft); border-radius: 10px; }
.line .ln { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.line .ln small { display: block; color: var(--muted); }

.sum { background: var(--surface); border-radius: 18px; padding: 12px 14px; margin: 12px 0 14px; font-size: 14.5px; }
.sum div { display: flex; justify-content: space-between; padding: 4px 0; }
.sum .tot { border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 17px; }
.save { color: var(--tile); }
.empty { text-align: center; padding: 30px 10px; }
.empty svg { width: 140px; height: 140px; }

/* ---------- slot ---------- */
.slot { display: block; width: 100%; text-align: left; background: var(--surface); border: 2px solid transparent; border-radius: 18px; padding: 13px 14px; margin-bottom: 10px; cursor: pointer; }
.slot[aria-checked="true"] { border-color: var(--orange); }
.slot:disabled { cursor: not-allowed; opacity: .55; }
.slot .when { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.slot .when b { font-size: 15.5px; }
.slot .left { font-size: 13px; font-weight: 700; color: var(--tile); white-space: nowrap; }
.slot .left.low { color: var(--orange); }
.slot .day { font-size: 13px; color: var(--muted); }
.seats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; margin-top: 10px; }
.seats i { height: 9px; border-radius: 3px; background: var(--line); }
.seats i.b { background: var(--kraft); }
.day-h { font-family: var(--display); font-weight: 700; font-size: 19px; font-stretch: 85%; margin: 16px 0 8px; }

/* ---------- details ---------- */
.field.upper { text-transform: uppercase; }
.lbl .opt { font-weight: 400; color: var(--muted); }
.step-foot { margin-top: 14px; }
.step-foot .btn { text-decoration: none; }

/* ---------- return pages ---------- */
.done-hero { background: var(--tile); color: var(--on-tile); border-radius: 24px; padding: 18px; margin: 8px 0 14px; }
.done-hero .ref { font-size: 13px; opacity: .8; }
.done-hero h2 { font-size: 34px; font-weight: 800; font-stretch: 78%; margin: 6px 0 4px; }
.done-hero p { font-size: 14.5px; opacity: .9; }

/* ---------- notices, sheet, toast ---------- */
.notice { border-radius: 14px; padding: 11px 13px; font-size: 13.5px; margin: 12px 0; background: var(--orange-soft); }
.fine { font-size: 12.5px; color: var(--muted); margin-top: 10px; text-align: center; }

.sheet-bg { position: fixed; inset: 0; background: rgba(10, 16, 13, .45); z-index: 40; display: none; }
.sheet-bg.open { display: block; }
.sheet {
  position: fixed; left: 50%; transform: translate(-50%, 105%); bottom: 0;
  width: min(100%, 480px); background: var(--paper); border-radius: 26px 26px 0 0;
  z-index: 41; padding: 10px 18px 22px; transition: transform .28s ease; max-height: 86%; overflow: auto;
}
.sheet.open { transform: translate(-50%, 0); }
.grab { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 10px; }
.sheet .big { background: var(--tile-soft); border-radius: 20px; display: grid; place-items: center; height: 190px; }
.sheet .big svg { width: 170px; height: 170px; }
.sheet h3 { font-size: 28px; font-weight: 800; font-stretch: 80%; margin: 14px 0 2px; }
.sheet .maker-note { font-size: 14px; color: var(--muted); margin: 8px 0 14px; }
.sheet .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.toast {
  position: fixed; left: 50%; transform: translate(-50%, -140%); top: 14px; z-index: 50;
  width: min(calc(100% - 28px), 452px); background: var(--ink); color: var(--paper);
  border-radius: 14px; padding: 11px 14px; font-size: 14px; opacity: 0; transition: .25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- the shelf is unavailable ---------- */
.holding { text-align: center; padding: 64px 22px; }
.holding .wm { font-family: var(--display); font-weight: 800; font-size: 20px; font-stretch: 85%; }
.holding .wm span { color: var(--orange); }
.holding h2 { font-size: 30px; font-weight: 800; font-stretch: 80%; margin: 22px 0 10px; }
.holding .btn { margin-top: 18px; }

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

/* ---------- featured strip and was-prices ---------- */
.card .pr s { font-weight: 500; font-size: 12.5px; color: var(--muted); margin-left: 2px; }
.sheet .was { font-family: var(--body); font-size: 14px; font-weight: 500; color: var(--muted); }
/* Marked so the strip is identifiable, though it styles like the main grid. */
.featured-strip { margin-bottom: 4px; }

/* ---------- policy links ---------- */
/* The footer sits after #screen, so it carries the clearance for the fixed bar
   instead of the screen. app.js toggles no-bar on the screen; this follows it. */
.screen.has-foot { padding-bottom: 8px; }
.legal-foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
  padding: 14px 18px 28px; font-size: 13px;
}
.screen.has-foot:not(.no-bar) + .legal-foot { padding-bottom: 110px; }
.legal-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; padding: 6px 0; }

/* ---------- per-town branding ---------- */
/* An image that failed to load hides itself; class display rules must not undo that. */
[hidden] { display: none !important; }
.brand { display: inline-flex; align-items: center; }
.app-head .logo { height: 28px; width: auto; max-width: 180px; display: block; }
/* max-width: none overrides the global img cap of 100%, which held the hero to the
   content width so the -18px margin pulled it left and left the right side short. */
.hero-img { display: block; width: calc(100% + 36px); max-width: none; margin: 6px -18px 0; max-height: 240px; object-fit: cover; border-radius: 0 0 28px 28px; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 0; display: grid; gap: 10px; }
.how li { counter-increment: how; background: var(--surface); border-radius: 16px; padding: 12px 14px 12px 46px; position: relative; }
.how li::before { content: counter(how); position: absolute; left: 14px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--tile); color: var(--on-tile); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.how b { display: block; }
.how span { font-size: 13.5px; color: var(--muted); }

/* ---------- makers ---------- */
.card a.mk, .mk-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.card a.mk { color: var(--muted); }
.card a.mk:hover, .mk-link:hover { text-decoration-color: currentColor; }
.maker-top { display: flex; gap: 14px; align-items: center; margin: 8px 0 10px; }
.maker-logo, .maker-initial { width: 64px; height: 64px; border-radius: 18px; flex: none; object-fit: cover; background: var(--surface); }
.maker-initial { display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 30px; background: var(--tile); color: var(--on-tile); }
.maker-story { font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.tag.low { background: var(--tile); color: var(--on-tile); }
.tag.age { background: var(--line); color: var(--ink); }
.tag + .tag.age { margin-left: 4px; }

/* ---------- allergens ---------- */
.allergens { background: var(--surface); border-radius: 14px; padding: 10px 12px; margin: 0 0 14px; font-size: 13.5px; }
.allergens p + p { margin-top: 6px; }
.allergen-note { font-size: 13.5px; background: var(--orange-soft); border-radius: 12px; padding: 10px 12px; margin: 12px 0; }
.allergens .allergen-note { margin: 0; padding: 0; background: none; }
