/* ═══════════════════════════════════════════════════════
   AnyMarket Product Showcase v1.02
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

/* ─── Container ─── */
.ams-showcase {
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* ─── Fade edges ─── */
.ams-edge {
  position: absolute;
  left: 0;
  right: 0;
  height: 40px;
  z-index: 10;
  pointer-events: none;
}
.ams-edge-top { top: 0; }
.ams-edge-bot { bottom: 0; }

/* ─── Grid: 4 fixed columns, 5 explicit rows ─── */
.ams-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* grid-template-rows and grid-gap set inline via PHP */
  width: 100%;
}

/* ─── Cell ───
   <a> tag. Must fill its entire grid area.
   Images are positioned absolutely inside.
*/
.ams-cell {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--ams-radius, 12px);
  text-decoration: none;
  cursor: pointer;
  /* CRITICAL: stretch to fill the grid area completely */
  width: 100%;
  height: 100%;
  min-height: 0;   /* prevent grid blowout */
  min-width: 0;
}

/* ─── Images ───
   Both stacked absolutely, covering the full cell.
   object-fit: cover fills edge-to-edge, cropping as needed.
*/
.ams-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: var(--ams-radius, 12px);
  display: block;
}

/* Current image: visible, behind next */
.ams-cur {
  opacity: 1;
  z-index: 1;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Next image: invisible, sits on top, ready to fade in */
.ams-nxt {
  opacity: 0;
  z-index: 2;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* During swap: next fades in over current. Current stays put. No gap. */
.ams-cell.ams-swap .ams-nxt {
  opacity: 1;
}

/* ─── Hover: subtle zoom ─── */
.ams-cell:hover .ams-cur,
.ams-cell:hover .ams-nxt {
  transform: scale(1.04);
  transition: opacity 1s cubic-bezier(0.4,0,0.2,1), transform 0.6s cubic-bezier(0.16,1,0.3,1);
}

/* ─── Overlay (hover only) ─── */
.ams-ov {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  background: linear-gradient(0deg,
    rgba(28,26,23,0.8) 0%,
    rgba(28,26,23,0.35) 40%,
    transparent 65%
  );
  border-radius: var(--ams-radius, 12px);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.ams-cell:hover .ams-ov {
  opacity: 1;
}

/* Hero cells get more overlay padding */
.ams-hero .ams-ov {
  padding: 24px;
}

.ams-ov-cat {
  font-family: 'Outfit', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: #C89B5E;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.ams-ov-name {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #FFFFFF;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ams-hero .ams-ov-name {
  font-size: 16px;
  -webkit-line-clamp: 3;
}

.ams-ov-price {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #C89B5E;
  margin-top: 4px;
}

.ams-ov-price del { color: #A99E91; font-weight: 400; font-size: 11px; }
.ams-ov-price ins { text-decoration: none; }

.ams-hero .ams-ov-price {
  font-size: 16px;
}

/* ─── Entrance stagger ─── */
@keyframes ams-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.ams-cell { animation: ams-in 0.5s cubic-bezier(0.16,1,0.3,1) both; }
.ams-cell:nth-child(1)  { animation-delay: 0.00s; }
.ams-cell:nth-child(2)  { animation-delay: 0.04s; }
.ams-cell:nth-child(3)  { animation-delay: 0.08s; }
.ams-cell:nth-child(4)  { animation-delay: 0.12s; }
.ams-cell:nth-child(5)  { animation-delay: 0.16s; }
.ams-cell:nth-child(6)  { animation-delay: 0.20s; }
.ams-cell:nth-child(7)  { animation-delay: 0.24s; }
.ams-cell:nth-child(8)  { animation-delay: 0.28s; }
.ams-cell:nth-child(9)  { animation-delay: 0.32s; }
.ams-cell:nth-child(10) { animation-delay: 0.36s; }
.ams-cell:nth-child(11) { animation-delay: 0.40s; }
.ams-cell:nth-child(12) { animation-delay: 0.44s; }
.ams-cell:nth-child(13) { animation-delay: 0.48s; }
.ams-cell:nth-child(14) { animation-delay: 0.52s; }

/* ─── Responsive ─── */
@media (max-width: 991px) {
  .ams-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  /* Heroes become 2×1 on tablet (wide but single row) */
  .ams-hero {
    grid-column: span 2 !important;
    grid-row: span 1 !important;
  }
}

@media (max-width: 600px) {
  .ams-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-gap: 4px !important;
  }
  .ams-cell   { border-radius: 8px !important; }
  .ams-img    { border-radius: 8px !important; }
  .ams-ov     { border-radius: 8px !important; padding: 12px; }
  .ams-edge   { height: 20px; }
  .ams-hero   { grid-column: span 2 !important; grid-row: span 1 !important; }
}
