/* BasketHack — site styles on top of /ui/ui.css (Tailwind + Basecoat).
   Colors come from site.ts `theme` (--primary raspberry for actions, --brand wicker brown).
   Signature element: the basket planogram (.bh-plan) — an overhead outline and a composite front view drawn by
   public/engine.js, with numbered footprints on crinkle paper. Everything else is Empire defaults.
   Bump APP_CSS_V in src/ui.tsx when this file changes. */

:root {
  --bh-wicker: #dcc394;
  --bh-wicker-ink: #8a6534;
  --bh-crinkle: #f4e9d2;
  --bh-crinkle-ink: #cdb58a;
  --bh-anchor: #bfd0b1;
  --bh-mid: #f0d49a;
  --bh-small: #f7ead1;
  --bh-byo: #e3d7f1;
  --bh-item-ink: #3a3024;
  --bh-badge: #fffdf8;
  --bh-badge-ink: #3a3024;
}
.dark {
  --bh-wicker: #7d6240;
  --bh-wicker-ink: #d8b982;
  --bh-crinkle: #3f3526;
  --bh-crinkle-ink: #8a7656;
  --bh-anchor: #6c8a5d;
  --bh-mid: #b4925c;
  --bh-small: #9c8a66;
  --bh-byo: #866ba5;
  --bh-item-ink: #f1e8d8;
  --bh-badge: #2a231a;
  --bh-badge-ink: #f1e8d8;
}

/* ---------- The planogram ---------- */
.bh-plan { display: grid; gap: 1.5rem; }
.bh-views { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .bh-views { grid-template-columns: 1fr 1fr; } }
.bh-fig { margin: 0; display: grid; gap: .5rem; }
.bh-fig-art { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: .75rem; }
.bh-fig figcaption { font-size: .8125rem; color: var(--muted-foreground); }
.bh-svg { display: block; width: 100%; height: auto; }
.bh-svg text { font-family: var(--font-body); }
.bh-item { transition: opacity var(--dur-1) var(--ease-out); }
.bh-plan:has(.bh-row:hover) .bh-item { opacity: .45; }
.bh-plan:has(.bh-row:hover) .bh-item.is-hot { opacity: 1; }
.bh-results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.bh-results-head h2 { margin: 0; }
.bh-notes { display: grid; gap: .5rem; }
.bh-alts { margin: 0; color: var(--muted-foreground); }
.bh-plan h3 { font-size: 1rem; margin: 0 0 .5rem; }

/* Budget gauge: the basket, the wrapping and the items as segments of the budget. */
.bh-gauge { position: relative; height: .875rem; border-radius: 999px; background: var(--muted); overflow: hidden; border: 1px solid var(--border); }
.bh-gauge-seg { position: absolute; top: 0; height: 100%; }
.bh-gauge-basket { background: var(--brand); }
.bh-gauge-supplies { background: color-mix(in oklab, var(--brand) 55%, var(--background)); }
.bh-gauge-items { background: var(--primary); }
.bh-gauge.is-over .bh-gauge-items { background: var(--destructive); }
.bh-gauge-caption { display: flex; align-items: baseline; gap: .5rem; margin-top: .375rem; font-size: .9375rem; }
.bh-gauge-pct { margin-left: auto; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.bh-over { color: var(--destructive); font-weight: 600; }

/* The list, in fill order, with the one checkout action. */
.bh-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; margin-bottom: .25rem; }
.bh-list-head h3 { margin: 0; }
.bh-list, .bh-suggest-list, .bh-steps { list-style: none; margin: 0; padding: 0; }
.bh-row, .bh-suggest-row { display: grid; grid-template-columns: auto 1fr auto; gap: .25rem .75rem; align-items: center; padding: .625rem 0; border-top: 1px solid var(--border); }
.bh-suggest-row { grid-template-columns: 1fr auto; }
.bh-list > li:first-child { border-top: 0; }
.bh-row-nums { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 1.75rem; }
.bh-thumb { width: 3rem; height: 3rem; object-fit: contain; border-radius: var(--radius); background: #fff; border: 1px solid var(--border); padding: .15rem; }
.bh-suggest-row.has-thumb { grid-template-columns: auto 1fr auto; }
.bh-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 999px; background: var(--bh-badge); color: var(--bh-badge-ink); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bh-n-none { background: transparent; color: var(--muted-foreground); border: 1px dashed var(--border); }
.bh-row-main { display: grid; gap: .1rem; min-width: 0; }
.bh-name { font-weight: 600; }
.bh-x { font-weight: 400; color: var(--muted-foreground); }
.bh-why { font-size: .875rem; }
.bh-meta { font-size: .8125rem; color: var(--muted-foreground); }
.bh-nofit { margin-left: .5rem; color: var(--destructive); font-weight: 600; }
.bh-row-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem .75rem; text-align: right; }
.bh-price { font-variant-numeric: tabular-nums; min-width: 3.5rem; }
.bh-buy { font-size: .875rem; }
.bh-byo-tag { color: var(--muted-foreground); }
.bh-row.is-unplaced .bh-name { color: var(--muted-foreground); text-decoration: line-through; }
.bh-row-extra .bh-name { font-weight: 500; }
.bh-qty { display: inline-flex; align-items: center; border: 1px solid var(--input); border-radius: var(--radius); overflow: hidden; }
.bh-qty-btn, .bh-remove { font: inherit; background: var(--card); color: var(--foreground); border: 0; cursor: pointer; }
.bh-qty-btn { width: 2.25rem; height: 2.25rem; }
.bh-qty-btn:hover:not(:disabled) { background: var(--muted); }
.bh-qty-btn:disabled { color: var(--muted-foreground); cursor: default; }
.bh-qty-n { min-width: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.bh-remove { padding: .4rem .5rem; font-size: .875rem; color: var(--muted-foreground); text-decoration: underline; text-underline-offset: 3px; }
.bh-remove:hover { color: var(--destructive); }
.bh-in { font-size: .875rem; color: var(--success); font-weight: 600; }
.bh-suggest-row.in .bh-name::after { content: " ✓"; color: var(--success); }
.bh-empty { color: var(--muted-foreground); }
.bh-steps { counter-reset: step; display: grid; gap: .5rem; }
.bh-steps li { counter-increment: step; display: grid; grid-template-columns: 1.75rem 1fr; gap: .5rem; align-items: baseline; }
.bh-steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 999px; border: 1px solid var(--border); font-size: .75rem; font-weight: 600; color: var(--brand); }

/* ---------- The planner form ---------- */
.bh-form { display: grid; gap: 1.25rem; }
.bh-field { border: 0; padding: 0; margin: 0; display: grid; gap: .625rem; min-width: 0; }
.bh-field > legend { font-weight: 600; padding: 0; margin-bottom: .25rem; }
.bh-baskets { display: flex; gap: .5rem; overflow-x: auto; padding: .125rem .125rem .5rem; scroll-snap-type: x proximity; }
.bh-basket { flex: 0 0 9.5rem; scroll-snap-align: start; display: grid; gap: .15rem; padding: .625rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); cursor: pointer; }
.bh-basket:hover { background: var(--muted); }
.bh-basket.on { border-color: var(--foreground); box-shadow: inset 0 0 0 1px var(--foreground); }
.bh-basket input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bh-basket:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.bh-mini { display: block; margin: 0 auto .25rem; }
.bh-mini rect, .bh-mini ellipse { fill: var(--bh-crinkle); stroke: var(--bh-wicker-ink); stroke-width: 2; }
.bh-basket-name { font-weight: 600; font-size: .9375rem; line-height: 1.2; }
.bh-basket-meta, .bh-basket-fits { font-size: .75rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.bh-check { display: inline-flex; align-items: center; gap: .5rem; font-size: .9375rem; }
.bh-chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.bh-chip { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 .875rem; border: 1px solid var(--border); border-radius: 999px; font-size: .875rem; font-weight: 500; cursor: pointer; background: var(--card); white-space: nowrap; }
.bh-chip:hover { background: var(--muted); }
.bh-chip.on { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.bh-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bh-chip:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.bh-theme-note { margin: 0; }
.bh-budget-row { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; }
.bh-budget-value { font-family: var(--font-heading); font-weight: var(--heading-weight, 600); font-size: 1.75rem; min-width: 4.5rem; font-variant-numeric: tabular-nums; }
.bh-budget-num { width: 6rem; }
input[type="range"]#budget { width: 100%; accent-color: var(--primary); }
.bh-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.bh-mode { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bh-mode-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: 0 .875rem; font: inherit; font-weight: 500; background: var(--card); color: var(--foreground); border: 0; cursor: pointer; }
.bh-mode-btn + .bh-mode-btn { border-left: 1px solid var(--border); }
.bh-mode-btn:hover { background: var(--muted); }
.bh-mode-btn.on { background: var(--foreground); color: var(--background); }
.bh-theme-form { display: grid; gap: .375rem; padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.bh-theme-form label { font-weight: 600; }
.bh-theme-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.bh-theme-row .input { flex: 1 1 14rem; }
.bh-theme-hint { margin: 0; }
.bh-results { position: relative; display: grid; gap: 1.25rem; }
.bh-results.is-busy { opacity: .6; }
.bh-results.is-busy::after { content: ""; position: absolute; inset: 0; }
.bh-suggest { display: grid; gap: .25rem; }
.bh-save { padding-top: 1rem; border-top: 1px solid var(--border); }
.bh-share-url a { word-break: break-all; }

/* Home hero: the sample plan, front view large and the overhead small beneath it. */
.bh-hero-fig { margin: 0; display: grid; gap: .5rem; }
.bh-hero-art { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: .5rem; }
.bh-hero-top { max-width: 60%; }

@media (max-width: 40rem) {
  .bh-row { grid-template-columns: auto 1fr; }
  .bh-row-side { grid-column: 1 / -1; justify-content: flex-start; text-align: left; }
  .bh-budget-row { grid-template-columns: auto 1fr; }
  .bh-budget-num { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .bh-item { transition: none; }
}

@media print {
  .site-header, .site-footer, .bh-form, .bh-theme-form, .bh-save, .bh-suggest, .bh-qty, .bh-remove, .bh-checkout, .page-head .flex, .skip-link { display: none !important; }
  .bh-fig-art { border: 0; padding: 0; }
  .bh-plan { gap: 1rem; }
  .bh-buy { display: none; }
  a[href]::after { content: none; }
}
