/*
 * Shopify Headless — self-contained styles for the product grid, filter bar
 * and per-product image slider.
 *
 * These rules do NOT rely on Tailwind's runtime utility classes (Tailwind only
 * scans .php files, so the classes emitted by shopify-headless.js are never
 * compiled). Keeping the layout here guarantees the grid, arrows and dots are
 * positioned correctly wherever the shortcode is used.
 */

/* --- Full-width breakout ---------------------------------------------------
 * The shortcode is often dropped inside a narrow, centred content column
 * (e.g. the max-w-4xl prose container on the Shop page). Break the grid out to
 * the full viewport width so the products use more of the screen. */
[data-lh-shopify] {
  position: relative;
  left: 50%;
  right: 50%;
  width: 100vw;
  margin-left: -50vw;
  margin-right: -50vw;
  padding-left: clamp(1.25rem, 4vw, 4rem);
  padding-right: clamp(1.25rem, 4vw, 4rem);
  box-sizing: border-box;
}

/* --- Filter bar ------------------------------------------------------------ */
[data-lh-shopify] .lh-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}
@media (min-width: 768px) {
  [data-lh-shopify] .lh-filter-bar {
    gap: 0.75rem;
    margin-bottom: 3rem;
  }
}
[data-lh-shopify] .lh-filter-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(51, 51, 51, 0.7);
  transition: all 0.3s ease;
}
[data-lh-shopify] .lh-filter-btn:hover {
  color: #333333;
}
[data-lh-shopify] .lh-filter-btn.lh-filter-active {
  background: #5A5C45;
  color: #ffffff;
}

/* --- Product grid ---------------------------------------------------------- */
[data-lh-shopify] .lh-shopify-cards {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 2rem;
}
@media (min-width: 640px) {
  [data-lh-shopify] .lh-shopify-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  [data-lh-shopify] .lh-shopify-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
  }
}
@media (min-width: 1280px) {
  [data-lh-shopify] .lh-shopify-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* --- Card ------------------------------------------------------------------ */
[data-lh-shopify] .lh-card {
  position: relative;
}
[data-lh-shopify] .lh-card a {
  text-decoration: none;
}

/* --- Slider ---------------------------------------------------------------- */
[data-lh-shopify] .lh-slider {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}
[data-lh-shopify] .lh-track {
  display: flex;
  transition: transform 0.3s ease-out;
}
[data-lh-shopify] .lh-slide {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 4 / 5;
}
[data-lh-shopify] .lh-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Arrows — vertically centred against the image edges. */
[data-lh-shopify] .lh-prev,
[data-lh-shopify] .lh-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.8);
  color: #333333;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
  z-index: 2;
}
[data-lh-shopify] .lh-prev { left: 0.5rem; }
[data-lh-shopify] .lh-next { right: 0.5rem; }
[data-lh-shopify] .lh-card:hover .lh-prev,
[data-lh-shopify] .lh-card:hover .lh-next {
  opacity: 1;
}
[data-lh-shopify] .lh-prev:hover,
[data-lh-shopify] .lh-next:hover {
  background: #ffffff;
}
[data-lh-shopify] .lh-prev svg,
[data-lh-shopify] .lh-next svg {
  width: 1rem;
  height: 1rem;
}

/* Dots */
[data-lh-shopify] .lh-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  z-index: 2;
}
[data-lh-shopify] .lh-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: rgba(51, 51, 51, 0.3);
  cursor: pointer;
  transition: background 0.2s ease;
}
[data-lh-shopify] .lh-dot.bg-charcoal {
  background: #333333;
}

/* --- Product meta ---------------------------------------------------------- */
[data-lh-shopify] .lh-card .font-body {
  color: #333333;
  transition: color 0.2s ease;
}
[data-lh-shopify] .lh-card:hover .font-body {
  color: #5A5C45;
}
