/*
  JustTeia - shop.css
  Shop archive: header, category rail, filter toolbar,
  product grid, cards, pagination.
  Loaded only on shop / product category / tag / search.
*/

/* ── SHOP HEADER ────────────────────────────────── */
.shop-head {
  background: linear-gradient(135deg, var(--bg-alt), var(--surface-2));
  padding: 44px 0 32px;
  border-bottom: 1.5px solid var(--border);
}
.shop-crumb {
  font-family: 'Nunito', sans-serif;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 10px;
}
.shop-crumb a { color: var(--text-mid); transition: color 150ms var(--ease); }
.shop-crumb a:hover { color: var(--cta); }
.shop-crumb .sep { margin: 0 8px; color: var(--text-light); }
.shop-title { margin: 0; font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl)); }
.shop-desc { margin-top: 10px; max-width: 62ch; font-size: var(--text-base); }

/* ── CATEGORY RAIL ──────────────────────────────── */
.shop-rail {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 72px;
  z-index: 300;
}
.cat-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
  scroll-snap-type: x proximity;
}
.cat-rail::-webkit-scrollbar { display: none; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 8px 18px 8px 8px;
  border-radius: var(--r-pill);
  border: 2px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 180ms var(--ease), transform 180ms var(--spring), box-shadow 180ms var(--ease);
  min-height: 48px;
}
.cat-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--border-mid); }
.cat-chip.is-active {
  border-color: var(--cta);
  background: linear-gradient(135deg, #fff8fb, var(--surface));
  box-shadow: 0 3px 12px rgba(255,107,157,0.2);
}
.cat-chip-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
  background: var(--chip-colour, var(--lavender));
}
/* The per-category colours are generated into the head from term meta. */
.cat-chip-dot.jt-chip-all { background: var(--yellow); }
.cat-chip-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  white-space: nowrap;
}
.cat-chip.is-active .cat-chip-label { color: var(--cta); }
.cat-chip-count {
  font-family: 'Nunito', sans-serif;
  font-style: normal;
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--text-light);
}

/* ── FILTER TOOLBAR ─────────────────────────────── */
.shop-body { padding: 28px 0 96px; }
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 26px;
  border-bottom: 1.5px solid var(--border);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.tb-drop { position: relative; }
.tb-drop > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border-mid);
  border-radius: var(--r-pill);
  padding: 9px 16px;
  min-height: 44px;
  transition: border-color 150ms var(--ease);
}
.tb-drop > summary::-webkit-details-marker { display: none; }
.tb-drop > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 200ms var(--ease);
}
.tb-drop[open] > summary { border-color: var(--cta); color: var(--cta); }
.tb-drop[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.tb-drop.has-value > summary { border-color: var(--cta); background: rgba(255,107,157,0.07); }

.tb-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 320;
  min-width: 250px;
  background: var(--surface);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
}
.tb-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
  min-height: 40px;
}
.tb-check input { width: 18px; height: 18px; accent-color: var(--cta); cursor: pointer; }
.tb-range { display: flex; align-items: center; gap: 8px; }
.tb-range input {
  width: 92px;
  padding: 9px 12px;
  border: 2px solid var(--border-mid);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}
.tb-range input:focus { border-color: var(--cta); background: var(--surface); }
.tb-range span { color: var(--text-light); font-weight: 800; }
.tb-pop-note { font-size: var(--text-xs); color: var(--text-light); margin-top: 10px; }
.tb-pop-apply { margin-top: 12px; width: 100%; }

.tb-clear {
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--cta);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 4px;
  min-height: 44px;
}
.tb-count { font-family: 'Nunito', sans-serif; font-size: var(--text-sm); color: var(--text-light); font-weight: 700; }

.tb-sort { display: inline-flex; align-items: center; gap: 8px; }
.tb-sort span { font-family: 'Nunito', sans-serif; font-weight: 700; font-size: var(--text-sm); color: var(--text-mid); }
.tb-sort select {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
  padding: 9px 16px;
  min-height: 44px;
  border: 2px solid var(--border-mid);
  border-radius: var(--r-pill);
  background: var(--surface);
  cursor: pointer;
  outline: none;
}
.tb-sort select:focus { border-color: var(--cta); }

.tb-density { display: flex; gap: 4px; }
.tb-density button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-light);
  transition: all 150ms var(--ease);
}
.tb-density button:hover { border-color: var(--border-mid); color: var(--text-mid); }
.tb-density button.is-active { border-color: var(--cta); color: var(--cta); background: rgba(255,107,157,0.07); }
.tb-density svg { width: 16px; height: 16px; }

/* ── ACTIVE FILTER PILLS ────────────────────────── */
.tb-active { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tb-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--text);
  background: var(--bg-alt);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--r-pill);
  padding: 6px 8px 6px 14px;
}
.tb-pill button {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(255,107,157,0.15);
  color: var(--cta);
  font-size: 0.7rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.tb-pill button:hover { background: var(--cta); color: #fff; }

/* ── PRODUCT GRID ───────────────────────────────── */
ul.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.products.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
ul.products.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
ul.products.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }

.shop-results { transition: opacity 200ms var(--ease); }
.shop-results[aria-busy="true"] { opacity: 0.45; pointer-events: none; }

/* ── PRODUCT CARD ───────────────────────────────── */
li.product.jt-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform 260ms var(--spring), box-shadow 260ms var(--ease), border-color 200ms var(--ease);
}
li.product.jt-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-mid);
}
.jt-card-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(135deg, #FFE4EF, #EDE0F7);
}
.jt-card-media > a { display: block; width: 100%; height: 100%; }
.jt-card-img,
.jt-card-img-alt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 350ms var(--ease), transform 500ms var(--ease);
}
.jt-card-img-alt { opacity: 0; }
li.product.jt-card:hover .jt-card-img { transform: scale(1.05); }
li.product.jt-card:hover .jt-card-img-alt { opacity: 1; transform: scale(1.05); }
.jt-card-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 56px;
}

.jt-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.jt-badge {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  line-height: 1.5;
}
.jt-badge-sale { background: var(--cta); color: #fff; }
.jt-badge-new { background: var(--mint-deep); color: #fff; }
.jt-badge-out { background: var(--text-mid); color: #fff; }

.jt-quick-add {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--yellow);
  border: none;
  border-radius: var(--r-pill);
  padding: 11px 18px;
  min-height: 44px;
  box-shadow: 0 4px 14px rgba(45,36,56,0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms var(--ease), transform 220ms var(--spring), background 150ms;
  text-decoration: none;
}
li.product.jt-card:hover .jt-quick-add,
.jt-quick-add:focus-visible { opacity: 1; transform: translateY(0); }
.jt-quick-add:hover { background: var(--yellow-deep); }
.jt-quick-add[disabled] {
  opacity: 1;
  transform: none;
  background: var(--border-mid);
  color: var(--text-mid);
  cursor: not-allowed;
}
.jt-quick-add.is-loading { color: transparent; }
.jt-quick-add.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(45,36,56,0.25);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: jtSpin 700ms linear infinite;
}
@keyframes jtSpin { to { transform: rotate(360deg); } }

.jt-card-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.jt-card-cat {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
}
.jt-card-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1.25;
  margin: 0;
}
.jt-card-title a { color: var(--text); transition: color 150ms var(--ease); }
li.product.jt-card:hover .jt-card-title a { color: var(--cta); }
.jt-card-price {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--cta);
  margin-top: auto;
  padding-top: 6px;
}
.jt-card-price del { color: var(--text-light); font-weight: 400; font-size: 0.85em; margin-right: 6px; }
.jt-card-price ins { text-decoration: none; }

/* Denser grids get smaller type */
ul.products.cols-4 .jt-card-title,
ul.products.cols-5 .jt-card-title { font-size: var(--text-base); }
ul.products.cols-4 .jt-card-price,
ul.products.cols-5 .jt-card-price { font-size: var(--text-base); }
ul.products.cols-5 .jt-card-body { padding: 12px 12px 14px; }
ul.products.cols-5 .jt-quick-add { font-size: 0.8125rem; padding: 9px 12px; }

/* ── PAGINATION ─────────────────────────────────── */
.jt-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 52px;
  flex-wrap: wrap;
}
.jt-page,
.jt-page-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 2px solid var(--border-mid);
  background: var(--surface);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-mid);
  text-decoration: none;
  transition: all 160ms var(--ease);
}
.jt-page:hover,
.jt-page-nav:hover { border-color: var(--cta); color: var(--cta); }
.jt-page.is-current { background: var(--cta); border-color: var(--cta); color: #fff; }
.jt-page-gap { color: var(--text-light); padding: 0 4px; }
.jt-page-nav[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* ── EMPTY STATE ────────────────────────────────── */
.jt-empty { text-align: center; padding: 80px 20px; }
.jt-empty-emoji { font-size: 68px; margin-bottom: 18px; }
.jt-empty h2 { margin-bottom: 12px; }
.jt-empty p { font-size: var(--text-lg); margin-bottom: 28px; }

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 1024px) {
  ul.products,
  ul.products.cols-3,
  ul.products.cols-4,
  ul.products.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 768px) {
  .shop-rail { top: 64px; padding: 12px 0; }
  .shop-head { padding: 32px 0 24px; }
  .shop-toolbar { gap: 10px; }
  .tb-left, .tb-right { width: 100%; justify-content: space-between; }
  .tb-density { display: none; }
  ul.products,
  ul.products.cols-3,
  ul.products.cols-4,
  ul.products.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .jt-card-title { font-size: var(--text-base); }
  .jt-card-price { font-size: var(--text-base); }
  /* Touch devices have no hover, so quick-add stays visible */
  .jt-quick-add { opacity: 1; transform: none; font-size: 0.8125rem; padding: 9px 12px; }
}
@media (max-width: 480px) {
  .tb-sort span { display: none; }
  ul.products,
  ul.products.cols-3,
  ul.products.cols-4,
  ul.products.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .jt-card-body { padding: 10px 12px 14px; }
}
