/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* ─────────────────────────────────────────────────────────────────────
   Makerique Boutique — homepage "Shop by category" card images.
   The base .mr-cat-card (position/overflow/label gradient) lives in
   makerique.css; this component only fits the admin-managed <img> inside
   the existing 4:3 card and keeps the label/badge legible over it.
   ───────────────────────────────────────────────────────────────────── */
.mr-cat-card {
  /* Neutral ground so image-less cards aren't blank white. */
  background: var(--mr-surface);
}

.mr-cat-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
  transition: transform var(--mr-transition);
}

.mr-cat-card:hover .mr-cat-card-img {
  transform: scale(1.04);
}

/* Keep the label above the image (label styles come from makerique.css). */
.mr-cat-card .label {
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────────────────
   Card display layouts (theme_makerique_catcards_layout).
   The "grid" layout keeps the Bootstrap `.row.g-4` markup and is styled
   entirely by Bootstrap + the base .mr-cat-card — nothing added here.
   Masonry and carousel are self-contained wrappers that reuse the same
   .mr-cat-card so the boutique look (radius, shadow, label gradient from
   makerique.css) carries over.
   ───────────────────────────────────────────────────────────────────── */

/* ── Masonry: CSS multi-column, heights vary with each image ── */
.mr-catgrid--masonry {
  column-count: 2;
  column-gap: 1.5rem;
}

@media (min-width: 768px) {
  .mr-catgrid--masonry {
    column-count: 3;
  }
}

@media (min-width: 1200px) {
  .mr-catgrid--masonry {
    column-count: 4;
  }
}

.mr-catgrid--masonry .mr-cat-card {
  display: block;
  width: 100%;
  /* Keep column items whole and spaced. */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 1.5rem;
  /* Fallback height so image-less cards still show the label band. */
  min-height: 150px;
}

/* In masonry the image flows in-block so the card height follows the
   image's natural aspect ratio (no fixed 4:3), giving the staggered look. */
.mr-catgrid--masonry .mr-cat-card-img {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
}

/* ── Carousel: horizontal scroll-snap strip of fixed-width cards ── */
.mr-catgrid--carousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.85rem;
  cursor: grab;
  /* Visible, usable horizontal scrollbar. */
  scrollbar-width: thin;
  scrollbar-color: var(--mr-primary, #b4694e) var(--mr-surface-2, rgba(0, 0, 0, .06));
}

/* While click-dragging: grabbing cursor, no snap fighting the drag, no text select. */
.mr-catgrid--carousel.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
  user-select: none;
}
.mr-catgrid--carousel.is-dragging .mr-cat-card { pointer-events: none; }

.mr-catgrid--carousel::-webkit-scrollbar {
  height: 10px;
}

.mr-catgrid--carousel::-webkit-scrollbar-track {
  background: var(--mr-surface-2, rgba(0, 0, 0, .06));
  border-radius: 999px;
}

.mr-catgrid--carousel::-webkit-scrollbar-thumb {
  background: var(--mr-primary, #b4694e);
  border-radius: 999px;
}
.mr-catgrid--carousel::-webkit-scrollbar-thumb:hover {
  background: var(--mr-primary-600, #9e5842);
}

.mr-catgrid--carousel .mr-cat-card {
  flex: 0 0 auto;
  width: clamp(240px, 60vw, 280px);
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
}

/* Respect reduced-motion: no zoom transition, no smooth snap animation. */
@media (prefers-reduced-motion: reduce) {
  .mr-cat-card-img {
    transition: none;
  }

  .mr-cat-card:hover .mr-cat-card-img {
    transform: none;
  }

  .mr-catgrid--carousel {
    scroll-behavior: auto;
  }
}
