/* ==========================================================================
   Direct Homes – Property card
   Markup: includes/property-card.php  (Featured + Popular sections)
   Rules:  title max 2 lines, description max 3 lines. All cards in a slider
           have the same height; location, facts and price are pushed to the
           bottom (margin-top: auto), so they line up in every card.
   ========================================================================== */

.dh-prop-card {
  --dh-card-title-lh: 1.3;
  --dh-card-title-size: 20px;
  --dh-card-desc-lh: 1.6;
  --dh-card-desc-size: 14px;

  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--dh-sand);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(var(--dh-primary-rgb), 0.06);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}

.dh-prop-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(var(--dh-primary-rgb), 0.14);
}

/* --------------------------------------------------------------------------
   1. Image + 2nd image on hover (smooth cross-fade, no jump)
   -------------------------------------------------------------------------- */
.dh-prop-card__media {
  position: relative;
  flex: 0 0 auto;
  /* height: 250px; */
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--dh-bg);
}

.dh-prop-card__img {
  position: absolute;
  inset: 0;
  display: block;
}

.dh-prop-card__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition:
    opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    transform 1.2s cubic-bezier(0.2, 0.6, 0.2, 1);
  will-change: opacity, transform;
  backface-visibility: hidden;
}

.dh-prop-card__photo--hover {
  opacity: 0;
}

.dh-prop-card:hover .dh-prop-card__photo {
  transform: scale(1.05);
}

.dh-prop-card:hover .dh-prop-card__photo--hover {
  opacity: 1;
}

/* soft gradient at the bottom so the round buttons stay visible */
.dh-prop-card__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.32) 100%);
  pointer-events: none;
}

/* Tags */
.dh-prop-card__tag {
  position: absolute;
  top: 16px;
  z-index: 2;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: var(--dh-font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}

.dh-prop-card__tag--featured {
  left: 16px;
  background: var(--dh-primary);
}

.dh-prop-card__tag--status {
  right: 16px;
  background: rgba(30, 30, 30, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Share + Favourite on the image */
.dh-prop-card__media-actions {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.dh-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  /* dark glass: looks the same on bright and dark photos */
  background: rgba(20, 20, 20, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.dh-prop-card .dh-icon-btn i,
.dh-prop-card .dh-icon-btn i:hover {
  color: inherit !important;
  font-size: 14px;
  line-height: 1;
}

.dh-icon-btn:hover,
.dh-icon-btn:focus-visible {
  background: #fff;
  color: var(--dh-primary);
  outline: none;
}

/* Share + heart are inline SVGs (no icon font needed) */
.dh-icon-btn .dh-icon-svg {
  display: block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

/* Saved: heart is filled */
.dh-icon-btn.dh-action--fav.is-active .dh-icon-heart {
  fill: currentColor;
}

.dh-icon-btn.dh-action--fav.is-active {
  background: #fff;
  color: #c0392b;
}

/* --------------------------------------------------------------------------
   2. Content
   -------------------------------------------------------------------------- */
.dh-prop-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 20px 22px 18px;
}

/* Title: max 2 lines (no empty space reserved under a 1-line title) */
.dh-prop-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 10px;
  font-family: var(--dh-font-heading);
  font-size: var(--dh-card-title-size);
  font-weight: 600;
  line-height: var(--dh-card-title-lh);
  text-transform: none;
}

.dh-prop-card__title a {
  color: var(--dh-primary);
}

.dh-prop-card__title a:hover {
  color: var(--dh-primary);
  text-decoration: none;
}

.dh-prop-card__address {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: auto 0 0;  /* pushes location, facts and price to the bottom */
  padding: 14px 0;   /* space above and below the location */
  overflow: hidden;
  font-family: var(--dh-font-body);
  font-size: 14px;
  line-height: 1.5;
  color: #666;
  white-space: nowrap;
}

.dh-prop-card__address span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dh-prop-card__address i {
  margin-top: 3px;
  color: var(--dh-accent);
}

/* Description: max 3 lines (no empty space reserved – any extra height in a
   taller neighbour card goes above the price row only) */
.dh-prop-card__desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-family: var(--dh-font-body);
  font-size: var(--dh-card-desc-size);
  line-height: var(--dh-card-desc-lh);
  color: #555;
}

.dh-prop-card__facts {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  margin: 0 0 16px;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.dh-prop-card__facts li {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  font-family: var(--dh-font-body);
  font-size: 14px;
  color: #555;
  white-space: nowrap;
}

.dh-prop-card__facts i {
  font-size: 15px;
  color: var(--dh-primary);
}

/* Location + facts + price are one bottom group: margin-top:auto on the
   location pushes all three down, so they line up in every card of a row */
.dh-prop-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--dh-sand);
}

.dh-prop-card__price {
  font-family: var(--dh-font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--dh-primary);
  white-space: nowrap;
}

/* "View details" – plain text, underlined while the card is hovered */
.dh-prop-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--dh-font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--dh-primary);
  white-space: nowrap;
  text-decoration: none;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.dh-prop-card__more svg {
  transition: transform 0.25s ease;
}

.dh-prop-card:hover .dh-prop-card__more,
.dh-prop-card__more:focus-visible {
  color: var(--dh-primary);
  text-decoration: underline;
}

.dh-prop-card:hover .dh-prop-card__more svg {
  transform: translateX(3px);
}

/* Small "Link copied / Saved" message */
.dh-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 100100;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--dh-primary);
  color: #fff;
  font-family: var(--dh-font-body);
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(var(--dh-primary-rgb), 0.3);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.dh-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   3. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  .dh-prop-card {
    --dh-card-title-size: 19px;
  }

  .dh-prop-card__media {
    height: 220px;
  }

  .dh-prop-card__facts {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dh-prop-card,
  .dh-prop-card__photo {
    transition: none;
  }
}
