:root {
  --ink: #0e0c0a;
  --glass: rgb(20 17 14 / .55);
  --glass-line: rgb(255 255 255 / .16);
  --on: #f6f1e8;
  --muted: rgb(246 241 232 / .72);
  --stone: #c9b08a;
  --hl: rgb(232 205 160 / .32);
  --hl-line: #f3dcb2;
  --paper: #f4efe6;
  --paper-ink: #1e1a16;
  --radius: 16px;
  --font-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-head: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --pad: clamp(16px, 2.6vw, 32px);
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--on); font: 400 16px/1.6 var(--font-body); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--hl-line); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.3; margin: 0; }

/* stage layers */
.stage, .scene, .layer, .clip, .pano, .plan-view, .hot, .vignette { position: fixed; inset: 0; width: 100%; height: 100%; }
.layer, .clip { object-fit: cover; }
.scene { transition: transform 1.1s var(--ease), opacity .7s var(--ease); transform-origin: 50% 50%; }
.scene.kenburns .layer { animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.08) translate(-1%, -.5%); } }
.layer.night { opacity: var(--night, 0); }
.clip { opacity: 0; transition: opacity .35s; pointer-events: none; }
.clip.on { opacity: 1; }
.pano { opacity: 0; transition: opacity .6s var(--ease); touch-action: none; cursor: grab; pointer-events: none; }
.pano.on { opacity: 1; pointer-events: auto; } /* an invisible canvas must not swallow clicks meant for the villas */
.pano:active { cursor: grabbing; }
/* skeleton: shown only when a scene asset takes longer than ~150 ms */
.skel { position: fixed; inset: 0; z-index: 3; pointer-events: none; background: linear-gradient(100deg, rgb(255 255 255 / 0) 30%, rgb(255 255 255 / .07) 50%, rgb(255 255 255 / 0) 70%) 0 0 / 250% 100%, rgb(14 12 10 / .35); animation: shimmer 1.4s linear infinite; }
.skel span { position: absolute; top: 0; inset-inline: 0; height: 2px; background: var(--stone); transform-origin: left; animation: grow 1.6s var(--ease) infinite; }
@keyframes shimmer { to { background-position: -150% 0, 0 0; } }
@keyframes grow { 0% { transform: scaleX(0); opacity: 1; } 80% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.layer { transition: transform .5s var(--ease); }
.vignette { pointer-events: none; background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgb(0 0 0 / .45)), linear-gradient(to bottom, rgb(0 0 0 / .45), transparent 18%, transparent 75%, rgb(0 0 0 / .5)); }

.hot path { fill: transparent; stroke: transparent; stroke-width: 2; cursor: pointer; transition: fill .25s, stroke .25s; vector-effect: non-scaling-stroke; }
.hot path:hover, .hot path.on { fill: var(--hl); stroke: var(--hl-line); }
.hot path:focus { outline: none; }
.hot path:focus-visible { fill: var(--hl); stroke: #fff; stroke-width: 3; }

.plan-view { background: var(--paper); display: grid; place-items: center; padding: 96px var(--pad) 150px; }
.plan-view img { max-width: 100%; max-height: calc(100svh - 250px); object-fit: contain; mix-blend-mode: multiply; }
.plan-note { position: fixed; bottom: 92px; inset-inline: 0; text-align: center; color: var(--paper-ink); margin: 0; font-size: 14px; opacity: .75; }

/* chrome */
.top { position: fixed; inset: 0 0 auto; z-index: 5; display: flex; align-items: center; gap: 18px; padding: calc(var(--pad) * .8) var(--pad); padding-top: max(calc(var(--pad) * .8), env(safe-area-inset-top)); }
.logo { height: 30px; width: auto; }
.crumbs { flex: 1; display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs button { background: none; border: 0; padding: 8px 4px; cursor: pointer; color: var(--muted); }
.crumbs button:hover { color: var(--on); }
.crumbs [aria-current] { color: var(--on); }
.crumbs .sep { opacity: .5; }
.top-actions { display: flex; gap: 8px; }
.chip { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--glass-line); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; transition: background .2s, border-color .2s, transform .2s; white-space: nowrap; }
.chip:hover { background: rgb(40 34 28 / .75); border-color: rgb(255 255 255 / .35); }
.chip[aria-pressed="true"] { background: var(--on); color: var(--ink); border-color: var(--on); }
.chip.round { width: 44px; padding: 0; display: grid; place-items: center; }
.chip svg, .back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.back { position: fixed; z-index: 5; top: 84px; inset-inline-start: var(--pad); display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 999px; border: 1px solid var(--glass-line); background: var(--glass); backdrop-filter: blur(14px); cursor: pointer; }
[dir="ltr"] .back svg { transform: scaleX(-1); }

.hint { position: fixed; z-index: 4; inset-inline: 0; bottom: 96px; margin: 0; text-align: center; font-size: 15px; color: var(--on); text-shadow: 0 1px 12px rgb(0 0 0 / .6); opacity: 0; transition: opacity .6s; pointer-events: none; }
.hint.on { opacity: .9; }

/* info card follows the pointer on desktop, docks as a bottom sheet on touch */
.card { position: fixed; z-index: 6; width: 290px; padding: 18px 20px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); pointer-events: none; transition: opacity .2s; }
.card h3 { font-size: 20px; margin-bottom: 4px; }
.card .sub { color: var(--stone); font-size: 14px; margin: 0 0 12px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.card .go { display: none; }
@media (hover: none) {
  .card { pointer-events: auto; inset: auto 12px calc(150px + env(safe-area-inset-bottom)) 12px !important; width: auto; }
  .card .go { display: flex; margin-top: 14px; width: 100%; justify-content: center; align-items: center; background: var(--on); color: var(--ink); }
}

.rooms, .views { position: fixed; z-index: 5; display: flex; gap: 8px; }
.rooms { bottom: calc(var(--pad) + 64px + env(safe-area-inset-bottom)); inset-inline: var(--pad); justify-content: center; flex-wrap: wrap; }
.views { top: 84px; inset-inline-end: var(--pad); }
@media (max-width: 700px) {
  .rooms { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding-bottom: 4px; }
  .crumbs { display: none; }
  #btn-site, #btn-project { padding: 0 12px; font-size: 14px; }
  .top { gap: 10px; }
  .logo { height: 24px; }
}

.daynight { position: fixed; z-index: 5; bottom: calc(var(--pad) + env(safe-area-inset-bottom)); inset-inline-end: var(--pad); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(14px); }
.daynight svg { width: 18px; height: 18px; fill: none; stroke: var(--on); stroke-width: 1.8; stroke-linecap: round; display: block; }
.daynight { min-height: 44px; color: var(--on); font: inherit; cursor: pointer; }
.daynight span { display: grid; place-items: center; width: 34px; height: 30px; border-radius: 999px; transition: background .3s; }
.daynight[aria-pressed="false"] .dn-day, .daynight[aria-pressed="true"] .dn-night { background: var(--stone); }
.daynight:focus-visible { outline: 2px solid var(--stone); outline-offset: 3px; }
.street img.night, .lb-frame .lb-night, .clip.night { transition: opacity .7s ease; } /* the toggle fades instead of a hard cut */
.layer.night { transition: opacity .7s ease, transform .5s var(--ease); }

/* side sheet (project brief / site study) */
.sheet { position: fixed; z-index: 8; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100%); background: var(--paper); color: var(--paper-ink); overflow-y: auto; transform: translateX(var(--off, 100%)); transition: transform .55s var(--ease); box-shadow: 0 0 60px rgb(0 0 0 / .4); }
[dir="rtl"] .sheet { --off: -100%; }
.sheet.open { transform: none; }
.sheet-close { position: sticky; top: 16px; float: inline-end; margin: 16px; background: rgb(30 26 22 / .08); color: var(--paper-ink); border-color: transparent; backdrop-filter: none; }
.sheet-body { padding: 40px clamp(20px, 5vw, 48px) 64px; }
.sheet h2 { font-size: clamp(26px, 4vw, 34px); margin-bottom: 12px; }
.sheet h3 { font-size: 20px; margin: 36px 0 14px; }
.sheet p.lead { color: #5a5148; font-size: 17px; margin: 0 0 28px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.kpis div { background: #fff; border: 1px solid #e3d9c8; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column-reverse; }
.kpis dd { margin: 0; font: 700 28px/1.15 var(--font-head); color: #8a5a12; font-variant-numeric: tabular-nums; }
.kpis dt { font-size: 14px; color: #5a5148; }
table.types { width: 100%; border-collapse: collapse; font-size: 15px; }
table.types th, table.types td { padding: 10px 8px; text-align: start; border-bottom: 1px solid #e3d9c8; font-variant-numeric: tabular-nums; }
table.types th { font-weight: 500; color: #5a5148; font-size: 13px; }
.sheet ul.feat { padding: 0; margin: 0; list-style: none; display: grid; gap: 10px; }
.sheet ul.feat li { padding-inline-start: 22px; position: relative; }
.sheet ul.feat li::before { content: ""; position: absolute; inset-inline-start: 0; top: .7em; width: 8px; height: 8px; border-radius: 2px; background: #c9b08a; }
.site-plot { width: 100%; height: auto; margin: 8px 0 4px; }
.site-plot .lbl { font: 600 6.5px var(--font-body); fill: #3a332c; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
dl.facts dt { color: #5a5148; }
dl.facts dd { margin: 0; }
.maplink { display: inline-flex; margin-top: 18px; color: #8a5a12; font-weight: 500; }
.credit { margin-top: 48px; font-size: 13px; color: #8b8176; }

/* intro */
.intro { position: fixed; inset: 0; z-index: 20; background: var(--ink); display: grid; place-content: center; justify-items: center; gap: 22px; transition: opacity .9s var(--ease), visibility .9s; }
.intro.done { opacity: 0; visibility: hidden; pointer-events: none; }
.intro img { width: 220px; height: auto; }
.intro-bar { width: 200px; height: 2px; background: rgb(255 255 255 / .14); overflow: hidden; border-radius: 2px; }
.intro-bar span { display: block; height: 100%; width: 0; background: var(--stone); transition: width .3s; }
.intro p { margin: 0; color: var(--muted); font-size: 14px; }

/* portrait phones: the 16:9 aerial/facade becomes a wide strip you can swipe sideways instead of a hard crop */
@media (orientation: portrait) {
  .stage { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .stage::-webkit-scrollbar { display: none; }
  .scene { position: absolute; width: calc(100svh * 16 / 9); height: 100svh; right: auto; }
  .scene .layer, .scene .hot { position: absolute; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* plans + shots sheets */
.sheet.wide { width: min(1080px, 100%); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.tabs button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid #d8cdbb; background: #fff; color: var(--paper-ink); cursor: pointer; font-size: 14px; }
.tabs button[aria-pressed="true"] { background: var(--paper-ink); color: var(--paper); border-color: var(--paper-ink); }
.plan-box { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
.plan-box figure { margin: 0; background: #fff; border: 1px solid #e3d9c8; border-radius: 12px; padding: 12px; min-height: 300px; display: grid; place-items: center; }
.plan-box figure img { max-width: 100%; max-height: 70vh; object-fit: contain; cursor: zoom-in; }
.plan-box dl.facts { font-size: 15px; }
@media (max-width: 760px) { .plan-box { grid-template-columns: 1fr; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in; aspect-ratio: 16 / 10; background: #e3d9c8; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.gallery button:hover img { transform: scale(1.04); }
.lightbox { position: fixed; inset: 0; z-index: 12; background: rgb(8 7 6 / .94); display: grid; place-items: center; padding: 56px 16px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-close { position: fixed; top: 16px; inset-inline-end: 16px; }
.lb-prev, .lb-next { position: fixed; top: 50%; transform: translateY(-50%); }
.lb-prev { inset-inline-start: 12px; } .lb-next { inset-inline-end: 12px; }
[dir="ltr"] .lb-prev svg, [dir="ltr"] .lb-next svg { transform: scaleX(-1); }
@media (max-width: 700px) { #btn-plans, #btn-shots { padding: 0 12px; font-size: 14px; } .top-actions { flex-wrap: wrap; justify-content: flex-end; } }

/* walk arrows inside the 360 view */
.marks { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.mark { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; color: var(--on); }
.mark i { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .9); background: rgb(20 17 14 / .35); backdrop-filter: blur(6px); display: grid; place-items: center; transition: transform .2s, background .2s; }
.mark i::after { content: ""; width: 12px; height: 12px; border-top: 2px solid #fff; border-inline-start: 2px solid #fff; transform: translateY(3px) rotate(45deg); }
.mark span { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: rgb(20 17 14 / .6); white-space: nowrap; }
.mark:hover i { transform: scale(1.12); background: rgb(201 176 138 / .55); }
.hint.up { bottom: calc(var(--pad) + 130px); }
/* street hero reached by scrolling from the aerial */
.street { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
.street img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); transition: transform 2.4s var(--ease); }
.street.in img { transform: scale(1.02); }
.street-copy { position: absolute; inset-inline: var(--pad); bottom: 22vh; color: var(--on); text-shadow: 0 2px 24px rgb(0 0 0 / .45); opacity: 0; transform: translateY(18px); transition: opacity 1s .6s, transform 1s .6s var(--ease); }
.street.in .street-copy { opacity: 1; transform: none; }
.street-copy h1 { font-size: clamp(34px, 6vw, 78px); }
.street-copy p { margin: 8px 0 0; font-size: clamp(16px, 2vw, 22px); color: var(--stone); }
.scene.dive { transform: scale(1.9) translateY(6%) !important; opacity: 0 !important; transition: transform 1.3s var(--ease), opacity 1.1s .25s !important; }

/* perspectives viewer: big centred image, prev/next, close top-right, day/night slider stays on top */
.lightbox { z-index: 12; }
.lb-frame { position: relative; width: min(86vw, calc(76vh * 16 / 9)); aspect-ratio: 16 / 9; max-height: 76vh; }
.lb-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.lb-frame .lb-night { opacity: var(--night, 0); }
.lb-frame .lb-night[hidden] { display: none; }
.lb-close { right: 16px !important; left: auto !important; inset-inline-end: auto; }
.lb-count { position: fixed; top: 26px; inset-inline: 0; margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
.lightbox:not([hidden]) ~ .daynight, body.viewing .daynight { z-index: 13; }

.clip { z-index: 1; } /* walk + drop clips play above the 360 view */
.street img.night { position: absolute; inset: 0; opacity: var(--night, 0); }
.street img.night[hidden] { display: none; }
body.walking .marks, body.walking .rooms { opacity: 0; pointer-events: none; transition: opacity .25s; }

.daynight.off { opacity: .35; pointer-events: none; }

/* street hit-zone on the drone shot */
.hot path.street-hit:hover, .hot path.street-hit.on { fill: rgb(243 220 178 / .34); stroke: var(--hl-line); stroke-width: 2.5; }

/* exploded floors: the villa's plans stacked in axonometric, pulled apart on open */
.explode { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; perspective: 2600px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 40%, #2a241d 0%, #12100d 70%); opacity: 0; transition: opacity .5s var(--ease); }
.explode.in { opacity: 1; }
.ex-stack { position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d; transform: translateY(var(--dy, 0)) rotateX(57deg) rotateZ(-36deg); }
.ex-layer { position: absolute; inset: 0; transform-style: preserve-3d; cursor: pointer; outline: none;
  transform: translateZ(0); transition: transform 1.1s var(--ease), filter .35s; transition-delay: calc(var(--i) * 90ms); }
.explode.in .ex-layer { transform: translateZ(calc(var(--i) * var(--gap))); }
.ex-plate { position: absolute; inset: 0; background: #fbf8f2; border: 1px solid rgb(255 255 255 / .5); border-radius: 2px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .25), 0 40px 60px -20px rgb(0 0 0 / .55); overflow: hidden; transition: box-shadow .35s; }
.ex-plate img { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }
.ex-stack:has(.ex-layer:hover, .ex-layer:focus-visible) .ex-layer:not(:hover, :focus-visible) { filter: brightness(.55) saturate(.7); }
.explode.in .ex-layer:hover, .explode.in .ex-layer:focus-visible { transform: translateZ(calc(var(--i) * var(--gap) + 18px)); transition-delay: 0s; }
.ex-layer:hover .ex-plate, .ex-layer:focus-visible .ex-plate { box-shadow: 0 0 0 2px var(--hl-line), 0 50px 70px -20px rgb(0 0 0 / .6); }
/* dashed guides from every corner of the ground plate up through the stack */
.ex-post { position: absolute; width: 0; height: calc(2 * var(--gap)); border-inline-start: 1px dashed rgb(243 220 178 / .55);
  transform-origin: 0 0; transform: rotateX(90deg); opacity: 0; transition: opacity .6s .9s; pointer-events: none; }
.explode.in .ex-post { opacity: 1; }
/* floor label: counter-rotated so it faces the viewer, sits off the plate's left corner */
.ex-tag { position: absolute; left: 0; top: 50%; transform-origin: 0 0; transform: rotateZ(36deg) rotateX(-57deg) translate(calc(-100% - 28px), -50%);
  white-space: nowrap; text-align: end; color: var(--on); pointer-events: none; }
.ex-tag b { display: block; font: 600 clamp(14px, 1.4vw, 19px)/1.3 var(--font-head); }
.ex-tag span { font-size: clamp(12px, 1vw, 14px); color: var(--muted); }
.ex-tag::after { content: ""; position: absolute; top: 50%; inset-inline-start: calc(100% + 6px); width: 18px; border-top: 1px solid rgb(243 220 178 / .7); }
.ex-toggle { top: auto; bottom: calc(var(--pad) + 64px + env(safe-area-inset-bottom)); inset-inline-end: auto; left: 50%; transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { .ex-layer, .explode { transition: none; } }
#btn-explode { background: var(--on); color: var(--ink); border-color: transparent; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
#btn-explode[aria-pressed="true"] { background: var(--glass); color: var(--on); border-color: var(--glass-line); }

.clip.night.on { opacity: var(--night-clip, 0); } /* night twin over the day clip; a switch, since the AI night move is not frame-identical */
