/* Dream Home — base: reset, typography, container, utilities.
   Uses logical properties everywhere so RTL (ar) and LTR (en) share one stylesheet. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--space-4)); }
body { margin: 0; min-height: 100vh; background: var(--surface); color: var(--ink); font-family: var(--font-text); font-size: 16px; line-height: 28px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
html.is-loading body { visibility: hidden; }
img, svg, video { max-width: 100%; }
img { display: block; height: auto; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--ink); text-wrap: balance; }
p { text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
strong, b { font-weight: 600; }
[hidden] { display: none !important; }
::selection { background: var(--brand-soft); color: var(--ink); }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); border-radius: var(--radius-xs); }
:lang(ar) em, :lang(ar) i { font-style: normal; font-weight: 600; }

/* Numbers, phones, prices stay left-to-right inside Arabic text */
.ltr, bdi.num { direction: ltr; unicode-bidi: isolate; }

/* ---------- Layout primitives ---------- */
.container { width: 100%; max-width: calc(var(--content-max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-gap); position: relative; }
.section--tight { padding-block: var(--space-8); }
.section--sunken { background: var(--surface-sunken); }
.section--raised { background: var(--surface-raised); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); margin-block-end: var(--space-6); flex-wrap: wrap; }
.section-head .dh-heading { flex: 1 1 420px; }
.section-head--center { justify-content: center; text-align: center; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.grid-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 1023px) { .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .grid-cards { grid-template-columns: minmax(0, 1fr); } }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); align-items: center; }
@media (max-width: 899px) { .split { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); } }

.muted { color: var(--ink-muted); }
.lead { font-size: 18px; line-height: 32px; color: var(--ink-muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.prose { max-width: 72ch; }
.prose > * + * { margin-block-start: var(--space-4); }
.prose h2 { font-size: 24px; line-height: 36px; margin-block-start: var(--space-7); }
.prose h3 { font-size: 19px; line-height: 30px; margin-block-start: var(--space-6); }
.prose ul, .prose ol { padding-inline-start: var(--space-5); }
.prose li + li { margin-block-start: var(--space-2); }

/* Skip link */
.skip-link { position: absolute; inset-inline-start: var(--space-4); top: -100px; z-index: 1000; background: var(--brand); color: var(--on-brand); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: var(--space-3); color: var(--on-brand); }

/* ---------- Extensions of DS components (site-level, same token rules) ---------- */
/* Icon-only button: square, 44px touch target */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--control-md); height: var(--control-md); border: 1.5px solid transparent; border-radius: var(--radius-sm); background: transparent; color: inherit; cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease; text-decoration: none; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.icon-btn--outline { border-color: var(--line-strong); color: var(--brand); background: var(--surface-raised); }
.icon-btn--outline:hover { border-color: var(--brand); background: var(--brand-soft); }

/* Chips (filters) — radius-full is reserved for pills/progress in DS */
.chip { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-sm); padding: 0 var(--space-4); border: 1.5px solid var(--line-strong); border-radius: var(--radius-full); background: var(--surface-raised); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip-count { font-size: 12px; font-weight: 600; opacity: .8; }

/* Select styled like DS TextField */
select.dh-field-input { appearance: none; -webkit-appearance: none; cursor: pointer; padding-inline-end: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23857b69' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; }
[dir="ltr"] select.dh-field-input { background-position: right 12px center; }
select.dh-field-input option { color: #161b33; background: #fff; }
.dh-field-req { color: var(--sold); margin-inline-start: 2px; }

/* Roof-corner frame for any media (signature of the brand) */
.roof { border-radius: var(--radius-md); border-start-start-radius: var(--radius-roof); overflow: hidden; }
.roof-lg { border-radius: var(--radius-md); border-start-start-radius: calc(var(--radius-roof) * 2); overflow: hidden; }

/* Parapet edge — Najdi triangles crowning a dark band (same technique as .dh-statband-edge) */
.parapet { position: relative; }
.parapet::before { content: ""; position: absolute; inset-inline: 0; top: -8px; height: 8px; background: conic-gradient(from 135deg at 50% 0, var(--parapet-color, var(--brand-deep)) 90deg, transparent 0) 0 0 / 16px 8px repeat-x; pointer-events: none; }

/* Media caption: «صورة تعبيرية» label on illustrative images */
.media-note { position: absolute; inset-block-end: var(--space-3); inset-inline-start: var(--space-3); z-index: 2; padding: 2px var(--space-2); border-radius: var(--radius-xs); background: var(--scrim); color: var(--on-deep); font-size: 12px; line-height: 18px; font-weight: 500; pointer-events: none; }

/* Fact list (specs with icons) */
.facts { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.fact { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); }
.fact .dh-icon { color: var(--brand); margin-block-start: 2px; }
.fact-label { display: block; font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.fact-value { display: block; font-weight: 600; font-size: 16px; line-height: 26px; color: var(--ink); }

/* Data table (lands, units) */
.table-wrap { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); overflow-x: auto; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 24px; }
.data-table th { text-align: start; font-size: 13px; font-weight: 600; color: var(--ink-muted); background: var(--surface-sunken); padding: var(--space-3) var(--space-4); white-space: nowrap; }
.data-table td { padding: var(--space-4); border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background-color .15s ease; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.data-table .cell-strong { font-weight: 600; color: var(--ink); }
.data-table .cell-num { white-space: nowrap; }
.data-table .cell-action { text-align: end; width: 1%; white-space: nowrap; }
.data-table a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.data-table a.row-link:hover { color: var(--brand); }
@media (max-width: 767px) {
  .data-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table--stack, .data-table--stack tbody, .data-table--stack tr, .data-table--stack td { display: block; width: 100%; }
  .data-table--stack tr { padding: var(--space-4); border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-4); }
  .data-table--stack tbody tr:first-child { border-top: 0; }
  .data-table--stack td { border: 0; padding: 0; }
  .data-table--stack td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; line-height: 18px; color: var(--ink-muted); font-weight: 500; }
  .data-table--stack td.cell-title { grid-column: 1 / -1; font-size: 17px; }
  .data-table--stack td.cell-action { grid-column: 1 / -1; text-align: start; width: auto; }
  .data-table--stack td.cell-action .dh-btn { width: 100%; }
}

/* Empty state */
.empty { text-align: center; padding: var(--space-8) var(--space-5); border: 1.5px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); }
.empty h3 { font-size: 19px; margin-block-end: var(--space-2); }

/* Notice */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-sm); background: var(--sand-soft); color: var(--ink); font-size: 14px; line-height: 24px; }
.notice .dh-icon { color: var(--sand-ink); flex: none; margin-block-start: 2px; }
.notice--brand { background: var(--brand-soft); }
.notice--brand .dh-icon { color: var(--brand); }
.notice--ok { background: var(--available-soft); }
.notice--ok .dh-icon { color: var(--available); }

/* Generic card */
.card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: var(--space-5); }
.card--roof { border-start-start-radius: var(--radius-roof); }

/* Small helpers */
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.text-center { text-align: center; }
.w-full { width: 100%; }
