/* ════════════════════════════════════════════════════════════════════════════
   Alloy Rewards shop (Omnium): product tiles, grid, spotlight, shop listing,
   product page, buy box and the header mini cart.

   Loaded after alloycms.css on Alloy Bank pages only, and built from its
   :root tokens (--brand-*, --surface*, --card, --ink, --muted, --r-*,
   --shadow-*). Restyle by moving those tokens, not by editing rules here.
   Kept in its own file so the commerce POC can be lifted out whole.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ---- shared atoms -------------------------------------------------------- */

body.alloycms .shop-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  font: 600 0.95rem/1.2 var(--font-display);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

body.alloycms .shop-button:hover { background: var(--surface-1); color: var(--ink); }
body.alloycms .shop-button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* The brand's primary button: an LFGreen fill, always with Dark Fir text. */
body.alloycms .shop-button--primary {
  border-color: var(--fill);
  background: var(--fill);
  color: var(--on-fill);
}

body.alloycms .shop-button--primary:hover { border-color: var(--fill-hover); background: var(--fill-hover); color: var(--on-fill); }

body.alloycms .shop-button--ghost { border-color: var(--border-strong); color: var(--ink); }

body.alloycms .shop-button:disabled,
body.alloycms .shop-button[disabled] {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--subtle);
  box-shadow: none;
  cursor: not-allowed;
}

body.alloycms .price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0 0; }
body.alloycms .price__now { font: 700 1.15rem/1.2 var(--font-display); color: var(--ink); }
body.alloycms .price__was { font-size: 0.9rem; color: var(--subtle); }
body.alloycms .price--large .price__now { font-size: clamp(1.5rem, 2.5vw, 1.9rem); }

body.alloycms .stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--positive);
}

body.alloycms .stock-badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

body.alloycms .stock-badge--low { color: var(--warn); }
body.alloycms .stock-badge--out { color: var(--subtle); }

body.alloycms .shop-hint {
  padding: 1rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  background: var(--surface-1);
}

body.alloycms .shop__source { font-size: 0.8rem; color: var(--subtle); margin: 0.75rem 0 0; }

/* ---- product tile -------------------------------------------------------- */

body.alloycms .product-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

body.alloycms .product-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

body.alloycms .product-tile__media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  background: var(--surface-1);
}

body.alloycms .product-tile__media img,
body.alloycms .product-spotlight__media img,
body.alloycms .pdp__gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.alloycms .product-tile__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-500);
  color: var(--on-fill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.alloycms .product-tile__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem 1.1rem;
}

body.alloycms .product-tile__brand {
  margin: 0;
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;   /* the demo's type-eyebrow */
  color: var(--subtle);
}

body.alloycms .product-tile__name { margin: 0; font: 600 1rem/1.3 var(--font-display); }
body.alloycms .product-tile__name a { color: var(--ink); text-decoration: none; }
body.alloycms .product-tile__name a:hover { color: var(--brand-600); }
body.alloycms .product-tile__points { margin: 0; font-size: 0.85rem; color: var(--muted); }

body.alloycms .product-tile__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

/* ---- product grid block -------------------------------------------------- */

body.alloycms .product-grid { padding-block: var(--pad-band-y); }

body.alloycms .product-grid__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1.5rem;
}

body.alloycms .product-grid__heading { margin: 0; font: 700 clamp(1.5rem, 3vw, 2rem)/1.15 var(--font-display); }
body.alloycms .product-grid__sub { margin: 0.4rem 0 0; color: var(--muted); }
body.alloycms .product-grid__all { font-weight: 600; color: var(--brand-500); text-decoration: none; white-space: nowrap; }
body.alloycms .product-grid__all:hover { text-decoration: underline; }

body.alloycms .product-grid__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 1.25rem;
}

/* ---- product spotlight block --------------------------------------------- */

/* :where() keeps this at the specificity of a bare element rule, so the Visual Builder style
   utilities (vbg-*, vtc-*, va-*) an editor picks still win over these defaults. */
body.alloycms :where(.product-spotlight) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-block: var(--pad-band-y);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border-radius: var(--r-xl);
  background: var(--brand-50);
}

body.alloycms .product-spotlight__media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-md);
}

body.alloycms .product-spotlight__body { display: flex; flex-direction: column; gap: 0.6rem; }

body.alloycms .product-spotlight__eyebrow {
  margin: 0;
  font: 500 0.8rem/1.2 var(--font-mono);
  letter-spacing: 0.03em;   /* the demo's type-eyebrow */
  text-transform: uppercase;
  color: var(--brand-600);
}

body.alloycms .product-spotlight__headline { margin: 0; font: 800 clamp(1.75rem, 3.5vw, 2.6rem)/1.1 var(--font-display); color: var(--ink); }
body.alloycms .product-spotlight__text { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 46ch; }
body.alloycms .product-spotlight__link { font-weight: 600; color: var(--brand-500); text-decoration: none; }
body.alloycms .product-spotlight__link:hover { text-decoration: underline; }

/* Visual Builder "Dark" ground: light type. ("Brand" is LFGreen, a light fill, so the
   default Dark Fir type already reads on it.) */
body.alloycms .product-spotlight.vbg-dark { color: var(--on-dark); }
body.alloycms .product-spotlight.vbg-dark :is(.product-spotlight__headline, .price__now, .product-spotlight__eyebrow) { color: var(--on-dark); }
body.alloycms .product-spotlight.vbg-dark .product-spotlight__link { color: var(--fill); }
body.alloycms .product-spotlight.vbg-dark :is(.product-spotlight__text, .product-tile__points, .price__was) { color: var(--on-dark-dim); }
body.alloycms .product-spotlight.vbg-brand .shop-button--primary { border-color: var(--on-fill); background: var(--on-fill); color: var(--fill); }

/* ---- buy box ------------------------------------------------------------- */

body.alloycms .buy-box { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.5rem; }
body.alloycms .buy-box__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }

body.alloycms .buy-box__qty input {
  width: 4.5rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  font: inherit;
  text-align: center;
}

body.alloycms .variant-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; border: 0; }
body.alloycms .variant-picker__legend { width: 100%; margin-bottom: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }

body.alloycms .variant-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

body.alloycms .variant-picker__option {
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.9rem;
  cursor: pointer;
}

body.alloycms .variant-picker__input:checked + .variant-picker__option { border-color: var(--brand-500); box-shadow: inset 0 0 0 1px var(--brand-500); color: var(--brand-700); font-weight: 600; }
body.alloycms .variant-picker__input:focus-visible + .variant-picker__option { outline: 2px solid var(--brand-500); outline-offset: 2px; }
body.alloycms .variant-picker__input[data-stock="out"] + .variant-picker__option { color: var(--subtle); text-decoration: line-through; }

/* ---- shop listing --------------------------------------------------------- */

body.alloycms .shop { padding-block: clamp(1.5rem, 4vw, 3rem) var(--pad-band-y); }
body.alloycms .shop__header { max-width: 60ch; margin-bottom: 1.5rem; }
body.alloycms .shop__title { margin: 0; font: 800 clamp(2rem, 4.5vw, 3rem)/1.05 var(--font-display); }
body.alloycms .shop__intro { margin: 0.75rem 0 0; font-size: 1.1rem; color: var(--muted); }
body.alloycms .shop__count { margin: 0 0 1rem; font-size: 0.9rem; color: var(--subtle); }

body.alloycms .shop-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 1rem; }

body.alloycms .shop-tabs__tab {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

body.alloycms .shop-tabs__tab:hover { border-color: var(--brand-400); color: var(--brand-700); }
body.alloycms .shop-tabs__tab[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }

body.alloycms .shop-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; color: var(--muted); }

/* ---- product page --------------------------------------------------------- */

body.alloycms .pdp { padding-block: clamp(1rem, 3vw, 2rem) var(--pad-band-y); }

body.alloycms .pdp__crumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; font-size: 0.9rem; color: var(--subtle); }
body.alloycms .pdp__crumbs a { color: var(--muted); text-decoration: none; }
body.alloycms .pdp__crumbs a:hover { color: var(--brand-600); text-decoration: underline; }

body.alloycms .pdp__main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.5rem, 4vw, 4rem);
}

body.alloycms .pdp__gallery {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: var(--r-xl);
  background: var(--surface-1);
}

body.alloycms .pdp__buy { display: flex; flex-direction: column; gap: 0.5rem; }
body.alloycms .pdp__name { margin: 0; font: 800 clamp(1.9rem, 4vw, 2.75rem)/1.08 var(--font-display); }
body.alloycms .pdp__description { margin: 0.5rem 0 0; font-size: 1.05rem; color: var(--muted); }

body.alloycms .pdp__specs { margin-top: clamp(2rem, 5vw, 3.5rem); max-width: 48rem; }
body.alloycms .pdp__specs h2 { font: 700 1.35rem/1.2 var(--font-display); margin-bottom: 0.75rem; }
body.alloycms .pdp__specs dl { margin: 0; border-top: 1px solid var(--border); }
body.alloycms .pdp__specs dl > div { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
body.alloycms .pdp__specs dt { font-weight: 600; color: var(--muted); }
body.alloycms .pdp__specs dd { margin: 0; }

body.alloycms .pdp__story { margin-top: clamp(2rem, 5vw, 3.5rem); max-width: 48rem; }
body.alloycms .pdp__shared,
body.alloycms .pdp__blocks { margin-top: 2rem; }

/* ---- header mini cart ----------------------------------------------------- */

body.alloycms .navbar .mini-cart { order: 2; margin-left: auto; }
body.alloycms .navbar .navbar-toggler { order: 3; margin-left: 0.5rem; }

@media (min-width: 992px) {
  body.alloycms .navbar .navbar-collapse { order: 2; }
  body.alloycms .navbar .mini-cart { order: 3; margin-left: 0.75rem; }
}

body.alloycms .mini-cart__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

body.alloycms .mini-cart__toggle:hover { border-color: var(--brand-400); color: var(--brand-600); }
body.alloycms .mini-cart__toggle:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

body.alloycms .mini-cart__count {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent-500);
  color: var(--on-fill);
  font: 700 0.7rem/1.25rem var(--font-body);
  text-align: center;
}

body.alloycms .mini-cart__count[hidden] { display: none; }

body.alloycms .mini-cart__drawer { position: fixed; inset: 0; z-index: 1060; }
body.alloycms .mini-cart__drawer[hidden] { display: none; }
body.alloycms .mini-cart__backdrop { position: absolute; inset: 0; background: rgba(13, 20, 37, 0.45); }

body.alloycms .mini-cart__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  outline: none;
}

body.alloycms.mini-cart-open { overflow: hidden; }

body.alloycms .mini-cart__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
body.alloycms .mini-cart__head h2 { margin: 0; font: 700 1.25rem/1.2 var(--font-display); }

body.alloycms .mini-cart__close {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

body.alloycms .mini-cart__close:hover { background: var(--surface-1); color: var(--ink); }

body.alloycms .mini-cart__lines { flex: 1; overflow-y: auto; margin: 0; padding: 0.5rem 1.25rem; list-style: none; }

body.alloycms .mini-cart__line {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

body.alloycms .mini-cart__thumb { width: 56px; height: 56px; border-radius: var(--r-xs); background: var(--surface-1); object-fit: cover; }
body.alloycms .mini-cart__info p { margin: 0; }
body.alloycms .mini-cart__name { font-weight: 600; line-height: 1.3; }
body.alloycms .mini-cart__variant,
body.alloycms .mini-cart__price { font-size: 0.85rem; color: var(--muted); }
body.alloycms .mini-cart__total { margin: 0; font-weight: 600; white-space: nowrap; }

body.alloycms .mini-cart__qty { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.45rem; }
body.alloycms .mini-cart__step {
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card);
  line-height: 1;
  cursor: pointer;
}

body.alloycms .mini-cart__qty-value { min-width: 1.5rem; text-align: center; font-weight: 600; }
body.alloycms .mini-cart__remove { margin-left: 0.5rem; border: 0; background: none; padding: 0; color: var(--brand-600); font-size: 0.85rem; text-decoration: underline; cursor: pointer; }
body.alloycms .mini-cart__empty { padding: 2rem 0; color: var(--muted); text-align: center; }

body.alloycms .mini-cart__foot { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem 1.25rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-1); }
body.alloycms .mini-cart__subtotal { display: flex; justify-content: space-between; margin: 0; font-size: 1.05rem; }
body.alloycms .mini-cart__note { margin: 0; font-size: 0.8rem; color: var(--subtle); }
body.alloycms .mini-cart__status { margin: 0; font-weight: 600; color: var(--positive); }
body.alloycms .mini-cart__status:empty { display: none; }

body.alloycms .shop-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 1070;
  transform: translateX(-50%);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

body.alloycms .shop-toast[hidden] { display: none; }

/* ---- small screens --------------------------------------------------------- */

@media (max-width: 767.98px) {
  body.alloycms .product-spotlight,
  body.alloycms .pdp__main { grid-template-columns: minmax(0, 1fr); }

  body.alloycms .pdp__specs dl > div { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }

  body.alloycms .product-grid__items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  body.alloycms .product-tile__body { padding: 0.75rem; }
  body.alloycms .product-tile__foot .shop-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  body.alloycms .product-tile,
  body.alloycms .shop-button { transition: none; }
  body.alloycms .product-tile:hover { transform: none; }
}
