/* ===========================================================================
   PeelBoard Supply — /shop hub, product pages and the cart drawer.
   Tokens + base come from /css/site.css; nav/footer/prose from /css/pages.css.
   Dark theme, one accent, the same radius system as the rest of the site.
   =========================================================================== */

/* ── nav cart button (injected into .nav-actions by js/shop.js) ───────────── */
.cart-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: var(--r-btn);
  background: var(--bg-card); color: var(--text);
  cursor: pointer;
  transition: border-color .22s var(--ease), background .22s var(--ease);
}
.cart-btn:hover { border-color: var(--accent-line); background: var(--bg-raise); }
.cart-btn svg { width: 19px; height: 19px; display: block; }
.cart-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 19px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.cart-count[hidden] { display: none; }

/* ── badges ───────────────────────────────────────────────────────────────── */
.s-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border-hi); background: var(--bg-inset); color: var(--muted);
}
.s-badge--soon { border-color: var(--border-hi); color: var(--dim); }
.s-badge--stock { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-hi); }

/* ── hub: product grid ────────────────────────────────────────────────────── */
.s-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 10px; }
.s-card {
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.s-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.s-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.s-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-card-media .s-badge { position: absolute; top: 12px; left: 12px; background: rgba(8,8,10,0.86); }
.s-card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.s-kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-hi);
}
.s-card h3 { font-size: 18.5px; margin: 10px 0 8px; line-height: 1.3; }
.s-card p { color: var(--muted); font-size: 14.5px; line-height: 1.55; margin: 0; }
.s-card-foot {
  margin-top: auto; padding-top: 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.s-price {
  font-family: 'Archivo', sans-serif; font-weight: 800;
  font-size: 21px; letter-spacing: -0.03em; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.s-price small { font-family: 'Inter', sans-serif; font-weight: 500; font-size: 12.5px; color: var(--dim); letter-spacing: 0; }
.s-card-more { font-size: 13.5px; font-weight: 600; color: var(--accent-hi); }
.s-card:hover .s-card-more { text-decoration: underline; text-underline-offset: 3px; }

/* ── "how ordering works" strip ───────────────────────────────────────────── */
.s-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 10px; }
.s-how .card { padding: 24px 26px; }
.s-how h3 { font-size: 16.5px; margin-bottom: 10px; }
.s-how p { color: var(--muted); font-size: 14.5px; line-height: 1.6; }

/* ── cross-sell block ─────────────────────────────────────────────────────── */
.s-cross {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: 26px 30px;
  border: 1px solid var(--accent-line); border-radius: var(--r-card);
  background: linear-gradient(180deg, rgba(99,102,241,0.08), var(--bg-card) 70%);
}
.s-cross h2 { font-size: clamp(19px, 2.2vw, 24px); }
.s-cross p { color: var(--muted); font-size: 15px; margin-top: 8px; max-width: 56ch; }

/* ── product page: two columns ────────────────────────────────────────────── */
.s-product { display: grid; grid-template-columns: 1.05fr 1fr; gap: 54px; align-items: start; }

/* gallery */
.s-gallery { position: sticky; top: 92px; }
.s-main-img {
  aspect-ratio: 1 / 1;
  background: var(--bg-inset);
  border: 1px solid var(--border); border-radius: var(--r-card);
  overflow: hidden;
}
.s-main-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.s-thumb {
  width: 72px; height: 72px; padding: 0;
  background: var(--bg-inset);
  border: 1px solid var(--border); border-radius: var(--r-btn);
  overflow: hidden; cursor: pointer;
  transition: border-color .2s var(--ease);
}
.s-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-thumb:hover { border-color: var(--border-hi); }
.s-thumb[aria-current="true"] { border-color: var(--accent); }

/* details */
.s-details h1 { font-size: clamp(27px, 3.4vw, 38px); margin: 12px 0 0; }
.s-price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-top: 18px; }
.s-price-lg {
  font-family: 'Archivo', sans-serif; font-weight: 800;
  font-size: 30px; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.s-compare { font-size: 17px; font-weight: 500; color: var(--dim); text-decoration: line-through; }
.s-avail { margin-top: 14px; font-size: 14px; color: var(--muted); }
.s-avail.is-out { color: var(--dim); }

/* option pills */
.s-opt { margin-top: 26px; }
.s-opt-name { font-size: 13px; font-weight: 600; color: var(--dim); letter-spacing: 0.04em; text-transform: uppercase; }
.s-pills { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 11px; }
.s-pill {
  font-size: 14px; font-weight: 500; color: var(--muted);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 10px 16px; min-height: 44px; border-radius: 999px;
  display: inline-flex; align-items: center; cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.s-pill:hover:not(:disabled) { border-color: var(--border-hi); color: var(--text); }
.s-pill[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.s-pill:disabled { opacity: 0.38; cursor: not-allowed; text-decoration: line-through; }

/* quantity + add to cart */
.s-buy { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; align-items: center; }
.s-qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--r-btn);
  background: var(--bg-card);
}
.s-qty button {
  width: 44px; height: 46px; padding: 0;
  background: none; border: 0; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: color .2s var(--ease);
}
.s-qty button:hover:not(:disabled) { color: var(--text); }
.s-qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.s-qty input {
  width: 44px; height: 46px; padding: 0;
  background: none; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 15px; font-weight: 600; text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.s-qty input::-webkit-outer-spin-button, .s-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.s-add { flex: 1; min-width: 190px; justify-content: center; }
.s-add:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.s-notes { margin-top: 24px; display: grid; gap: 8px; }
.s-notes li { position: relative; padding-left: 20px; color: var(--muted); font-size: 14.5px; line-height: 1.55; list-style: none; }
.s-notes li::before { content: ''; position: absolute; left: 4px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-line); }

.s-cross-line { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); font-size: 14.5px; color: var(--muted); }
.s-cross-line a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }

/* "more from the shop" */
.s-more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 8px; }
.s-more-card {
  display: block; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-card);
  overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.s-more-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.s-more-card .s-card-media { aspect-ratio: 1 / 1; }
.s-more-card .s-more-body { padding: 14px 16px 16px; }
.s-more-card h3 { font-size: 15px; line-height: 1.35; margin: 0; }
.s-more-card .s-price { font-size: 15px; display: block; margin-top: 8px; }

/* ── cart drawer ──────────────────────────────────────────────────────────── */
.cart-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(4,4,6,0.66);
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ease);
}
.cart-backdrop.is-open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 401;
  width: min(420px, 100vw);
  display: flex; flex-direction: column;
  background: var(--bg-raise);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0,0,0,0.5);
  transform: translateX(100%);
  transition: transform .3s var(--ease);
}
.cart-drawer.is-open { transform: translateX(0); }

/* .cart-drawer sets display:flex and .cart-backdrop position:fixed, which both
 * beat the hidden attribute's UA display:none — so a "closed" drawer stayed in
 * the accessibility tree with its Close button and links focusable. */
.cart-drawer[hidden], .cart-backdrop[hidden] { display: none; }

.cart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cart-head h2 { font-size: 18px; }
.cart-close {
  width: 40px; height: 40px; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: var(--r-btn);
  color: var(--muted); font-size: 20px; line-height: 1;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.cart-close:hover { color: var(--text); border-color: var(--border-hi); }

.cart-body { flex: 1; overflow-y: auto; padding: 8px 22px; }
.cart-empty { padding: 60px 0; text-align: center; color: var(--dim); font-size: 14.5px; line-height: 1.7; }
.cart-empty a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }

.cart-line { display: grid; grid-template-columns: 62px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: 0; }
.cart-line-img {
  width: 62px; height: 62px; border-radius: var(--r-btn);
  background: var(--bg-inset); border: 1px solid var(--border); overflow: hidden;
}
.cart-line-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-line h3 { font-size: 14.5px; line-height: 1.35; font-family: 'Inter', sans-serif; font-weight: 600; letter-spacing: 0; }
.cart-line .cart-line-variant { font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.cart-line-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.cart-line-price { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; }
.cart-qty button {
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: none; border: 0; color: var(--muted); font-size: 15px; line-height: 1;
}
.cart-qty button:hover { color: var(--text); }
.cart-qty span { min-width: 22px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-remove {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--dim); text-decoration: underline; text-underline-offset: 2px;
}
.cart-remove:hover { color: var(--muted); }

.cart-foot { flex-shrink: 0; padding: 20px 22px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-card); }
.cart-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cart-sub span { color: var(--muted); font-size: 14.5px; }
.cart-sub b { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cart-foot .btn { width: 100%; justify-content: center; margin-top: 16px; }
.cart-note { margin-top: 12px; font-size: 12.5px; color: var(--dim); text-align: center; line-height: 1.6; }
body.cart-open { overflow: hidden; }

/* ── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .s-grid { grid-template-columns: repeat(2, 1fr); }
  .s-product { grid-template-columns: 1fr; gap: 34px; }
  .s-gallery { position: static; }
  .s-more-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .s-how { grid-template-columns: 1fr; }
  .s-cross { padding: 22px 22px; }
  .s-card-body { padding: 18px 18px 20px; }
}
@media (max-width: 520px) {
  .s-grid { grid-template-columns: 1fr; }
  .s-add { width: 100%; flex: none; }
  .s-thumb { width: 60px; height: 60px; }
  .cart-drawer { width: 100vw; }
}
@media (max-width: 430px) {
  /* the cart button is one more thing in .nav-actions than the rest of the
     site carries, and on a 360px phone that tipped the nav into a sideways
     scroll. Sign in is in the footer of every shop page too. */
  #nav .nav-signin { display: none; }
}
@media (max-width: 380px) {
  .s-more-grid { grid-template-columns: 1fr; }
  .s-buy { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .s-card, .s-more-card, .s-pill, .cart-drawer, .cart-backdrop, .cart-btn, .s-thumb {
    transition: none !important;
  }
  .s-card:hover, .s-more-card:hover { transform: none; }
}

/* Product description sits right under the gallery/details block — no double section gap. */
.s-desc { padding-top: 0; }
.s-desc .prose { max-width: 760px; }
