/*
 * Shop layer -- refresh build item 4 (PLAN §22.3), concept v2 applied to the
 * WooCommerce templates: PLP card, used list view, /specials/, PDP fulfilment
 * line and the sticky mobile buy bar.
 *
 * Loads after theme.css on every page (inc/shop.php). The card rules repeat
 * the `.woocommerce ul.products li.product` shape where Woo's own CSS competes
 * -- see the scoping note at the top of theme.css. Responsive rules last.
 */

/* ---------- shared bits ---------- */
.erg-kicker { font-family: var(--erg-mono); font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--erg-gold); margin: 0; }
.erg-pill {
  display: inline-block; font-family: var(--erg-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; padding: 4px 8px; border-radius: 6px; border: 1px solid; line-height: 1.2;
}
.erg-pill--local { color: var(--erg-green); border-color: rgba(92,184,122,.35); background: rgba(13,26,13,.85); }
.erg-pill--sale  { color: var(--erg-green); border-color: rgba(92,184,122,.35); background: rgba(13,26,13,.85); }
.erg-pill--store { color: var(--erg-gold); border-color: rgba(200,168,75,.4); background: rgba(200,168,75,.1); }

/* ---------- PLP card (concept .card) ---------- */
.woocommerce ul.products li.product.erg-plp-card,
ul.products li.product.erg-plp-card {
  background: var(--erg-panel); border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 0; overflow: visible;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.woocommerce ul.products li.product.erg-plp-card:hover,
ul.products li.product.erg-plp-card:hover { border-color: rgba(255,255,255,.14); transform: translateY(-2px); box-shadow: 0 18px 40px rgba(0,0,0,.4); }

/* Light well: distributor renders are white-background; fighting that looks worse. */
html body .erg-plp-card .erg-card__thumb {
  background: #f3f4f6; border: 0; border-radius: 8px; aspect-ratio: 1; padding: 0;
  display: grid; place-items: center; overflow: hidden; position: relative;
}
html body .erg-plp-card .erg-card__thumb img { width: 86%; height: 86%; max-width: 86%; max-height: 86%; object-fit: contain; }
html body .erg-plp-card.erg-card--nophoto .erg-card__thumb { background: #1a2028; }
.erg-card__ph { font-family: var(--erg-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #6b7280; text-align: center; padding: 0 12px; }
.erg-card--nophoto .erg-card__ph { color: var(--erg-text-dim); }
.erg-card__badges { top: 8px; left: 8px; right: 8px; }

.erg-plp-card .erg-card__body { background: transparent; padding: 10px 0 0; gap: 7px; }
.erg-plp-card .erg-card__brand { font-family: var(--erg-mono); font-size: 10px; letter-spacing: .18em; color: #aab1bb; text-transform: uppercase; }
.woocommerce ul.products li.product .erg-card__title,
.erg-plp-card .erg-card__title { font-family: var(--erg-body); font-weight: 600; font-size: 14px; line-height: 1.35; }
.erg-plp-card .erg-card__meta { font-size: 12px; color: #aab1bb; margin-top: -2px; }
.erg-plp-card .erg-card__upc { margin: 0; font-family: var(--erg-mono); font-size: 10px; letter-spacing: .06em; color: #7d8590; }

.erg-card__bottom { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.woocommerce ul.products li.product .erg-card__priceval,
.erg-plp-card .erg-card__priceval { margin: 0; font-family: var(--erg-head); font-size: 21px; font-weight: 500; color: var(--erg-bone); }
.erg-card__priceval .woocommerce-price-suffix { display: none; }
.erg-plp-card .erg-card__actions { display: block; }
html body .erg-plp-card .erg-card__actions .button,
html body .erg-plp-card .erg-card__actions .erg-btn,
html body .woocommerce ul.products li.product.erg-plp-card .button {
  width: auto; padding: 9px 16px; font-size: 12px; border-radius: 999px; margin: 0; font-weight: 500; letter-spacing: .1em;
}
html body .erg-plp-card .erg-card__actions .erg-btn--ghost { background: transparent; color: var(--erg-text); border-color: rgba(255,255,255,.14); }
html body .erg-plp-card .erg-card__actions .erg-btn--ghost:hover { border-color: var(--erg-gold); color: var(--erg-gold); }
.erg-plp-card .added_to_cart { display: block; margin-top: 6px; font-family: var(--erg-head); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--erg-gold); }
.erg-plp-card .add_to_cart_button.added { display: none; }


/* Legacy erg-assets (10-base.css, 30-plp.css) still style these class names
   for the Elementor card: padding on title/meta/actions, an uppercase Oswald
   title link, and a dark background on the <img> itself, which turned every
   transparent PNG into a black square on the light well. Neutralized here
   at higher specificity; drop this block when those files are retired. */
html body .erg-plp-card .erg-card__title,
html body .erg-plp-card .erg-card__meta,
html body .erg-plp-card .erg-card__actions { padding: 0; margin-top: 0; }
html body .erg-plp-card .erg-card__meta { display: block; }
html body .erg-plp-card .erg-card__title a {
  font-family: var(--erg-body); font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none;
  line-height: 1.35; color: var(--erg-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
html body .erg-plp-card .erg-card__title a:hover { color: var(--erg-gold); }
/* 36-homepage.css paints .woocommerce ul.products li.product a img (0,3,4)
   dark with a 12px radius: a hairline dark frame inside the light well. */
html body .erg-plp-card .erg-card__thumb img,
html body .woocommerce ul.products li.product.erg-plp-card a img,
html body.woocommerce ul.products li.product.erg-plp-card a img { background: transparent; border-radius: 0; will-change: auto; filter: none; }
html body .erg-plp-card .erg-card__actions { display: block !important; } /* 30-plp.css sets flex with !important */
html body .erg-plp-card .erg-card__priceval .price,
html body .erg-plp-card .erg-card__priceval .woocommerce-Price-amount { font-family: var(--erg-head); font-weight: 500; letter-spacing: 0; }
html body .erg-plp-card .erg-card__priceval del .woocommerce-Price-amount { font-size: 13px; color: #aab1bb; }
html body .erg-plp-card .erg-card__priceval del { opacity: 1; margin-right: 6px; }


/* ---------- sub-category chips (inc/shop.php) ---------- */
.erg-subcats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.erg-subcats a { font-family: var(--erg-head); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--erg-text); text-decoration: none; padding: 8px 14px; border: 1px solid var(--erg-border); border-radius: 999px; background: var(--erg-panel); transition: border-color .15s; }
.erg-subcats a:hover { border-color: var(--erg-gold); }
.erg-subcats a span { font-family: var(--erg-mono); font-size: 10.5px; color: #aab1bb; letter-spacing: 0; margin-left: 4px; }

/* ---------- used archive: view toggle + list rows ---------- */
.erg-viewtoggle { display: inline-flex; border: 1px solid var(--erg-border); border-radius: 999px; overflow: hidden; margin: 0 0 14px 12px; vertical-align: middle; }
.erg-viewtoggle a { font-family: var(--erg-head); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--erg-muted); padding: 7px 14px; text-decoration: none; }
.erg-viewtoggle a.is-on { background: var(--erg-gold); color: var(--erg-on-gold); }

.woocommerce ul.products.erg-ulist,
ul.products.erg-ulist { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.woocommerce ul.products li.product.erg-urow { padding: 0; display: flex; }
.woocommerce ul.products li.product.erg-urow > .erg-urow__link { flex: 1; min-width: 0; }
.erg-urow__link {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--erg-panel); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 10px;
  color: var(--erg-text); text-decoration: none; transition: border-color .15s;
}
.erg-urow__link:hover { border-color: var(--erg-gold); }
.erg-urow__img { width: 78px; height: 78px; border-radius: 8px; overflow: hidden; background: #f3f4f6; display: grid; place-items: center; }
html body .erg-urow__img img { width: 100%; height: 100%; object-fit: cover; margin: 0; }
.erg-urow__img--ph { background: #212831; color: #aab1bb; font-family: var(--erg-mono); font-size: 9px; letter-spacing: .1em; text-align: center; line-height: 1.3; text-transform: uppercase; }
.erg-urow__txt { display: grid; gap: 3px; min-width: 0; }
.erg-urow__title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.erg-urow__note { font-size: 12px; color: #aab1bb; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.erg-urow__price { font-family: var(--erg-head); font-size: 20px; color: var(--erg-bone); text-align: right; white-space: nowrap; }
.erg-urow__price small { display: block; white-space: normal; max-width: 9em; margin-left: auto; font-family: var(--erg-mono); font-size: 9.5px; letter-spacing: .12em; color: var(--erg-green); text-transform: uppercase; }
.erg-urow__price del { color: #aab1bb; font-size: .62em; margin-right: 4px; }
.erg-urow__price ins { text-decoration: none; }

/* ---------- /specials/ ---------- */
.erg-specials { padding-block: 28px 56px; }
.erg-pagehead { margin: 0 0 26px; max-width: 720px; }
.erg-pagehead h1 { font-size: clamp(32px, 4.4vw, 48px); color: var(--erg-bone); text-transform: uppercase; font-weight: 500; line-height: 1.02; margin: 10px 0 12px; }
.erg-pagehead__lede { color: var(--erg-muted); font-size: 15.5px; margin: 0; }
.erg-minirow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0 0; font-size: 13px; color: var(--erg-muted); }
.erg-rebates { margin-top: 52px; }
.erg-sechead { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.erg-sechead h2 { font-size: 30px; color: var(--erg-bone); text-transform: uppercase; font-weight: 500; margin: 6px 0 0; }
.erg-sechead__more { font-family: var(--erg-head); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; color: var(--erg-text); border-bottom: 1px solid var(--erg-gold); padding-bottom: 2px; text-decoration: none; white-space: nowrap; }
.erg-rebates__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.erg-rebate { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--erg-panel); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 14px; color: var(--erg-text); text-decoration: none; }
.erg-rebate:hover { border-color: var(--erg-gold); }
.erg-rebate__amt { font-family: var(--erg-head); font-size: 26px; color: var(--erg-gold); line-height: 1; min-width: 88px; }
.erg-rebate__txt b { display: block; font-weight: 600; font-size: 14px; }
.erg-rebate__txt span { font-size: 12px; color: #aab1bb; }
.erg-rebate__end { font-family: var(--erg-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--erg-red); text-transform: uppercase; text-align: right; white-space: nowrap; }
.erg-rebate__end.is-ok { color: #aab1bb; }

/* ---------- PDP ---------- */
.erg-fulfil { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: -4px 0 14px; font-size: 13px; color: var(--erg-muted); }
.erg-buybar { display: none; }

/* ---------- responsive (keep last) ---------- */
@media (max-width: 980px) {
  .woocommerce ul.products.erg-ulist, ul.products.erg-ulist { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .erg-buybar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    gap: 12px; align-items: center; justify-content: space-between;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(12,16,21,.97); border-top: 1px solid rgba(200,168,75,.35);
    box-shadow: 0 -12px 30px rgba(0,0,0,.45);
    transform: translateY(110%); transition: transform .2s ease;
  }
  .erg-buybar[hidden] { display: none; }
  body.erg-buybar-on .erg-buybar { transform: none; }
  body.erg-buybar-on { padding-bottom: 72px; }
  .erg-buybar__txt { display: grid; min-width: 0; }
  .erg-buybar__name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .erg-buybar__price { font-family: var(--erg-head); font-size: 19px; color: var(--erg-bone); line-height: 1.1; }
  .erg-buybar__price del { color: #aab1bb; font-size: .65em; margin-right: 4px; }
  .erg-buybar__price ins { text-decoration: none; }
  .erg-buybar__price .woocommerce-price-suffix { display: none; }
  html body .erg-buybar__btn { flex: 0 0 auto; border-radius: 999px; padding: 12px 18px; }
  .erg-rebates__grid { grid-template-columns: minmax(0, 1fr); }
  .erg-sechead { flex-direction: column; align-items: start; gap: 8px; }
}
@media (max-width: 560px) {
  /* Two-up on phones: one card per screen made a 40-item category a 40-screen scroll. */
  .woocommerce ul.products:not(.erg-ulist),
  .woocommerce-page ul.products:not(.erg-ulist),
  .erg-plp-layout__main ul.products:not(.erg-ulist) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .woocommerce ul.products li.product.erg-plp-card, ul.products li.product.erg-plp-card { padding: 8px; }
  .erg-plp-card .erg-card__title { font-size: 13px; }
  .erg-plp-card .erg-card__priceval { font-size: 18px; }
  .erg-plp-card .erg-card__bottom { flex-direction: column; align-items: stretch; }
  html body .erg-plp-card .erg-card__actions .button,
  html body .erg-plp-card .erg-card__actions .erg-btn { width: 100%; }
  .erg-plp-card .erg-card__upc { display: none; }
  .erg-card__badges .erg-pill { font-size: 8.5px; padding: 3px 6px; }
  .erg-urow__link { grid-template-columns: 64px minmax(0, 1fr); }
  .erg-urow__img { width: 64px; height: 64px; }
  .erg-urow__price { grid-column: 2; text-align: left; font-size: 18px; }
  .erg-urow__price small { display: inline; margin-left: 8px; }
  .erg-rebate { grid-template-columns: auto minmax(0, 1fr); }
  .erg-rebate__end { grid-column: 2; text-align: left; }
}
