/* Tham quan có hướng dẫn (js/tour.js). Khi chạy: hai dải phim trên dưới trượt vào, phụ đề hiện từng chữ, vùng sáng làm nổi phần đang nói,
   con trỏ ảo bay tới chỗ sẽ bấm rồi gợn sóng. Nạp sau cùng. */
:root { --tour-gold: #c8ac78; --tour-ease: cubic-bezier(.16, 1, .3, 1); }

/* ----- lối vào ----- */
.tour-start { display: inline-flex; align-items: center; gap: 14px; margin: 2px 0 6px; padding: 4px 0; color: #fff; text-align: left; text-shadow: 0 1px 14px rgba(0,0,0,.5); }
.tour-start i { position: relative; flex: none; width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(20,18,14,.18); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .35s, border-color .35s; }
/* vòng gợn: viền vẽ sẵn, chỉ phóng to + mờ dần (card đồ hoạ tự chạy, không vẽ lại nút). Bản đầu đổi box-shadow của chính nút có backdrop-filter:
   mỗi khung hình vẽ lại và làm mờ lại nền dưới nút, đo trên điện thoại chậm tốn ~40% luồng chính ngay ở màn đầu */
.tour-start i::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6); pointer-events: none;
  animation: tour-pulse 2.8s var(--tour-ease) 4; }      /* 4 nhịp lúc vừa tới (~11 giây) rồi đứng yên, cuộn đi rồi quay lại thì gợn lại (finesse.js fx-idle) */
.tour-start i::before { content: ""; position: absolute; left: 50%; top: 50%; margin: -6px 0 0 -4px; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.tour-start span { display: grid; gap: 2px; font-family: var(--sans); font-stretch: 112%; font-size: 12.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.tour-start small { font-size: 12.5px; font-weight: 400; letter-spacing: .04em; text-transform: none; opacity: .82; }
.tour-start:hover i { background: var(--tour-gold); border-color: var(--tour-gold); color: #14120e; }
.tour-start:hover i::after { animation: none; opacity: 0; }
@keyframes tour-pulse { 0% { transform: scale(1); opacity: .85; } 70%, 100% { transform: scale(1.78); opacity: 0; } }
.menu-tour .tour-menu { display: grid; gap: 4px; width: 100%; padding: 0 0 18px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.22); color: #fff; text-align: left; }
.menu-tour .tour-menu span { font-family: var(--sans); font-stretch: 112%; font-size: 12.5px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: #f4e6c8; }
.menu-tour .tour-menu span::before { content: "▶"; margin-right: 12px; font-size: 10px; }
.menu-tour .tour-menu small { font-size: 14px; color: rgba(255,255,255,.78); }
.app.panel-open .tour-start, .stage.zoomed .tour-start { pointer-events: none; }
@media (max-width: 860px) { .tour-start { margin: 0 0 2px; gap: 11px; } .tour-start i { width: 38px; height: 38px; } .tour-start small { display: none; } }

/* ----- lớp tham quan ----- */
.tour { position: fixed; inset: 0; z-index: 85; pointer-events: none; visibility: hidden; }
.tour.on { visibility: visible; }
.tour-shield { position: absolute; inset: 0; pointer-events: auto; cursor: default; }          /* chặn bấm nhầm vào trang lúc kịch bản đang chạy */
.tour-bar { position: absolute; left: 0; right: 0; background: #0f0e0c; color: #f3eee5; pointer-events: auto; transition: transform .9s var(--tour-ease); }
.tour-bar.t { top: 0; height: 58px; padding: 0 max(22px, env(safe-area-inset-left, 0px)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; transform: translateY(-101%); }
.tour-bar.b { bottom: 0; min-height: 132px; padding: 22px max(22px, env(safe-area-inset-left, 0px)) calc(26px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 40px; align-items: center; transform: translateY(101%); }
.tour.on .tour-bar { transform: none; }
.tour-brand { font-family: var(--sans); font-stretch: 125%; font-weight: 300; font-size: 17px; letter-spacing: .5em; text-transform: uppercase; display: flex; align-items: baseline; gap: 18px; white-space: nowrap; }
.tour-brand small { font-stretch: 112%; font-weight: 500; font-size: 10.5px; letter-spacing: .24em; color: var(--tour-gold); }
.tour-count { font-family: var(--serif); font-weight: 300; font-size: 17px; letter-spacing: .12em; color: rgba(243,238,229,.75); font-variant-numeric: tabular-nums; }
.tour-x { justify-self: end; display: inline-flex; align-items: center; gap: 10px; padding: 9px 0 9px 14px; font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: rgba(243,238,229,.8); }
.tour-x i { font-style: normal; font-size: 20px; line-height: 1; }
.tour-x:hover { color: #fff; }
.tour-k { margin: 0 0 8px; font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; color: var(--tour-gold); }
.tour-text { margin: 0; max-width: 62ch; font-family: var(--serif); font-weight: 300; font-size: clamp(19px, 1.7vw, 27px); line-height: 1.34; text-wrap: pretty; }
.tour-text span { display: inline-block; white-space: pre; opacity: 0; animation: tour-word .7s var(--tour-ease) both; }
@keyframes tour-word { from { opacity: 0; transform: translateY(.5em); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.tour-ctl { display: flex; align-items: center; gap: 10px; }
.tour-ctl button { height: 40px; padding: 0 16px; border: 1px solid rgba(243,238,229,.36); font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
  color: #f3eee5; white-space: nowrap; transition: background .3s, color .3s, border-color .3s; }
.tour-ctl button:hover { background: #f3eee5; color: #14120e; border-color: #f3eee5; }
.tour-ctl i { font-style: normal; margin-left: 8px; }
.tour-prog { grid-column: 1 / -1; display: flex; gap: 5px; margin-top: 6px; }
.tour-prog i { position: relative; flex: 1; height: 2px; background: rgba(243,238,229,.18); overflow: hidden; }
.tour-prog i::after { content: ""; position: absolute; inset: 0; background: var(--tour-gold); transform: scaleX(0); transform-origin: 0 50%; }
.tour-prog i.done::after { transform: none; }
.tour-prog i.now::after { animation: tour-fill var(--d, 8000ms) linear both; }
.tour.paused .tour-prog i.now::after { animation-play-state: paused; }
@keyframes tour-fill { to { transform: none; } }

/* lớp tối chuyển cảnh: nằm giữa hai dải phim, tối dần → trang đổi màn → sáng dần (js: cut()) */
.tour-veil { position: absolute; inset: 0; background: #0f0e0c; opacity: 0; transition: opacity .48s cubic-bezier(.4, 0, .2, 1);
  display: grid; place-content: center; justify-items: center; gap: 16px; padding: 0 24px; text-align: center; color: #f3eee5; }
.tour-veil.on { opacity: 1; }
/* thẻ tiêu đề lúc màn tối: nhãn nhỏ, tên cảnh sắp tới, sợi chỉ vàng chạy dần hết thời gian chờ (--hold) */
.tv-k { font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--tour-gold); opacity: 0; }
.tv-t { font-family: var(--serif); font-weight: 300; font-size: clamp(30px, 3.6vw, 56px); line-height: 1.1; text-wrap: balance; opacity: 0; }
.tv-line { width: min(240px, 46vw); height: 1px; margin-top: 6px; background: rgba(243, 238, 229, .16); position: relative; overflow: hidden; }
.tv-line::after { content: ""; position: absolute; inset: 0; background: var(--tour-gold); transform: scaleX(0); transform-origin: 0 50%; }
.tour-veil.on .tv-k { animation: tour-word .7s var(--tour-ease) .22s both; }
.tour-veil.on .tv-t { animation: tour-word .9s var(--tour-ease) .3s both; }
.tour-veil.on .tv-line::after { animation: tour-fill var(--hold, 1400ms) cubic-bezier(.3, 0, .2, 1) .2s both; }
.tour-k.in { animation: tour-word .7s var(--tour-ease) both; }
/* vùng sáng: khung vàng mảnh, phần còn lại của trang tối đi */
.tour-spot { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border: 1px solid var(--tour-gold); border-radius: 6px; box-shadow: 0 0 26px rgba(200, 172, 120, .28);
  opacity: 0; transition: left .7s var(--tour-ease), top .7s var(--tour-ease), width .7s var(--tour-ease), height .7s var(--tour-ease), opacity .5s; }
/* quầng tối mềm quanh chỗ đang chỉ: một tấm rất lớn có lỗ sáng ở tâm, viền mờ rộng nửa màn hình, di chuyển bằng transform. KHÔNG phủ tối cả màn (bản đầu
   dùng box-shadow 200vmax đậm 50%: tòa nhà tối sầm mỗi lần chỉ vào một nút, user chê xấu) */
.tour-dim { position: absolute; left: 0; top: 0; width: 500vmax; height: 500vmax; margin: -250vmax 0 0 -250vmax; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(10, 9, 8, 0) var(--r, 200px), rgba(10, 9, 8, .1) calc(var(--r, 200px) + 22vmax), rgba(10, 9, 8, .3) calc(var(--r, 200px) + 62vmax));
  transition: transform .9s var(--tour-ease), opacity .7s; will-change: transform; }
.tour-dim.on { opacity: 1; }
.tour-spot.on { opacity: 1; }
.tour-spot::after { content: ""; position: absolute; inset: -7px; border: 1px solid rgba(200, 172, 120, .55); border-radius: 10px; animation: tour-ring 2.2s var(--tour-ease) infinite; }
@keyframes tour-ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.06); } }
/* con trỏ ảo */
.tour-hand { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transition: transform .78s var(--tour-ease), opacity .4s; }
.tour-hand.on { opacity: 1; }
.tour-hand b { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border: 1.5px solid #fff; border-radius: 50%; background: rgba(255,255,255,.2); box-shadow: 0 2px 16px rgba(0,0,0,.4); }
.tour-hand b::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; }
.tour-hand::after { content: ""; position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border: 2px solid var(--tour-gold); border-radius: 50%; opacity: 0; }
.tour-hand.tap b { animation: tour-press .42s var(--tour-ease); }
.tour-hand.tap::after { animation: tour-ripple .7s var(--tour-ease); }
@keyframes tour-press { 40% { transform: scale(.72); } }
@keyframes tour-ripple { from { opacity: .95; transform: scale(.7); } to { opacity: 0; transform: scale(2.6); } }

/* màn kết */
.tour-end { position: absolute; inset: 58px 0 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; color: #fff; pointer-events: auto;
  background: radial-gradient(ellipse at 50% 50%, rgba(10,9,8,.72), rgba(10,9,8,.86)); animation: tour-fade .9s var(--tour-ease) both; }
.tour-end[hidden] { display: none; }
.tour.ended .tour-bar.b { transform: translateY(101%); }
.tour-h { margin: 0 0 14px; font-family: var(--serif); font-weight: 300; font-size: clamp(36px, 4.6vw, 72px); line-height: 1.06; text-wrap: balance; }
.tour-acts { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.tour-skip { padding: 12px 14px; font-family: var(--sans); font-stretch: 112%; font-size: 11.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.72); }
.tour-skip:hover { color: #fff; }
@keyframes tour-fade { from { opacity: 0; } }

/* trang lúc đang tham quan: nhường chỗ cho hai dải phim */
html.tour-on .top { transform: translateY(-102%) !important; }
html.tour-on .fx-rail, html.tour-on .fx-cur, html.tour-on .scroll-cue { opacity: 0 !important; }
html.tour-on .hero { opacity: 0; pointer-events: none; }
html.tour-on .toast { bottom: calc(var(--tour-b, 132px) + 18px); }
/* các phần của trang bám mép dưới / mép trên: dời vào giữa hai dải phim (chiều cao thật do js đặt vào --tour-t, --tour-b) */
html.tour-on .daybar, html.tour-on .lens, html.tour-on .lens-tog, html.tour-on .spin, html.tour-on .hour,
html.tour-on .pano-hint, html.tour-on .pano-map, html.tour-on .lm3-steps, html.tour-on .lm3-sun { translate: 0 calc(-1 * var(--tour-b, 132px)); transition: translate .8s var(--tour-ease); }
/* .floor-tag (thẻ tên căn trên tòa) KHÔNG dời: nó bám đúng tầng của căn, dời đi là chỉ sai tầng (bản trước dời 158 px, thẻ nằm lệch hẳn khỏi căn) */
html.tour-on .pano-top { translate: 0 calc(var(--tour-t, 58px) - 8px); transition: translate .8s var(--tour-ease); }
html.tour-on .sl-ov { top: var(--tour-t, 58px); bottom: var(--tour-b, 132px); }
html.tour-on .panel { bottom: var(--tour-b, 132px); }
@media (max-width: 860px) { html.tour-on .app:not(.unit-open) .panel { height: calc(100% - var(--tour-t, 50px) - var(--tour-b, 132px)); } }   /* tấm bảng căn không vọt quá mép trên */
@media (min-width: 861px) { html.tour-on .panel { top: var(--tour-t, 58px); } }
html.tour-on .lm3-head { translate: 0 var(--tour-t, 58px); }
/* khung phim mở đầu (16:9, cao hơn khe giữa hai dải trên máy bàn): lúc tham quan thu lại cho vừa trọn khe, vẫn giữ tỉ lệ, để cảnh "Phim" không bị dải trên cắt đầu */
@media (min-width: 861px) { html.tour-on .ch-intro .media.wide { width: auto; max-width: calc(100% - 56px); height: calc(100vh - var(--tour-t, 58px) - var(--tour-b, 132px) - 56px); aspect-ratio: 16 / 9; } }

/* ĐIỆN THOẠI (user 21/11/2026: "mấy nút button cứ bị lệch với cao che cả hình ảnh toà"). Hai lỗi của bản trước:
   1. Dời hai lần. Trên điện thoại thanh giờ, nút tìm căn, thẻ tìm căn, thanh giờ trang căn đã tự né tấm bảng căn qua --vb (app.js đo mép trên tấm bảng), mà lúc tham quan
      tấm bảng đứng ngay trên dải dưới nên --vb = chiều cao dải. Cộng thêm translate của tham quan là dời gấp đôi: các nút trôi lên giữa thân tòa. → bỏ translate ở đây.
   2. Dải dưới cao 188–236 px (hơn một phần tư màn) và cao thấp theo từng phụ đề. → gọn lại: nhãn cảnh và hai nút điều khiển chung một hàng (nút chỉ còn biểu tượng),
      vạch tiến độ nằm trên mép dải, chữ 16,5 px; chiều cao giữ cố định bằng min-height do js đo. */
@media (max-width: 860px) {
  html.tour-on .daybar, html.tour-on .lens, html.tour-on .lens-tog, html.tour-on .spin, html.tour-on .hour { translate: none; }
  html.tour-on .daybar, html.tour-on .lens-tog, html.tour-on .spin { bottom: calc(14px + var(--vb, 0px)); }
  html.tour-on .lens { bottom: calc(62px + var(--vb, 0px)); }
  .tour-bar.t { height: 50px; grid-template-columns: 1fr auto auto; gap: 14px; }
  .tour-brand small { display: none; }
  .tour-bar.b { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; gap: 0 12px; padding: 13px 20px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .tour-cap { display: contents; }
  .tour-bar.b .tour-k { grid-column: 1; grid-row: 1; margin: 0; letter-spacing: .2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tour-ctl { grid-column: 2; grid-row: 1; gap: 8px; }
  .tour-ctl button { flex: none; width: 44px; height: 34px; padding: 0; display: inline-grid; place-items: center; }
  .tour-ctl button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tour-ctl i { margin: 0; font-size: 17px; line-height: 1; }
  .tour-pause::before { content: ""; box-sizing: content-box; width: 4px; height: 12px; border: solid currentColor; border-width: 0 3px; }
  .tour-pause[aria-pressed="true"]::before { width: 0; height: 0; margin-left: 3px; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; }
  .tour-text { grid-column: 1 / -1; grid-row: 2; margin-top: 9px; font-size: 16.5px; line-height: 1.36; }
  .tour-prog { position: absolute; left: 0; right: 0; top: 0; margin: 0; gap: 3px; }
  .tour-end { inset: 50px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-bar, .tour-spot, .tour-hand { transition: none; } .tour-text span { animation: none; opacity: 1; } .tour-start i::after, .tour-spot::after { animation: none; }
}
/* video đi vào căn (js/unit-tour.js) trong cảnh "Đi vào bên trong căn" (24/11/2026): kịch bản tự điều khiển → ẩn thanh tiến trình, dòng nhắc lăn,
   danh sách phòng, nút thoát; chữ từng phòng dời xuống dưới dải phim trên */
html.tour-on .utour.film .utf-bar, html.tour-on .utour.film .ut-hint, html.tour-on .utour.film .ut-steps,
html.tour-on .utour.film .ut-close, html.tour-on .utour.film .ut-end { opacity: 0 !important; pointer-events: none !important; }
html.tour-on .utour.film .utf-cap { margin-top: var(--tour-t, 58px); }
