/* ==========================================================================
   PROPERTY CARDS  (villas / apartments / lands / projects)
   Markup: footage/includes/property-cards.php   Behaviour: js/property-cards.js
   Mobile first: 1 column on phones, 2 on tablets, 3 on desktop.
   Cards carry their own dir="rtl|ltr", so only logical properties are used.
   ========================================================================== */

.pc-grid,
.pc-card,
.pc-empty,
.pc-cat {
  --pc-ink: #141414;
  --pc-ink-soft: #2b2b2b;
  --pc-muted: #71757b;
  --pc-line: #ebe9e4;
  --pc-soft: #f6f5f2;
  --pc-gold: #9c7a45;
  --pc-wa: #0f8a4a;
  --pc-wa-soft: #e8f5ee;
  --pc-radius: 20px;
}

/* ---------- Grid ---------- */
.pc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 0;
  padding: 0;
}
@media (min-width: 640px) {
  .pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
}
@media (min-width: 1024px) {
  .pc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
}

/* ---------- Card ---------- */
.pc-card {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--pc-line);
  border-radius: var(--pc-radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 10px 28px -16px rgba(20, 20, 20, 0.18);
  color: var(--pc-ink);
  text-align: start;
  animation: pc-in 0.5s ease both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes pc-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@media (hover: hover) {
  .pc-card { transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
  .pc-card:hover {
    transform: translateY(-4px);
    border-color: #dedad2;
    box-shadow: 0 2px 4px rgba(20, 20, 20, 0.04), 0 22px 40px -18px rgba(20, 20, 20, 0.28);
  }
  .pc-card:hover .pc-media__img { transform: scale(1.05); }
}

/* ---------- Photo ---------- */
.pc-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 11;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #e9e7e2;
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.pc-media__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}
/* placeholder shown when there is no photo or it fails to load */
.pc-media__ph {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2b2b2b, #141414);
  color: rgba(255, 255, 255, 0.3);
  font-size: 52px;
}
.pc-media.is-empty .pc-media__ph,
.pc-media.is-broken .pc-media__ph { display: flex; }
.pc-media.is-broken .pc-media__img { display: none; }

.pc-tags {
  position: absolute;
  top: 14px;
  inset-inline: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}
.pc-tag {
  --dot: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pc-ink);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}
.pc-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
}
.pc-tag i { font-size: 14px; }
.pc-tag--planning { --dot: #3b7ddd; }
.pc-tag--under_construction { --dot: #e0a100; }
.pc-tag--completed { --dot: #1f9d55; }
.pc-tag--on_hold { --dot: #9aa0a6; }
.pc-tag--pending { --dot: #e0a100; }
.pc-tag--sold,
.pc-tag--rented { background: #b3261e; color: #fff; --dot: #fff; }
.pc-tag--featured { background: var(--pc-ink); color: #f1dcb0; }
.pc-tag--featured::before,
.pc-tag--plain::before { display: none; }

.pc-count {
  position: absolute;
  bottom: 14px;
  inset-inline-end: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
}
.pc-count i { font-size: 15px; }

/* ---------- Body ---------- */
.pc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 0;
}

.pc-loc {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--pc-muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.pc-loc i { flex: none; font-size: 16px; color: var(--pc-gold); }

.pc-title {
  margin: 0;
  color: var(--pc-ink);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* titles keep their own text direction but line up with the rest of the card */
.pc-card[dir="rtl"] .pc-title { text-align: right; }
.pc-card[dir="ltr"] .pc-title { text-align: left; }

.pc-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  margin: 0;
}
.pc-price__value {
  color: var(--pc-ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}
.pc-price__unit { color: var(--pc-gold); font-size: 13.5px; font-weight: 700; }
.pc-price__note { flex-basis: 100%; color: var(--pc-muted); font-size: 12.5px; }

/* stats row: value on top, label underneath, hairline dividers */
.pc-stats {
  display: flex;
  margin: 8px 0 0;
  padding: 12px 0;
  list-style: none;
  border-top: 1px solid var(--pc-line);
  border-bottom: 1px solid var(--pc-line);
}
.pc-stat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
}
.pc-stat + .pc-stat { border-inline-start: 1px solid var(--pc-line); }
.pc-stat__value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  color: var(--pc-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}
.pc-stat__value i { flex: none; color: var(--pc-muted); font-size: 16px; }
.pc-stat__value bdi { overflow: hidden; text-overflow: ellipsis; }
.pc-stat__label {
  max-width: 100%;
  overflow: hidden;
  color: var(--pc-muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* narrow cards: icons go, four stats become two rows */
@container (max-width: 380px) {
  .pc-stat__value i { display: none; }
}
@container (max-width: 300px) {
  .pc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .pc-stat:nth-child(odd) { border-inline-start: 0; }
}

.pc-desc {
  margin: 4px 0 0;
  color: var(--pc-muted);
  font-size: 14px;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* project extras */
.pc-progress { margin-top: 4px; }
.pc-progress__row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--pc-muted);
  font-size: 12.5px;
}
.pc-progress__row b { color: var(--pc-ink); }
.pc-progress__track {
  height: 6px;
  border-radius: 999px;
  background: var(--pc-soft);
  overflow: hidden;
}
.pc-progress__track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pc-ink);
}
.pc-dev {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--pc-muted);
  font-size: 13px;
}
.pc-dev i { font-size: 17px; color: var(--pc-ink); }

/* ---------- Actions ---------- */
.pc-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 16px 20px 20px;
}

.pc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pc-btn:hover { text-decoration: none; }
.pc-btn:active { transform: scale(0.97); }
.pc-btn i { font-size: 19px; }
.pc-btn--primary { flex: 1; background: var(--pc-ink); color: #fff; }
.pc-btn--primary:hover,
.pc-btn--primary:focus-visible { background: var(--pc-ink-soft); color: #fff; }
.pc-btn--wa { background: var(--pc-wa-soft); color: var(--pc-wa); }
.pc-btn--wa:hover,
.pc-btn--wa:focus-visible { background: var(--pc-wa); color: #fff; }
.pc-btn:focus-visible,
.pc-media:focus-visible { outline: 3px solid #5b9dff !important; outline-offset: 2px; }
/* the forward arrow points left in Arabic */
[dir="rtl"] .pc-arrow,
.lang-ar .pc-arrow { transform: scaleX(-1); }
@media (hover: hover) {
  .pc-btn--primary .pc-arrow { transition: translate 0.2s ease; }
  .pc-btn--primary:hover .pc-arrow { translate: 3px 0; }
  [dir="rtl"] .pc-btn--primary:hover .pc-arrow { translate: -3px 0; }
}

@media (max-width: 380px) {
  .pc-body { padding: 16px 16px 0; }
  .pc-actions { padding: 14px 16px 16px; }
  .pc-btn { padding: 0 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-card,
  .pc-cat { animation: none; }
  .pc-card,
  .pc-card *,
  .pc-cat { transition: none !important; }
}

/* ---------- Empty state ---------- */
.pc-empty {
  max-width: 520px;
  margin: 10px auto;
  padding: 36px 24px;
  border: 1px dashed #d5d2cb;
  border-radius: var(--pc-radius);
  background: #fafaf8;
  text-align: center;
}
.pc-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 16px rgba(20, 20, 20, 0.08);
  font-size: 36px;
  color: var(--pc-ink);
}
.pc-empty h4 { margin: 0 0 8px; color: var(--pc-ink); font-size: 20px; font-weight: 700; }
.pc-empty p { margin: 0 0 20px; color: var(--pc-muted); line-height: 1.8; }
.pc-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.pc-empty .pc-btn--primary { flex: none; }
.lang-ar .pc-empty { direction: rtl; }

/* ---------- Category cards (realestate-offers.php) ---------- */
.pc-grid--cats { --pc-radius: 20px; }
@media (min-width: 640px) { .pc-grid--cats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .pc-grid--cats { grid-template-columns: repeat(3, 1fr); } }
.lang-ar .pc-grid--cats { direction: rtl; }

.pc-cat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 24px 22px 22px;
  background: #fff;
  border: 1px solid var(--pc-line, #eceef0);
  border-radius: var(--pc-radius, 20px);
  box-shadow: 0 2px 14px rgba(20, 20, 20, 0.05);
  color: #141414;
  text-align: start;
  text-decoration: none;
  animation: pc-in 0.55s ease both;
  -webkit-tap-highlight-color: transparent;
}
.lang-ar .pc-cat { direction: rtl; text-align: right; }
.pc-cat:hover, .pc-cat:focus-visible { color: #141414; text-decoration: none; }
.pc-cat:focus-visible { outline: 3px solid #5b9dff; outline-offset: 2px; }
@media (hover: hover) {
  .pc-cat { transition: transform 0.3s ease, box-shadow 0.3s ease; }
  .pc-cat:hover { transform: translateY(-5px); box-shadow: 0 18px 38px rgba(20, 20, 20, 0.12); }
}
.pc-cat:nth-child(2) { animation-delay: 70ms; }
.pc-cat:nth-child(3) { animation-delay: 140ms; }

.pc-cat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-cat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2b2f33, #141414);
  color: #fff;
  font-size: 30px;
}
.pc-cat__chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: #e3f6ea;
  color: #17653a;
  font-size: 13px;
  font-weight: 700;
}
.pc-cat__chip.is-soon { background: #f1f2f4; color: #6b7280; }
.pc-cat__title { margin: 6px 0 0; font-size: 21px; font-weight: 800; color: #141414; }
.pc-cat__text { flex: 1; margin: 0; color: #6b7280; font-size: 14.5px; line-height: 1.8; }
.pc-cat__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 6px;
  font-weight: 700;
  color: #141414;
}
.pc-cat__cta i { font-size: 18px; transition: transform 0.2s ease; }
@media (hover: hover) { .pc-cat:hover .pc-cat__cta i { transform: translateX(4px); } .lang-ar .pc-cat:hover .pc-cat__cta i { transform: scaleX(-1) translateX(4px); } }
