/**
 * Darwesh Unified Premium Card — approved final geometry.
 * Property + Post share shell. Sun ivory · Moon charcoal · champagne #B49A6A.
 * No View CTAs, hearts, verified badges, or deal-type overlays.
 */
:root {
  --dw-card-radius: 20px;
  --dw-card-pad: 14px 14px 16px;
  --dw-card-champagne: #B49A6A;
  --dw-card-bg: #ffffff;
  --dw-card-border: rgba(21, 24, 28, 0.09);
  --dw-card-shadow: 0 12px 28px -16px rgba(21, 24, 28, 0.22);
  --dw-card-title: #1a1d21;
  --dw-card-mute: #6b7280;
  --dw-card-meta: #3d434b;
  --dw-card-divider: rgba(21, 24, 28, 0.1);
  --dw-card-media-bg: #eef0f2;
  --dw-card-nav-bg: rgba(255, 255, 255, 0.92);
  --dw-card-nav-ink: #1a1d21;
  --dw-card-dot: rgba(255, 255, 255, 0.55);
  --dw-card-dot-on: #ffffff;
}

html[data-dg-theme="dark"],
html.dark {
  --dw-card-bg: #1c1f24;
  --dw-card-border: rgba(228, 229, 230, 0.12);
  --dw-card-shadow: 0 14px 32px -16px rgba(0, 0, 0, 0.72);
  --dw-card-title: #f1f3f5;
  --dw-card-mute: #a8b0b8;
  --dw-card-meta: #e4e5e6;
  --dw-card-divider: rgba(228, 229, 230, 0.14);
  --dw-card-media-bg: #12151a;
  --dw-card-nav-bg: rgba(28, 31, 36, 0.88);
  --dw-card-nav-ink: #f1f3f5;
  --dw-card-dot: rgba(255, 255, 255, 0.35);
  --dw-card-dot-on: #ffffff;
}

/* ---- Grid helpers ---- */
.dw-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: clamp(12px, 2vw, 20px);
  width: 100%;
  min-width: 0;
}
.dw-card-grid[data-density="1"] { grid-template-columns: minmax(0, 1fr); }
.dw-card-grid[data-density="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dw-card-grid[data-density="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dw-card-grid[data-density="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) {
  .dw-card-grid[data-density="3"],
  .dw-card-grid[data-density="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .dw-card-grid[data-density="2"],
  .dw-card-grid[data-density="3"],
  .dw-card-grid[data-density="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dw-card-grid[data-mobile-density="1"] { grid-template-columns: minmax(0, 1fr); }
  .dw-card-grid[data-mobile-density="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dw-card-grid[data-mobile-density="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 374px) {
  .dw-card-grid[data-mobile-density="2"],
  .dw-card-grid[data-mobile-density="3"],
  .dw-card-grid[data-density="2"],
  .dw-card-grid[data-density="3"],
  .dw-card-grid[data-density="4"] { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Card shell ---- */
.dw-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: var(--dw-card-bg);
  border: 1px solid var(--dw-card-border);
  border-radius: var(--dw-card-radius);
  box-shadow: var(--dw-card-shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease;
  -webkit-tap-highlight-color: transparent;
}
a.dw-card:hover,
a.dw-card:focus-visible,
.dw-card.is-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -16px rgba(21, 24, 28, 0.3);
  outline: none;
}
html[data-dg-theme="dark"] a.dw-card:hover,
html.dark a.dw-card:hover {
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.78);
}
@media (prefers-reduced-motion: reduce) {
  .dw-card { transition: none; }
  a.dw-card:hover { transform: none; }
}

/* ---- Media / gallery ---- */
.dw-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  background: var(--dw-card-media-bg);
  overflow: hidden;
  flex: none;
}
.dw-card-media img,
.dw-card-media video,
.dw-card-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dw-card-slides {
  position: absolute;
  inset: 0;
}
.dw-card-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.dw-card-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.dw-card-media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--dw-card-mute);
  font-size: 11px;
  text-align: center;
  padding: 12px;
}
.dw-card-media-fallback[hidden] { display: none; }

.dw-card-media-fallback svg {
  width: 28px;
  height: 28px;
  opacity: 0.5;
}

.dw-card-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: var(--dw-card-nav-bg);
  color: var(--dw-card-nav-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.dw-card-nav svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.dw-card-nav--prev { inset-inline-start: 10px; }
.dw-card-nav--next { inset-inline-end: 10px; }
.dw-card-nav:hover { filter: brightness(1.03); }
.dw-card-nav:focus-visible {
  outline: 2px solid var(--dw-card-champagne);
  outline-offset: 2px;
}
[dir="rtl"] .dw-card-nav svg { transform: scaleX(-1); }

.dw-card-dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}
.dw-card-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--dw-card-dot);
  border: none;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
}
.dw-card-dot.is-active {
  background: var(--dw-card-dot-on);
  width: 7px;
  height: 7px;
}

/* ---- Body ---- */
.dw-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--dw-card-pad);
  min-width: 0;
  flex: 1 1 auto;
}

.dw-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: start;
  min-width: 0;
}

.dw-card-title {
  margin: 0;
  grid-column: 1;
  grid-row: 1;
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: clamp(14.5px, 1.45vw, 16.5px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--dw-card-title);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dw-card-price {
  margin: 0;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: clamp(14.5px, 1.45vw, 16.5px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--dw-card-champagne);
  white-space: nowrap;
}

.dw-card-loc {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  font-size: 12.5px;
  color: var(--dw-card-mute);
  line-height: 1.3;
}
.dw-card-loc svg {
  flex: none;
  width: 13px;
  height: 13px;
  color: var(--dw-card-champagne);
}
.dw-card-loc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.dw-card-dg {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--dw-card-mute);
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}
.dw-card-dg-label {
  font-weight: 500;
  opacity: 0.85;
}
.dw-card-dg-id {
  color: var(--dw-card-champagne);
  font-weight: 700;
}
.dw-card-price-period {
  margin: 0;
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  font-size: 12px;
  font-weight: 500;
  color: var(--dw-card-mute);
  white-space: nowrap;
  line-height: 1.3;
}

.dw-card-divider {
  height: 1px;
  width: 100%;
  background: var(--dw-card-divider);
  border: 0;
  margin: 2px 0 0;
}

.dw-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0;
  color: var(--dw-card-meta);
  font-size: 12.5px;
  font-weight: 600;
}
.dw-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
}
.dw-card-meta-item svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--dw-card-champagne);
  stroke-width: 1.55;
}

/* Legacy View/arrow removed from markup — keep hidden if any host leftover */
.dw-card-actions,
.dw-card-view,
.dw-card-arrow,
.dw-card-foot {
  display: none !important;
}

/* Post variant */
.dw-card--post .dw-card-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--dw-card-mute);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dw-card--post .dw-card-author {
  margin: 0;
  font-size: 11.5px;
  color: var(--dw-card-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-card-media--text {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--dw-card-title);
  text-align: center;
}

/* Map bottom rail */
.dw-card-rail {
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  padding-block: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.dw-card-rail > .dw-card,
.dw-card-rail > .listing-card.dw-card {
  flex: 0 0 min(280px, 78vw);
  width: min(280px, 78vw);
  max-width: 300px;
  scroll-snap-align: start;
  height: auto;
}
.dw-card.is-selected {
  border-color: color-mix(in srgb, var(--dw-card-champagne) 55%, var(--dw-card-border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--dw-card-champagne) 40%, transparent),
    var(--dw-card-shadow);
}

.cine-scope .pd-grid .dw-card,
.homele-rail .dw-card,
.home-property-rail .dw-card {
  height: 100%;
}

/* Lock 20px against host density / world overrides */
.dw-card.dw-card--property,
.dw-card.dw-card--post,
body.world .dw-card.homele-card,
.listing-similar-section .dw-card.homele-card,
.cine-scope .pd-grid .dw-card.pd-card,
#cardList .dw-card.lc,
.sell-preview-card-wrap .dw-card {
  border-radius: 20px !important;
}
