/* =========================================================
   COLLECTION SPATIAL V3.5 — Product Card Media
   DNA: Exhibit frame + corner rupture + index line
   Mobile: DNA scaled, touch feedback refined
========================================================= */
.sv-product-card__media {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #f3f2ee;
  box-shadow: 0 7px 18px rgba(20, 28, 36, .035);
  transform: translate3d(0, 0, 0);
  transform-origin: 50% 55%;
  transition: transform 620ms cubic-bezier(.16, .78, .2, 1),
              box-shadow 620ms cubic-bezier(.16, .78, .2, 1);
  will-change: transform, box-shadow;
  -webkit-tap-highlight-color: transparent;
}

/* Exhibit frame border */
.sv-product-card__media::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  border: 1px solid rgba(24, 33, 41, .08);
  pointer-events: none;
  transition: border-color 360ms ease;
}

/* DNA corner rupture mark (top-left) */
.sv-product-card__media-corner {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 10px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  opacity: .55;
  transition: opacity 320ms ease;
}

.sv-product-card__media-corner::before,
.sv-product-card__media-corner::after {
  content: "";
  position: absolute;
  background: rgba(24, 33, 41, .45);
}

.sv-product-card__media-corner::before {
  top: 0;
  left: 0;
  width: 1px;
  height: 100%;
}

.sv-product-card__media-corner::after {
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
}

.sv-product-card__media img {
  display: block;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: contain;
  object-position: center;
  transform: translate3d(0, 0, 0);
  transition: transform 700ms cubic-bezier(.16, .78, .2, 1);
}

/* Index line (bottom-right) — DNA continuity with Hero */
.sv-product-card__media-index {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 11px;
  width: 16px;
  height: 1px;
  background: rgba(24, 33, 41, .42);
  transform-origin: right center;
  transition: width 360ms ease, transform 360ms ease;
  pointer-events: none;
}

/* Desktop hover — spatial lift + DNA response */
@media (hover: hover) and (pointer: fine) {
  .sv-collection-product-grid__item:hover .sv-product-card__media,
  .sv-product-card__media:focus-visible {
    transform: translate3d(0, -8px, 0);
    box-shadow: 0 32px 46px rgba(20, 28, 36, .16),
                0 12px 20px rgba(20, 28, 36, .065);
  }

  .sv-collection-product-grid__item:hover .sv-product-card__media::before,
  .sv-product-card__media:focus-visible::before {
    border-color: rgba(24, 33, 41, .16);
  }

  .sv-collection-product-grid__item:hover .sv-product-card__media img,
  .sv-product-card__media:focus-visible img {
    transform: translate3d(0, -1.2%, 0) scale(1.015);
  }

  .sv-collection-product-grid__item:hover .sv-product-card__media-index {
    width: 30px;
  }

  .sv-collection-product-grid__item:hover .sv-product-card__media-corner {
    opacity: .9;
  }
}

/* ---------- MOBILE DNA + TOUCH ---------- */
@media (max-width: 760px) {
  /* Scale DNA elements so they don’t feel crowded */
  .sv-product-card__media-corner {
    top: 7px;
    left: 7px;
    width: 9px;
    height: 9px;
    opacity: .45;
  }

  .sv-product-card__media-index {
    right: 9px;
    bottom: 8px;
    width: 12px;
  }

  /* Slightly softer shadow on mobile */
  .sv-product-card__media {
    box-shadow: 0 4px 12px rgba(20, 28, 36, .04);
  }
}

/* Touch feedback (all touch devices) */
@media (hover: none), (pointer: coarse) {
  .sv-product-card__media:active {
    transform: translate3d(0, -1px, 0) scale(.985);
    box-shadow: 0 3px 9px rgba(20, 28, 36, .08);
  }

  .sv-product-card__media:active img {
    transform: scale(1.01);
  }

  .sv-product-card__media:active .sv-product-card__media-index {
    width: 20px;
  }

  .sv-product-card__media:active .sv-product-card__media-corner {
    opacity: .75;
  }

  .sv-product-card__media:active::before {
    border-color: rgba(24, 33, 41, .14);
  }
}

.sv-product-card__media:focus-visible {
  outline: 2px solid rgba(70, 91, 108, .75);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .sv-product-card__media,
  .sv-product-card__media::before,
  .sv-product-card__media img,
  .sv-product-card__media-index,
  .sv-product-card__media-corner {
    transition: none !important;
  }
}
