/* -------------------------------------------------------------------------
   Clasitrónicos card-photo treatment V1
   -------------------------------------------------------------------------
   Each listing already contains two copies of the same image:
     .front            = the complete, uncropped photograph
     .background-blur  = the full-bleed background layer

   These rules keep every card image area uniform while preserving the full
   subject. The background copy fills the frame; the foreground copy uses
   object-fit: contain so cars, houses, pets, and portrait photos are not cut.
   ------------------------------------------------------------------------- */

.ads .ad-image {
  box-sizing: border-box;
  position: relative !important;
  display: block !important;
  isolation: isolate;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  background: #dfe8e8 !important;
  border-bottom: 1px solid rgba(28, 43, 41, 0.12);
}

/* A very light veil keeps the blurred fill from competing with the real photo. */
.ads .ad-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(12, 48, 49, 0.025),
    rgba(12, 48, 49, 0.10)
  );
}

.ads .ad-image img {
  box-sizing: border-box;
  margin: 0 !important;
  pointer-events: none;
  user-select: none;
}

/* Full-bleed copy. It is intentionally enlarged so the blur never leaves an
   unfilled edge around extremely tall or wide photographs. */
.ads .ad-image .background-blur {
  position: absolute !important;
  inset: -12% !important;
  z-index: 0 !important;
  width: 124% !important;
  height: 124% !important;
  padding: 0 !important;
  object-fit: cover !important;
  object-position: center !important;
  opacity: 0.72 !important;
  transform: scale(1.08) !important;
  filter: blur(4px) saturate(0.9) brightness(1.0) !important;
}

/* Complete foreground photograph. Nothing is cropped. */
.ads .ad-image .front {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2 !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0px !important;
  object-fit: contain !important;
  object-position: center !important;
  background: transparent !important;
  transform: translateZ(0);
  filter: saturate(1.03) contrast(1.015) !important;
  transition: transform 160ms ease, filter 160ms ease;
}

.ads .ad-listing:hover .ad-image .front {
  transform: scale(1.012) translateZ(0);
  filter: saturate(1.06) contrast(1.02) !important;
}

/* The no-photo brand image should remain calm rather than generating a large
   blurred logo behind itself. */
.ads .ad-image .front[src*="palelogob"] {
  padding: 18px !important;
  opacity: 0.96;
}

.ads .ad-image .front[src*="palelogob"] + .background-blur {
  opacity: 0.12 !important;
  filter: blur(12px) saturate(0.55) brightness(1.02) !important;
}

/* Desktop/tablet: preserve the existing 1.6:1 image proportion, but make CSS
   authoritative even though the legacy JavaScript also writes an inline
   height. This gives every card in a row exactly the same photo frame. */
@media only screen and (min-width: 701px) {
  .ads .ad-image {
    aspect-ratio: 16 / 10;
    height: auto !important;
  }
}

/* Phones: a controlled height avoids an excessively tall frame on wide phones
   while still giving portrait photographs enough room. */
@media only screen and (max-width: 700px) {
  .ads .ad-image {
    aspect-ratio: auto;
    height: clamp(180px, 54vw, 215px) !important;
  }

  .ads .ad-image .front {
    padding: 0px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ads .ad-image .front {
    transition: none;
  }

  .ads .ad-listing:hover .ad-image .front {
    transform: none;
  }
}
