/* ==========================================================================
   كايرو سكوير — Arabic / RTL layer on top of style.css (design unchanged).
   Mirrors left/right-sensitive rules automatically; font: Almarai (headings + body), loaded via <link> in each page.
   ========================================================================== */
:root{
  --ar-head: "Almarai", "Segoe UI", Tahoma, sans-serif;
  --ar-body: "Almarai", "Segoe UI", Tahoma, sans-serif;
  /* the whole site reads these two: headings and body are both Almarai (to split them again, change only these two lines + the <link> in each page) */
  --font-display: var(--ar-head);
  --font-body: var(--ar-body);
  /* secondary text: #79756B was 4.37:1 on --bg and 3.94:1 on --sand (below WCAG AA 4.5). #6F6B61 = 5.05 / 4.56 and looks the same */
  --muted: #6F6B61;
}

/* ---------- Typography ----------
   Body text: Almarai 400 (700 for bold). Headings + buttons: Almarai 800.
   Almarai ships 300 / 400 / 700 / 800 only (loaded via the <link> in each page): the site's 500 renders as 400 and 600 as 700, with no synthetic bolding. */
body{
  font-family: var(--ar-body);
  font-weight: 400;
}
h1, h2, h3, h4,
.btn, .cta, .pill{
  font-family: var(--ar-head);
  font-weight: 800;
}
/* the site's own chips / pills / segmented tabs: same heading face, their own weights (600–700) are kept */
.chip, .pill-toggle, .location-pill, .ab-pill, .map-price-pill, .seg button{
  font-family: var(--ar-head);
}
/* Leaflet hard-codes "Helvetica Neue" on the whole map (zoom buttons, attribution) */
.leaflet-container{ font-family: var(--ar-body); }
/* figures: lining + tabular so prices, counters and pagination keep their width and align */
.cp-price, .pd-price, .hf-price, .range-values, .counter__num, .stat-card__num, .ab-stat b, .trust-item b,
.news-facts b, .pagination button, .date-chip .dom, .map-price-pill, #resultsCount{
  font-variant-numeric: lining-nums tabular-nums;
}
/* Arabic needs a bigger floor than Latin: nothing below 12px (was 10.5–11.5px on badges and labels) */
.eyebrow, .badge, .card-property .cp-type, .hero-featured .hf-badge{ font-size: .75rem; }
/* Arabic headings need more leading than the Latin template gave them (1.1–1.25).
   :where() keeps this at class-level specificity so every heading that already has its own tuned line-height keeps it. */
:where(html[dir="rtl"]) :is(.h1, .h2, .h3){ line-height: 1.4; }

/* ---------- Map: district bubbles (zoomed out) ---------- */
.map-district-pill{
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer;
  padding-block: 4px; padding-inline: 5px 14px;
  background: var(--ink); color: #fff; border: 2px solid #fff; border-radius: var(--r-pill); box-shadow: var(--shadow-md);
  font-family: var(--ar-head); font-weight: 700; font-size: .82rem; line-height: 1.4;
  transition: transform var(--dur-fast) var(--ease);
}
.map-district-pill b{
  min-width: 28px; height: 28px; padding-inline: 6px; border-radius: var(--r-pill); display: grid; place-items: center;
  background: #fff; color: var(--ink); font-weight: 800; font-size: .8rem; font-variant-numeric: lining-nums tabular-nums;
}
.leaflet-marker-icon:hover .map-district-pill, .leaflet-marker-icon:focus-visible .map-district-pill{ transform: translate(-50%, -50%) scale(1.07); }

/* ---------- Skip link (WCAG 2.4.1) ---------- */
.skip-link{
  position: absolute; inset-inline-start: 12px; top: -64px; z-index: 1000;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r-pill);
  font-weight: 700; transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus{ top: 12px; }

/* ---------- mirrored rules (auto-generated from style.css) ---------- */
html[dir="rtl"] .icon-btn .dot{ left:10px; right:auto; }
html[dir="rtl"] .select{ padding-left:38px; padding-right:0; }
html[dir="rtl"] .check-row input[type="checkbox"]:checked::after{ right:5px; left:auto; }
html[dir="rtl"] .toggle::after{ right:3px; left:auto; }
html[dir="rtl"] .search-bar{ padding:8px 22px 8px 8px; }
html[dir="rtl"] .hero-featured{ left:6%; right:auto; }
html[dir="rtl"] .hero-featured .hf-price{ text-align:left; }
html[dir="rtl"] .hero-arrows{ left:6%; right:auto; }
html[dir="rtl"] .card-property .cp-type{ right:12px; left:auto; }
html[dir="rtl"] .card-property .cp-fav{ left:10px; right:auto; }
html[dir="rtl"] .row-property .rp-fav{ left:8px; right:auto; }
html[dir="rtl"] .page-toolbar .search-bar{ padding:6px 18px 6px 6px; }
html[dir="rtl"] .gallery-hero .gh-count{ right:16px; left:auto; }
html[dir="rtl"] .pd-header .pd-price{ text-align:left; }
html[dir="rtl"] .info-table td:last-child{ text-align:left; }
html[dir="rtl"] .lightbox-nav.prev{ right:16px; left:auto; }
html[dir="rtl"] .lightbox-nav.next{ left:16px; right:auto; }
html[dir="rtl"] .map-sidebar{ border-left:1px solid var(--line); border-right:0; }
html[dir="rtl"] .map-floating-card .mfc-close{ left:8px; right:auto; }
html[dir="rtl"] .chat-context-panel{ border-right:1px solid var(--line); border-left:0; }
html[dir="rtl"] .conv-list-panel{ border-left:1px solid var(--line); border-right:0; }
html[dir="rtl"] .conv-item .ci-unread{ left:16px; right:auto; }
html[dir="rtl"] .profile-card .pc-actions{ margin-right:auto; margin-left:0; }
html[dir="rtl"] .info-list .il-row span:last-child{ text-align:left; }
html[dir="rtl"] .avatar-upload .au-edit{ left:0; right:auto; }

html[dir="rtl"] .input-icon-wrap .input{ padding-left:16px; padding-right:44px; }
html[dir="rtl"] .lightbox-nav svg{ transform:scaleX(-1); }

/* ---------- RTL / Arabic ---------- */
html[dir="rtl"] *{ letter-spacing:normal !important; }
html[dir="rtl"] .range-slider, html[dir="rtl"] .range-values{ direction:ltr; }
html[dir="rtl"] .range-slider .fill{ left:auto; }
html[dir="rtl"] .hero-arrows svg, html[dir="rtl"] .see-all svg, html[dir="rtl"] .pagination svg, html[dir="rtl"] .search-submit svg, html[dir="rtl"] .menu-item > svg:last-child, html[dir="rtl"] .back-btn svg{ transform:scaleX(-1); }
html[dir="rtl"] .cp-price small, html[dir="rtl"] .pd-price small{ font-size:.7em; font-weight:600; color:var(--muted); }

/* ---------- About page ---------- */
.acc{ border:1px solid var(--line); border-radius:var(--r-card); background:var(--surface); margin-bottom:12px; }
.acc summary{ cursor:pointer; padding:18px 20px; font-weight:700; list-style:none; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.acc summary::-webkit-details-marker{ display:none; }
.acc summary::after{ content:'+'; color:var(--gold); font-size:1.4rem; line-height:1; flex:none; }
.acc[open] summary::after{ content:'\2212'; }
.acc-body{ padding:0 20px 20px; color:var(--ink-soft); line-height:1.9; }
.acc-body p + p{ margin-top:10px; }
.acc-body ul{ margin-top:12px; padding-inline-start:20px; list-style:disc; display:grid; gap:6px; }
.plan-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:20px; align-items:stretch; }
.plan{ border:1px solid var(--line); border-radius:var(--r-card); background:var(--surface); padding:24px; display:flex; flex-direction:column; gap:16px; }
.plan.is-featured{ border:2px solid var(--gold); }
.plan ul{ display:grid; gap:10px; flex:1; padding-inline-start:20px; list-style:disc; }
.quote-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
.quote{ border:1px solid var(--line); border-radius:var(--r-card); background:var(--surface); padding:22px; display:flex; flex-direction:column; gap:14px; }
.quote blockquote{ line-height:1.9; flex:1; }
.quote figcaption{ display:flex; flex-direction:column; font-size:.9rem; }
.quote figcaption span{ color:var(--muted); }
.tl{ border-inline-start:2px solid var(--line-strong); padding-inline-start:24px; display:grid; gap:22px; }
.tl b{ color:var(--gold); font-family:var(--font-display); font-size:1.15rem; }
.tl h4{ font-weight:700; margin-top:2px; }
.tl p{ color:var(--muted); }
@media (max-width:900px){ .plan-grid, .quote-grid{ grid-template-columns:1fr; } }

/* short Arabic names: keep card location on one line */
html[dir="rtl"] .card-property .cp-loc, html[dir="rtl"] .row-property .cp-loc{ white-space:nowrap; min-width:0; }
/* the line is now "district · tower": if a phone column is still too narrow it ends with "…" instead of being cut mid-letter */
html[dir="rtl"] .card-property .cp-loc > span, html[dir="rtl"] .row-property .cp-loc > span{ min-width:0; overflow:hidden; text-overflow:ellipsis; }

/* unit cards: longer names -> price on its own line; select arrow on the left in RTL */
html[dir="rtl"] .card-property .cp-top{ flex-direction:column; align-items:stretch; gap:6px; }
html[dir="rtl"] .select{ background-position:left 14px center; padding-right:16px; padding-left:40px; }

/* list view: reuse the card meta styling (missing in the original design) */
.row-property .cp-price{font-weight:700; font-size:.95rem; white-space:nowrap;}
.row-property .cp-price span{font-weight:500; color:var(--muted); font-size:.78rem;}
.row-property .cp-loc{display:flex; align-items:center; gap:5px; color:var(--muted); font-size:.82rem;}
.row-property .cp-stats{display:flex; gap:14px; margin-top:4px; padding-top:12px; border-top:1px solid var(--line); flex-wrap:wrap;}
.row-property .cp-stat{display:flex; align-items:center; gap:5px; font-size:.78rem; color:var(--muted);}
.row-property .cp-stat svg{color:var(--muted-2); flex:none;}

/* guard against a few px of horizontal page scroll from the home rail on narrow screens */
html[dir="rtl"] body{ overflow-x:clip; }

/* grid items may shrink so horizontal chip rows scroll inside their card instead of widening the page */
.pd-layout > *{ min-width:0; }

/* ---------- QA fixes ---------- */
[hidden]{ display:none !important; }
.field-error{ color:#b3261e; font-size:.82rem; margin-top:6px; }
.input[aria-invalid="true"]{ border-color:#b3261e; }
.form-result{ border:1px solid var(--line); background:var(--sand); border-radius:var(--r-card); padding:16px; display:grid; gap:12px; line-height:1.9; }
@media (min-width:768px) and (max-width:900px){ .nav-links{ gap:14px; font-size:.82rem; } }
@media (max-width:767px){ .rail{ margin-inline:-18px; padding-inline:18px; } }
.seg{ max-width:100%; overflow-x:auto; scrollbar-width:none; }
/* the design removes the input's own outline; show the focus ring on the search pill instead */
.search-bar:focus-within{ outline:2px solid var(--ink); outline-offset:2px; }
.noscript-note{ padding:14px 18px; text-align:center; background:var(--sand); border-bottom:1px solid var(--line); font-weight:600; }
.tl b{ font-size:1.2rem; }
