/* shop.css — C-end shop layer (product list + cart).
 *
 * Loaded from the page fragments themselves (products.html, quote-cart.html),
 * because scripts/build.py only auto-injects site/assets/css/<route-name>.css
 * and these two routes are products/ and cart/.
 *
 * Everything here either (a) styles markup that plp.js / content.js build at
 * runtime, or (b) re-points a colour the reference sheet hard-codes for its
 * light theme to the IOZITCG palette (dark surface, gold accents). Nothing here
 * changes layout that the shared fragments already define.
 */

/* ------------------------------------------------------------------ *
 * 1. Hidden states for the cart's two screens.
 *    [hidden] alone loses to Tailwind's display utilities, as elsewhere.
 * ------------------------------------------------------------------ */
[data-cart-empty][hidden],
[data-cart-filled][hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ *
 * 2. Product list: C-end price treatment.
 *    The shared card template paints the price with .text-ink, which the
 *    brand layer resolves to white; a retail card shows one price per item in
 *    the brand gold (see reference/iozi/home-1440.png). card.html is outside
 *    this task's write scope, so the colour lives here.
 * ------------------------------------------------------------------ */
[data-products-grid] > a[data-category] .text-ink {
  color: #f5cd62;
}

/* Single "In stock only" switch: pressed state is the gold accent. */
[data-stock-filter][aria-pressed='true'] {
  background: #f5cd62;
  color: #0b1a20;
  box-shadow: 0 8px 20px -12px rgba(245, 205, 98, 0.6);
}

[data-stock-filter][aria-pressed='true']:hover {
  background: #dbb75a;
}

/* ------------------------------------------------------------------ *
 * 3. Cart page.
 * ------------------------------------------------------------------ */
.ioz-cart-rows > .ioz-cart-row + .ioz-cart-row {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* The rows container is its own plate rather than .card: brand.css paints
   `.card > div:first-child` white (it is the product-photo plate on shop
   cards), which would put white text on a white panel as soon as the rows sit
   there instead of a photo. */
.ioz-cart-panel {
  padding: 0.25rem 1.25rem;
  border-radius: 1.25rem;
  background-color: #132932;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 24px rgba(2, 28, 37, 0.35);
}

.ioz-cart-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1rem 0;
}

.ioz-cart-thumb {
  flex: 0 0 auto;
  width: 4rem;
  height: 4rem;
  border-radius: 0.875rem;
  object-fit: contain;
  background: linear-gradient(160deg, #ffffff 0%, #f4f6f8 55%, #eaeff2 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  padding: 0.25rem;
}

.ioz-cart-meta {
  flex: 1 1 9rem;
  min-width: 0;
}

.ioz-cart-name {
  display: block;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
  transition: color 0.15s ease;
}

a.ioz-cart-name:hover {
  color: #f5cd62;
}

.ioz-cart-unit {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.72);
}

.ioz-cart-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.ioz-cart-step {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: 0.5rem;
  background: #17323c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.ioz-cart-step button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ioz-cart-step button:hover:not(:disabled) {
  background: #20444e;
  color: #ffffff;
}

.ioz-cart-step button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ioz-cart-step button:focus-visible {
  outline: 2px solid #f5cd62;
  outline-offset: 1px;
}

.ioz-cart-qty {
  width: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  outline: none;
}

.ioz-cart-qty::-webkit-outer-spin-button,
.ioz-cart-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ioz-cart-line {
  min-width: 5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #f5cd62;
  white-space: nowrap;
}

.ioz-cart-line small {
  display: block;
  font-weight: 400;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.55);
}

.ioz-cart-remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ioz-cart-remove:hover {
  color: #fca5a5;
  background: #20444e;
}

.ioz-cart-remove:focus-visible {
  outline: 2px solid #f5cd62;
  outline-offset: 1px;
}

.ioz-cart-clear {
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.ioz-cart-clear:hover {
  color: #fca5a5;
}

.ioz-cart-clear:focus-visible {
  outline: 2px solid #f5cd62;
  outline-offset: 2px;
}

@media (min-width: 640px) {
  .ioz-cart-row {
    flex-wrap: nowrap;
  }

  .ioz-cart-remove {
    order: 9;
  }
}

@media (max-width: 639px) {
  /* Narrow rows stack: name on top (with the remove button parked at its
     right), then the stepper and the line total on one row underneath. */
  .ioz-cart-row {
    position: relative;
    padding-right: 2.25rem;
  }

  .ioz-cart-remove {
    position: absolute;
    top: 0.85rem;
    right: 0;
  }

  .ioz-cart-actions {
    flex: 1 1 100%;
    justify-content: space-between;
    margin-left: 0;
  }
}


/* filtering can shrink the page from 122 cards to a handful; without this the
   browser re-anchors the scroll position and the view lands near the footer */
[data-products-grid] { overflow-anchor: none; }

/* stop Chrome's scroll anchoring from re-positioning the page when the grid
   shrinks after a filter change (the classic "it jumped to the footer") */
html, body { overflow-anchor: none; }
