/* ============================================================
   STORE — Fourthwall product grid + cart drawer
   Kept in its own file (loaded only by store.html) so shop work
   and site-wide style work never land on the same lines.
   Tokens (--cream, --ink, --peach …) come from css/style.css.
   ============================================================ */

/* ---------- club discount promo ribbon (infinite marquee) ---------- */
.shop-promo {
  display: block;
  overflow: hidden;
  text-decoration: none;
  background: var(--peach);
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  position: relative;
  z-index: 3;
}
.shop-promo-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: shop-promo-scroll 50s linear infinite;
}
/* pause so people can read + click when they hover or focus */
.shop-promo:hover .shop-promo-track,
.shop-promo:focus-visible .shop-promo-track { animation-play-state: paused; }
.shop-promo:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.shop-promo-seg {
  display: inline-flex;
  align-items: center;
  padding: 11px 0;
  font-family: var(--font-marker);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.shop-promo-msg strong { font-weight: 700; }
/* star doubles as the separator: equal margin each side keeps it centred
   between messages and opens up the spacing */
.shop-promo-star {
  width: 18px;
  height: 18px;
  flex: none;
  align-self: center;
  margin: 0 46px;
}
@keyframes shop-promo-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .shop-promo-track { animation: none; }
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 34px 26px;
  margin-top: 10px;
  /* cap at 3 columns so a small catalog stays neat (e.g. 5 items = 3 + 2,
     not 4 + 1 orphan); still wraps to 2 / 1 on smaller screens. */
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.shop-loading {
  grid-column: 1 / -1;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--ink-soft);
  padding: 40px 0;
}

.shop-grid .shop-placeholder { grid-column: 1 / -1; }

/* ---------- product card ---------- */
.shop-card {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 5px 0 rgba(23, 11, 17, 0.15);
  padding: 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shop-card:hover { transform: translateY(-4px) rotate(-0.5deg); box-shadow: 7px 8px 0 rgba(23, 11, 17, 0.18); }
.shop-card:nth-child(3n+2):hover { transform: translateY(-4px) rotate(0.6deg); }

.shop-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--cream-deep);
  border: 2px solid var(--paper-line);
  border-radius: 8px;
  overflow: hidden;
}

.shop-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* drawn rubber stamp, dropped across the corner of the artwork */
.shop-card-img .shop-sold-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 82%;
  height: 82%;
  object-fit: contain;
  /* no rotation: the stamp artwork runs flush to both edges of its own
     canvas (content box is x0.1-300.0 of a 0-300 viewBox), so tilting it
     makes those flush ends read as a crop. Keep it level until the SVG is
     re-exported with a little padding inside the artboard. */
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.shop-card.is-sold-out .shop-card-img img { filter: grayscale(0.7); opacity: 0.75; }

/* the stamp's letters are knocked out of the banner, so whatever sits behind
   shows through them. Over a busy photo the pale patches swallow a letter —
   this wash keeps the background even so the whole word stays readable. */
.shop-card.is-sold-out .shop-card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(243, 239, 216, 0.5);
  pointer-events: none;
}
.shop-card-img .shop-sold-stamp { z-index: 1; }

.shop-card-name {
  font-family: var(--font-marker);
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0;
}

.shop-card-price {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 0;
}

.shop-card-buy { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.shop-variant {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
  cursor: pointer;
}

/* colour + size as two separate labelled menus */
.shop-selects { display: flex; gap: 10px; flex-wrap: wrap; }
.shop-opt { flex: 1 1 45%; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.shop-opt-label { font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.5px; text-transform: uppercase; color: var(--ink-soft); }
.shop-variant option:disabled { color: #b0a99a; }

.shop-add {
  cursor: pointer;
  font-size: 0.9rem;
  padding: 12px 16px;
  width: 100%;
  border-width: 3px;
}

/* ---------- floating cart button (sits above the mail launcher) ---------- */
.cart-launcher {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 1150;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--sage);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(23, 11, 17, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cart-launcher:hover { transform: translateY(-2px) rotate(-5deg); background: var(--accent-warm-mid); }
.cart-launcher[hidden] { display: none; }
.cart-launcher svg,
.cart-launcher .cart-icon { width: 27px; height: 27px; display: block; object-fit: contain; }

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--peach);
  font-family: var(--font-marker);
  font-size: 0.8rem;
  line-height: 20px;
  text-align: center;
}

.cart-count[hidden] { display: none; }

/* ---------- cart drawer ---------- */
.cart-drawer { position: fixed; inset: 0; z-index: 1200; }
.cart-drawer[hidden] { display: none; }

.cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 11, 17, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(400px, 92vw);
  background: var(--cream);
  border-left: 3px solid var(--ink);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s ease;
}

.cart-drawer.is-open .cart-backdrop { opacity: 1; }
.cart-drawer.is-open .cart-panel { transform: translateX(0); }
.cart-drawer.is-busy .cart-panel { opacity: 0.6; pointer-events: none; }

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 14px;
  border-bottom: 2px solid var(--paper-line);
}

.cart-head h2 { font-family: var(--font-marker); font-size: 1.3rem; margin: 0; }

.cart-close {
  background: none;
  border: none;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  padding: 0 4px;
}

.cart-items { flex: 1; overflow-y: auto; padding: 16px 22px; }

.cart-empty {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--ink-soft);
  text-align: center;
  padding: 40px 10px;
}

.cart-item {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px dashed var(--paper-line);
}

.cart-item-img {
  width: 62px;
  height: 62px;
  border: 2px solid var(--paper-line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--cream-deep);
}

.cart-item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-item-info p { margin: 0; }
.cart-item-name { font-family: var(--font-marker); font-size: 0.95rem; line-height: 1.2; }
.cart-item-variant { font-size: 0.85rem; color: var(--ink-soft); }
.cart-item-price { font-family: var(--font-hand); font-size: 1rem; }

.cart-item-qty { display: flex; align-items: center; gap: 6px; }

.cart-item-qty button {
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--cream);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.cart-item-qty button:hover { background: var(--accent-warm); }
.cart-item-qty button .icon-step,
.cart-item-qty button .icon-x { width: 12px; height: 12px; margin: auto; display: block; }
.cart-item-qty button { display: flex; align-items: center; justify-content: center; }
.cart-item-qty span { min-width: 18px; text-align: center; font-family: var(--font-marker); }
.cart-item-remove { border-color: var(--paper-line) !important; color: var(--ink-soft) !important; }

.cart-foot { border-top: 2px solid var(--paper-line); padding: 18px 22px 24px; }

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-marker);
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.cart-checkout { width: 100%; cursor: pointer; border-width: 3px; }
.cart-checkout[disabled] { opacity: 0.5; cursor: default; transform: none; }
.cart-note { font-size: 0.82rem; color: var(--ink-soft); text-align: center; margin: 12px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .shop-card, .cart-panel, .cart-backdrop, .cart-launcher { transition: none; }
}

/* clickable product image + name (open the detail modal) */
.shop-card-img { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.shop-card-namebtn { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.shop-card-namebtn:hover { text-decoration: underline; text-decoration-color: var(--accent-warm-mid); text-underline-offset: 2px; }

/* ---- product detail modal: full gallery (every colour) + info ---- */
.shop-detail { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; }
.shop-detail[hidden] { display: none; }
.shop-detail-backdrop { position: absolute; inset: 0; background: rgba(23, 11, 17, 0.6); }
.shop-detail-card {
  position: relative; z-index: 1;
  display: flex;
  width: 100%; max-width: 940px; max-height: 90vh;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px;
  overflow: auto;
  box-shadow: 8px 8px 0 rgba(23, 11, 17, 0.2);
}
.shop-detail-close {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--cream); color: var(--ink); border: 2px solid var(--ink);
  font-family: var(--font-marker); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.shop-detail-gallery { flex: 1 1 48%; min-width: 0; padding: 22px; }
.shop-detail-main {
  position: relative;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden;
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
}
.shop-detail-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: rgba(243, 239, 216, 0.92); color: var(--ink); border: 2px solid var(--ink);
  font-family: var(--font-marker); font-size: 1.5rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.shop-detail-nav:hover { background: var(--peach); }
.shop-detail-nav[hidden] { display: none; }
.shop-detail-prev { left: 10px; }
.shop-detail-next { right: 10px; }
.shop-detail-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* click-to-zoom: click the main image to magnify, move the pointer (or drag on
   touch) to pan across the detail, click again to zoom back out. */
.shop-detail-main img { cursor: zoom-in; transform-origin: center center; transition: transform .18s ease; will-change: transform; }
.shop-detail-main.is-zoomed img { transform: scale(2.4); cursor: zoom-out; transition: transform .12s ease; }
.shop-detail-main.is-zoomed .shop-detail-nav { opacity: 0; pointer-events: none; }
.shop-detail-zoom-hint {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 2;
  background: rgba(23, 11, 17, 0.72); color: #fff; font-size: 0.72rem; line-height: 1;
  padding: 4px 10px; border-radius: 999px; pointer-events: none; letter-spacing: 0.02em;
}
.shop-detail-main.is-zoomed .shop-detail-zoom-hint { opacity: 0; }
@media (hover: none) { .shop-detail-zoom-hint { display: none; } }
.shop-detail-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; max-height: 210px; overflow-y: auto; padding: 2px; }
.shop-detail-thumb {
  width: 58px; height: 58px; padding: 0; overflow: hidden; cursor: pointer;
  background: #fff; border: 2px solid var(--cream-deep); border-radius: 8px;
}
.shop-detail-thumb.is-active { border-color: var(--accent-warm-mid); box-shadow: 0 0 0 2px var(--accent-warm-mid); }
.shop-detail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-detail-info { flex: 1 1 52%; min-width: 0; padding: 30px 26px 26px; display: flex; flex-direction: column; gap: 12px; }
.shop-detail-name { font-family: var(--font-marker); font-size: 1.6rem; margin: 0; }
.shop-detail-price { font-family: var(--font-marker); font-size: 1.3rem; margin: 0; color: var(--ink); }
.shop-detail-add { align-self: flex-start; cursor: pointer; margin-top: 2px; }
.shop-detail-add[disabled] { opacity: 0.5; cursor: default; transform: none; }
.shop-detail-desc { line-height: 1.55; color: var(--ink-soft); font-size: 0.95rem; }
.shop-detail-desc p { margin: 0 0 8px; }
.shop-detail-desc img { max-width: 100%; height: auto; border-radius: 8px; }
.shop-detail-desc a { color: var(--ink); text-decoration: underline; }
@media (max-width: 720px) {
  .shop-detail-card { flex-direction: column; max-height: 92vh; }
  .shop-detail-gallery, .shop-detail-info { flex: 1 1 auto; }
}
