/* Mô hình 3D STOWN cho landing — gắn vào <div id="stown-3d"> */
.s3d { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 340px; max-height: 78vh; background: var(--cream, #fcfaf7); border: 1px solid var(--beige, #ecd9c6); overflow: hidden; user-select: none; -webkit-user-select: none; }
@media (max-width: 720px) { .s3d { aspect-ratio: 4 / 5; max-height: 72vh; } }
.s3d canvas { display: block; width: 100%; height: 100%; outline: none; opacity: 0; transition: opacity .35s ease; }
.s3d.s3d-painted canvas { opacity: 1; }
.s3d:fullscreen { aspect-ratio: auto; max-height: none; width: 100vw; height: 100vh; border: 0; }
.s3d-load { position: absolute; inset: 0; display: grid; place-items: center; color: #3a0d08; font: 500 15px var(--font-body, system-ui); }
.s3d-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.s3d-tag { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font: 700 13px var(--font-head, system-ui); letter-spacing: .04em; color: #1f2a2e; background: rgba(251, 250, 247, .92); padding: 3px 8px; border-radius: 4px; }
.s3d-tag.road { font: 600 11px var(--font-body, system-ui); letter-spacing: 0; color: #5f6b6e; background: rgba(251, 250, 247, .8); }
.s3d-tag.zone { font: 800 13px var(--font-head, system-ui); letter-spacing: .08em; color: #fff; background: rgba(31, 42, 46, .72); padding: 5px 10px; }
.s3d-tag.factory { font: 500 10.5px var(--font-body, system-ui); letter-spacing: 0; color: rgba(31, 42, 46, .62); background: rgba(251, 250, 247, .42); padding: 2px 6px; transform: translate(-50%, -50%); }
@media (max-width: 720px) { .s3d-tag.zone { font-size: 10px; padding: 3px 7px; } .s3d-tag.factory { display: none !important; } }
.s3d-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; pointer-events: none; }
.s3d-bar button, .s3d-tool button, .s3d-plan-btn, .s3u-back { pointer-events: auto; min-height: 40px; padding: 6px 14px; border: 1px solid var(--beige, #ecd9c6); background: rgba(255, 255, 255, .94); color: var(--ink, #3a0d08); font: 500 14px var(--font-body, system-ui); cursor: pointer; }
.s3d-bar button[aria-pressed="true"] { background: var(--red, #d7192a); border-color: var(--red, #d7192a); color: #fff; }
.s3d-bar button:focus-visible, .s3d-tool button:focus-visible { outline: 2px solid var(--red, #d7192a); outline-offset: 2px; }
.s3d-tool { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; }
.s3d-tool button { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; }
.s3d-compass { position: absolute; top: 12px; left: 12px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .94); border: 1px solid var(--beige, #ecd9c6); display: grid; place-items: center; pointer-events: none; }
.s3d-compass svg { width: 34px; height: 34px; }
.s3d-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(31, 42, 46, .78); color: #fff; padding: 8px 14px; font: 500 14px var(--font-body, system-ui); pointer-events: none; opacity: 0; transition: opacity .25s; text-align: center; max-width: 80%; }
.s3d-hint.on { opacity: 1; }
.s3d-osm { position: absolute; right: 6px; bottom: 60px; font: 400 10px var(--font-body, system-ui); color: rgba(31, 42, 46, .7); background: rgba(255, 255, 255, .6); padding: 1px 5px; pointer-events: none; }
@media (max-width: 720px) { .s3d-bar { bottom: 8px; left: 8px; right: 8px; gap: 4px; } .s3d-bar button { padding: 6px 10px; font-size: 13px; } .s3d-osm { bottom: 56px; } }

/* điện thoại: khung 3D nằm trong ảnh phối cảnh ở đầu trang */
.s3d.s3d-hero { position: absolute; inset: 0; width: auto; aspect-ratio: auto; min-height: 0; max-height: none; border: 4px solid #fff; box-sizing: border-box; }
.s3d.s3d-hero:not(.s3d-ready) { background: transparent; }
.s3d.s3d-hero .s3d-load { inset: auto 10px 10px auto; display: block; background: rgba(58, 13, 8, .72); color: #fff; font-size: 12px; padding: 3px 10px; }
.hero-img.has-3d figcaption { display: none; }
.s3d-hero .s3d-osm { bottom: 56px; }

/* nút điều khiển: nhỏ, mờ, kính mờ; sáng rõ hơn khi chạm/rê */
.s3d-bar { gap: 4px; bottom: 10px; }
.s3d-bar button, .s3d-tool button, .s3d-plan-btn, .s3u-back { min-height: 30px; padding: 4px 11px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 3px; background: rgba(255, 255, 255, .42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: rgba(58, 13, 8, .85); font: 500 12px var(--font-body, system-ui); letter-spacing: .02em; box-shadow: 0 1px 6px rgba(40, 20, 10, .12); opacity: .8; transition: opacity .2s, background .2s; }
.s3d-bar button:hover, .s3d-tool button:hover, .s3d-plan-btn:hover, .s3u-back:hover, .s3d-bar button:focus-visible, .s3d-tool button:focus-visible, .s3d-plan-btn:focus-visible, .s3u-back:focus-visible { opacity: 1; background: rgba(255, 255, 255, .78); }
.s3d-bar button[aria-pressed="true"] { background: rgba(215, 25, 42, .82); border-color: rgba(255, 255, 255, .6); color: #fff; opacity: .95; }
.s3d-tool { top: 10px; right: 10px; gap: 4px; }
.s3d-tool button { width: 30px; height: 30px; min-height: 30px; padding: 0; font-size: 16px; }
.s3d-compass { top: 10px; left: 10px; width: 34px; height: 34px; background: rgba(255, 255, 255, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .55); opacity: .85; }
.s3d-compass svg { width: 26px; height: 26px; }
@media (max-width: 720px) { .s3d-bar { bottom: 8px; gap: 3px; } .s3d-bar button, .s3d-plan-btn, .s3u-back { padding: 3px 9px; font-size: 11.5px; min-height: 28px; } .s3d-tool button { width: 28px; height: 28px; min-height: 28px; } }

/* nút chuyển sang mô hình cắt tầng ở trang chủ: cùng kiểu với các nút Bắc, Đông, Nam…, chỉ khác vị trí */
.s3d-plan-btn { position: absolute; z-index: 3; top: 10px; left: 54px; cursor: pointer; white-space: nowrap; }
.s3d-plan-btn:disabled { opacity: .6; cursor: progress; }
