/* ============================================================================
   CyberKnights Robotics: store styles. Loaded per view on top of site.css via
   $data['styles'], for /shop, /shop/<handle>, /cart and /checkout/success.

   Deliberately token-driven rather than self-coloured: everything here reads
   --card / --line / --ink / --accent-text from site.css, so the store inherits
   the violet theme (and would follow a .theme-light section) instead of
   carrying a second palette that has to be kept in sync with the first.
   ========================================================================== */

/* ---- Shop grid ----------------------------------------------------------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--gap); }
a.shop-card { color: inherit; text-decoration: none; }
.shop-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease;
}
.shop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--violet); color: var(--ink); }
.shop-card__img { aspect-ratio: 4 / 3; width: 100%; object-fit: contain; background: var(--paper-2); padding: 1rem; }
.shop-card__img--ph {
  display: grid; place-items: center; padding: 0;
  font-family: var(--font-display); font-size: 2rem; color: var(--ink-3);
}
.shop-card__body { padding: 1.1rem 1.25rem 1.35rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.shop-card__title { font-family: var(--font-body); font-weight: 700; font-size: 1.08rem; margin: 0; color: var(--heading); line-height: 1.35; }
.shop-card__sub { color: var(--ink-3); font-size: .9rem; margin: 0; }
.shop-card__price { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.shop-card__compare { color: var(--ink-3); font-weight: 400; text-decoration: line-through; margin-right: .45em; }
.shop-card__foot { margin-top: auto; padding-top: .9rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.shop-card__cta { font-weight: 700; color: var(--accent-text); font-size: .9rem; }
.shop-card__cta::after { content: " \2192"; }

/* ---- Product detail ------------------------------------------------------- */
.shop-detail { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.shop-detail__img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain; padding: 1.5rem;
  border-radius: var(--r-lg); border: 1.5px solid var(--line); background: var(--paper-2);
}
.shop-detail__img--ph {
  display: grid; place-items: center; padding: 0;
  font-family: var(--font-display); font-size: 3rem; color: var(--ink-3);
}
.shop-detail__thumbs { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.shop-detail__thumb { padding: 0; border: 1.5px solid var(--line-2); border-radius: var(--r); overflow: hidden; cursor: pointer; background: var(--card); line-height: 0; }
.shop-detail__thumb.is-active { border-color: var(--cyan); }
.shop-detail__thumb img { width: 68px; height: 68px; object-fit: cover; display: block; }
.shop-detail__price { font-weight: 700; font-size: 1.8rem; margin: .6rem 0 1rem; font-variant-numeric: tabular-nums; color: var(--heading); }
.shop-detail__compare { font-size: 1.1rem; font-weight: 400; text-decoration: line-through; color: var(--ink-3); margin-right: .5rem; }
.shop-detail__desc { max-width: 62ch; line-height: 1.75; color: var(--ink-2); }
.shop-buy { display: grid; gap: 1rem; max-width: 440px; }
.shop-buy .field { margin: 0; }
.shop-buy .input--qty { max-width: 8rem; }
.shop-stock { font-weight: 700; font-size: .88rem; }
.shop-stock--out { color: var(--err); }
.shop-stock--low { color: var(--accent-text); }
@media (max-width: 820px) { .shop-detail { grid-template-columns: 1fr; } }

/* ---- Cart ----------------------------------------------------------------- */
.cart { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: clamp(1.2rem, 3vw, 2.2rem); align-items: start; }
.cart__items { display: grid; gap: .8rem; list-style: none; margin: 0; padding: 0; }
.cart-row {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) auto auto auto;
  gap: 1rem; align-items: center;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: .9rem 1.1rem;
}
.cart-row__media img, .cart-row__ph {
  width: 100%; aspect-ratio: 1 / 1; border-radius: var(--r); object-fit: contain;
  background: var(--paper-2); padding: .4rem;
}
.cart-row__ph { display: grid; place-items: center; font-family: var(--font-display); font-size: 1.2rem; color: var(--ink-3); padding: 0; }
.cart-row__title { font-weight: 700; color: var(--ink); }
.cart-row__meta { color: var(--ink-3); font-size: .88rem; }
.cart-row__note { color: var(--cyan); font-size: .88rem; font-weight: 600; }
.cart-row__qty { display: flex; gap: .4rem; align-items: center; }
.cart-row__qty .input { width: 4.5rem; }
.cart-row__total { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cart-row__remove { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--ink-3); cursor: pointer; padding: .2rem .5rem; }
.cart-row__remove:hover { color: var(--err); }
.cart__summary { position: sticky; top: calc(var(--header-h) + 1rem); }
.cart-sum { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.cart-sum--total { font-weight: 700; font-size: 1.1rem; border-top: 1.5px solid var(--line); border-bottom: 0; margin-top: .3rem; padding-top: .8rem; }
@media (max-width: 860px) {
  .cart { grid-template-columns: 1fr; }
  .cart__summary { position: static; }
  .cart-row {
    grid-template-columns: 68px minmax(0, 1fr) auto;
    grid-template-areas: "media main total" "media qty remove";
  }
  .cart-row__media { grid-area: media; grid-row: span 2; }
  .cart-row__main { grid-area: main; }
  .cart-row__qty { grid-area: qty; }
  .cart-row__total { grid-area: total; text-align: right; }
  .cart-row__remove { grid-area: remove; justify-self: end; }
}

/* ---- Order confirmation ----------------------------------------------------- */
.order-table { width: 100%; border-collapse: collapse; }
.order-table th, .order-table td { text-align: left; padding: .75rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.order-table thead th { color: var(--ink-3); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.order-table td:last-child, .order-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.order-note { color: var(--cyan); font-size: .88rem; font-weight: 600; }
