/* Whole-photo corners belong to the visible image, not its letterbox. */
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection) .card.ad-card .img img:not(.ld-card-soft-bg),
.card.ad-card.ld-ad-card:not(.ld-ad-card--top) .img img.ld-card-photo{
  width:auto!important;height:auto!important;max-width:100%;max-height:100%;
  flex:none!important;border-radius:12px!important;
}

/* TOP VIP: the existing photo above a compact title and metadata strip.
   The homepage and shared listing renderer use the same component. */
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel{
  --top-panel-photo-height:320px;
  --top-panel-info-height:50px;
  height:auto!important;min-height:0!important;
  overflow:hidden;border:2px solid #c89b2e!important;border-radius:16px!important;
  background:#fff!important;
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel > a{
  display:flex!important;flex-direction:column;height:auto!important;color:#fff;
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel > a::after{content:none!important;}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .img{
  position:relative!important;inset:auto!important;
  width:100%!important;height:var(--top-panel-photo-height)!important;
  flex:0 0 var(--top-panel-photo-height);min-height:0!important;
  overflow:hidden;border-radius:0;background:#1e1d1a;
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .img img{
  width:100%!important;height:100%!important;border-radius:0!important;
  object-fit:cover!important;object-position:var(--ld-photo-focus,50% 8%)!important;
  transform:none!important;filter:none!important;transition:none!important;
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel:hover{transform:none!important;}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .ld-top-info{
  display:flex;flex-direction:column;box-sizing:border-box;width:100%;min-width:0;
  height:var(--top-panel-info-height);min-height:var(--top-panel-info-height);
  padding:6px 9px;background:#fff;color:#1c1a17;
  border-top:1px solid #e7e1d7;
  transition:background-color .2s ease;
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .ld-top-info h3{
  display:block;width:100%;min-width:0;max-width:100%;height:16px;min-height:16px;max-height:16px;overflow:hidden;
  margin:0 0 2px!important;color:#1c1a17!important;font-size:13px!important;
  line-height:16px!important;font-weight:700;text-shadow:none;
  white-space:nowrap!important;text-overflow:ellipsis;
}
.ld-top-panel .ld-top-meta{
  display:flex;align-items:center;gap:6px;min-width:0;
  color:#6b6258;font-size:12px;line-height:15px;
}
.ld-top-panel .ld-top-city{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ld-top-panel .ld-top-view{
  display:block;flex:0 0 auto;min-width:0;max-width:75%;
  color:#000;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
/* Limit hover feedback to a mouse/trackpad so touch does not latch the state. */
@media(hover:hover) and (pointer:fine){
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel > a:hover .ld-top-info{
    background-color:#f3e3b6;
  }
  .ld-top-panel > a:hover .ld-top-view{text-decoration:underline;}
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel > a:active .ld-top-info,
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel > a:focus-visible .ld-top-info{
  background-color:#f3e3b6;
}
.ld-top-panel > a:focus-visible .ld-top-view{text-decoration:underline;}
@media(prefers-reduced-motion:reduce){
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .ld-top-info{transition:none;}
}
.ld-top-panel .ld-top-photo-price{
  position:absolute;right:7px;bottom:7px;z-index:3;
  display:block;max-width:calc(100% - 14px);padding:4px 6px;
  border:1px solid rgba(200,155,46,.30);border-radius:6px;
  background:rgba(36,35,31,.58);color:#fff2c5;text-shadow:0 1px 2px rgba(0,0,0,.72);
  font-size:12px;line-height:1.3;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.ld-top-panel > a:focus-visible{outline:3px solid #f9df92;outline-offset:-4px;}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .card-save-btn{
  top:7px!important;right:6px!important;width:40px!important;min-width:40px!important;height:40px!important;
}
:is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .new-badge{display:none!important;}
/* Old cached disclosure controls are never part of the new design. */
.ld-top-info-toggle{display:none!important;}

@media(max-width:900px){
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel{--top-panel-photo-height:305px;}
}
@media(max-width:620px){
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel{
    --top-panel-photo-height:clamp(258px,70vw,286px);
    --top-panel-info-height:50px;
  }
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .ld-top-info{padding:5px 8px;}
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .ld-top-info h3{
    height:17px;min-height:17px;max-height:17px;font-size:13px!important;line-height:17px!important;
  }
  .ld-top-panel .ld-top-meta{font-size:12px;line-height:15px;gap:4px;}
  .ld-top-panel .ld-top-view{font-size:11px;}
  .ld-top-panel .ld-top-photo-price{font-size:12px;}
}

/* Light listing cards. Named caption classes isolate them from legacy overlays.
   The same selector covers home, nearby, city, saved and related listings. */
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card{
  border:1px solid #e7e1d7;border-radius:16px!important;background:#fff;
  box-shadow:0 3px 10px rgba(36,33,29,.045);overflow:hidden;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card--vip{
  border-color:#c89b2e;box-shadow:0 3px 12px rgba(138,100,18,.08);
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card--top{
  border:2px solid #c89b2e;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card:hover{transform:none;}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card > a{
  color:#1c1a17;display:block;min-width:0;padding-top:6px;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card > a:focus-visible{
  outline:3px solid #8a6412;outline-offset:-3px;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card .img{
  position:relative;aspect-ratio:4 / 5;height:auto!important;min-height:0!important;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;background:#fff!important;padding:0;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card .img img:not(.ld-card-soft-bg){
  /* Center the final constrained image size, independently of overlay controls. */
  position:absolute;inset:50% auto auto 50%;margin:0;z-index:1;display:block;flex:none!important;
  width:auto!important;height:auto!important;max-width:100%;max-height:100%;
  border-radius:12px!important;object-fit:contain!important;object-position:center!important;
  filter:none!important;transform:translate(-50%,-50%)!important;transition:none!important;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card .img .ld-card-soft-bg{
  display:none!important;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card .img > span{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  color:#6b6258;font-size:13px;font-weight:500;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card .ld-card-info{
  display:flex;flex-direction:column;gap:7px;min-height:112px;padding:12px 11px;
  background:#fff;color:#1c1a17;box-sizing:border-box;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card .ld-card-title-row{
  display:flex;align-items:flex-start;gap:5px;min-width:0;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card h3.ld-card-title{
  flex:1;min-width:0;min-height:40px;max-height:40px;margin:0!important;
  font-size:15px!important;line-height:20px!important;font-weight:700;letter-spacing:-.01em;
  color:#1c1a17!important;white-space:normal!important;overflow:hidden;
  overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
}
.ld-clean-card .ld-card-verified{display:inline-flex;flex:0 0 17px;margin-top:2px;color:#176b43;}
.ld-clean-card .ld-card-verified svg{display:block;}
.ld-clean-card .ld-card-location{
  display:flex;align-items:baseline;flex-wrap:wrap;column-gap:4px;row-gap:2px;min-width:0;
  color:#6b6258;font-size:12px;line-height:17px;
}
.ld-clean-card .ld-card-city{min-width:0;overflow-wrap:anywhere;}
.ld-clean-card .ld-card-age{white-space:nowrap;}
.ld-clean-card .ld-card-bottom{
  display:flex;align-items:baseline;justify-content:space-between;gap:5px 8px;flex-wrap:wrap;
  margin-top:auto;min-width:0;
}
.ld-clean-card .ld-card-rate{flex:1;min-width:0;color:#1c1a17;font-size:15px;line-height:20px;font-weight:700;overflow-wrap:anywhere;}
.ld-clean-card .ld-card-rate.is-unspecified{color:#6b6258;font-size:13px;font-weight:500;}
.ld-clean-card .ld-card-tier{
  flex-shrink:0;display:inline-block;padding:2px 6px;border-radius:5px;
  background:#f5e7be;color:#5d4512;font-size:11px;line-height:15px;font-weight:800;
}
.ld-clean-card--top .ld-card-tier{background:#e8c66e;color:#1a1408;}
.ld-clean-card .ld-card-new{color:#6b6258;font-size:11px;line-height:15px;white-space:nowrap;}
/* Each listing row follows its tallest caption; the full card remains a link. */
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .grid.ld-card-grid > .ld-clean-card > a{
  height:100%;box-sizing:border-box;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card .card-save-btn{
  position:absolute;top:7px!important;right:7px!important;z-index:5;
  width:44px!important;min-width:44px!important;height:44px!important;padding:0!important;
  display:flex;align-items:center;justify-content:center;border-radius:50%;border:1px solid rgba(255,255,255,.65);
  background:rgba(36,33,29,.78)!important;color:#fff;box-shadow:none;font-size:23px;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card .card-save-btn.is-active{
  background:#fff1f2!important;color:#be123c;
}
:is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card .card-save-btn:focus-visible{
  outline:3px solid #fff;outline-offset:-5px;
}
:is(#homeAdsTopSlot,body) .ld-top-panel .vip-badge.topvip{font-size:10px!important;}
:is(#homeAdsTopSlot,body) .ld-top-panel .verified-badge{top:52px!important;font-size:10px!important;}
@media(max-width:620px){
  :is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card.ld-clean-card .img{
    /* A definite width prevents the height cap from shrinking the 4:5 frame. */
    width:100%;max-width:100%;box-sizing:border-box;margin-inline:auto;max-height:218px;
  }
  :is(#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .ld-clean-card .ld-card-info{padding:10px 9px;}
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel{--top-panel-info-height:59px;}
  .ld-top-panel .ld-top-meta{flex-wrap:wrap;row-gap:0;line-height:14px;}
  .ld-top-panel .ld-top-city{flex:0 0 100%;}
  .ld-top-panel .ld-top-view{margin-left:auto;max-width:100%;}
}
@media(max-width:360px){
  :is(#homeAdsTopSlot,body) .ld-top-panel .vip-badge.topvip{font-size:9px!important;padding:4px!important;}
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel .card-save-btn{top:37px!important;}
  :is(#homeAdsTopSlot,body) .ld-top-panel .verified-badge{top:82px!important;}
  :is(#homeAdsTopSlot .ad-card,.card.ad-card.ld-ad-card--top).ld-top-panel{--top-panel-info-height:65px;}
  .ld-top-panel .ld-top-meta{flex-wrap:wrap;row-gap:1px;}
  .ld-top-panel .ld-top-city{flex:0 0 100%;}
  .ld-top-panel .ld-top-view{margin-left:auto;}
}

/* The target is generous, while the visible heart stays unobtrusive. */
:is(#homeAdsTopSlot,#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card:is(.ld-clean-card,.ld-top-panel) .card-save-btn,
:is(#homeAdsTopSlot,#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) .card.ad-card:is(.ld-clean-card,.ld-top-panel) .card-save-btn.is-active{
  background:transparent!important;border:0!important;box-shadow:none!important;
  display:flex;align-items:center;justify-content:center;
}
:is(#homeAdsTopSlot,#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) :is(.ld-clean-card,.ld-top-panel) .card-save-btn::before{
  content:"";position:absolute;width:32px;height:32px;border-radius:50%;
  background:rgba(36,33,29,.78);border:1px solid rgba(255,255,255,.6);pointer-events:none;
}
:is(.ld-clean-card,.ld-top-panel) .card-save-btn > span{position:relative;z-index:1;pointer-events:none;}
:is(#homeAdsTopSlot,#homeAdsVipSlot,#homeAdsLatestSlot,#homeNearbySection,body) :is(.ld-clean-card,.ld-top-panel) .card-save-btn.is-active::before{background:#fff1f2;border-color:#f6cdd3;}

/* Reserve the photo ratio and caption space in live-search placeholders. */
body.ld-public :is(.search-skeleton-card,.nearby-skeleton-card){height:auto!important;overflow:hidden;}
body.ld-public :is(.search-skeleton-card,.nearby-skeleton-card)::before{content:"";display:block;aspect-ratio:4 / 5;}
body.ld-public :is(.search-skeleton-card,.nearby-skeleton-card)::after{content:"";display:block;height:112px;}
