/* NNY 360° aerial tour (/tour/) — immersive full-screen viewer built on Pannellum */

:root {
  --navy: #07142a;
  --blue: #19499e;
  --white: #fff;
  --font-latin: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", var(--font-latin);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root:lang(en) { --font: var(--font-latin); }
:root:lang(th) { --font: "Prompt", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif; --font-latin: var(--font); }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--navy); }
body {
  overflow: hidden; color: var(--white); font-family: var(--font); line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #e7142e; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ stage */

.tr-stage { position: fixed; inset: 0; }
.tr-pano { position: absolute; inset: 0; }
.tr-pano .pnlm-container { background: var(--navy); font-family: var(--font); }
.tr-pano .pnlm-load-box {
  width: 220px; height: auto; margin: -46px 0 0 -110px; padding: 18px 12px 20px;
  background: rgba(7, 20, 42, 0.72); border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 14px;
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
  font-size: 15px; letter-spacing: 0.04em;
}
.tr-pano .pnlm-load-box p { margin: 0 0 12px; }
.tr-pano .pnlm-lbar { width: 160px; height: 4px; border: 0; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.tr-pano .pnlm-lbar-fill { background: var(--white); border-radius: 2px; }
.tr-pano .pnlm-lmsg { margin-top: 8px; font-size: 12px; opacity: 0.8; }
.tr-pano .pnlm-info-box { font-size: 15px; background: rgba(7, 20, 42, 0.92); border-radius: 14px; }

/* ------------------------------------------------------------ top bar */

.tr-top {
  position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 14px) max(22px, env(safe-area-inset-right)) 34px max(22px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(7, 20, 42, 0.78) 0%, rgba(7, 20, 42, 0) 100%);
  pointer-events: none;
}
.tr-top > * { pointer-events: auto; }
.tr-brand { display: block; flex: none; }
.tr-brand img { display: block; height: 34px; width: auto; }
.tr-lang { display: flex; gap: 2px; margin-left: auto; font-size: 14px; }
.tr-lang a { position: relative; padding: 7px 10px; opacity: 0.72; white-space: nowrap; transition: opacity 0.2s; }
.tr-lang a:hover { opacity: 1; }
.tr-lang a[aria-current="true"] { opacity: 1; font-weight: 700; }
.tr-lang a[aria-current="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 3px; height: 1.5px; background: var(--white); }

/* glass buttons: the same recipe as the site's video buttons */
.tr-exit, .tr-btn {
  color: var(--white); cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.06) 48%, rgba(255, 255, 255, 0.14) 100%), rgba(129, 129, 129, 0.28);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), inset 0 -1px 2px rgba(0, 0, 0, 0.18), 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s var(--ease), opacity 0.2s;
}
.tr-exit:hover, .tr-btn:hover { border-color: var(--white); background-color: rgba(160, 160, 160, 0.38); transform: scale(1.05); }
.tr-exit:active, .tr-btn:active { transform: scale(0.96); }
.tr-exit { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }

/* ------------------------------------------------------------ scene tabs */

.tr-scenes {
  position: absolute; z-index: 21; left: 50%; top: calc(env(safe-area-inset-top) + 16px); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(7, 20, 42, 0.5); border: 1px solid rgba(255, 255, 255, 0.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
}
.tr-scenes a { padding: 7px 16px; border-radius: 999px; font-size: 14px; white-space: nowrap; opacity: 0.8; transition: background-color 0.2s, opacity 0.2s; }
.tr-scenes a:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
.tr-scenes a[aria-current="true"] { opacity: 1; font-weight: 700; background: rgba(255, 255, 255, 0.92); color: #0a1b33; }

/* ------------------------------------------------------------ views of the current project (right edge, like WHA) */

.tr-views {
  position: absolute; z-index: 10; right: 0; bottom: calc(max(26px, calc(env(safe-area-inset-bottom) + 14px)) + 62px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.tr-views a {
  min-width: 108px; padding: 10px 16px 10px 18px; border-radius: 12px 0 0 12px; text-align: right;
  font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--white);
  background: rgba(25, 73, 158, 0.82); border: 1px solid rgba(255, 255, 255, 0.35); border-right: 0;
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transform: translateX(6px); transition: transform 0.2s var(--ease), background-color 0.2s;
}
.tr-views a:hover { transform: translateX(0); background: rgba(25, 73, 158, 0.95); }
.tr-views a[aria-current="true"] { transform: translateX(0); background: var(--white); color: #19499e; }

/* ------------------------------------------------------------ info card */

.tr-info {
  position: absolute; z-index: 10; left: max(22px, env(safe-area-inset-left)); bottom: max(26px, calc(env(safe-area-inset-bottom) + 14px));
  max-width: min(520px, calc(100% - 110px)); padding: 16px 22px 16px 20px;
  background: rgba(7, 20, 42, 0.58); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 14px;
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.tr-info h1 { margin: 0; font-size: clamp(1.0625rem, 1.7vw, 1.375rem); font-weight: 700; line-height: 1.3; letter-spacing: 0.01em; }
.tr-info p { margin: 7px 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.78); letter-spacing: 0.02em; }

.tr-case { pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.tr-case::before { content: ""; width: 20px; height: 1px; background: currentColor; transition: width 0.25s var(--ease); }
.tr-case:hover::before { width: 32px; }

/* ------------------------------------------------------------ controls */

.tr-ctrl {
  position: absolute; z-index: 10; right: max(22px, env(safe-area-inset-right)); bottom: max(26px, calc(env(safe-area-inset-bottom) + 14px));
  display: flex; flex-direction: row; gap: 10px;
}
.tr-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.tr-btn svg { width: 20px; height: 20px; }
.tr-btn[aria-pressed="false"] { opacity: 0.6; }
.tr-btn[aria-pressed="true"] svg { animation: tr-spin 6s linear infinite; }
@keyframes tr-spin { to { transform: rotate(-360deg); } }
.tr-btn.is-on { background-color: rgba(76, 139, 245, 0.45); border-color: var(--white); }

.tr-hint {
  position: absolute; z-index: 9; left: 50%; bottom: max(110px, calc(env(safe-area-inset-bottom) + 100px)); margin: 0; padding: 9px 18px;
  transform: translateX(-50%); max-width: calc(100% - 40px); text-align: center; font-size: 14px; letter-spacing: 0.03em; pointer-events: none;
  background: rgba(7, 20, 42, 0.6); border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: opacity 0.8s var(--ease);
}
.tr-hint.is-gone { opacity: 0; }

.tr-noscript { position: absolute; inset: 0; z-index: 30; margin: 0; padding: 120px 24px 24px; background: var(--navy); text-align: center; }
.tr-noscript img { max-width: 100%; margin-top: 20px; }

/* ------------------------------------------------------------ hotspots */

.tr-pin { width: 26px; height: 26px; cursor: pointer; }
.tr-pin__dot {
  position: absolute; inset: 6px; border-radius: 50%; background: var(--white);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.38), 0 2px 8px rgba(0, 0, 0, 0.4);
}
.tr-pin__dot::after {
  content: ""; position: absolute; inset: -9px; border: 1.5px solid rgba(255, 255, 255, 0.8); border-radius: 50%;
  animation: tr-ping 2.4s var(--ease) infinite;
}
@keyframes tr-ping { 0% { transform: scale(0.45); opacity: 0.95; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
/* callout: a leader line runs diagonally up from the dot, then a short horizontal run into the label.
   tour.js sets --dy (rise) per pin and flips the side, so neighbouring labels stack at different heights */
.tr-pin { --dy: 64px; --dx: calc(var(--dy) * 0.42); --run: 16px; }
.tr-pin__lead { position: absolute; left: 13px; bottom: 13px; overflow: visible; pointer-events: none; }
.tr-pin__lead polyline { fill: none; stroke: rgba(255, 255, 255, 0.92); stroke-width: 1.5; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55)); }
.tr-pin.is-flip .tr-pin__lead { transform: scaleX(-1); transform-origin: 0 0; }
.tr-pin__label {
  position: absolute; left: calc(13px + var(--dx) + var(--run)); top: calc(13px - var(--dy)); transform: translateY(-50%); white-space: nowrap;
  padding: 7px 13px 8px; font-size: 14px; line-height: 1.3; letter-spacing: 0.02em; color: var(--white);
  background: rgba(25, 73, 158, 0.86); border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 6px;
  -webkit-backdrop-filter: blur(10px) saturate(1.4); backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s;
}
.tr-pin__label b { display: block; font-weight: 700; }
.tr-pin__label small { display: block; margin-top: 1px; font-size: 12px; color: rgba(255, 255, 255, 0.8); }
.tr-pin:hover .tr-pin__label, .tr-pin:focus-visible .tr-pin__label { background: rgba(25, 73, 158, 1); }
.tr-pin.is-flip .tr-pin__label { left: auto; right: calc(13px + var(--dx) + var(--run)); text-align: right; }
.tr-pin__label { cursor: pointer; }
.tr-pin--link .tr-pin__label b::after { content: "›"; display: inline-block; margin-left: 8px; font-size: 1.15em; line-height: 1; transition: transform 0.2s var(--ease); }
.tr-pin--link:hover .tr-pin__label b::after { transform: translateX(3px); }
.tr-pin.is-crowded .tr-pin__label, .tr-pin.is-crowded .tr-pin__lead { opacity: 0; visibility: hidden; }
.tr-pin.is-crowded:hover .tr-pin__label, .tr-pin.is-crowded:focus-visible .tr-pin__label,
.tr-pin.is-crowded:hover .tr-pin__lead, .tr-pin.is-crowded:focus-visible .tr-pin__lead { opacity: 1; visibility: visible; z-index: 2; }

/* ------------------------------------------------------------ building index */

.tr-index {
  position: absolute; z-index: 11; left: max(22px, env(safe-area-inset-left)); top: calc(env(safe-area-inset-top) + 86px);
  width: 210px; max-height: calc(100% - 260px); overflow-y: auto; padding: 14px 10px 10px;
  background: rgba(7, 20, 42, 0.62); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 14px;
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.tr-index p { margin: 0 8px 8px; font-size: 12px; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.7); }
.tr-index ul { margin: 0; padding: 0; list-style: none; }
.tr-index button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; padding: 7px 10px;
  background: none; border: 0; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px;
}
.tr-index button:hover, .tr-index button:focus-visible { background: rgba(255, 255, 255, 0.14); }
.tr-index small { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(231, 20, 46, 0.85); white-space: nowrap; }

/* ------------------------------------------------------------ small screens */

/* phones: project tabs get their own row under the logo */
@media (max-width: 700px) {
  .tr-scenes { top: calc(env(safe-area-inset-top) + 62px); max-width: calc(100% - 28px); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tr-scenes::-webkit-scrollbar { display: none; }
  .tr-scenes a { flex: none; }
  .tr-hint { top: calc(env(safe-area-inset-top) + 112px); bottom: auto; }
}

@media (max-width: 700px) {
  .tr-top { gap: 8px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .tr-brand img { height: 28px; }
  /* phones: scene tabs sit under the top bar (over the sky), clear of the info card */
  .tr-scenes a { padding: 6px 12px; font-size: 13px; }
  .tr-lang { font-size: 13px; }
  .tr-lang a { padding: 6px 7px; }
  .tr-exit { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .tr-info { left: max(14px, env(safe-area-inset-left)); bottom: calc(max(18px, calc(env(safe-area-inset-bottom) + 8px)) + 54px); max-width: calc(100% - 28px); padding: 11px 14px 12px; border-radius: 12px; }
  .tr-info h1 { font-size: 0.9375rem; }
  .tr-info p { font-size: 11.5px; margin-top: 4px; line-height: 1.45; }
  .tr-case { margin-top: 6px; font-size: 12px; }
  .tr-ctrl { right: max(14px, env(safe-area-inset-right)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); gap: 8px; }
  .tr-btn { width: 42px; height: 42px; }
  /* pinch zooms on a phone, so the +/- buttons are left out to keep the column short */
  .tr-btn[data-zoom-in], .tr-btn[data-zoom-out] { display: none; }
  .tr-views { bottom: calc(max(18px, calc(env(safe-area-inset-bottom) + 8px)) + 236px); gap: 8px; }
  .tr-views a { min-width: 0; padding: 8px 12px 8px 14px; font-size: 13px; }
  .tr-hint { top: calc(env(safe-area-inset-top) + 112px); font-size: 12.5px; white-space: nowrap; padding: 7px 14px; }
  .tr-pin { --run: 10px; }
  .tr-pin__label { padding: 5px 10px 6px; font-size: 12.5px; }
  .tr-index { left: auto; right: max(14px, env(safe-area-inset-right)); top: auto; bottom: calc(max(18px, calc(env(safe-area-inset-bottom) + 8px)) + 54px); width: 190px; max-height: 50vh; }
  .tr-pin__label small { font-size: 11px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .tr-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-pin__dot::after, .tr-btn[aria-pressed="true"] svg { animation: none; }
}
