/* Carl's Butcher Express — components on top of the Everyday tokens (styles.css) and brand.css.
   Every colour, size, space, radius and shadow is a token; both themes are defined here. */
:root {
  --text-link: var(--brand-primary);
  --text-link-hover: var(--brand-accent-text);
  --text-brand: var(--brand-accent-text);
  --surface-cta: var(--brand-primary);
  --surface-cta-text: var(--color-white);
  --surface-cta-hover: var(--color-teal-900);
  --surface-accent: var(--brand-accent-soft);
  --surface-accent-text: var(--color-black);
  --focus-ring: var(--brand-accent);
  --tone-ok-text: #1e6b4f;    --tone-ok-bg: #e3f4ec;
  --tone-warn-text: #7a4b00;  --tone-warn-bg: #fff1d6;
  --tone-danger-text: #a3271c;--tone-danger-bg: #fde4e1;
  --tone-info-text: #1a5f7a;  --tone-info-bg: #e0f3f7;
  --tone-neutral-text: var(--text-secondary); --tone-neutral-bg: var(--bg-surface-sunken);
  --hero-overlay: linear-gradient(100deg, rgba(27, 42, 78, 0.94) 0%, rgba(27, 42, 78, 0.82) 55%, rgba(15, 22, 38, 0.6) 100%);
  --nav-h: 64px;
  --touch: 44px;
  --maxw: 1200px;
}
:root[data-theme="dark"] {
  --bg-page: var(--brand-charcoal);
  --bg-surface: var(--brand-charcoal-2);
  --bg-surface-sunken: var(--brand-charcoal-3);
  --bg-inverse: var(--color-white);
  --text-primary: #f3f5f8;
  --text-secondary: #b3bdcc;
  --text-inverse: var(--brand-charcoal);
  --text-link: var(--color-accent-cyan);
  --text-link-hover: var(--brand-accent-soft);
  --text-brand: var(--brand-accent-soft);
  --border-subtle: var(--brand-charcoal-line);
  --border-strong: #46547a;
  --surface-cta: var(--brand-accent-soft);
  --surface-cta-text: var(--color-black);
  --surface-cta-hover: var(--color-orange-400);
  --tone-ok-text: #8fe0bd;    --tone-ok-bg: #1a3a2f;
  --tone-warn-text: #ffd791;  --tone-warn-bg: #4a3410;
  --tone-danger-text: #ffb4ab;--tone-danger-bg: #4e1f1a;
  --tone-info-text: #9fdcea;  --tone-info-bg: #173a46;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg-page); color: var(--text-primary);
  font-family: var(--font-body); font-size: var(--fs-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: var(--lh-heading); margin: 0 0 var(--space-3); color: var(--text-primary); font-weight: var(--fw-bold); }
h1 { font-size: clamp(2rem, 5vw, var(--fs-h1)); line-height: var(--lh-tight); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, var(--fs-h2)); }
h3 { font-size: var(--fs-h4); }
p { margin: 0 0 var(--space-3); }
a { color: var(--text-link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--text-link-hover); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-secondary); }
.small { font-size: var(--fs-body-sm); }
.overline { font-size: var(--fs-overline); letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--text-brand); font-weight: var(--fw-bold); margin-bottom: var(--space-2); }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.icon { width: 24px; height: 24px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--space-4); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid-2 { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2-wide { grid-template-columns: 2fr 1fr; } }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--touch); padding: 0 var(--space-5);
  border-radius: var(--radius-pill); border: 2px solid transparent; font: inherit; font-weight: var(--fw-bold); cursor: pointer; text-decoration: none;
  transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }
.btn-primary { background: var(--surface-cta); color: var(--surface-cta-text); }
.btn-primary:hover { background: var(--surface-cta-hover); color: var(--surface-cta-text); }
.btn-accent { background: var(--surface-accent); color: var(--surface-accent-text); }
.btn-accent:hover { background: var(--color-orange-400); color: var(--surface-accent-text); }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-surface-sunken); color: var(--text-primary); }
.btn-danger { background: var(--tone-danger-bg); color: var(--tone-danger-text); border-color: var(--tone-danger-text); }
.btn-link { background: none; border: 0; color: var(--text-link); padding: 0 var(--space-2); min-height: var(--touch); text-decoration: underline; }
.btn-sm { min-height: 36px; padding: 0 var(--space-4); font-size: var(--fs-body-sm); }
.btn-icon { width: var(--touch); padding: 0; border-radius: var(--radius-pill); }
.btn-block { width: 100%; }

/* ── Cards, badges, forms ────────────────────────────────────────────────────── */
.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.card-media { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-radius: var(--radius-sm); }
.card-title-row { display: flex; justify-content: space-between; gap: var(--space-3); align-items: flex-start; }
.card-title-row h3 { margin: 0; flex: 1 1 auto; min-width: 0; }
.card-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-3); border-radius: var(--radius-pill); font-size: var(--fs-body-sm); font-weight: var(--fw-bold); white-space: nowrap; background: var(--tone-neutral-bg); color: var(--tone-neutral-text); border: 1px solid var(--border-subtle); }
.badge-ok { background: var(--tone-ok-bg); color: var(--tone-ok-text); border-color: transparent; }
.badge-warn { background: var(--tone-warn-bg); color: var(--tone-warn-text); border-color: transparent; }
.badge-danger { background: var(--tone-danger-bg); color: var(--tone-danger-text); border-color: transparent; }
.badge-info { background: var(--tone-info-bg); color: var(--tone-info-text); border-color: transparent; }
.badge-brand { background: var(--brand-primary); color: var(--color-white); border-color: transparent; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: var(--fs-body-sm); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand-primary); color: var(--color-white); border-color: var(--brand-primary); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field label, .field .label { font-weight: var(--fw-bold); font-size: var(--fs-body-sm); }
.field input, .field select, .field textarea {
  font: inherit; min-height: var(--touch); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary); width: 100%;
}
.field textarea { min-height: 96px; resize: vertical; }
::placeholder { color: var(--text-secondary); opacity: 1; }
input[readonly] { background: var(--bg-surface-sunken); }
input[type="radio"] { width: 22px; height: 22px; accent-color: var(--brand-primary); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--focus-ring); outline-offset: 1px; border-color: var(--brand-primary); }
.field .hint { color: var(--text-secondary); font-size: var(--fs-body-sm); }
.field .error { color: var(--tone-danger-text); font-size: var(--fs-body-sm); min-height: 1.2em; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--tone-danger-text); }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } }
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-sm); border: 1px solid transparent; }
.notice-ok { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.notice-warn { background: var(--tone-warn-bg); color: var(--tone-warn-text); }
.notice-danger { background: var(--tone-danger-bg); color: var(--tone-danger-text); }
.notice-info { background: var(--tone-info-bg); color: var(--tone-info-text); }
.notice p { margin: 0; }
.stars { display: inline-flex; gap: 2px; color: var(--text-brand); }
.stars .icon { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.stars .icon.off { fill: none; stroke: currentColor; opacity: 0.55; }
.rating-input { display: inline-flex; gap: var(--space-1); }
.rating-input button { background: none; border: 0; width: var(--touch); height: var(--touch); cursor: pointer; color: var(--text-brand); }
.rating-input .icon { width: 28px; height: 28px; margin: 0 auto; }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); min-width: 560px; }
th, td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
th { position: sticky; top: 0; background: var(--bg-surface-sunken); color: var(--text-secondary); font-size: var(--fs-caption); letter-spacing: 0.06em; text-transform: uppercase; z-index: 1; }
th button { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: var(--space-1); align-items: center; min-height: 32px; text-transform: inherit; letter-spacing: inherit; }
tbody tr:hover { background: var(--bg-surface-sunken); }
.table-tools { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); }
.table-tools input { font: inherit; min-height: 40px; padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-primary); max-width: 100%; }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; padding: var(--space-3) var(--space-4); color: var(--text-secondary); font-size: var(--fs-body-sm); flex-wrap: wrap; }

/* ── States ──────────────────────────────────────────────────────────────────── */
.skeleton { display: grid; gap: var(--space-3); }
.skeleton span { display: block; height: 18px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--bg-surface-sunken), var(--border-subtle), var(--bg-surface-sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--text-secondary); display: grid; gap: var(--space-3); justify-items: center; }
.state .icon { width: 40px; height: 40px; color: var(--text-brand); }

/* ── Toasts and dialogs ──────────────────────────────────────────────────────── */
.toasts { position: fixed; right: var(--space-4); bottom: var(--space-4); left: var(--space-4); display: grid; gap: var(--space-2); z-index: 60; pointer-events: none; }
@media (min-width: 640px) { .toasts { left: auto; width: 380px; } }
.toast { pointer-events: auto; display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); border: 1px solid transparent; background: var(--bg-surface); color: var(--text-primary); }
.toast .icon { width: 20px; height: 20px; }
.toast-msg { flex: 1; margin: 0; font-size: var(--fs-body-sm); }
.toast-ok { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.toast-info { background: var(--tone-info-bg); color: var(--tone-info-text); }
.toast-warn { background: var(--tone-warn-bg); color: var(--tone-warn-text); }
.toast-danger { background: var(--tone-danger-bg); color: var(--tone-danger-text); }
.toast .btn-icon { color: inherit; border-color: transparent; }
dialog.dlg { border: 0; border-radius: var(--radius-lg); padding: 0; max-width: min(92vw, 520px); width: 100%; background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgba(15, 22, 38, 0.6); }
dialog.dlg .dlg-body { padding: var(--space-5); display: grid; gap: var(--space-4); }
dialog.dlg .dlg-actions { display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }

/* ── Public shell ────────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); backdrop-filter: blur(8px); }
.topbar .wrap { display: flex; align-items: center; gap: var(--space-3); min-height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--text-primary); font-family: var(--font-display); font-weight: var(--fw-bold); }
.brand img { height: 32px; width: auto; }
.nav { display: none; gap: var(--space-1); margin-left: auto; align-items: center; }
.nav a { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--text-primary); text-decoration: none; font-weight: var(--fw-bold); font-size: var(--fs-body-sm); }
.nav a:hover, .nav a[aria-current="page"] { background: var(--bg-surface-sunken); color: var(--text-brand); }
.nav-tools { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }
@media (min-width: 900px) { .nav { display: flex; } .nav-tools { margin-left: 0; } .menu-btn { display: none; } }
.drawer { display: none; border-top: 1px solid var(--border-subtle); padding: var(--space-3) var(--space-4) var(--space-4); background: var(--bg-surface); }
.drawer[data-open="true"] { display: grid; gap: var(--space-1); }
.drawer a { display: flex; align-items: center; min-height: var(--touch); padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text-primary); text-decoration: none; font-weight: var(--fw-bold); }
.drawer a[aria-current="page"] { background: var(--bg-surface-sunken); color: var(--text-brand); }
@media (min-width: 900px) { .drawer { display: none !important; } }
.cart-count { min-width: 22px; height: 22px; border-radius: var(--radius-pill); background: var(--brand-accent-soft); color: var(--color-black); font-size: var(--fs-caption); font-weight: var(--fw-bold); display: inline-grid; place-items: center; padding: 0 6px; }

.hero { position: relative; color: var(--color-white); background-image: var(--hero-overlay), url('/assets/stock-1.webp'); background-size: cover; background-position: center; padding: var(--space-8) 0 var(--space-7); }
.hero h1 { color: var(--color-white); font-size: clamp(2.25rem, 6vw, 3.75rem); max-width: 14ch; }
.hero p.lead { font-size: var(--fs-body-lg); max-width: 56ch; color: var(--color-white); opacity: 0.95; }
.hero .overline { color: var(--brand-accent-soft); }
.finder { background: var(--bg-surface); color: var(--text-primary); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-lg); display: grid; gap: var(--space-4); margin-top: var(--space-6); max-width: 720px; }
.finder-row { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .finder-row { grid-template-columns: 1fr auto; align-items: end; } }
@media (max-width: 640px) {
  .hero { padding: var(--space-6) 0 var(--space-6); }
  .hero h1 { font-size: 2rem; }
  .hero p.lead { font-size: var(--fs-body); }
  .finder { padding: var(--space-4); margin-top: var(--space-4); }
}
.hero-stats { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-top: var(--space-6); }
.hero-stats strong { display: block; font-family: var(--font-display); font-size: var(--fs-h3); line-height: 1; }
.hero-stats span { font-size: var(--fs-body-sm); opacity: 0.9; }

.section { padding: var(--space-8) 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.section-head h2 { margin: 0; }
.section-alt { background: var(--bg-surface-sunken); }
.feature { display: grid; gap: var(--space-5); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .feature { grid-template-columns: 1fr 1fr; } .feature.flip > :first-child { order: 2; } }
.feature img { border-radius: var(--radius-lg); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; box-shadow: var(--shadow-md); }
.steps { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); counter-reset: step; }
.step { counter-increment: step; }
.step::before { content: counter(step); display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-pill); background: var(--brand-primary); color: var(--color-white); font-family: var(--font-display); font-weight: var(--fw-bold); margin-bottom: var(--space-3); }

.footer { background: var(--brand-primary); color: var(--color-white); padding: var(--space-7) 0 var(--space-5); margin-top: var(--space-8); }
.footer a { color: var(--color-white); }
.footer .cols { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.footer h4 { color: var(--color-white); font-size: var(--fs-body); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.footer .trust { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid rgba(255, 255, 255, 0.2); font-size: var(--fs-body-sm); }
.footer .trust span { display: inline-flex; gap: var(--space-2); align-items: center; }

/* ── Shopfront & checkout ────────────────────────────────────────────────────── */
.shop-head { display: grid; gap: var(--space-5); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .shop-head { grid-template-columns: 1fr 1fr; } }
.shop-head img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-lg); }
.cuts { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.cut { display: flex; flex-direction: column; gap: var(--space-2); }
.cut .price-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.cut .price-line .money { font-size: var(--fs-body-lg); color: var(--text-brand); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; }
.qty button { width: var(--touch); height: var(--touch); border: 0; background: var(--bg-surface-sunken); color: var(--text-primary); font-size: var(--fs-body-lg); cursor: pointer; }
.qty input { width: 64px; min-height: var(--touch); border: 0; text-align: center; font: inherit; background: var(--bg-surface); color: var(--text-primary); }
.basket { position: sticky; top: calc(var(--nav-h) + var(--space-4)); }
.basket-line { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-3); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.total-line { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-body-lg); }
.slot-grid { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.slot { text-align: left; display: grid; gap: 2px; padding: var(--space-3); border: 2px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-primary); font: inherit; cursor: pointer; min-height: var(--touch); }
.slot[aria-pressed="true"] { border-color: var(--brand-primary); background: var(--tone-info-bg); color: var(--tone-info-text); }
.slot .small { color: inherit; opacity: 0.85; }
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
.timeline li { list-style: none; text-align: center; font-size: var(--fs-caption); color: var(--text-secondary); padding-top: var(--space-3); position: relative; }
.timeline li::before { content: ''; display: block; height: 6px; border-radius: var(--radius-pill); background: var(--border-subtle); margin-bottom: var(--space-2); }
.timeline li.done::before { background: var(--brand-accent); }
.timeline li.done { color: var(--text-primary); font-weight: var(--fw-bold); }
.order-card .card-title-row { align-items: center; }
.kanban { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 900px) { .kanban { grid-template-columns: repeat(3, 1fr); } }
.kanban h3 { display: flex; justify-content: space-between; align-items: center; }
.theme-note { display: inline-flex; gap: var(--space-2); align-items: center; }
