:root {
  --glass: rgba(24, 21, 18, 0.82);
  --line: rgba(255, 255, 255, 0.24);
  --accent: #a9532f; /* white text on this is 5.3:1 */
  --here: #f08a3c;
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.82);
  --paper: #f4f0ea;
  --ink: #2b2622;
  --radius: 12px;
  --tap: 44px;
  --gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #14110f; color: var(--text); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app { position: fixed; inset: 0; }
.pano { position: absolute; inset: 0; outline: none; }
.pano:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }

:is(button, a):focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.6); }

/* ---- Bars -------------------------------------------------------------------------------- */
.top, .bottom {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: var(--gap);
  padding: var(--gap) max(var(--gap), env(safe-area-inset-right)) var(--gap) max(var(--gap), env(safe-area-inset-left));
  pointer-events: none;
}
.top { top: 0; padding-top: max(var(--gap), env(safe-area-inset-top)); background: linear-gradient(rgba(0, 0, 0, 0.5), transparent); }
.bottom { bottom: 0; padding-bottom: max(var(--gap), env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: space-between; background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); }
.top > *, .bottom > * { pointer-events: auto; }

.brand { flex: 1; margin: 0; text-align: center; font-size: 15px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: var(--tap); min-height: var(--tap);
  padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--glass);
  font-size: 14px; font-weight: 600; letter-spacing: 0.03em; text-decoration: none; color: var(--text); cursor: pointer;
}
.btn:hover { background: rgba(48, 42, 36, 0.92); }
.btn[aria-expanded="true"] { background: var(--paper); color: var(--ink); }
.btn--primary { background: var(--accent); border-color: rgba(255, 255, 255, 0.5); }
.btn--primary:hover { background: #944727; }

.place { margin: 0; display: flex; flex-direction: column; gap: 2px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.place strong { font-size: 17px; font-weight: 700; letter-spacing: 0.06em; }
.place span { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Panels ------------------------------------------------------------------------------ */
.panel { position: absolute; top: 68px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* Project / tower switcher under the Locations button. Wide screens list every tour; narrow
   screens show the current one and open the list when it is tapped. */
.tours { position: absolute; z-index: 1; left: max(var(--gap), env(safe-area-inset-left)); top: calc(var(--tap) + 2 * var(--gap) + 4px + env(safe-area-inset-top)); }
.tours__list { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tours__item, .tours__current { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 112px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--glass); font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-align: left; cursor: pointer; }
.tours__item:hover, .tours__current:hover { background: rgba(48, 42, 36, 0.92); }
.tours__item[aria-current="true"] { background: var(--paper); color: var(--ink); }
.tours__current { display: none; margin-bottom: 6px; }

/* Locations drawer: logo, then one collapsible section per floor and one for the show units. */
.menu { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: min(272px, 86vw); display: flex; flex-direction: column; padding-left: env(safe-area-inset-left); background: rgba(30, 27, 24, 0.84); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 6px 0 24px rgba(0, 0, 0, 0.35); }
.menu__head { display: flex; align-items: flex-start; justify-content: space-between; padding: max(18px, env(safe-area-inset-top)) 6px 14px 18px; }
.menu__logo { display: block; width: 150px; height: auto; }
.menu__close { display: grid; place-items: center; width: var(--tap); height: var(--tap); border: 0; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, 0.82); cursor: pointer; }
.menu__close:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.menu__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.35) transparent; }
.acc__title { margin: 0; font-size: inherit; }
.acc__head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 14px; border: 0; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); text-align: left; font-size: 14.5px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; }
.acc__head:hover { background: rgba(0, 0, 0, 0.45); }
.acc__head.is-here { color: #eda765; } /* 6.9:1 on the drawer */
.acc__icon { flex: none; transform: rotate(-90deg); transition: transform 0.2s; }
.acc__head[aria-expanded="true"] .acc__icon { transform: none; }
.acc__body { list-style: none; margin: 0; padding: 4px 0 8px; }
.menu__item { display: block; width: 100%; min-height: 38px; padding: 8px 14px 8px 42px; border: 0; background: transparent; text-align: left; font-size: 13.5px; letter-spacing: 0.03em; color: rgba(255, 255, 255, 0.9); cursor: pointer; }
.menu__item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.menu__item[aria-current="true"] { color: #eda765; font-weight: 600; box-shadow: inset 3px 0 0 #eda765; }

/* Tools column (bottom right), as in the source tour: picture, VR, gyroscope, hotspots, full screen. */
.tools { position: absolute; right: max(var(--gap), env(safe-area-inset-right)); bottom: calc(var(--tap) + 2 * var(--gap) + 10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tools__list { display: flex; flex-direction: column; gap: 8px; }
.tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 50%; background: rgba(86, 80, 74, 0.78); color: #fff; cursor: pointer; }
.tool::after { content: ""; position: absolute; width: var(--tap); height: var(--tap); } /* 44 px hit area */
.tool:hover { background: rgba(58, 53, 48, 0.95); }
.tool[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.tool[aria-pressed="true"] .tool__slash { display: none; }
.tool--more { background: transparent; border-color: transparent; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8)); }
.tool--more:hover { background: rgba(0, 0, 0, 0.35); }
.app[data-hotspots="off"] .hs { visibility: hidden; }

/* VR mode: one view per eye; a dot in the middle grows while a hotspot is being looked at. */
.vr { position: absolute; inset: 0; z-index: 20; display: flex; background: #000; }
.vr__eye { position: relative; flex: 1; height: 100%; overflow: hidden; }
.vr__eye + .vr__eye { border-left: 2px solid #000; }
.vr__eye::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5); pointer-events: none; transition: transform 0.2s, background 0.2s; }
.vr[data-gaze] .vr__eye::after { transform: scale(3); background: var(--here); transition: transform 1.6s linear, background 0.2s; }
.vr__exit { position: absolute; left: 50%; bottom: max(var(--gap), env(safe-area-inset-bottom)); transform: translateX(-50%); min-height: 36px; opacity: 0.75; }
.vr__exit:hover, .vr__exit:focus-visible { opacity: 1; }
.hs--vr .hs__btn { width: var(--tap); height: var(--tap); border-radius: 50%; cursor: default; }
.app[data-vr] > :not(.vr) { visibility: hidden; }

.plan { right: var(--gap); width: min(300px, calc(100vw - 2 * var(--gap))); padding: 8px; }
/* With a mouse the plan rests at 70 % size and half transparent, and comes back to full size and
   full opacity while it is pointed at or holds keyboard focus. Touch screens have no hover, so
   there it always stays full size. */
@media (hover: hover) and (pointer: fine) {
  .plan { transform: scale(0.7); transform-origin: top right; opacity: 0.5; transition: transform 0.2s ease, opacity 0.2s ease; }
  .plan:hover, .plan:focus-within { transform: none; opacity: 1; }
}
.plan__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.plan__tab { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; }
.plan__tab[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
/* The map keeps the plan's own proportions (--ratio = width / height); tall unit plans are limited
   by the screen height instead of the panel width. */
.plan__map { position: relative; aspect-ratio: var(--ratio, 1); width: min(100%, calc(62vh * var(--ratio, 1))); margin: 0 auto; border-radius: 8px; background: var(--paper); overflow: hidden; }
.plan__map img { display: block; width: 100%; height: 100%; }
/* Tower floor plans: one clickable area per unit. */
.unit { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; }
.unit:hover, .unit:focus-visible { background: rgba(169, 83, 47, 0.4); }
.unit[aria-current="true"] { background: rgba(240, 138, 60, 0.45); box-shadow: inset 0 0 0 2px var(--here); }
.dot { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.dot::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; }
.dot:hover::before { background: var(--accent); }
.dot[aria-current="true"]::before { inset: 4px; background: var(--here); }
.radar { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; pointer-events: none; background: conic-gradient(from calc(var(--a, 0deg) - var(--w, 90deg) / 2), rgba(240, 138, 60, 0.5) 0 var(--w, 90deg), transparent 0); }

/* ---- Hotspots (Marzipano positions .hs; the button is centred on that point) -------------- */
.hs { position: absolute; width: 0; height: 0; }
.hs__btn { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); margin: 0; border: 0; background: transparent; cursor: pointer; }
.hs--ring .hs__btn { width: var(--tap); height: var(--tap); border-radius: 50%; padding: 0; }
.hs--ring .hs__btn::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 3px solid #fff; background: rgba(255, 255, 255, 0.16); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5), inset 0 0 0 1.5px rgba(0, 0, 0, 0.35); transition: transform 0.15s; }
.hs--ring .hs__btn::after { content: ""; position: absolute; inset: 18px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5); }
.hs--floor .hs__btn::before { transform: scaleY(0.55); }
.hs--floor .hs__btn::after { transform: scaleY(0.55); }
.hs--ring .hs__btn:hover::before { transform: scale(1.15); }
.hs--floor .hs__btn:hover::before { transform: scale(1.15, 0.63); }
.hs__tip { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); padding: 6px 11px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.hs__btn:hover .hs__tip, .hs__btn:focus-visible .hs__tip { opacity: 1; }

/* Text labels as in the source tour: 70 % opaque, no border. Their size follows --hs-scale, which
   the viewer updates with the zoom level and the screen size (see updateLabelScale in app.js). */
.hs--label .hs__btn { padding: 0.42em 1.05em; border: 0; border-radius: 999px; background: rgba(178, 90, 52, 0.7); font-size: calc(13px * var(--hs-scale, 1)); font-weight: 600; letter-spacing: 0.04em; line-height: 1.25; text-align: center; white-space: pre; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65); }
.hs--label .hs__btn::after { content: ""; position: absolute; inset: -9px; } /* keeps a 44 px hit area at the smallest size */
.hs--label button.hs__btn:hover { background: rgba(148, 71, 39, 0.92); }
.hs--static .hs__btn { padding: 2px 6px; background: transparent; font-size: calc(12px * var(--hs-scale, 1)); text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, 0.9); cursor: default; }
.hs--static .hs__btn::after { content: none; }
.app[data-busy] .hs__btn { cursor: progress; }

/* ---- Loading ----------------------------------------------------------------------------- */
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: #14110f; font-size: 15px; letter-spacing: 0.04em; transition: opacity 0.4s; }
.loading__ring { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.9s linear infinite; }
.app[data-state="ready"] .loading { opacity: 0; pointer-events: none; }
.app[data-state="error"] .loading__ring { display: none; }
@keyframes spin { to { transform: rotate(1turn); } }

@media (max-width: 640px) {
  .btn__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .btn--icon { padding: 0; }
  .brand { font-size: 13px; letter-spacing: 0.14em; }
  .bottom { flex-direction: column; align-items: stretch; gap: 10px; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1; white-space: nowrap; }
  .tools { bottom: calc(2 * var(--tap) + 3 * var(--gap) + 16px + env(safe-area-inset-bottom)); }
  .tours__current { display: flex; min-height: 40px; }
  .tours__item { min-height: 40px; }
  .tours:not([data-open]) .tours__list { display: none; }
  .plan { top: 118px; } /* below the tour switcher, which sits under the Locations button */
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .loading__ring { animation-duration: 2.5s; }
}
