@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&display=swap');

/* ============================================================
   Whiskey Buddy — search results / full catalogue browse.
   Unlike the curated market page (photographed, priced bottles only),
   this view spans the RAW catalogue: every canonical, priced or not,
   variants included. Same brand system as the rest of the app.
   ============================================================ */
:root{
  --bg:#f7efe3; --bg-tint:#fdf8ef; --card:#fffdf9;
  --ink:#33241A; --ink-soft:#5b4a39; --muted:#9a8c79;
  --line:#e8ddc9; --line-soft:#f1e9da; --soft:#faf3e7;
  --accent:#a8692a; --accent-2:#c0792f; --accent-bg:#f6e9d2; --accent-line:#e4c89c;
  --gold:#e0a23e; --gold-soft:#f1c87a; --chip-bg:#f1e8d8;
  --green:#2f7a44; --green-bg:#eaf3e4; --green-line:#cfe0bd;
  --red:#b23b27; --red-bg:#f7e0db; --red-line:#eebfb4;
  --amber-txt:#9a6a16; --amber-bg:#fbf0d2; --amber-line:#ecd6a0;
  --focus:#c98736;
  --round:'Fredoka',ui-rounded,'Segoe UI',system-ui,sans-serif;
  --sans:-apple-system,system-ui,'Segoe UI',Roboto,'Helvetica Neue',sans-serif;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{font:15px/1.5 var(--sans);margin:0;color:var(--ink);background:var(--bg);-webkit-font-smoothing:antialiased}
.wrap{max-width:1180px;margin:0 auto;padding:0 1.4rem}
h1,h2,h3{font-family:var(--round);letter-spacing:-.01em;margin:0}
a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible{
  outline:2px solid var(--focus);outline-offset:2px;border-radius:5px}
.muted{color:var(--muted)} .note{color:var(--muted);font-size:.85rem;line-height:1.5}

/* header chrome → single source in static/css/wb-header.css */

/* header search */
.wb-search{position:relative;flex:1 1 240px;max-width:430px;margin:0 .4rem}
.wb-search .ico{position:absolute;left:.7rem;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.wb-search input{width:100%;padding:.55rem .8rem .55rem 2.2rem;border-radius:11px;border:1px solid var(--line);
  background:#fff;font:inherit;color:var(--ink);transition:border-color .14s,box-shadow .14s}
.wb-search input::placeholder{color:var(--muted)}
.wb-search input:focus{outline:none;border-color:var(--accent-line);box-shadow:0 0 0 3px rgba(201,135,54,.16)}
.wb-results{position:absolute;top:calc(100% + .45rem);left:0;right:0;background:var(--card);border:1px solid var(--line);
  border-radius:14px;box-shadow:0 16px 38px rgba(51,36,26,.20);overflow:hidden auto;max-height:min(66vh,440px);z-index:60;display:none}
.wb-results.open{display:block}
.wb-res-head{font-family:var(--round);font-weight:600;font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:.55rem .8rem .35rem}
.wb-result{display:flex;align-items:center;gap:.65rem;padding:.5rem .8rem;cursor:pointer;border-top:1px solid var(--line-soft);text-decoration:none;color:var(--ink)}
.wb-result:hover{text-decoration:none}.wb-result.active{background:var(--soft)}
.wb-result img{width:34px;height:44px;object-fit:contain;background:#fff;border:1px solid var(--line-soft);border-radius:6px;flex:none;padding:2px}
.wb-result .rtext{min-width:0;display:flex;flex-direction:column;gap:.1rem}
.wb-result .rname{font-family:var(--round);font-weight:600;font-size:.9rem;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wb-result .rmeta{font-size:.77rem;color:var(--muted)}
.wb-result .rright{margin-left:auto;display:flex;flex-direction:column;align-items:flex-end;gap:.2rem;flex:none}
.wb-result .rprice{font-family:var(--round);font-weight:600;color:var(--accent);font-variant-numeric:tabular-nums}
.wb-result .rprice-none{color:var(--muted)}
.wb-result .idx{font-size:.72rem;padding:.1rem .4rem}
.wb-res-foot{display:block;padding:.6rem .8rem;border-top:1px solid var(--line);font-family:var(--round);font-weight:600;font-size:.85rem;color:var(--accent);background:var(--bg-tint);text-decoration:none}
.wb-res-foot:hover,.wb-res-foot.active{background:var(--accent-bg);text-decoration:none}
@media (max-width:560px){.wb-search{flex:1 1 auto;margin:0}}

/* index pill (shared) */
.idx{display:inline-flex;align-items:center;gap:.2rem;font-family:var(--round);font-weight:600;font-size:.8rem;
  padding:.12rem .45rem;border-radius:999px;border:1px solid transparent;line-height:1}
.idx small{font-size:.6rem;opacity:.65;text-transform:uppercase;letter-spacing:.04em}
/* Clickable pill -> /v2/value leaderboard, focused on the bottle (320615946). */
.idx-link{text-decoration:none;cursor:pointer;transition:filter .12s}
.idx-link:hover{text-decoration:none;filter:brightness(.95)}
.idx-green{background:var(--green-bg);color:var(--green);border-color:var(--green-line)}
.idx-amber{background:var(--amber-bg);color:var(--amber-txt);border-color:var(--amber-line)}
.idx-red{background:var(--red-bg);color:var(--red);border-color:var(--red-line)}

/* ---------- search head ---------- */
main{padding-bottom:3rem}
.search-head{margin:1.5rem 0 .2rem}
.search-title{font-size:1.9rem;font-weight:600;line-height:1.12;letter-spacing:-.02em;color:var(--ink)}
.search-title em{font-style:normal;color:var(--accent)}
.search-stats{margin:.7rem 0 0;font-size:.92rem;color:var(--ink-soft);display:flex;flex-wrap:wrap;gap:.3rem .9rem}
.search-stats strong{font-family:var(--round);color:var(--ink);font-variant-numeric:tabular-nums}
.raw-note{margin:.9rem 0 0;font-size:.84rem;line-height:1.5;color:var(--ink-soft);
  border-left:3px solid var(--accent-line);padding:.15rem 0 .15rem .7rem}
.raw-note a{font-weight:500}

/* ---------- command bar ---------- */
.filters{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:.85rem 1rem;
  margin:1.1rem 0 1.2rem;box-shadow:0 4px 16px rgba(51,36,26,.06)}
/* two-tier: search row on top, equal-width filter dropdowns below */
form.f{display:flex;flex-direction:column;gap:.6rem;margin:0}
.filter-primary,.filter-secondary{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}
.filter-primary .grow{flex:1 1 280px}
input.f-q,select{font:inherit;color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:10px;padding:.55rem .7rem;transition:border-color .14s,box-shadow .14s}
input.f-q{width:100%;font-size:1rem}
.filter-secondary select{cursor:pointer;flex:1 1 160px;min-width:150px;max-width:240px}
.f-reset{flex:none;margin-left:auto}
@media (max-width:560px){.filter-secondary select{flex:1 1 calc(50% - .25rem);max-width:none}.f-reset{margin-left:0}}
input.f-q:focus,select:focus{outline:none;border-color:var(--focus);box-shadow:0 0 0 3px rgba(201,135,54,.18)}
label.toggle{background:var(--accent-bg);border:1px solid var(--accent-line);border-radius:10px;padding:.5rem .8rem;
  font-size:.9rem;cursor:pointer;color:var(--accent);font-weight:500;display:inline-flex;align-items:center;gap:.45rem;font-family:var(--round);white-space:nowrap}
label.toggle input{margin:0;accent-color:var(--accent)}
.f-reset{font-size:.86rem;color:var(--muted);background:none;border:none;cursor:pointer;padding:.5rem .4rem;font-family:var(--round)}
.f-reset:hover{color:var(--accent);text-decoration:underline}
.f-besthere{flex:none;display:inline-flex;align-items:center;gap:.35rem;font-size:.86rem;color:var(--muted);cursor:pointer;padding:.5rem .4rem;font-family:var(--round);white-space:nowrap}
.f-besthere input{cursor:pointer;margin:0;accent-color:var(--accent)}
.f-besthere:hover{color:var(--accent)}
.f-go{flex:none;font:inherit;font-size:.9rem;color:#fff;background:var(--accent,#c98736);border:1px solid var(--accent,#c98736);border-radius:10px;padding:.55rem 1.1rem;cursor:pointer;font-family:var(--round)}
.f-go:hover{filter:brightness(1.06)}
.f-go:focus{outline:none;box-shadow:0 0 0 3px rgba(201,135,54,.3)}

/* ---------- results table ---------- */
.results{background:var(--card);border:1px solid var(--line);border-radius:16px;overflow:hidden}
/* border-collapse:separate (not collapse) so the position:sticky thead renders
   correctly — with collapse, Chrome lets the sticky header overlap/hide the
   FIRST body row (the "missing first result" bug). border-spacing:0 keeps the
   look identical; cell separation stays via per-cell border-bottom below. */
table.res{border-collapse:separate;border-spacing:0;width:100%}
table.res thead th{text-align:left;font-family:var(--round);font-weight:600;font-size:.72rem;text-transform:uppercase;
  letter-spacing:.05em;color:var(--muted);padding:.7rem 1rem;background:var(--bg-tint);border-bottom:1px solid var(--line)}
/* NOT position:sticky — a sticky header (top:57px, opaque bg) overlapped and hid
   the FIRST result row on every search (the "missing first bottle" bug). The
   column header now scrolls with the table, so row 1 is always fully visible. */
table.res thead th.num{text-align:right}
table.res thead th.sortable{cursor:pointer;user-select:none;transition:color .12s,background .12s}
table.res thead th.sortable:hover{color:var(--accent);background:var(--accent-bg)}
table.res thead th.sortable .arw{display:inline-block;width:.9em;margin-left:.15em;color:var(--accent);opacity:0;transition:opacity .12s;font-size:.9em}
table.res thead th.sortable:hover .arw{opacity:.4}
table.res thead th.sorted{color:var(--ink)}
table.res thead th.sorted .arw{opacity:1}
table.res thead th.num .arw{margin-left:.1em}
table.res tbody td{padding:.7rem 1rem;border-bottom:1px solid var(--line-soft);vertical-align:middle}
table.res tbody tr:last-child td{border-bottom:none}
table.res tbody tr{transition:background .12s;cursor:pointer}
table.res tbody tr:hover{background:var(--soft)}
table.res tbody tr.unpriced{background:var(--bg-tint)}
table.res tbody tr.unpriced:hover{background:var(--soft)}
/* out of stock everywhere (>=7d): red row tint + badge in the price cell */
table.res tbody tr.oos,table.res tbody tr.oos.unpriced{background:var(--red-bg)}
table.res tbody tr.oos:hover{background:var(--red-line)}
.stock-chip{display:inline-block;font-family:var(--round);font-weight:600;font-size:.72rem;
  padding:.1rem .5rem;border-radius:6px;border:1px solid transparent;white-space:nowrap;cursor:help}
.stock-chip.stock-out{background:#fff;color:var(--red);border-color:var(--red-line)}
.r-name{font-family:var(--round);font-weight:600;font-size:1rem;line-height:1.25;color:var(--ink);display:block}
.r-name:hover{color:var(--accent);text-decoration:none}
.r-photo-dot{display:inline-block;width:.5rem;height:.5rem;border-radius:50%;background:var(--gold);margin-left:.4rem;vertical-align:middle}
.r-brand{font-size:.9rem;color:var(--ink-soft)}
.abv-cell{text-align:right;font-family:var(--round);font-weight:600;font-variant-numeric:tabular-nums;color:var(--ink-soft);white-space:nowrap}
.idx-cell{text-align:right;white-space:nowrap}
.idx-cell .idx{font-size:.82rem;padding:.14rem .5rem}
.idx-none{color:var(--muted)}
.price-cell{text-align:right;white-space:nowrap}
.price-line{display:flex;align-items:center;justify-content:flex-end;gap:.45rem}
.price-amt{font-family:var(--round);font-weight:600;font-size:1.08rem;color:var(--accent);font-variant-numeric:tabular-nums}
.price-sub{font-size:.78rem;color:var(--muted);margin-top:.15rem}
.price-none{color:var(--muted);font-style:italic;font-size:.9rem}
.empty{padding:3rem 1.4rem;text-align:center;color:var(--muted)}
.empty .big{font-family:var(--round);font-weight:600;font-size:1.15rem;color:var(--ink-soft);margin-bottom:.3rem}
.more-row td{text-align:center;padding:1rem;background:var(--bg-tint)}
.btn-more{font-family:var(--round);font-weight:600;background:var(--ink);color:#fdf4e4;border:none;border-radius:10px;padding:.55rem 1.4rem;cursor:pointer;font-size:.92rem}
.btn-more:hover{background:#46342a}

/* mobile: collapse the results table into real cards.
   Each row becomes a 2-col grid: name + brand + price span the full width;
   ABV and the US-index pill sit side-by-side as a labelled meta row. Empty
   cells (`.m-empty`: no ABV/index, or the "(no brand family)" placeholder)
   are hidden so a card never shows a stray "—" or a bug-looking placeholder. */
@media (max-width:720px){
  table.res thead{display:none}
  /* Two content-width columns for the ABV + index meta pair, plus a 1fr filler
     so the full-width spanning rows (name/brand/price) don't stretch the meta
     columns to ~50% each and leave a dead gap between ABV and the pill. */
  table.res tbody tr{display:grid;grid-template-columns:max-content max-content 1fr;
    align-items:baseline;column-gap:1rem;row-gap:.2rem;
    border-bottom:1px solid var(--line);padding:.95rem 1rem}
  table.res tbody td{display:block;border:none;padding:0;text-align:left;white-space:normal}
  .cell-name,.cell-brand,.price-cell{grid-column:1 / -1}
  .cell-brand{margin-bottom:.15rem}
  /* ABV gets a small uppercase label (the index pill self-labels "USA RRP"). */
  .abv-cell{font-weight:500;color:var(--ink-soft)}
  .abv-cell::before{content:attr(data-label);font-family:var(--round);font-size:.66rem;
    text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:600;margin-right:.35rem}
  .idx-cell{text-align:left}
  .price-cell{margin-top:.35rem}
  .price-line{justify-content:flex-start}
  /* must out-specify `table.res tbody td{display:block}` (0,1,3) above, so the
     scope is repeated here — a bare `td.m-empty` (0,1,1) would lose and the
     empty cell would still show its stray "—". */
  table.res tbody td.m-empty{display:none}
}

/* footer */
.wb-footer{background:#33241A;color:#cdbba3;margin-top:2rem;padding:2.4rem 0 2rem}
.wb-footer-in{max-width:1180px;margin:0 auto;padding:0 1.4rem;display:flex;flex-wrap:wrap;justify-content:space-between;gap:1.4rem;align-items:center}
.wb-footer .wb-brand:hover{text-decoration:none}
.wb-foot-tag{font-size:.84rem;color:#b3a288;max-width:40ch;line-height:1.55}
.wb-foot-bottom{max-width:1180px;margin:1.4rem auto 0;padding:1.2rem 1.4rem 0;border-top:1px solid rgba(255,235,200,.10);
  font-size:.8rem;color:#8a785f;display:flex;flex-wrap:wrap;gap:.6rem;justify-content:space-between}
