/* Rosemarine Garden — 3D tour page. Shares the site's tokens, built as a full-screen app. */
@font-face { font-family: Thmanyah; src: local('thmanyah sans Regular'), local('thmanyahsans-Regular'); font-weight: 100 499; font-display: swap; }
@font-face { font-family: Thmanyah; src: local('thmanyah sans Bold'), local('thmanyahsans-Bold'); font-weight: 500 900; font-display: swap; }

:root {
  --marine: #0c191b; --marine-2: #132427; --marine-3: #1d3337;
  --foam: #eef0ea; --foam-muted: #a9b4b0; --ink: #121a1b;
  --accent: #93c2b4; --accent-soft: #c9e2d9; --accent-deep: #2e6b5e;
  --glass: rgba(10, 22, 24, .58); --line: rgba(238, 240, 234, .16);
  --sans: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --pad: clamp(12px, 2vw, 22px);
}
html[lang=ar] { --sans: Thmanyah, 'IBM Plex Sans Arabic', 'Geist', system-ui, sans-serif; --serif: var(--sans); }
html[lang=zh] { --sans: 'Geist', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; overscroll-behavior: none;
  background: radial-gradient(120% 90% at 50% 28%, #22393d 0%, #0f1f22 55%, #081214 100%);
  color: var(--foam); font-family: var(--sans); font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
html[dir=rtl] .i-dir { transform: scaleX(-1); }

.t-stage, .t-stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.t-stage canvas { cursor: grab; }
.t-stage canvas:active { cursor: grabbing; }
body[data-mode=walk] .t-stage canvas { cursor: crosshair; }

/* Glass controls */
.t-btn {
  display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: 14px; font-weight: 500;
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  transition: background .3s, color .3s, border-color .3s, transform .4s var(--ease);
}
.t-btn:hover { background: rgba(238, 240, 234, .14); }
.t-icon { width: 44px; padding: 0; justify-content: center; }
.seg { position: relative; display: inline-flex; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.seg button { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--foam-muted); transition: color .4s var(--ease); white-space: nowrap; }
.seg button[aria-pressed=true] { color: var(--ink); }
.seg-ind { position: absolute; top: 4px; bottom: 4px; left: 0; width: var(--w, 0); border-radius: 999px; background: var(--foam); transform: translateX(var(--x, 4px)); transition: transform .55s var(--ease), width .55s var(--ease); }
.seg-wide { display: flex; width: 100%; }
.seg-wide button { flex: 1; }

/* Top bar */
.t-bar {
  position: fixed; z-index: 20; top: 0; inset-inline: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: calc(var(--pad) + env(safe-area-inset-top, 0px)) var(--pad) 26px;
  background: linear-gradient(180deg, rgba(6, 14, 15, .62), rgba(6, 14, 15, 0)); pointer-events: none;
}
.t-bar > * { pointer-events: auto; }
.t-back { justify-self: start; }
.t-title { display: grid; justify-items: center; text-align: center; line-height: 1.15; pointer-events: none; }
.t-brand { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; letter-spacing: .32em; color: var(--foam-muted); direction: ltr; }
.t-brand svg { width: 12px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.t-title b { font-size: 26px; font-weight: 400; letter-spacing: -.04em; margin-top: 2px; }
.t-title span:last-child { font-size: 12px; color: var(--foam-muted); }
.t-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.t-settings[aria-expanded=true] { background: var(--foam); color: var(--ink); }

/* Settings panel */
.t-panel {
  position: fixed; z-index: 30; top: 0; inset-inline-end: 0; width: min(390px, 100vw); height: 100%; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 28px; background: rgba(9, 20, 22, .9);
  border-inline-start: 1px solid var(--line); backdrop-filter: blur(26px) saturate(1.3); -webkit-backdrop-filter: blur(26px) saturate(1.3);
  transform: translateX(105%); transition: transform .6s var(--ease); user-select: text;
}
html[dir=rtl] .t-panel { transform: translateX(-105%); }
body.panel-open .t-panel { transform: none; }
.t-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.t-panel h2 { margin: 0; font-size: 28px; font-weight: 400; letter-spacing: -.03em; }
.t-panel section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.t-panel h3 { margin: 0 0 12px; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--foam-muted); }
html[lang=ar] .t-panel h3 { letter-spacing: 0; }
.t-types { display: grid; gap: 8px; }
.t-type { display: grid; gap: 4px; padding: 13px 15px; border-radius: 14px; text-align: start; border: 1px solid var(--line); background: rgba(238, 240, 234, .04); transition: background .3s, border-color .3s, color .3s, transform .4s var(--ease); }
.t-type:hover { background: rgba(238, 240, 234, .09); }
.t-type[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.t-type-top { display: flex; justify-content: space-between; gap: 10px; }
.t-type-top b { font-size: 16px; font-weight: 600; }
.t-type-top span, .t-type-floor { font-size: 12.5px; opacity: .78; }
.t-type-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }
.t-light .i { width: 15px; height: 15px; }
.t-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; }
.t-facts dt { font-size: 11px; color: var(--foam-muted); }
.t-facts dd { margin: 2px 0 0; font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Room labels (overview) */
.t-labels { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
body[data-mode=walk] .t-labels { display: none; }
.t-label {
  position: absolute; top: 0; left: 0; display: grid; justify-items: center; gap: 1px; padding: 6px 11px; border-radius: 11px;
  background: rgba(10, 22, 24, .62); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12.5px; line-height: 1.2; white-space: nowrap; transition: opacity .25s, background .3s, color .3s, padding .3s;
  /* Only the room under the pointer (or keyboard focus) shows its name, so the plan stays clean. */
  opacity: 0; pointer-events: none;
}
.t-label.is-hot, .t-label:focus-visible { opacity: 1; pointer-events: auto; }
.t-label b { font-weight: 600; }
.t-label span { font-size: 11px; color: var(--foam-muted); font-variant-numeric: tabular-nums; }
.t-label.is-small { font-size: 11px; padding: 4px 8px; }
.t-label.is-small span { font-size: 10px; }
.t-label.is-hot { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.t-label.is-hot span { color: var(--accent-deep); }

.t-beta { margin-inline-start: 4px; padding: 1px 7px; border-radius: 999px; border: 1px solid rgba(147, 194, 180, .55); color: var(--accent); font-style: normal; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }

/* Busy indicator (mode switch, plan change): fades in only if the wait is noticeable */
.t-busy {
  position: fixed; z-index: 30; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96); margin: 0;
  display: flex; align-items: center; gap: 12px; padding: 12px 18px 12px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  font-size: 13.5px; color: var(--foam); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s, transform .4s var(--ease), visibility 0s .25s;
}
.t-busy.is-on { opacity: 1; visibility: visible; transform: translate(-50%, -50%); transition: opacity .25s .18s, transform .4s var(--ease) .18s, visibility 0s .18s; }
.t-busy i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(238, 240, 234, .2); border-top-color: var(--accent); animation: busy-spin .8s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }

/* Quick settings dock: residence/type, light and furniture always one tap away */
.t-dock {
  position: fixed; z-index: 16; inset-inline-start: var(--pad); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.t-dock button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 10px; border-radius: 999px; color: var(--foam-muted); transition: background .3s, color .3s; }
.t-dock button:hover { color: var(--foam); background: rgba(238, 240, 234, .1); }
.t-dock button[aria-pressed=true] { background: var(--foam); color: var(--ink); }
.t-dock-type { padding: 0 8px 0 12px !important; color: var(--foam) !important; }
.t-dock-type span { display: grid; line-height: 1.1; text-align: start; }
.t-dock-type b { font-size: 14px; font-weight: 600; }
.t-dock-type small { font-size: 11px; color: var(--foam-muted); white-space: nowrap; }
.t-dock-chev { width: 16px; height: 16px; opacity: .7; }
.t-dock-light { display: flex; gap: 2px; }
.t-dock-sep { width: 1px; height: 24px; background: var(--line); margin: 0 3px; }
body.panel-open .t-dock, body.pano-open .t-dock { opacity: 0; pointer-events: none; }
.t-dock { transition: opacity .3s; }
body.is-touch[data-mode=walk] .t-dock { inset-inline-start: auto; inset-inline-end: var(--pad); flex-direction: column; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
body.is-touch[data-mode=walk] .t-dock-sep { width: 24px; height: 1px; margin: 3px 0; }
body.is-touch[data-mode=walk] .t-dock-light { flex-direction: column; }
body.is-touch[data-mode=walk] .t-dock-type span, body.is-touch[data-mode=walk] .t-dock-chev { display: none; }
body.is-touch[data-mode=walk] .t-dock-type { padding: 0 !important; }
@media (max-width: 1180px) {
  /* Room card moves to the end so it never sits on the dock. */
  body[data-mode=walk]:not(.is-touch) .t-here { left: auto; inset-inline-end: var(--pad); transform: none; }
  body[data-mode=walk]:not(.is-touch) .t-here.is-in { animation-name: here-in-end; }
}
@keyframes here-in-end { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 760px) {
  .t-dock-type span, .t-dock-chev { display: none; }
  .t-dock-type { padding: 0 !important; }
  body[data-mode=walk]:not(.is-touch) .t-dock { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  body[data-mode=walk]:not(.is-touch) .t-here { inset-inline: 12px; justify-content: space-between; }
}

/* 360° views */
.t-type-360 { display: inline-block; margin-inline-start: 6px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 10.5px; font-style: normal; font-weight: 600; vertical-align: 2px; }
.t-360-btn { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.t-360-btn:hover { background: var(--foam); }
.t-pano { position: fixed; inset: 0; z-index: 18; pointer-events: none; }
.t-pano > * { pointer-events: auto; }
.t-pano-head {
  position: fixed; left: 50%; top: calc(96px + env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 8px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); white-space: nowrap;
}
.t-pano-badge { padding: 5px 10px; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.t-pano-head b { font-size: 15px; font-weight: 600; }
.t-pano-close { height: 36px; background: var(--foam); color: var(--ink); border-color: var(--foam); }
.t-pano-close:hover { background: var(--accent); }
.t-pano-rooms {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; gap: 6px; max-width: calc(100vw - 2 * var(--pad)); overflow-x: auto; scrollbar-width: none;
  padding: 5px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.t-pano-rooms::-webkit-scrollbar { display: none; }
.t-pano-rooms button { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--foam-muted); white-space: nowrap; transition: background .3s, color .3s; }
.t-pano-rooms button:hover { color: var(--foam); }
.t-pano-rooms button[aria-pressed=true] { background: var(--foam); color: var(--ink); }
.t-pano-hint { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); margin: 0; max-width: calc(100vw - 32px); padding: 8px 15px; border-radius: 999px; background: rgba(10, 22, 24, .45); font-size: 12.5px; color: var(--foam-muted); text-align: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: none; }
.t-pano-loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; display: grid; justify-items: center; gap: 14px; padding: 18px 22px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); font-size: 13.5px; color: var(--foam-muted); opacity: 0; transition: opacity .3s; pointer-events: none; }
.t-pano-loading i { width: 120px; height: 2px; border-radius: 2px; background: rgba(238, 240, 234, .15); overflow: hidden; position: relative; }
.t-pano-loading i::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: bar 1.2s ease-in-out infinite; }
.t-pano.is-loading .t-pano-loading { opacity: 1; }
.t-stage canvas { transition: opacity .28s var(--ease); }
body.pano-fade .t-stage canvas { opacity: 0; }
body.pano-open .t-map, body.pano-open .t-here, body.pano-open .t-hint, body.pano-open .t-stick, body.pano-open .t-zoom, body.pano-open .t-labels { display: none; }
body.pano-open .t-stage canvas { cursor: grab; }
body.pano-open .t-stage canvas:active { cursor: grabbing; }
@media (max-width: 760px) {
  .t-pano-head { top: calc(132px + env(safe-area-inset-top, 0px)); }
  .t-pano-close span { display: none; }
  .t-pano-close { width: 36px; padding: 0; justify-content: center; }
  .t-pano-hint { display: none; }
  .t-here:has(.t-360-btn:not([hidden])) .t-btn span { display: none; }
  .t-here:has(.t-360-btn:not([hidden])) .t-btn { width: 44px; padding: 0; justify-content: center; }
}

/* Walk HUD */
.t-here {
  position: fixed; z-index: 15; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; padding: 8px 8px 8px 20px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
html[dir=rtl] .t-here { padding: 8px 20px 8px 8px; }
.t-here div { display: grid; line-height: 1.2; }
.t-here b { font-size: 16px; font-weight: 600; }
.t-here div span { font-size: 12px; color: var(--foam-muted); }
.t-here.is-in { animation: here-in .6s var(--ease); }
@keyframes here-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.t-photos-btn { background: var(--foam); color: var(--ink); border-color: var(--foam); }
.t-photos-btn:hover { background: var(--accent); }
body[data-mode=overview] .t-here, body[data-mode=overview] .t-map, body[data-mode=overview] .t-stick { display: none; }
.t-map { position: fixed; z-index: 15; top: calc(92px + env(safe-area-inset-top, 0px)); inset-inline-end: var(--pad); border-radius: 14px; background: rgba(10, 22, 24, .55); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; }
.t-stick { position: fixed; z-index: 15; inset-inline-start: 26px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); width: 116px; height: 116px; border-radius: 50%; display: none; place-items: center; background: rgba(10, 22, 24, .4); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); touch-action: none; }
.t-stick i { width: 50px; height: 50px; border-radius: 50%; background: var(--foam); box-shadow: 0 6px 20px rgba(0, 0, 0, .3); transition: transform .15s; }
body.is-touch[data-mode=walk] .t-stick { display: grid; }
.t-zoom { position: fixed; z-index: 15; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); inset-inline-end: var(--pad); display: grid; gap: 8px; }
body[data-mode=walk] .t-zoom { display: none; }
.t-hint { position: fixed; z-index: 14; left: 50%; bottom: calc(34px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); margin: 0; max-width: calc(100vw - 140px); padding: 9px 16px; border-radius: 999px; background: rgba(10, 22, 24, .45); font-size: 12.5px; color: var(--foam-muted); text-align: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: none; }
body[data-mode=walk] .t-hint { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

/* Loading */
.t-loading { position: fixed; z-index: 50; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--marine); transition: opacity .8s var(--ease), visibility .8s; }
.t-loading.is-done { opacity: 0; visibility: hidden; }
.t-loading svg { width: 46px; height: 52px; fill: none; stroke: var(--foam); stroke-width: 1.3; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 1.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.t-loading p { margin: 0; font-size: 14px; color: var(--foam-muted); }
.t-loading i { width: 160px; height: 2px; border-radius: 2px; background: rgba(238, 240, 234, .15); overflow: hidden; position: relative; }
.t-loading i::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: bar 1.2s ease-in-out infinite; }
@keyframes bar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.t-loading.is-error i { display: none; }

/* Photo viewer */
.t-photos { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(6, 12, 13, .96); color: var(--foam); display: none; flex-direction: column; }
.t-photos[open] { display: flex; animation: fade .4s ease; }
.t-photos::backdrop { background: transparent; }
@keyframes fade { from { opacity: 0; } }
.t-photos header, .t-photos footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--pad); }
.t-photos footer { justify-content: center; gap: 24px; font-variant-numeric: tabular-nums; }
.t-photo-stage { flex: 1; min-height: 0; padding: 0 var(--pad); }
.t-photo-stage img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transform: scale(1.02); transition: opacity .5s var(--ease), transform .7s var(--ease); }
.t-photo-stage img.is-in { opacity: 1; transform: none; }

/* Panel open: keep the scene readable on small screens */
body.panel-open .t-hint, body.panel-open .t-here { opacity: 0; pointer-events: none; }

@media (max-width: 760px) {
  .t-bar { grid-template-columns: auto 1fr auto; padding-bottom: 18px; }
  .t-back span, .t-settings span { display: none; }
  .t-back, .t-settings { width: 44px; padding: 0; justify-content: center; }
  .t-full { display: none; }
  .t-title b { font-size: 21px; }
  .t-title span:last-child { font-size: 10.5px; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t-modes { position: fixed; top: calc(82px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); }
  .t-map { top: calc(136px + env(safe-area-inset-top, 0px)); }
  .t-hint { max-width: calc(100vw - 32px); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); font-size: 11.5px; }
  body[data-mode=walk] .t-hint { display: none; }
  .t-here { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 24px); }
  .t-label { font-size: 11px; padding: 4px 8px; }
  .t-label span { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
.t-label.is-hidden { opacity: 0 !important; pointer-events: none; }
