/* ------------------------------------------------------------------
   Brand tokens. These are defaults only: the Worker injects the day's
   brand (Beeston / Nottingham Hockey Centre) from src/brand.ts.
   ------------------------------------------------------------------ */
:root {
  --brand: #2d3359;        /* header */
  --brand-ink: #ffffff;
  --accent: #1479bf;       /* buttons, highlights */
  --accent-ink: #ffffff;
  --accent-text: #1479bf;  /* accent-coloured text on the page */

  --bg: #f4f5f8;
  --surface: #ffffff;
  --ink: #141824;
  --muted: #5d6475;
  --line: #e3e6ee;
  --ok: #18794e;
  --ok-soft: #e3f5ec;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --danger: #b42318;
  --danger-soft: #fdecea;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1220;
    --surface: #171c2c;
    --ink: #eef0f6;
    --muted: #a3a9ba;
    --line: #283049;
    --ok-soft: #12301f;
    --warn-soft: #33270f;
    --danger-soft: #3a1714;
    --ok: #4ccf8d;
    --warn: #f2b445;
    --danger: #ff7a6e;
    --shadow: none;
    color-scheme: dark;
  }
}

/* Derived from the brand accent, so it follows both brand and light/dark. */
:root { --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface)); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ header */
.top {
  background: var(--brand);
  color: var(--brand-ink);
  padding: 18px 16px 20px;
}
.top-inner { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.brand-logo {
  flex: none;
  height: 52px; width: auto; max-width: 150px;
  object-fit: contain;
}
/* Logos with a white background sit on a white plate in the dark header. */
.brand-logo.plate { height: 48px; max-width: 132px; background: #fff; padding: 4px 6px; border-radius: 10px; }
.eyebrow { font-size: 13px; opacity: 0.8; }
.top h1 { font-size: 22px; line-height: 1.15; font-weight: 750; }

.strip {
  max-width: 640px; margin: 0 auto;
  padding: 10px 16px; font-size: 14px;
}
.strip.demo { background: var(--warn-soft); color: var(--warn); }
.strip.notice { background: var(--accent-soft); color: var(--ink); border-radius: 0 0 var(--radius) var(--radius); }
.strip.closed { background: var(--danger-soft); color: var(--danger); font-weight: 600; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------------ block picker */
.block-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 16px 0 8px;
}
.block-card h2 { font-size: 17px; margin-bottom: 12px; }
.blocks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.block-btn {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  font-size: 20px; font-weight: 750;
}
.block-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.block-chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.block-chosen strong { font-size: 17px; }
.link-btn { background: none; border: 0; color: var(--accent-text); font-weight: 600; padding: 8px 0; }

.recent {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ok-soft); color: var(--ok);
  border-radius: var(--radius); padding: 12px 14px; margin-top: 12px;
  text-decoration: none; font-weight: 600; font-size: 15px;
}

/* ------------------------------------------------------------------ categories */
.cats {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 10px 0;
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px; font-weight: 600;
}
.cat-btn[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.cat-title { font-size: 19px; margin: 18px 0 10px; scroll-margin-top: 64px; }

/* ------------------------------------------------------------------ items */
.items { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px;
}
.item.sold-out { opacity: 0.55; }
.thumb {
  width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
  background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item h3 { font-size: 16px; font-weight: 650; }
.item .desc {
  font-size: 13.5px; color: var(--muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item .price { font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); }

.add-btn {
  width: 44px; height: 44px; border-radius: 999px;
  border: 0; background: var(--accent); color: var(--accent-ink);
  font-size: 26px; line-height: 1; font-weight: 500;
  display: grid; place-items: center; position: relative;
}
.add-btn:disabled { background: var(--line); color: var(--muted); }
.add-btn .count {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 700; display: grid; place-items: center;
}

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 20px; line-height: 1;
}
.stepper button.plus { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stepper button:disabled { opacity: 0.4; }
.stepper output { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.loading, .empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ------------------------------------------------------------------ basket bar */
.spacer { height: 96px; }
.basket-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.basket-bar button {
  width: 100%; max-width: 608px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  border: 0; border-radius: 14px; padding: 16px 18px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 17px; font-weight: 700;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}
.basket-bar .pill { background: color-mix(in srgb, var(--accent-ink) 18%, transparent); border-radius: 999px; padding: 2px 10px; margin-right: 10px; font-size: 15px; }

/* ------------------------------------------------------------------ sheets (dialog) */
dialog.sheet {
  width: 100%; max-width: 640px; max-height: 92vh;
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0;
  background: var(--surface); color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(10, 14, 25, 0.55); }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 20px; }
}
.sheet-head {
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 19px; }
.close-btn { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 999px; font-size: 20px; }
.sheet-body { padding: 8px 16px 16px; }
.sheet-foot {
  position: sticky; bottom: 0; background: var(--surface);
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .name { font-weight: 600; }
.line .sub { font-size: 14px; color: var(--muted); }
.line .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

.section-label { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.field { display: block; margin-top: 12px; }
.field span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field small { font-weight: 400; color: var(--muted); }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg);
  font-size: 16px; /* stops iOS zooming */
}
.field input:focus { outline: none; border-color: var(--accent); }
.blocks.small .block-btn { aspect-ratio: auto; height: 48px; font-size: 18px; }

.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 17px; }
.total-row strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.btn-primary {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 16px;
  background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 750; text-align: center; text-decoration: none;
}
.btn-primary:disabled { opacity: 0.6; }
.btn-ghost { display: block; text-align: center; padding: 14px; color: var(--muted); text-decoration: none; }
.secure { text-align: center; font-size: 13px; color: var(--muted); margin-top: 10px; }
.error { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }

.var-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.var-row:last-child { border-bottom: 0; }
.var-row .name { font-weight: 600; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ------------------------------------------------------------------ order status page */
.status-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 18px; margin: 16px 0; text-align: center;
}
.status-icon {
  width: 64px; height: 64px; border-radius: 999px; margin: 0 auto 12px;
  display: grid; place-items: center; font-size: 34px; font-weight: 800;
}
.status-icon.ok { background: var(--ok-soft); color: var(--ok); }
.status-icon.bad { background: var(--danger-soft); color: var(--danger); }
.spinner {
  width: 44px; height: 44px; margin: 10px auto 16px; border-radius: 999px;
  border: 4px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-card h1 { font-size: 22px; }
.order-ref { font-size: 56px; font-weight: 850; letter-spacing: 0.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.deliver-to { font-size: 18px; font-weight: 650; margin-top: 8px; }
.show-runner { margin-top: 14px; font-size: 14px; color: var(--muted); }
.summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 16px; }
.summary .total { display: flex; justify-content: space-between; padding: 14px 0; font-weight: 750; font-size: 17px; }

/* ------------------------------------------------------------------ demo card page */
.sheet-page { max-width: 480px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 12px; }
.sheet-page h1 { font-size: 28px; }
.demo-flag { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.demo-lines { width: 100%; border-collapse: collapse; }
.demo-lines td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.demo-lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
