/* Coast View 3D — the QHD Folio app's look on the website.
   Every colour, size and timing lives in the variables below (from the app's Design/Theme.swift and
   Components.swift), so the whole section can be re-tuned here without touching the page code. */
:root {
  color-scheme: light;
  /* the model canvas: same light ivory as the app, in either system appearance */
  --scene-canvas: #F2EEE4;
  --scene-highlight: #FFFFFF;
  --scene-edge: #E5DDCE;
  --scene-ink: #302C26;
  --scene-secondary: #655D52;
  --scene-panel: rgba(255, 255, 255, .94);
  --scene-gold: #7D5E22;

  /* page */
  --surface: #F7F4EC;          /* warm ivory page */
  --card: #FFFFFF;             /* white panels */
  --ink: #302C26;              /* warm charcoal text */
  --ink-2: #5C574D;
  --hairline: #E6DFCF;
  --gold: #B08D45;             /* hairlines, icons, outlines */
  --gold-text: #7D5E22;        /* readable gold text */
  --gold-light: #D9BF84;       /* gold on charcoal */
  --accent: #302C26;           /* charcoal action fill */
  --on-accent: #F5F1E8;        /* ivory text on charcoal */

  /* availability: a word first, colour second */
  --for-sale: #2D6A47;
  --reserved: #84540E;
  --sold: #5C574D;

  /* selection on the building */
  --zone-line: #B08D45;
  --zone-fill-opacity: .18;
  --zone-hover-opacity: .10;

  /* type */
  --font-display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --text-caption: 12px;
  --text-footnote: 13px;
  --text-sub: 15px;
  --text-body: 17px;
  --title-home: clamp(34px, 6vw, 44px);
  --title-section: 22px;
  --title-sheet: 20px;

  /* spacing + shape */
  --gutter: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --bar-h: 52px;
  --control-h: 44px;
  --radius-card: 14px;
  --radius-hero: 0px;
  --radius-pill: 999px;
  --content-max: 820px;
  --side-panel: 440px;          /* desktop: details beside the model */
  --hairline-w: 1px;
  --shadow-panel: 0 1px 0 rgba(48, 44, 38, .06), 0 10px 30px rgba(48, 44, 38, .08);

  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-push: 320ms;
  --dur-fade: 220ms;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--surface);
  color: var(--ink);
  font: 400 var(--text-body)/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- screens: a navigation stack like the app ---------- */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
  transition: transform var(--dur-push) var(--ease), opacity var(--dur-push) var(--ease);
  will-change: transform;
}
.screen.under { transform: translateX(-24%); opacity: .6; pointer-events: none; visibility: hidden; transition: transform var(--dur-push) var(--ease), opacity var(--dur-push) var(--ease), visibility 0s linear var(--dur-push); }   /* seen during the push, then gone (nothing under a cover is readable, 4 Nov 2026) */
.screen.ahead { transform: translateX(100%); pointer-events: none; }
html[dir=rtl] .screen.under { transform: translateX(24%); }
html[dir=rtl] .screen.ahead { transform: translateX(-100%); }
.screen.cover.ahead, html[dir=rtl] .screen.cover.ahead { transform: translateY(100%); }
.screen.off { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .screen { transition: none; } }

/* ---------- navigation bar ---------- */
.navbar {
  flex: none;
  min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--space-2), env(safe-area-inset-right)) 0 max(var(--space-2), env(safe-area-inset-left));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-2);
  background: var(--scene-panel);
  border-bottom: var(--hairline-w) solid var(--hairline);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  position: relative; z-index: 5;
}
.navbar .lead { justify-self: start; display: flex; gap: var(--space-1); }
.navbar .trail { justify-self: end; display: flex; gap: var(--space-1); align-items: center; }
.navbar .title {
  font-size: var(--text-body); font-weight: 600; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
}
.navbar .title.serif { font: 600 var(--title-sheet)/1.1 var(--font-display); }
.bar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--control-h); min-width: var(--control-h); padding: 0 10px;
  border: 0; background: none; color: var(--ink); cursor: pointer;
  font-size: var(--text-body); font-weight: 600; text-decoration: none; border-radius: 10px;
}
.bar-btn:hover { background: rgba(48, 44, 38, .05); }
.bar-btn svg { width: 20px; height: 20px; flex: none; }
html[dir=rtl] .bar-btn .flip { transform: scaleX(-1); }
.bar-btn.icon-only { padding: 0; justify-content: center; }
.lang-btn { font-size: var(--text-footnote); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- language menu ---------- */
.lang-menu {
  position: fixed; z-index: 50; top: calc(var(--bar-h) + env(safe-area-inset-top) + 6px); inset-inline-end: var(--space-3);
  background: var(--card); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: var(--shadow-panel); padding: 6px; min-width: 200px;
}
.lang-menu button {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px;
  min-height: var(--control-h); padding: 0 12px; border: 0; background: none; border-radius: 10px; cursor: pointer;
  font-size: var(--text-sub);
}
.lang-menu button:hover { background: var(--surface); }
.lang-menu button[aria-checked=true] { font-weight: 600; }
.lang-menu button[aria-checked=true]::after { content: '✓'; color: var(--gold-text); }

/* ---------- the model canvas ---------- */
.scene {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  background: radial-gradient(circle at 50% 50%, var(--scene-highlight) 0, var(--scene-canvas) 45%, var(--scene-edge) 100%);
}
.scene.plan-bg { background: radial-gradient(circle at 50% 45%, var(--scene-highlight) 0, var(--scene-canvas) 50%, var(--scene-edge) 100%); }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.scene canvas:active { cursor: grabbing; }
.scene.embedded canvas { touch-action: pan-y; }
.scene.hovering canvas { cursor: pointer; }
.scene .state {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3); padding: var(--space-5); text-align: center; color: var(--scene-ink); pointer-events: none;
}
.scene .state > * { pointer-events: auto; }
.scene .state p { margin: 0; font-size: var(--text-sub); max-width: 34ch; }
.scene .state .small { font-size: var(--text-footnote); color: var(--scene-secondary); }
.scene .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.scene .poster.mirrored { transform: scaleX(-1); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(48, 44, 38, .14); border-top-color: var(--scene-ink);
  animation: spin .9s linear infinite;
}
.meter { width: min(260px, 70%); height: 4px; border-radius: 4px; background: rgba(48, 44, 38, .1); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.tip {
  position: absolute; z-index: 3; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
  background: var(--card); color: var(--ink); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-pill);
  padding: 5px 12px; font-size: var(--text-footnote); font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-panel);
}
.tip .tag { margin-inline-start: 8px; }
.capsule-note {
  position: absolute; z-index: 2; inset-inline-start: 12px; bottom: 12px;
  background: var(--scene-panel); color: var(--scene-secondary); border-radius: var(--radius-pill);
  padding: 6px 10px; font-size: var(--text-caption); font-weight: 600; max-width: calc(100% - 24px);
}
.scene-tools { position: absolute; z-index: 2; inset-inline-end: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.round-btn {
  width: var(--control-h); height: var(--control-h); border-radius: 50%; border: var(--hairline-w) solid var(--hairline);
  background: var(--scene-panel); color: var(--scene-ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-panel);
}
.round-btn svg { width: 18px; height: 18px; }

/* ---------- bottom panel (building + floor plan) ---------- */
.dock {
  flex: none; background: var(--scene-panel); border-top: var(--hairline-w) solid var(--hairline);
  padding: var(--space-3) 0 calc(var(--space-3) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--space-3); align-items: center; text-align: center; z-index: 4;
}
.dock .hint { font-size: var(--text-sub); font-weight: 600; color: var(--scene-ink); padding: 0 var(--gutter); }
.dock .hint.error { color: var(--reserved); }
.dock .fine { font-size: var(--text-caption); color: var(--scene-secondary); padding: 0 var(--gutter); max-width: 560px; }
.chips {
  display: flex; gap: var(--space-2); overflow-x: auto; width: 100%; padding: 2px var(--gutter) 4px;
  scroll-snap-type: x proximity; scrollbar-width: none; justify-content: safe center;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: center; min-height: 38px; padding: 0 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  font-size: var(--text-sub); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  font-variant-numeric: tabular-nums;
}
.chip:hover { opacity: .9; }
.chip[aria-current=true] { background: var(--card); color: var(--ink); border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.chip .dot { display: none; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.chip[aria-current=true] .dot { display: inline-block; }
@media (min-width: 900px) { .chips { flex-wrap: wrap; justify-content: center; max-width: 1180px; overflow: visible; } }
.dock .links { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; padding: 0 var(--gutter); }

/* ---------- buttons (AccentButtonStyle / OutlineButtonStyle) ---------- */
.btn-accent, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border-radius: var(--radius-pill); cursor: pointer; text-decoration: none; text-align: center;
}
.btn-accent {
  background: var(--accent); color: var(--on-accent); border: 0;
  padding: 13px 12px; font-size: var(--text-body); font-weight: 600;
}
.btn-accent:active { opacity: .85; }
.btn-outline {
  background: var(--card); color: var(--ink); border: 1px solid var(--gold);
  padding: 11px 10px; font-size: var(--text-sub); font-weight: 600;
}
.btn-outline:active { opacity: .6; }
.btn-outline.compact { width: auto; padding: 8px 16px; }
.btn-accent svg, .btn-outline svg { width: 18px; height: 18px; flex: none; }
.btn-accent svg { color: var(--gold-light); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.busy-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }

/* ---------- home page (UnitDetailView) ---------- */
.home-body { flex: 1; min-height: 0; display: flex; }
.home-hero { position: relative; flex: none; aspect-ratio: 4 / 3; max-height: 62vh; width: 100%; border-radius: var(--radius-hero); }
.home-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.home-col { max-width: var(--content-max); margin: 0 auto; }
.home-content { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.eyebrow { text-transform: uppercase; font-size: var(--text-caption); font-weight: 600; letter-spacing: .13em; color: var(--gold-text); }
html[lang=ar] .eyebrow, html[lang=fa] .eyebrow, html[lang=he] .eyebrow { letter-spacing: normal; }
.home-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.home-title { margin: 2px 0 0; font: 600 var(--title-home)/1.05 var(--font-display); color: var(--ink); }
.home-sub { color: var(--ink-2); font-size: var(--text-sub); margin-top: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 3px 8px; border-radius: var(--radius-pill); font-size: var(--text-caption); font-weight: 600;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 12%, transparent);
}
.tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--tag); box-sizing: border-box; }
.tag.available { --tag: var(--for-sale); }
.tag.available::before { background: var(--tag); }
.tag.reserved { --tag: var(--reserved); }
.tag.reserved::before { background: linear-gradient(90deg, var(--tag) 50%, transparent 50%); }
.tag.sold { --tag: var(--sold); }
.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat svg { width: 20px; height: 20px; color: var(--gold); }
.note-line { display: flex; gap: 6px; align-items: flex-start; font-size: var(--text-caption); color: var(--ink-2); }
.note-line svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.card { background: var(--card); border-radius: var(--radius-card); padding: var(--space-4); }
.card h2 { margin: 0 0 var(--space-3); font: 600 var(--title-section)/1.15 var(--font-display); color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { text-transform: uppercase; font-size: var(--text-caption); font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.facts dd { margin: 2px 0 0; font-size: var(--text-body); }
.source-line { font-size: var(--text-caption); color: var(--ink-2); }
.explore {
  flex: none; border-top: var(--hairline-w) solid var(--hairline); background: var(--surface);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); display: flex; justify-content: center;
}
.explore button {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: var(--radius-pill); padding: 11px 26px; text-align: start;
}
.explore svg { width: 22px; height: 22px; color: var(--gold-light); flex: none; }
.explore b { display: block; font: 600 21px/1.1 var(--font-display); }
.explore small { display: block; text-transform: uppercase; font-size: 11px; font-weight: 600; letter-spacing: .1em; opacity: .8; margin-top: 2px; }

/* desktop + iPad landscape: the model beside the details, like a split view */
@media (min-width: 1024px) and (min-height: 560px) {
  .home-body { flex-direction: row; }
  .home-hero-wrap { flex: 1; min-width: 0; display: flex; }
  .home-hero { aspect-ratio: auto; max-height: none; height: 100%; }
  .home-scroll { flex: none; width: var(--side-panel); border-inline-start: var(--hairline-w) solid var(--hairline); }
  .home-scroll .home-col { max-width: none; }
  .home-scroll .in-flow-hero { display: none; }
  .explore { display: none; }
}
@media not all and (min-width: 1024px) and (min-height: 560px) {
  .home-hero-wrap { display: none; }
}

/* ---------- full-screen floor plan + 2D sheet ---------- */
.plan-panel { flex: none; background: var(--scene-panel); border-top: var(--hairline-w) solid var(--hairline);
  padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.plan-panel .btn-row { width: 100%; max-width: 440px; }
.plan-panel .hint { font-size: var(--text-footnote); font-weight: 600; }
.plan-panel .fine { font-size: var(--text-caption); color: var(--scene-secondary); max-width: 560px; }
.plan-panel .warn { font-size: var(--text-caption); color: var(--reserved); font-weight: 600; }
.sheet-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--card); touch-action: none; cursor: grab; }
.sheet-stage:active { cursor: grabbing; }
.sheet-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.sheet-inner img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.sheet-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sheet-inner polygon { fill: color-mix(in srgb, var(--gold) 16%, transparent); stroke: var(--gold); stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

/* ---------- 360 tour (TourPlayerView) ---------- */
.tourbar {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: calc(44px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--space-3) 0; background: var(--card); border-bottom: var(--hairline-w) solid var(--hairline);
}
.tourbar .t { min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.tourbar .t b { font-size: var(--text-footnote); font-weight: 600; }
.tourbar .t span { font-size: var(--text-caption); color: var(--ink-2); }
.tour-stage { position: relative; flex: 1; min-height: 0; background: #000; }
.tour-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.tour-stage .state { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 24px; pointer-events: none; }
.tour-stage .state > * { pointer-events: auto; }
.tour-stage .spinner { border-color: rgba(255, 255, 255, .2); border-top-color: #fff; }
.tour-stage .btn-accent { width: auto; min-width: 200px; background: var(--card); color: var(--ink); }

/* ---------- small screens ---------- */
@media (max-width: 420px) {
  :root { --text-body: 16px; --title-home: 36px; }
  .navbar .title { max-width: 44vw; }
  .bar-btn .lbl { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .dock { padding-top: 6px; gap: 6px; }
  .dock .fine { display: none; }
  .plan-panel { padding-top: 6px; gap: 4px; }
  .plan-panel .fine { display: none; }
}

/* the home's film (21 Nov 2026): black stage, the whole 16:9 picture on any screen */
.film-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.film-stage video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
