/* Shop: product cards fed by WooCommerce, filtered by category, scrolled as a rail. */
.cp-shop__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--cp-space-md);
  margin-bottom: var(--cp-space-lg);
}

.cp-shop__head .cp-section__lead {
  margin-top: var(--cp-space-sm);
}

.cp-shop__nav {
  display: flex;
  align-items: center;
  gap: var(--cp-space-xs);
}

.cp-shop__nav .cp-link {
  margin-right: var(--cp-space-sm);
}

/* No arrows on a touch rail: the swipe is the control. Restored from 601px up. */
.cp-shop__nav .cp-arrow {
  display: none;
}

.cp-link {
  color: inherit;
  font-size: var(--cp-text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--cp-amber);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.cp-link:hover {
  text-decoration-color: currentColor;
}

.cp-arrow {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid var(--cp-ink);
  background: var(--cp-sheet);
  color: var(--cp-ink);
  cursor: pointer;
  transition: background-color var(--cp-duration) var(--cp-ease), color var(--cp-duration) var(--cp-ease);
}

.cp-arrow svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.cp-arrow:hover:not(:disabled) {
  background: var(--cp-ink);
  color: var(--cp-sheet);
}

.cp-arrow:disabled {
  border-color: var(--cp-line);
  color: var(--cp-line);
  cursor: default;
}

.cp-filters {
  display: flex;
  gap: var(--cp-space-2xs);
  margin-bottom: var(--cp-space-md);
  overflow-x: auto;
  scrollbar-width: none;
}

.cp-filters::-webkit-scrollbar {
  display: none;
}

.cp-filter {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--cp-space-xs);
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--cp-line);
  background: var(--cp-sheet);
  color: var(--cp-ink);
  font: 500 var(--cp-text-sm) / 1 var(--cp-font-body);
  cursor: pointer;
  transition: border-color var(--cp-duration) var(--cp-ease);
}

.cp-filter span {
  color: var(--cp-graphite);
  font-size: var(--cp-text-xs);
  font-variant-numeric: tabular-nums;
}

.cp-filter:hover {
  border-color: var(--cp-ink);
}

.cp-filter[aria-pressed='true'] {
  border-color: var(--cp-ink);
  background: var(--cp-ink);
  color: var(--cp-sheet);
}

.cp-filter[aria-pressed='true'] span {
  color: var(--cp-amber);
}

/* Mobile-first: 1.6 cards peek past the gutter at 390px; the rail widens with the viewport. */
.cp-shop__track {
  --cards: 1.6;
  --gap: 0.75rem;
  display: grid;
  grid-auto-columns: calc((100% - var(--gap) * (var(--cards) - 1)) / var(--cards));
  grid-auto-flow: column;
  gap: var(--gap);
  /* The rail bleeds into the right gutter so the cut card reads as "there is more". */
  margin: 0 calc(var(--cp-gutter) * -1) 0 0;
  padding: 0 var(--cp-gutter) 0.25rem 0;
  scroll-padding-inline: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  list-style: none;
}

.cp-shop__track::-webkit-scrollbar {
  display: none;
}

/* Card */
.cp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--cp-line);
  background: var(--cp-sheet);
  scroll-snap-align: start;
  transition: border-color var(--cp-duration) var(--cp-ease);
}

.cp-card[hidden] {
  display: none;
}

.cp-card:hover,
.cp-card:focus-within {
  border-color: var(--cp-ink);
}

.cp-card__media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--cp-slot);
}

.cp-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 500ms var(--cp-ease), opacity 300ms var(--cp-ease);
}

.cp-card__media--photo .cp-card__image {
  object-fit: cover;
}

.cp-card__image--alt {
  opacity: 0;
}

.cp-card:hover .cp-card__image {
  transform: scale(1.04);
}

.cp-card:hover .cp-card__image--alt {
  opacity: 1;
}

.cp-card__badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  pointer-events: none;
}

.cp-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--cp-ink);
  background: var(--cp-sheet);
  color: var(--cp-ink);
  font-size: var(--cp-text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.cp-badge--amber {
  background: var(--cp-amber);
}

.cp-badge--ink {
  background: var(--cp-ink);
  color: var(--cp-sheet);
}

.cp-badge--dark {
  border-color: var(--cp-line-dark);
  background: transparent;
  color: var(--cp-sheet);
}

.cp-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.375rem;
  padding: var(--cp-space-sm);
}

.cp-card__category {
  color: var(--cp-graphite);
  font-size: var(--cp-text-xs);
}

.cp-card__title {
  font-size: var(--cp-text-md);
  font-weight: 600;
  line-height: 1.3;
}

.cp-card__title a {
  text-decoration: none;
}

.cp-card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.cp-card__title a:focus-visible {
  outline: none;
}

.cp-card__title a:focus-visible::after {
  outline: 3px solid var(--cp-amber);
  outline-offset: -3px;
}

.cp-card__meta {
  color: var(--cp-graphite);
  font-size: var(--cp-text-xs);
}

.cp-card__swatches {
  display: flex;
  gap: 0.3125rem;
  margin: 0.125rem 0 0;
  padding: 0;
  list-style: none;
}

.cp-card__swatches li {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--cp-radius-circle);
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cp-ink) 18%, transparent);
}

.cp-card__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--cp-space-xs);
  margin-top: auto;
  padding-top: var(--cp-space-sm);
}

.cp-card__price {
  font-size: var(--cp-text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.cp-card__price small {
  display: block;
  color: var(--cp-graphite);
  font-size: var(--cp-text-xs);
  font-weight: 500;
}

.cp-card__action {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.5rem;
  padding: 0 0.875rem;
  border: 2px solid var(--cp-ink);
  background: var(--cp-sheet);
  color: var(--cp-ink);
  font: 600 var(--cp-text-sm) / 1 var(--cp-font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--cp-duration) var(--cp-ease), color var(--cp-duration) var(--cp-ease);
}

.cp-card__action:hover {
  background: var(--cp-ink);
  color: var(--cp-sheet);
}

.cp-card__action--cart {
  background: var(--cp-amber);
}

.cp-card__action[data-added='true'] {
  background: var(--cp-ink);
  color: var(--cp-sheet);
}

.cp-card__action[data-added='true']::before {
  content: '';
  width: 0.75rem;
  height: 0.4rem;
  border-bottom: 2px solid var(--cp-amber);
  border-left: 2px solid var(--cp-amber);
  transform: translateY(-2px) rotate(-45deg);
}

/*
 * The cart badge used to be styled here. It is in `header.php`, so it renders on every
 * page, and this stylesheet is enqueued only on the front page (`inc/setup.php`, the
 * `is_front_page()` early return) — so everywhere but the home the badge fell back to a
 * bare underlined "1" stacked under the cart icon. It now lives in base.css next to
 * `.cp-icon-link`, which is the anchor it sits inside. Nothing that renders outside this
 * page's sections belongs in this file.
 */

/* Custom-order strip */
.cp-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cp-space-sm) var(--cp-space-md);
  margin-top: var(--cp-space-md);
  padding: var(--cp-space-sm) var(--cp-space-md);
  border: 1px dashed var(--cp-ink);
}

.cp-custom__text {
  font-size: var(--cp-text-md);
}

/* ------------------------------------------------------------------ *
 * Wider screens. 601px and 1081px are the exact complements of the
 * 600px / 1080px max-width queries these replace.
 * ------------------------------------------------------------------ */
@media (min-width: 601px) {
  .cp-shop__track {
    --cards: 2.6;
    --gap: 1rem;
    margin-right: 0;
    padding-right: 0;
    /* `auto` is the initial value: the rail stops bleeding into the gutter. */
    scroll-padding-inline: auto;
  }

  .cp-shop__nav .cp-arrow {
    display: grid;
  }

  .cp-card__footer {
    flex-direction: row;
    align-items: center;
  }
}

@media (min-width: 1081px) {
  .cp-shop__track {
    --cards: 4;
  }
}
