/* ==========================================================================
   Components: product card, compact rows, free-delivery bar, qty stepper,
   option/radio cards, totals, drawer, toast, status pills, overlay
   ========================================================================== */

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr));
  gap: var(--grid-gap);
}

/* ---------- Product card (woocommerce/content-product.php) ---------- */
.product-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; height: 100%; }
.product-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: var(--arch);
  overflow: hidden;
  background: var(--c-img-bg);
}
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-out); }
.product-card__media:hover img { transform: scale(1.03); }
.product-card__body { display: flex; flex-direction: column; gap: 4px; }
.product-card__name {
  font: 400 20px/1.15 var(--font-display);
  text-decoration: none;
  text-wrap: pretty;
}
.product-card__line { font-size: 13px; line-height: 1.45; color: var(--c-muted); text-wrap: pretty; }
.product-card__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.product-card__price { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.product-card__price .strike { font-size: 13px; font-weight: 400; }
.product-card.is-oos .product-card__media img { opacity: .75; }

.tag-pill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--c-cream);
  color: var(--c-forest);
  font: 700 10px/1 var(--font-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: var(--shadow-pill);
}

/* ---------- Arched thumbnail ---------- */
.thumb {
  flex-shrink: 0;
  display: block;
  overflow: hidden;
  background: var(--c-img-bg);
  width: 48px;
  height: 58px;
  border-radius: 24px 24px 3px 3px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb--44 { width: 44px; height: 54px; border-radius: 22px 22px 3px 3px; }
.thumb--52 { width: 52px; height: 62px; border-radius: 26px 26px 3px 3px; }
.thumb--64 { width: 64px; height: 78px; border-radius: 32px 32px 3px 3px; }
.thumb--68 { width: 68px; height: 84px; border-radius: 34px 34px 3px 3px; }
.thumb--badge { position: relative; overflow: visible; }
.thumb--badge img { border-radius: inherit; }
.thumb__badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  background: var(--c-forest); color: var(--c-cream);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Compact row (usuals, recommendations) ---------- */
.mini-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--c-white);
  border: 1px solid var(--c-line);
}
.mini-row--soft { border-color: var(--c-line-soft); padding: 8px; }
.mini-row--flat { background: none; border: 0; border-bottom: 1px solid var(--c-line-soft); padding: 8px 0; }
.mini-row__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-row__name { font: 400 16px/1.15 var(--font-display); text-decoration: none; }
.mini-row__meta { font-size: 12px; color: var(--c-muted); }
.mini-row__hint { font-size: 11px; font-weight: 700; color: var(--c-mustard-ink); }
.mini-row__sub { font-size: 11px; color: var(--c-muted-2); }
.mini-row__oos { font-size: 12px; color: var(--c-muted-2); }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }

/* ---------- Free-delivery progress ---------- */
.free-bar { display: flex; flex-direction: column; gap: 10px; }
.free-bar__msg { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.free-bar__check {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-mustard); color: var(--c-forest);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.free-bar__track { height: 6px; background: var(--c-line-soft); border-radius: 3px; overflow: hidden; }
.free-bar__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--c-forest-hover);
  transition: width .5s var(--ease-out);
}
.free-bar.is-free .free-bar__fill { background: var(--c-mustard); }

/* ---------- Qty stepper ---------- */
.qty {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border: 1px solid var(--c-input-border);
  border-radius: var(--radius-btn);
  background: var(--c-white);
}
.qty button {
  width: 44px; height: 44px;
  border: 0; background: none;
  font-size: 18px; color: var(--c-forest);
}
.qty span { min-width: 24px; text-align: center; font-weight: 600; font-size: 15px; }
.qty--lg button { width: 48px; height: 54px; }

/* ---------- Cart line (drawer + cart page) ---------- */
.cart-line {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--c-line);
}
.cart-line__media {
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: 999px 999px 4px 4px;
  overflow: hidden;
  background: var(--c-img-bg);
}
.cart-line__media img { width: 100%; height: 100%; object-fit: cover; }
.cart-line__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cart-line__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cart-line__name { font: 400 17px/1.15 var(--font-display); text-decoration: none; }
.cart-line__size { font-size: 12px; color: var(--c-muted); }
.cart-line__price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.cart-line__price .strike { font-size: 11px; font-weight: 400; }
.cart-line__disc { font-size: 12px; font-weight: 600; color: var(--c-forest-hover); }
.cart-line__actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; }
.cart-line__remove { font-size: 12px; color: var(--c-muted); text-decoration: underline; border: 0; background: none; padding: 0; height: 44px; }

/* ---------- Totals ---------- */
.totals { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.totals__row { display: flex; justify-content: space-between; gap: 12px; }
.totals__row--save { color: var(--c-forest-hover); }
.totals__row--total {
  font-size: 18px; font-weight: 600;
  padding-top: 12px; margin-top: 4px;
  border-top: 1px solid var(--c-line);
}

/* ---------- Option button (size selector) ---------- */
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.option {
  min-height: 56px;
  padding: 8px 14px;
  border: 1px solid var(--c-input-border);
  border-radius: var(--radius-card);
  background: var(--c-white);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: var(--c-forest); text-align: left;
}
.option__label { font-size: 15px; font-weight: 600; }
.option__price { font-size: 13px; color: var(--c-muted); }
.option[aria-pressed="true"], .option[aria-checked="true"] {
  border-color: var(--c-forest);
  box-shadow: inset 0 0 0 1px var(--c-forest);
  background: var(--c-tint-warm);
}
.option-grid.is-invalid .option:not([aria-pressed="true"]) { border-color: var(--c-error); }

/* ---------- Radio card (address, shipping, payment) ---------- */
.radio-card {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-card);
  background: var(--c-white);
  display: flex; gap: 12px; align-items: flex-start;
  color: var(--c-forest);
  font-size: 14px; line-height: 1.45;
}
.radio-card[aria-checked="true"] { border-color: var(--c-forest); box-shadow: inset 0 0 0 1px var(--c-forest); }
.radio-card__dot {
  width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--c-forest);
  display: flex; align-items: center; justify-content: center;
}
.radio-card__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.radio-card[aria-checked="true"] .radio-card__dot::after { background: var(--c-forest); }
.radio-card__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.radio-card__sub { font-size: 13px; color: var(--c-muted); }
.radio-card__price { font-weight: 600; white-space: nowrap; align-self: center; }

/* ---------- Accordion ---------- */
.accordion__item { border-bottom: 1px solid var(--c-line); }
.accordion__btn {
  width: 100%; min-height: 52px;
  border: 0; background: none; padding: 0;
  display: flex; justify-content: space-between; align-items: center;
  font: 600 14px var(--font-ui); color: var(--c-forest);
}
.accordion__sign { font-size: 18px; font-weight: 400; }
.accordion__panel { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--c-body-2); }

/* ---------- Status pill ---------- */
.status-pill { padding: 6px 10px; font-size: 12px; font-weight: 700; background: var(--c-status-default-bg); color: var(--c-status-default-fg); white-space: nowrap; }
.status-pill--sm { padding: 4px 8px; font-size: 11px; }
.status-pill--out { background: var(--c-status-out-bg); color: var(--c-status-out-fg); }
.status-pill--delivered { background: var(--c-status-delivered-bg); color: var(--c-status-delivered-fg); }


/* ---------- Bag drawer (mini-cart) ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer.is-open { pointer-events: auto; }
.drawer__backdrop {
  position: absolute; inset: 0;
  background: var(--overlay);
  opacity: 0;
  transition: opacity .3s ease;
}
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 100%;
  background: var(--c-cream);
  box-shadow: var(--shadow-drawer);
  transform: translateX(105%);
  transition: transform .38s var(--ease-out);
  display: flex; flex-direction: column;
}
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head {
  padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--c-butter);
  border-bottom: 1px solid var(--c-line);
}
.drawer__title { font: 400 24px var(--font-display); text-transform: uppercase; }
.drawer__title small { font: 500 14px var(--font-ui); text-transform: none; }
.drawer__close { width: 44px; height: 44px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--c-forest); }
.drawer__progress { padding: 16px 20px; border-bottom: 1px solid var(--c-line); }
.drawer__note {
  padding: 10px 20px;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-line);
  font-size: 13px; font-weight: 600; color: var(--c-forest-hover);
}
.drawer__body { flex: 1; overflow-y: auto; padding: 0 20px; }
.drawer__recs { padding: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.drawer__foot {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--c-line);
  background: var(--c-white);
  display: flex; flex-direction: column; gap: 8px;
}
.drawer__empty { padding: 40px 0; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 767px) { .drawer__panel { width: 100%; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 90;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: var(--c-forest);
  color: var(--c-cream);
  padding: 12px 18px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-toast);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Processing overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(251, 247, 238, .94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center;
}
.overlay__title { font: 400 24px var(--font-display); text-transform: uppercase; }
.overlay__text { font-size: 14px; color: var(--c-muted); max-width: 340px; line-height: 1.5; }
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--c-input-border);
  border-top-color: var(--c-forest);
  border-radius: 50%;
  animation: tj-spin .8s linear infinite;
}
@keyframes tj-spin { to { transform: rotate(360deg); } }

/* ---------- Mobile sticky bar ---------- */
.sticky-bar {
  position: sticky; bottom: 0; z-index: 15;
  background: var(--c-cream);
  border-top: 1px solid var(--c-line);
  box-shadow: var(--shadow-sticky);
  padding: 10px 16px;
  display: flex; gap: 12px; align-items: center;
}

/* Pill tabs: home "pantry" filter and shop shelves */
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--c-input-border);
  border-radius: 999px;
  background: var(--c-white);
  font: 600 13px var(--font-ui);
  color: var(--c-forest);
  text-decoration: none;
  white-space: nowrap;
}
.pill-tab:hover { border-color: var(--c-forest); }
.pill-tab[aria-selected="true"], .pill-tab[aria-current] { background: var(--c-forest); border-color: var(--c-forest); color: var(--c-cream); }
.pill-tab__count { font-weight: 400; opacity: .65; }
