/* الرمال الواحة — showcase. Light, airy, image-first: the layout language of
   premium compound microsites, carrying the TQRES green/gold identity. */

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('assets/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('assets/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('assets/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('assets/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF;
}

:root {
  --ink: #17301f;
  --ink-2: #4c5f52;
  --paper: #f7f5ef;
  --card: #ffffff;
  --line: #e3ded2;
  --green: #1e3a2b;
  --green-2: #2c5540;
  --gold: #b8963e;
  --gold-2: #c2a24c;
  --available: #2f9e63;
  --reserved: #c2a24c;
  --sold: #9a5b57;
  --radius: 14px;
  --shadow: 0 10px 40px rgb(23 48 31 / 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; }

/* ---------------- top bar ---------------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 30;
  flex-wrap: wrap;
}
.bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar__mark {
  inline-size: 40px; block-size: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--green); color: var(--gold-2);
  font-weight: 700; font-size: 1.2rem;
}
.bar__titles { display: grid; line-height: 1.25; }
.bar__titles strong { font-size: 1.02rem; }
.bar__titles span { font-size: 0.78rem; color: var(--ink-2); }

.pill {
  display: inline-block; padding: 0.14em 0.7em; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.pill--demo { border: 1px solid var(--gold); color: var(--gold); background: rgb(194 162 76 / 0.10); }

.bar__nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 700; color: var(--ink-2);
  border: 1px solid transparent;
  transition: 0.18s;
}
.nav-btn:hover { color: var(--green); background: rgb(30 58 43 / 0.06); }
.nav-btn.is-active { background: var(--green); color: #fff; }
.nav-btn--live {
  border-color: var(--gold); color: var(--green);
  background: linear-gradient(135deg, rgb(194 162 76 / 0.16), rgb(194 162 76 / 0.05));
}
.nav-btn--live:hover { background: var(--gold-2); color: #fff; }
.nav-ic { font-size: 0.9em; opacity: 0.85; }

/* ---------------- views ---------------- */
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; }
.view[hidden] { display: none; }

/* ---------------- map ---------------- */
.view--map { display: flex; }
.map-stage {
  position: relative; flex: 1; overflow: hidden;
  background: #cfd8ce;
  touch-action: none;
  user-select: none;
}
/* The live engine renders beneath the still; rotate intent fades the still
   away and the model is already there, mid-frame, at the same angle. */
#map-canvas {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  cursor: grab;
}
#map-canvas:active { cursor: grabbing; }

/* Sized by app.js to cover the stage at the image's own aspect ratio, so
   the hotspot SVG and the photograph can never disagree about a pixel. */
.map-world {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.map-img {
  position: absolute; inset: 0;
  inline-size: 100%; block-size: 100%;
  object-fit: fill;
  pointer-events: none;
}
.map-img--night { opacity: 0; transition: opacity 0.8s ease; }
.map-stage.is-night .map-img--night { opacity: 1; }

/* Live mode: the still (and its hotspots) yields to the engine beneath. */
.map-world { transition: opacity 0.45s ease; }
.map-stage.is-live .map-world {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .map-world, .map-img--night { transition-duration: 1ms; }
}

#map-svg { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
#map-svg polygon {
  fill: transparent;
  stroke: transparent;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  pointer-events: fill;
  transition: fill 0.15s;
}
#map-svg polygon:hover, #map-svg polygon.is-hover {
  fill: rgb(194 162 76 / 0.26);
  stroke: var(--gold-2);
}
#map-svg polygon.is-sold:hover { fill: rgb(154 91 87 / 0.30); stroke: var(--sold); }
#map-svg polygon.is-reserved:hover { fill: rgb(194 162 76 / 0.32); stroke: var(--reserved); }

.map-tooltip {
  position: fixed; z-index: 40; pointer-events: none;
  background: rgb(255 255 255 / 0.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  min-inline-size: 190px;
  transform: translate(-50%, calc(-100% - 14px));
}
.map-tooltip strong { display: flex; gap: 8px; align-items: center; font-size: 0.95rem; }
.map-tooltip .tt-type { color: var(--ink-2); font-size: 0.78rem; display: block; margin-top: 2px; }
.map-tooltip .tt-price { margin-top: 6px; font-weight: 700; font-size: 0.9rem; display: flex; gap: 6px; align-items: center; }

.map-provenance {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 20;
  font-size: 0.72rem; color: #fff;
  background: rgb(23 48 31 / 0.55);
  border: 1px solid rgb(255 255 255 / 0.25);
  padding: 4px 10px; border-radius: 999px;
  backdrop-filter: blur(6px);
}

.dot { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; margin-inline-end: 5px; }
.dot--available { background: var(--available); }
.dot--reserved { background: var(--reserved); }
.dot--sold { background: var(--sold); }

.map-legend {
  position: absolute; inset-block-end: 16px; inset-inline-start: 16px; z-index: 20;
  display: flex; gap: 14px; align-items: center;
  background: rgb(255 255 255 / 0.9); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2);
}

/* right rail — physical right, like the reference chrome */
.rail {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  display: grid; gap: 8px; z-index: 20;
}
.rail-btn {
  inline-size: 52px; min-block-size: 44px;
  display: grid; place-items: center;
  background: rgb(255 255 255 / 0.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 12px;
  font-size: 1rem; font-weight: 700; color: var(--ink-2);
  transition: 0.18s;
}
.rail-btn:hover { color: var(--green); border-color: var(--green-2); }
.rail-btn.is-active { background: var(--green); color: #fff; border-color: var(--green); }
.rail-btn--wide { inline-size: 52px; font-size: 0.62rem; line-height: 1.5; padding: 6px 2px; text-align: center; color: var(--green); border-color: var(--gold); }

/* bottom controls */
.controls {
  position: absolute; inset-block-end: 16px; inset-inline-start: 50%;
  transform: translateX(50%);
  display: flex; gap: 8px; align-items: center; z-index: 20;
  background: rgb(255 255 255 / 0.9); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 12px;
}
.ctl {
  inline-size: 40px; block-size: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  font-size: 1.05rem; color: var(--ink);
  display: grid; place-items: center;
}
.ctl:hover { background: var(--green); color: #fff; }
.ctl-hint { font-size: 0.72rem; color: var(--ink-2); padding-inline: 8px; }

/* unit sheet */
.sheet {
  inline-size: min(400px, 92vw);
  background: var(--card);
  border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  z-index: 25;
}
.sheet[hidden] { display: none; }
.sheet__head {
  display: flex; justify-content: space-between; align-items: start;
  padding: 18px 20px 10px;
}
.sheet__id { color: var(--gold); font-weight: 700; font-size: 0.85rem; }
.sheet__title { font-size: 1.3rem; }
.sheet__close {
  border: 1px solid var(--line); background: #fff; border-radius: 50%;
  inline-size: 36px; block-size: 36px;
}
.sheet__body { flex: 1; overflow: auto; padding: 6px 20px 16px; }
.sheet__foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-block: 10px; }
.fact {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px;
  text-align: center; font-size: 0.72rem; color: var(--ink-2);
}
.fact strong { display: block; color: var(--ink); font-size: 0.95rem; margin-top: 2px; }
.dw {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-block: 10px;
}
.dw__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dw__head strong { font-size: 0.98rem; }
.status { font-size: 0.72rem; font-weight: 700; padding: 0.15em 0.7em; border-radius: 999px; }
.status--available { color: var(--available); background: rgb(47 158 99 / 0.12); }
.status--reserved { color: #8a6d24; background: rgb(194 162 76 / 0.16); }
.status--sold { color: var(--sold); background: rgb(154 91 87 / 0.14); }
.dw__price { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 700; }
.dw__rooms { margin-top: 8px; color: var(--ink-2); font-size: 0.8rem; line-height: 1.9; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.9rem; transition: 0.18s;
}
.btn--primary { background: var(--gold-2); color: #1d1607; }
.btn--primary:hover { background: var(--gold); }
.btn--ghost { border-color: var(--line); background: #fff; color: var(--green); }
.btn--ghost:hover { border-color: var(--green); }
.btn--block { inline-size: 100%; }

/* ---------------- pages ---------------- */
.view--page { overflow: auto; }
.page { max-inline-size: 1180px; margin-inline: auto; padding: 34px 22px 70px; }
.page--narrow { max-inline-size: 560px; }
.page h2 { font-size: 1.7rem; margin-block-end: 6px; }
.page__note { color: var(--ink-2); margin-block-end: 22px; font-size: 0.9rem; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.gallery figure {
  position: relative; border-radius: var(--radius); overflow: hidden;
  cursor: pointer; box-shadow: var(--shadow); background: var(--card);
  aspect-ratio: 16/9;
}
.gallery img { inline-size: 100%; block-size: 100%; object-fit: cover; transition: transform 0.4s; }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption {
  position: absolute; inset-inline: 0; inset-block-end: 0;
  padding: 26px 12px 10px; font-size: 0.8rem; color: #fff;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.55));
}

/* location */
.loc { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.loc__card, .loc__high {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.loc h3 { margin-block-end: 12px; }
.loc ul { list-style: none; display: grid; gap: 10px; margin-block-end: 16px; }
.loc li { padding-inline-start: 22px; position: relative; color: var(--ink-2); }
.loc li::before { content: '◆'; position: absolute; inset-inline-start: 0; color: var(--gold-2); font-size: 0.7em; top: 0.45em; }
.loc__warranty { border-top: 1px dashed var(--line); padding-top: 14px; font-size: 0.85rem; color: var(--ink-2); line-height: 2; }
.loc__warranty b { color: var(--green); }

/* list + filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: end;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin-block-end: 18px; box-shadow: var(--shadow);
}
.filters label { display: grid; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--ink-2); }
.filters select, .filters input[type='range'] { min-inline-size: 150px; accent-color: var(--green-2); }
.filters select {
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-size: 0.85rem;
}
.f-range { min-inline-size: 230px; }
.filters__count { margin-inline-start: auto; color: var(--ink-2); font-size: 0.8rem; align-self: center; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: grid; gap: 8px;
  transition: transform 0.18s;
}
.card:hover { transform: translateY(-3px); }
.card__top { display: flex; justify-content: space-between; align-items: center; }
.card__id { color: var(--gold); font-weight: 700; font-size: 0.8rem; }
.card h3 { font-size: 1.02rem; }
.card__meta { color: var(--ink-2); font-size: 0.78rem; display: flex; gap: 12px; flex-wrap: wrap; }
.card__price { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.card__actions { display: flex; gap: 8px; margin-top: 4px; }
.card__actions .btn { padding: 8px 12px; font-size: 0.8rem; flex: 1; }

/* form */
#interest-form { display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
#interest-form label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 700; }
#interest-form input[type='text'], #interest-form input[type='tel'], #interest-form select, #interest-form textarea {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff;
}
#interest-form small { color: var(--ink-2); font-weight: 400; }
.consent { flex-direction: row; display: flex !important; gap: 10px; align-items: start; font-weight: 400 !important; color: var(--ink-2); }
.form-error { color: #a03535; font-size: 0.85rem; }
.form-done {
  background: var(--card); border: 1px solid var(--available); border-radius: var(--radius);
  padding: 22px; margin-top: 14px; line-height: 2;
}

/* lightbox + pano */
.lightbox, .pano {
  position: fixed; inset: 0; z-index: 60;
  background: rgb(12 18 14 / 0.94);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden], .pano[hidden] { display: none; }
.lightbox figure { max-inline-size: 92vw; max-block-size: 88vh; text-align: center; }
.lightbox img { max-inline-size: 92vw; max-block-size: 80vh; border-radius: 10px; }
.lightbox figcaption { color: #d8cbb4; margin-top: 12px; font-size: 0.85rem; }
.lightbox__close {
  position: absolute; top: 18px; inset-inline-start: 18px;
  inline-size: 44px; block-size: 44px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.3); background: transparent; color: #fff; font-size: 1rem;
}
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  inline-size: 52px; block-size: 52px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.3); background: transparent; color: #fff; font-size: 1.6rem;
}
.lightbox__nav--prev { inset-inline-start: 22px; }
.lightbox__nav--next { inset-inline-end: 22px; }

.pano__strip {
  inline-size: 100vw; block-size: 76vh;
  background-image: url('assets/pano-majlis.jpg');
  background-size: auto 100%;
  background-repeat: repeat-x;
  cursor: grab;
}
.pano__strip:active { cursor: grabbing; }
.pano__hint {
  position: absolute; inset-block-end: 26px; inset-inline-start: 50%;
  transform: translateX(50%);
  color: #fff; font-size: 0.85rem; display: flex; gap: 10px; align-items: center;
  background: rgb(23 48 31 / 0.6); padding: 8px 16px; border-radius: 999px;
}

/* footer */
.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; font-size: 0.75rem; color: var(--ink-2);
  border-top: 1px solid var(--line); background: #fff;
  z-index: 30;
}
.foot a { color: var(--green); font-weight: 700; }
.foot__legal { display: flex; gap: 8px; flex-wrap: wrap; }

/* responsive */
@media (max-width: 900px) {
  body { overflow: auto; }
  .view { position: relative; }
  .view--map { flex-direction: column; height: calc(100dvh - 120px); }
  .sheet {
    position: fixed; inset-inline: 0; inset-block-end: 0; inline-size: 100%;
    max-block-size: 70dvh; border-radius: 18px 18px 0 0; z-index: 50;
  }
  .loc { grid-template-columns: 1fr; }
  .rail { top: auto; inset-block-end: 90px; transform: none; }
  .ctl-hint { display: none; }
  .bar__nav { order: 3; inline-size: 100%; overflow-x: auto; }
}
