/* =====================================================================
   3M Car Care Studio Dadar — products.css
   Styles specific to the retail products feature: homepage product
   carousel, products.html grid, product card, product detail modal.
   ===================================================================== */

/* ---------------------------------------------------------------------
   0. PRODUCTS PAGE HERO
   --------------------------------------------------------------------- */
/* A dedicated modifier (rather than an inline background-image on
   .page-hero) so the dark gradient overlay stays layered with the photo
   in one background-image value — an inline background-image would
   otherwise replace the shared class's gradient outright, since inline
   styles win over the stylesheet for that same longhand property. */
.page-hero--products {
  background-image: linear-gradient(120deg, rgba(10, 10, 12, 0.92) 0%, rgba(20, 20, 22, 0.72) 60%, rgba(20, 20, 22, 0.55) 100%), url("../assets/product/Untitled-design-2025-08-07T221436.187.webp");
  background-size: cover;
  background-position: center;
}

/* ---------------------------------------------------------------------
   1. PRODUCT CARD
   --------------------------------------------------------------------- */
.product-card {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--color-grey-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover,
.product-card:focus-within {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(204, 0, 0, 0.25);
}

.product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(160deg, var(--color-off-white), var(--color-grey-100));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.12));
}

.product-card:hover .product-card__media img {
  transform: scale(1.08);
}

.product-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.06) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.product-card:hover .product-card__media::after {
  opacity: 1;
}

.product-card__brand {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  background: var(--color-white);
  color: var(--color-primary);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.product-card__body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  flex: 1;
}

.product-card__category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  font-weight: 700;
}

.product-card__body h3 {
  font-size: 1.05rem;
}

.product-card__body p {
  color: var(--text-muted);
  font-size: 0.88rem;
  flex: 1;
}

.product-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-xs);
}

.product-card__actions .btn {
  flex: 1;
  white-space: nowrap;
}

/* Button ripple micro-interaction, scoped to product actions only */
.product-card__actions .btn {
  position: relative;
  overflow: hidden;
}

.product-card__actions .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, transparent 60%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.product-card__actions .btn:active::after {
  opacity: 1;
  transform: scale(1.4);
  transition: opacity 0.05s ease, transform 0.05s ease;
}

/* ---------------------------------------------------------------------
   2. PRODUCTS GRID (products.html)
   --------------------------------------------------------------------- */
.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

/* Self-contained fade/slide-up entrance for grid cards — deliberately not
   AOS-driven, since these cards are injected on a DOMContentLoaded listener
   that runs after main.js's AOS.init() has already scanned the DOM. */
@keyframes productCardReveal {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card--reveal {
  animation: productCardReveal 0.6s ease both;
}

@media (min-width: 560px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---------------------------------------------------------------------
   3. HOMEPAGE PRODUCT CAROUSEL
   --------------------------------------------------------------------- */
.products-carousel-wrap {
  position: relative;
}

.products-carousel {
  overflow: hidden;
  padding-bottom: var(--space-xl);
}

.products-carousel .swiper-slide {
  height: auto;
}

/* Linear easing keeps the autoplay motion constant-speed with no
   ease-in/out stutter at each slide boundary (matches related-carousel). */
.products-carousel .swiper-wrapper {
  transition-timing-function: linear !important;
}

.products-carousel .swiper-pagination {
  position: static;
  margin-top: var(--space-lg);
}

.products-carousel .swiper-pagination-bullet {
  background: var(--color-grey-400);
  opacity: 1;
  width: 9px;
  height: 9px;
}

.products-view-all {
  text-align: center;
  margin-top: var(--space-lg);
}

/* ---------------------------------------------------------------------
   4. FILTER TABS (products.html — reuses .btn-outline / .services-filter
   pattern already defined for the services hub; this only extends the
   selector so shared JS logic can target either page's data-filter tabs)
   --------------------------------------------------------------------- */
.products-filter {
  transition: background var(--transition-base), color var(--transition-base);
}

/* ---------------------------------------------------------------------
   5. PRODUCT DETAIL MODAL
   --------------------------------------------------------------------- */
.product-modal__dialog {
  width: min(760px, 100%);
  aspect-ratio: auto;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: visible;
}

.product-modal__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
}

@media (min-width: 680px) {
  .product-modal__body {
    grid-template-columns: 260px 1fr;
    align-items: center;
  }
}

.product-modal__media {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--color-off-white), var(--color-grey-100));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.product-modal__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-modal__info .product-card__brand {
  position: static;
  display: inline-flex;
  margin-bottom: var(--space-sm);
  box-shadow: none;
  border: 1px solid var(--color-grey-200);
}

.product-modal__info .product-card__category {
  display: block;
  margin-bottom: var(--space-3xs);
}

.product-modal__info h3 {
  margin-bottom: var(--space-sm);
}

.product-modal__info p {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-bottom: var(--space-md);
}

.product-modal__info .cta-group {
  flex-wrap: wrap;
}
