/* T.O.C. shop — product grid and cart drawer.
   Uses only the site tokens: --bg, --bg-2, --ink, --muted, --line, --ease, --gutter, --font, --font-head.
   Monochrome; .btn / .btn-primary come from site.css. */

/* ---------- grid ---------- */
.shop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px) clamp(24px, 4vw, 56px);
}
@media (min-width: 760px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.shop-card {
  display: grid;
  gap: 22px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.shop-media {
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
}
.shop-media img, .shop-media video { width: 100%; height: 100%; object-fit: cover; }

.shop-body { display: grid; gap: 18px; align-content: start; }
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.shop-name { margin: 0; }
.shop-price { margin: 0; font-family: var(--font-head); font-size: 1.1rem; white-space: nowrap; }
.shop-price small { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.04em; margin-left: 0.4em; }
.shop-tagline { margin: 0; color: var(--muted); }

/* ---------- fabric swatches ---------- */
.shop-label, .swatch-name {
  margin: 0;
  font-family: var(--font-head);
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.shop-fabrics { display: grid; gap: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch {
  width: 44px; height: 44px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-2) center / cover no-repeat;
  cursor: pointer;
  position: relative;
  transition: transform .3s var(--ease), border-color .3s var(--ease);
}
.swatch:hover { transform: translateY(-1px); border-color: var(--muted); }
.swatch::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid var(--ink); opacity: 0; transform: scale(.9);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.swatch[aria-pressed="true"]::after { opacity: 1; transform: scale(1); }
.swatch.is-placeholder {
  background-image: repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 7px);
}
.swatch-name { text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--ink); font-family: var(--font); }
.swatch-name .muted { color: var(--muted); }

/* ---------- quantity + add ---------- */
.shop-buy { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  height: 44px;
}
.qty button {
  width: 44px; height: 100%;
  background: none; border: 0; color: var(--ink);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  border-radius: 999px;
  transition: background .3s var(--ease);
}
.qty button:hover { background: var(--bg-2); }
.qty output { min-width: 1.6em; text-align: center; font-family: var(--font-head); font-size: .95rem; }
.shop-buy .btn { height: 44px; padding-block: 0; }
.shop-lead { margin: -6px 0 0; font-size: .82rem; }

/* ---------- details ---------- */
.shop-details { border-top: 1px solid var(--line); padding-top: 14px; }
.shop-details summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-head); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  padding: 4px 0;
}
.shop-details summary::-webkit-details-marker { display: none; }
.shop-details summary::after { content: "+"; font-size: 1.1rem; line-height: 1; transition: transform .3s var(--ease); }
.shop-details[open] summary::after { transform: rotate(45deg); }
.shop-details summary:hover { color: var(--ink); }
.shop-desc { margin: 16px 0 0; font-size: .92rem; color: var(--muted); }
.shop-specs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 18px 0 0; font-size: .9rem; }
.shop-specs dt { color: var(--muted); }
.shop-specs dd { margin: 0; }
.shop-details h4 { margin: 20px 0 8px; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.shop-box { margin: 0; padding-left: 1.1em; font-size: .9rem; display: grid; gap: 4px; }
.shop-error { padding: 24px 0; border-top: 1px solid var(--line); }

/* ---------- cart drawer ---------- */
html.cart-open { overflow: hidden; }

.cart-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  opacity: 0; transition: opacity .4s var(--ease);
}
.cart-backdrop.is-open { opacity: 1; }
.cart-backdrop[hidden] { display: none; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(420px, 100%);
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--bg);
  border-left: 1px solid var(--line);
  color: var(--ink);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .45s var(--ease), visibility 0s linear .45s;
}
.cart-drawer.is-open { transform: none; visibility: visible; transition: transform .45s var(--ease); }
.cart-drawer:focus { outline: none; }
@media (max-width: 560px) { .cart-drawer { width: 100%; border-left: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cart-drawer, .cart-backdrop, .swatch, .swatch::after, .qty button { transition: none; }
}

.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter) 18px;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 561px) { .cart-head, .cart-items, .cart-foot { padding-inline: 28px; } }
.cart-head h2 { margin: 0; font-size: 1.1rem; letter-spacing: 0; }
.cart-x {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: none; color: var(--ink);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  transition: border-color .3s var(--ease);
}
.cart-x:hover { border-color: var(--ink); }

.cart-items { overflow-y: auto; padding: 8px var(--gutter); }
.cart-empty { padding: 32px 0; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item {
  display: grid; grid-template-columns: 56px 1fr; gap: 16px;
  padding: 20px 0; border-bottom: 1px solid var(--line);
  position: relative;
}
.cart-swatch {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-2) center / cover no-repeat;
}
.cart-swatch.is-placeholder { background-image: repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 7px); }
.cart-item-body { display: grid; gap: 4px; min-width: 0; }
.cart-item-name { margin: 0; font-family: var(--font-head); font-weight: 500; padding-right: 64px; }
.cart-item-fabric { margin: 0; font-size: .88rem; }
.cart-item-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.cart-item-row .qty { height: 36px; }
.cart-item-row .qty button { width: 36px; }
.cart-item-total { font-family: var(--font-head); font-weight: 500; }
.cart-remove {
  position: absolute; top: 20px; right: 0;
  background: none; border: 0; padding: 2px 0;
  color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; border-bottom: 1px solid transparent;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.cart-remove:hover { color: var(--ink); border-color: var(--ink); }

.cart-foot { padding: 18px var(--gutter) 24px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.cart-subtotal { display: flex; justify-content: space-between; margin: 0; font-family: var(--font-head); font-size: 1.05rem; }
.cart-note { margin: 0; font-size: .8rem; }
.cart-msg { margin: 6px 0 0; font-size: .88rem; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); }
.cart-msg[hidden] { display: none; }
.cart-actions { display: grid; gap: 10px; margin-top: 8px; }
.cart-actions .btn { justify-content: center; }
.cart-actions .btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; }

/* header badge: hide the number when the cart is empty */
[data-cart-count][data-empty] { display: none; }
