/*
 * wb-components.css — BourbonBuddy component primitives
 *
 * All classes carry the `wb-` prefix so they cannot collide with the existing
 * catalog.css / bottle.css during the incremental migration.  Component CSS
 * uses var(--*) tokens from wb-tokens.css.  The only literal hexes allowed
 * are inside the hero gradient/glow (below).
 *
 * Phase 0: INVISIBLE — this file is served but not yet included in any page
 * <head>. Page wiring happens in later phases, one page at a time.
 *
 * Sections
 *   1. Buttons
 *   2. Card (+ frame, cbody, price, stock, trend, askbtn)
 *   3. Filter pill
 *   4. AU flag chip
 */


/* ─── 1. Buttons ─────────────────────────────────────────────────────────── */

.wb-btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
  padding: 9px 17px;
  cursor: pointer;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wb-btn-primary {
  background: var(--brass);
  color: #fff;
}

.wb-btn-primary:hover {
  background: var(--brass-deep);
}

.wb-btn-ghost {
  background: transparent;
  color: var(--sk-q-sub);
  border: 1px solid rgba(255, 255, 255, .28);
}

.wb-btn-ghost:hover {
  background: rgba(255, 255, 255, .08);
}

/* ─── 2. Card ─────────────────────────────────────────────────────────────── */

/* Bottom-alignment rule: name top, primary action bottom, variable signals
   between.  The flex-column chain ensures .wb-askbtn always sits at the card
   foot regardless of how many signal rows appear between price and button. */
.wb-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .12s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.wb-card:hover {
  transform: translateY(-4px);
}

/* Card image frame */
.wb-card .frame {
  height: 185px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
}

.wb-card .frame img {
  max-height: 100%;
  max-width: 74%;
  object-fit: contain;
}

/* Card body — flex:1 so it fills remaining height, enabling margin-top:auto
   on .wb-askbtn to push the button to the card foot. */
.wb-card .cbody {
  padding: 15px 16px 17px;
  border-top: 1px solid #f0e8da;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Price display: clean sans number, $ in Inter ink colour, AUD muted suffix */
.wb-price {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
}

.wb-price .dollar {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);       /* ink, NOT grey — see design brief */
  vertical-align: 6px;
  margin-right: 1px;
}

.wb-price .cur {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .06em;
  margin-left: 5px;
  vertical-align: 3px;
}

/* Price trend — green = positive price signal only, never neutral chrome */
.wb-trend {
  font-size: 11.5px;
  color: var(--green);
  font-weight: 700;
  margin-top: 6px;
}

/* Per-bottle "Ask Buddy" button — margin-top:auto keeps it at card foot */
.wb-askbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: auto;
  padding: 9px;
  border: 1px solid var(--line);
  background: #fbf6ee;
  border-radius: 10px;
  color: var(--brass-deep);
  font-weight: 600;
  font-size: 12.5px;
  font-family: var(--sans);
  cursor: pointer;
  transition: all .12s;
}

.wb-askbtn:hover {
  border-color: var(--brass);
  background: #f6ead7;
}

/* ─── 3. Filter pill ──────────────────────────────────────────────────────── */

.wb-pill {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.wb-pill.active {
  border-color: var(--brass);
  background: #f6ead7;
  color: var(--brass-deep);
  font-weight: 600;
}

/* ─── 4. AU flag chip ─────────────────────────────────────────────────────── */

.wb-chip-au {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #f0dcc0;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  padding: 6px 12px;
}

/* Flag graphic — real <img>, never emoji (fails on Windows) */
.wb-chip-au .flag {
  width: 19px;
  height: 13px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2);
}

/* Box-sizing reset scoped to wb-* components only (moved from wb-tokens.css
   2026-07-10 — tokens file is variables-only). */
.wb-card,
.wb-btn,
.wb-pill,
.wb-chip-au,
.wb-price {
  box-sizing: border-box;
}

/* ─── Brand hub card grid (moved wholesale from brands.css 2026-07-10;
   sole consumer is hub.html, which links wb-components via head_assets) ─── */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

/* Card — mirrors catalog.css .cat-card */
.brand-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(var(--sk-q-ink-rgb),.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  transition: transform .12s, box-shadow .16s;
}
.brand-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(var(--sk-q-ink-rgb),.16);
  text-decoration: none;
}

/* Image frame — mirrors catalog.css .cat-frame */
.brand-frame {
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 16px;
  overflow: hidden;
}
.brand-frame img {
  max-height: 100%;
  max-width: 80%;
  object-fit: contain;
  display: block;
}

/* Card body */
.brand-meta {
  padding: 13px 15px 16px;
  border-top: 1px solid #f0e8da;
}

/* Brand name — matches .cname: clean sans (Inter), weight 600 (serif reads
   fussy at card size; serif stays on headings/hero only). */
.brand-name {
  font-family: 'Inter',system-ui,sans-serif;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: -.01em;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 3px;
}
.brand-card:hover .brand-name {
  color: var(--accent);
}

/* Bottle count — muted sub-line */
.brand-count {
  font-family: var(--sans);
  color: var(--muted);
  font-size: .82rem;
}

/* Responsive — narrow screens: shrink min column (mirrors catalog.css media query) */
@media (max-width: 560px) {
  .brand-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .brand-frame {
    height: 130px;
    padding: 12px;
  }
  .brand-name {
    font-size: .88rem;
  }
}

/* ─── Shared index pill (canonical; moved from catalog.css 2026-07-10 —
   retailer.css carried a byte-identical copy) ─── */
.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}
.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)}

/* ─── Catalogue card system (moved verbatim from catalog.css 2026-07-10;
   cat-* classes render on catalog + retailer surfaces) ─── */
/* ---------- results grid ---------- */
.results{padding:.2rem 0}
.cat-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:.62rem;
  padding:.2rem 0 1rem;
}

/* ---------- catalogue card ---------- */
/* Card is a <div class="cat-card"> (position:relative) containing a stretched
   overlay <a class="card-link"> + the image frame + the body. This mirrors the
   market.js card() pattern so the whole card is ONE grid child and nested
   interactive elements (val chip link, Ask Buddy button) remain independently
   clickable via z-index:2. */
.cat-card{
  position:relative;background:#fff;border-radius:8px;
  box-shadow:0 1px 0 rgba(var(--sk-q-ink-rgb),.06);overflow:hidden;
  display:flex;flex-direction:column;cursor:pointer;
  transition:border-color .12s,box-shadow .14s;
  border:1px solid var(--line);
}
.cat-card:hover{border-color:var(--accent-line);box-shadow:0 3px 10px rgba(var(--sk-q-ink-rgb),.08)}

/* Stretched overlay link — fills the whole card; val chip + card-buddy sit above it */
.cat-card .card-link{
  position:absolute;inset:0;z-index:1;
  display:block;border-radius:inherit;
  outline-offset:2px;
}
.cat-card .card-link:focus-visible{outline:2px solid var(--focus)}
.cat-card:has(.card-link:focus-visible){box-shadow:0 0 0 3px rgba(201,135,54,.30)}

/* Muted state for unpriced / OOS cards */
.cat-card-unpriced{opacity:.72}
.cat-card-oos{border-color:var(--red-line);background:var(--red-bg)}

/* Image frame — position:relative anchors the .val chip; NO z-index so the frame
   stays BELOW the stretched .card-link overlay (raising it blocks card clicks).
   The .val chip re-escapes the overlay via its own z-index:2. */
.cat-frame{
  position:relative;height:118px;display:flex;align-items:center;
  justify-content:center;background:#fff;padding:10px 9px 4px;overflow:hidden;
}
.cat-frame img{max-height:100%;max-width:76%;object-fit:contain;display:block}
.cat-frame.is-placeholder img{opacity:.45}






/* Value chip — top-right of the image frame, z-index above frame */
.cat-card .val{
  position:absolute;top:10px;right:10px;z-index:2;
  font-size:.72rem;font-weight:700;padding:.2rem .55rem;border-radius:999px;
  border:1px solid transparent;text-decoration:none;white-space:nowrap;
  transition:filter .12s;
}
.cat-card .val:hover{text-decoration:none;filter:brightness(.95)}

/* Card body — position:relative anchors children; NO z-index so the body stays
   BELOW the stretched .card-link overlay (raising it blocks card clicks). The
   interactive child (.card-buddy) re-escapes the overlay via its own z-index:2. */
.cat-cbody{
  position:relative;
  padding:7px 8px 9px;border-top:1px solid #f0e8da;
  flex:1;display:flex;flex-direction:column;
}

/* Brand eyebrow */
.cbrand{
  font-size:.58rem;letter-spacing:.06em;text-transform:uppercase;
  color:var(--muted);font-weight:700;margin-bottom:3px;
  font-family:var(--sans);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}

/* Bottle name — clean sans (Inter): serif reads fussy at this small grid size;
   serif stays on headings/hero only. 2-line clamp for row-height alignment. */
.cname{
  font-family:var(--sans);font-weight:650;font-size:.78rem;letter-spacing:0;
  line-height:1.22;color:var(--ink);margin:0 0 2px;
  overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;
  -webkit-box-orient:vertical;min-height:2.38em;
}
.cat-card:hover .cname{color:var(--accent)}

/* ABV sub-line */
.csub{
  font-size:.68rem;color:var(--muted);font-weight:600;margin-bottom:4px;min-height:1em;
  font-family:var(--sans);
}

/* Price area — top-anchored under the ABV line (2026-07-17 fix: this used to
   carry margin-top:auto to "pin the price to the bottom", but .cname and
   .csub already reserve fixed min-heights (2.38em / 1em) so the top block's
   height never varies card-to-card — the auto margin had no legitimate job
   EXCEPT absorbing the extra height CSS Grid's default align-items:stretch
   hands a bar-less card when its same-row neighbour has a price-bar (T32a).
   That shoved the whole price+buy+bar footer down, opening a large gap
   between the ABV line and the price on the shorter card (Robert's iOS
   screenshot, 2026-07-17 — Wild Turkey Master's Keep Revival). Dropping the
   auto margin leaves .cat-cbody's default flex-start behaviour: content
   packs from the top and any grid-stretch slack falls after the last child
   (the buy line / price-bar), i.e. below the retailer button — the one
   place extra height is supposed to land. Rows where both or neither card
   has a bar are unaffected either way since there's no slack to absorb. */
.cat-price-wrap{padding-top:4px}

/* AUD price: sans weight 600, tabular nums. .dollar = ink prefix, .cur = muted tag */
.cprice{
  display:inline-flex;align-items:baseline;gap:0;
  font-family:var(--sans);font-size:1rem;font-weight:700;color:var(--ink);
  font-variant-numeric:tabular-nums;letter-spacing:-.01em;line-height:1.05;
}
.cprice .dollar{
  font-family:var(--sans);font-size:.74rem;font-weight:700;
  color:var(--ink);margin-right:1px;line-height:inherit;
}
.cprice .cur{
  font-family:var(--sans);font-size:.58rem;font-weight:700;
  color:var(--muted);letter-spacing:.04em;margin-left:3px;line-height:inherit;
}
.cprice-meta{display:none}
.cprice-none{color:var(--muted);font-style:italic;font-size:.72rem;font-family:var(--sans)}

/* "at <retailer> →" buy line — mirrors market.css .card-buy. z-index:2 so it
   escapes the stretched .card-link overlay and taps straight out to the seller. */
.cat-card .card-buy{position:relative;z-index:2;display:inline-flex;align-items:center;gap:3px;
  margin-top:4px;width:fit-content;max-width:100%;
  font-family:var(--sans);font-weight:650;font-size:.66rem;color:var(--accent-2,var(--sk-lg-accent-2));
  text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cat-card .card-buy:hover{color:var(--burnt,var(--sk-lg-burnt));text-decoration:none}
.cat-card .card-buy-arr{font-size:.95em;flex:none}

/* Out of stock chip */
.cstock.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:normal;max-width:100%;line-height:1.3}
.cstock.stock-out{background:#fff;color:var(--red);border-color:var(--red-line)}

/* Empty state */
.cat-empty{padding:3rem 1.4rem;text-align:center;color:var(--muted)}
.cat-empty-big{font-family:var(--round);font-weight:600;font-size:1.15rem;color:var(--ink-soft);margin-bottom:.3rem}

/* Show-more */
.cat-more-wrap{grid-column:1/-1;text-align:center;padding:.8rem 0 .4rem}
.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}

@media (max-width:600px){
  .cat-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:.45rem}
  .cat-frame{height:96px;padding:8px 6px 3px}
  .cat-cbody{padding:6px 7px 8px}
  .cprice{font-size:.92rem}
  .cname{font-size:.72rem}
  .cat-card .card-buy{font-size:.61rem}
}
@media (max-width:380px){
  .cat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* ─── Price-position bar (T32/#307) ──────────────────────────────────────
   Shared across all three surfaces that render it: market.js's card()
   (landing rows), catalog.js's cardHTML() (browse/search), and the
   server-rendered bottle-page "Best AU price" panel — one component here
   (this file is already loaded on all three templates via
   partials/head_assets.html) instead of three near-duplicate rule sets.
   Reuses each page's own --accent/--accent-line/--accent-bg/--muted/--ink
   tokens (defined identically in market.css/catalog.css's own :root, and
   inherited unqualified by bottle.css already) — no new hex values. */
.price-bar{margin-top:8px}
.price-bar-track-wrap{position:relative;padding-top:22px}
.price-bar-tag{
  position:absolute;top:0;transform:translateX(-50%);white-space:nowrap;
  background:var(--ink);color:#fff;font-family:var(--sans);
  font-size:.66rem;font-weight:700;padding:2px 8px;border-radius:999px;
}
.price-bar-tag::after{
  content:"";position:absolute;left:50%;top:100%;transform:translateX(-50%);
  border:4px solid transparent;border-top-color:var(--ink);
}
.price-bar-track{position:relative;height:4px;border-radius:999px;background:var(--accent-bg)}
.price-bar-fill{position:absolute;left:0;top:0;bottom:0;border-radius:999px;background:var(--accent-line)}
.price-bar-dot{
  position:absolute;top:50%;width:10px;height:10px;border-radius:50%;
  background:var(--accent);border:2px solid #fff;
  box-shadow:0 0 0 1px var(--accent);transform:translate(-50%,-50%);
}
.price-bar-ends{display:flex;justify-content:space-between;font-family:var(--sans);
  font-size:.66rem;font-weight:600;color:var(--muted);margin-top:4px}
.price-bar-lo,.price-bar-hi{line-height:1}
.price-bar-caption{font-family:var(--sans);font-size:.62rem;color:var(--muted);margin-top:2px}
/* T574/#1946: history-less bottle's placeholder bar (priceBarEmptyHTML in
   market.js) — same skeleton, same height, paints nothing. Keeps the
   bottom-pinned .price-block (market.css margin-top:auto) aligned across a
   row when a row-mate has a real/flat bar and this card doesn't. */
.price-bar--empty{visibility:hidden}
/* Family bar-top hero photos (ask #2319 r2): show the WHOLE portrait photo
   (contain) over a blurred, darkened copy of itself so the box still reads as
   one full-bleed picture. Markup: .fam-photo + inline --fam-photo:url(...). */
html:not(#_) body .card .card-img-wrap.fam-photo.fam-photo,
html:not(#_) body .cat-card .cat-frame.fam-photo.fam-photo{
  position:relative !important;overflow:hidden !important;padding:0 !important;
  background:var(--sk-ink) !important;
}
html:not(#_) body .card .card-img-wrap.fam-photo.fam-photo::before,
html:not(#_) body .cat-card .cat-frame.fam-photo.fam-photo::before{
  content:"";position:absolute;inset:-24px;
  background:var(--fam-photo) center/cover no-repeat;
  filter:blur(18px) brightness(.55) saturate(1.1);
}
html:not(#_) body .card .card-img-wrap.fam-photo.fam-photo img,
html:not(#_) body .cat-card .cat-frame.fam-photo.fam-photo img{
  position:relative !important;width:100% !important;height:100% !important;
  max-width:100% !important;max-height:100% !important;
  object-fit:contain !important;object-position:center !important;
  mix-blend-mode:normal !important;filter:none !important;
}
html:not(#_) body .card .card-img-wrap.fam-photo.fam-photo .fam-badge{z-index:2}

/* Gold STORE PICK sticker (T2887). Sits top-right of a single-bottle card's
   photo box; never intercepts taps. */
.sp-photo{position:relative}
.sp-sticker{position:absolute;top:8px;right:8px;width:34%;max-width:96px;aspect-ratio:1/1;
  background:url(/static/img/store-pick-sticker.webp?v=3) center/contain no-repeat;
  transform:rotate(9deg);filter:drop-shadow(0 2px 3px rgba(0,0,0,.55));
  pointer-events:none;z-index:6}
.catm-shot:has(>.sp-sticker){position:relative}
.catm-shot>.sp-sticker{width:60px;top:3px;right:3px}

/* Bottle card photo box, every page (Robert, 6 Nov 2026, T2953): the same 3:4
   box as the home cards (home-shop.css). A bench or family photo fills the box
   with no side bands; any other picture (cut-out, shop shot, placeholder) stays
   whole on its plate. Website only: the app's card rules (html.wb-app) are left
   as they are. family.css carries the same rule for the family page cards. */
html:not(.wb-app):not(#_) body :is(.card .card-img-wrap,.cat-card .cat-frame,.brand-frame){
  height:auto !important;aspect-ratio:3/4;margin:0 !important;
}
html:not(.wb-app):not(#_) body :is(.card .card-img-wrap,.cat-card .cat-frame,.brand-frame):has(>:is(img[src*="/img/bottle-bartop"],img[src*="/img/bottle-card/"],img[src*="/img/family-hero/"])){
  padding:0 !important;overflow:hidden !important;background:var(--sk-ink) !important;
}
html:not(.wb-app):not(#_) body :is(.card .card-img-wrap,.cat-card .cat-frame,.brand-frame).fam-photo.fam-photo::before{display:none}
html:not(.wb-app):not(#_) body :is(.card .card-img-wrap,.cat-card .cat-frame,.brand-frame)>:is(img[src*="/img/bottle-bartop"],img[src*="/img/bottle-card/"],img[src*="/img/family-hero/"]){
  width:100% !important;height:100% !important;max-width:none !important;max-height:none !important;
  padding:0 !important;object-fit:cover !important;object-position:center !important;
}
