/* ==========================================================================
   Base & Layout Configuration
   ========================================================================== */
#products {
  padding: 72px 24px;
  background-color: #ffffff;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: relative;
  box-sizing: border-box;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
}

.header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}

/* #products-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #000000;
  margin: 0 0 8px 0;
  line-height: 1.2;
} */

/* .muted {
  color: #64748b;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.5;
} */

/* ==========================================================================
   Desktop Slider Controls
   ========================================================================== */
.main-slider-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.main-slider-controls.is-hidden {
  display: none !important;
}

.ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ctrl-btn:hover:not(:disabled) {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   Outer Card Track (Horizontal Slider)
   ========================================================================== */
/* .cards-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 2px 24px 2px;
  scrollbar-width: none; /* Firefox */
 /* -ms-overflow-style: none; /* IE / Edge */
 /* -webkit-overflow-scrolling: touch; /* iOS WebKit momentum */
 /* overscroll-behavior-x: contain; /* Stop outer page bouncing */
 /* will-change: scroll-position;
}
 */

 .cards-track {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 8px 0 24px 0;
  width: 100%;
}
.cards-track::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* ==========================================================================
   Product Card Styles
   ========================================================================== */
.product-card {
  /* flex: 0 0 100%;
  scroll-snap-align: start;
  background-color: #f8f9fa;
  border: 1px solid #edf0f2;
  border-radius: 14px;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease; */
  /*transform: translateZ(0); /* iOS Hardware rendering acceleration */
  width: 100%;
  background-color: #f8f9fa;
  border: 1px solid #edf0f2;
  border-radius: 14px;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  transform: translateZ(0);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   In-Card Image Slider (Top Component)
   ========================================================================== */
.card-slider-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  background: #f1f5f9;
  overflow: hidden;
  touch-action: pan-y pinch-zoom; /* Permits vertical page scroll while swiping */
}

.card-image-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  will-change: scroll-position;
}

.card-image-track::-webkit-scrollbar {
  display: none;
}

.img-frame {
  flex: 0 0 100%;
  height: 100%;
  position: relative;
  scroll-snap-align: center;
  overflow: hidden;
  cursor: zoom-in;
  background-color: #f1f5f9;
  -webkit-tap-highlight-color: transparent;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
  pointer-events: none; /* Prevents default image drag on mobile */
  user-select: none;
}

.img-frame:hover img:not(.is-fallback) {
  transform: scale(1.05);
}

/* ==========================================================================
   Image Fallback / Placeholder Handling
   ========================================================================== */
.img-frame img.is-fallback {
  object-fit: contain !important;
  background-color: #f1f5f9;
  padding: 24px;
  box-sizing: border-box;
  cursor: default;
}

.img-frame.has-fallback {
  cursor: default !important;
}

.img-frame.has-fallback .zoom-trigger {
  display: none !important;
}

/* ==========================================================================
   Inner Nav Controls & Visual Cues
   ========================================================================== */
.inner-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    background 0.2s ease;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
}

.left-arrow {
  left: 8px;
}
.right-arrow {
  right: 8px;
}

.card-slider-wrapper:hover .inner-arrow {
  opacity: 1;
}

.inner-arrow:hover {
  background: #ffffff;
}

.slider-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
  z-index: 2;
  pointer-events: none;
}

.slider-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.25);
  transition: all 0.2s ease;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.slider-dots .dot.active {
  background: #0f172a;
  transform: scale(1.3);
}

.zoom-trigger {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(4px); /* iOS Safari Fix */
  backdrop-filter: blur(4px);
  border: none;
  font-size: 14px;
  color: #0f172a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: all 0.2s ease;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.img-frame:hover .zoom-trigger {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   Card Content
   ========================================================================== */
.card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-body h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0b0f19;
  margin: 0 0 10px 0;
}

.card-body p {
  color: #555e6d;
  line-height: 1.6;
  font-size: 0.94rem;
  margin: 0;
}

/* ==========================================================================
   Accessible Lightbox Modal
   ========================================================================== */
.lightbox-modal {
  display: none !important;
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height ya Safari */
  width: 100vw;
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(8px); /* iOS Safari */
  backdrop-filter: blur(8px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.lightbox-modal.active {
  display: flex !important;
}

.lightbox-content {
  max-width: 850px;
  width: 100%;
  text-align: center;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  max-height: 80dvh;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: inline-block;
}

.lightbox-caption {
  color: #ffffff;
  margin-top: 12px;
  font-size: 0.95rem;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (min-width: 640px) {
  .product-card {
    flex: 0 0 calc((100% - 20px) / 2);
  }
  .cards-track {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .main-slider-controls {
    display: none !important;
  }

  /* Make interactive controls visible on touch devices */
  .inner-arrow,
  .zoom-trigger {
    opacity: 1 !important;
    transform: scale(1) !important;
  }
}

@media (min-width: 1024px) {
  .product-card {
    flex: 0 0 calc((100% - (20px * 3)) / 4);
  }
  .cards-track {
    grid-template-columns: repeat(4, 1fr);
  }
}
