/* ============================================
   DOTYSHOP SHORTCODE STYLES
   Product cards, grids, mobile scroll, categories,
   highlights — all shortcode-rendered components
   ============================================ */

/* ─────────────────────────────────────────────
   [ds_products] – Product Section Wrapper
   ───────────────────────────────────────────── */
.ds-ps {
  padding: 60px 24px;
  max-width: var(--ds-max-width, 1280px);
  margin: 0 auto;
}

.ds-ps__action {
  text-align: center;
  margin-top: 24px;
}

/* ─────────────────────────────────────────────
   Product Track (the scrollable / grid container)
   ALWAYS horizontal flex scroll.
   Desktop: card width = 100% / columns (shows N visible, rest scroll)
   Mobile: shows ~2.3 cards with swipe
   ───────────────────────────────────────────── */
.ds-ps__track {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.ds-ps__track::-webkit-scrollbar {
  display: none;
}

/* Card widths based on data-columns (desktop) */
.ds-ps__track[data-columns="2"] .ds-pc { flex: 0 0 calc(50% - 10px); min-width: calc(50% - 10px); }
.ds-ps__track[data-columns="3"] .ds-pc { flex: 0 0 calc(33.333% - 14px); min-width: calc(33.333% - 14px); }
.ds-ps__track[data-columns="4"] .ds-pc { flex: 0 0 calc(25% - 15px); min-width: calc(25% - 15px); }
.ds-ps__track[data-columns="5"] .ds-pc { flex: 0 0 calc(20% - 16px); min-width: calc(20% - 16px); }

.ds-ps__track .ds-pc {
  scroll-snap-align: start;
  flex-shrink: 0 !important;
}

/* Force-scroll layout (narrower cards for more peek) */
.ds-ps--force-scroll .ds-ps__track {
  gap: 16px;
  padding-bottom: 8px;
}
.ds-ps--force-scroll .ds-pc {
  flex: 0 0 220px !important;
}

/* ─────────────────────────────────────────────
   Product Card (ds-pc) — used in shortcodes
   ───────────────────────────────────────────── */
.ds-pc {
  position: relative;
  min-width: 0; /* prevent grid blowout */
}

.ds-pc__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Badge */
.ds-pc__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--ds-pink, #f5c6d0);
  color: var(--ds-dark, #1a1a1a);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  z-index: 2;
  line-height: 1.4;
}

.ds-pc__badge--sale {
  background: var(--ds-pink-dark, #d4849a);
  color: #fff;
}

/* Image wrapper */
.ds-pc__img-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--ds-light-gray, #f5f5f0);
  margin-bottom: 12px;
}

.ds-pc__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease, transform 0.5s ease;
}

/* Primary image */
.ds-pc__img-primary {
  position: relative;
  z-index: 1;
}

/* Hover image (second gallery image) */
.ds-pc__img-hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
}

.ds-pc--has-hover:hover .ds-pc__img-primary {
  opacity: 0;
}

.ds-pc--has-hover:hover .ds-pc__img-hover {
  opacity: 1;
}

/* Subtle zoom on hover for cards without a second image */
.ds-pc:not(.ds-pc--has-hover):hover .ds-pc__img-wrap img {
  transform: scale(1.05);
}

/* WooCommerce shop loop – same hover effect */
.ds-product-card__image-wrap {
  position: relative;
  overflow: hidden;
}

.ds-product-card__hover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 2;
}

.ds-product-card__image-wrap--has-hover:hover .ds-product-card__hover-img {
  opacity: 1;
}

.ds-product-card__image-wrap--has-hover:hover > img:first-child {
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* Meta: brand, name, price */
.ds-pc__meta {
  padding: 0 2px;
}

.ds-pc__brand {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ds-gray, #6b6b6b);
  margin-bottom: 3px;
}

.ds-pc__name {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 5px;
  color: var(--ds-dark, #1a1a1a);
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ds-pc__price {
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-dark, #1a1a1a);
}

.ds-pc__price del {
  text-decoration: line-through;
  color: var(--ds-gray, #6b6b6b);
  font-weight: 400;
  margin-right: 6px;
}

.ds-pc__price ins {
  text-decoration: none;
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   MOBILE: Horizontal Scroll
   On screens ≤ 768px, product grids become
   a horizontally scrollable track with partial
   card visibility (peek) at the right edge.
   ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .ds-ps {
    padding: 40px 0;
  }

  .ds-ps > .ds-section-title,
  .ds-ps > .ds-ps__action {
    padding: 0 20px;
  }

  .ds-ps__track {
    gap: 12px;
    padding: 0 20px;
  }

  /* Show ~2.3 cards on mobile */
  .ds-ps__track .ds-pc {
    flex: 0 0 calc(45% - 8px) !important;
    min-width: calc(45% - 8px);
  }

  .ds-pc__name {
    font-size: 11px;
  }
  .ds-pc__price {
    font-size: 12px;
  }
  .ds-pc__brand {
    font-size: 9px;
  }
}

@media (max-width: 480px) {
  /* Show ~1.8 cards for tighter screens */
  .ds-ps__track .ds-pc {
    flex: 0 0 calc(52% - 8px);
    min-width: calc(52% - 8px);
  }
}

/* ─────────────────────────────────────────────
   Tablet: 3 columns grid (no scroll)
   ───────────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .ds-ps__track {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ─────────────────────────────────────────────
   [ds_categories] – Category grid
   ───────────────────────────────────────────── */
.ds-cat-grid {
  display: grid;
  gap: 20px;
}
.ds-cat-grid--2col { grid-template-columns: repeat(2, 1fr); }
.ds-cat-grid--3col { grid-template-columns: repeat(3, 1fr); }
.ds-cat-grid--4col { grid-template-columns: repeat(4, 1fr); }

.ds-cat-card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  display: block;
  background: var(--ds-light-gray, #f5f5f0);
}

.ds-cat-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.ds-cat-card:hover img {
  transform: scale(1.05);
}

.ds-cat-card__label {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .ds-cat-grid--3col { grid-template-columns: repeat(2, 1fr); }
  .ds-cat-grid--4col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .ds-cat-grid--3col,
  .ds-cat-grid--4col { grid-template-columns: 1fr 1fr; }
  .ds-cat-card__label { font-size: 12px; bottom: 14px; left: 14px; }
}

/* ─────────────────────────────────────────────
   [ds_highlights] – Highlight grid (square)
   ───────────────────────────────────────────── */
.ds-hl-grid {
  display: grid;
  gap: 20px;
}
.ds-hl-grid--2col { grid-template-columns: repeat(2, 1fr); }
.ds-hl-grid--3col { grid-template-columns: repeat(3, 1fr); }
.ds-hl-grid--4col { grid-template-columns: repeat(4, 1fr); }

.ds-hl-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  display: block;
  background: var(--ds-light-gray, #f5f5f0);
}

.ds-hl-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.ds-hl-card:hover img {
  transform: scale(1.05);
}

.ds-hl-card__label {
  position: absolute;
  bottom: 16px;
  left: 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .ds-hl-grid--3col { grid-template-columns: repeat(2, 1fr); }
  .ds-hl-grid--4col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .ds-hl-grid--3col,
  .ds-hl-grid--4col { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   Scroll indicators – subtle fade hints on edges
   (mobile only, for product scroll tracks)
   ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .ds-ps {
    position: relative;
  }

  /* Right fade hint — tells user there's more content */
  .ds-ps::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), rgba(255,255,255,0));
    pointer-events: none;
    z-index: 3;
  }

  /* Hide the fade once user has scrolled to end */
  .ds-ps.ds-ps--scrolled-end::after {
    opacity: 0;
    transition: opacity 0.3s;
  }
}
