/* =====================================================================
   BANNER 3D GIAN PHÒNG  —  đi kèm inc/phong-3d.php
   ===================================================================== */

.r3d { margin: 0 auto 34px; --r3d-h: clamp(340px, 62vh, 720px); }

/* ---------- Sân khấu ---------- */
.r3d__stage {
	position: relative;
	height: var(--r3d-h);
	overflow: hidden;
	background: #1a0404;
	border: 1px solid rgba(184,145,47,.6);
	box-shadow: 0 0 0 4px rgba(46,6,6,.9), 0 0 0 5px rgba(230,200,122,.35), 0 30px 70px rgba(0,0,0,.55);
	clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
	perspective: 1300px;
	perspective-origin: 50% 50%;
	cursor: grab;
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
	outline: none;
}
.r3d__stage.is-dragging { cursor: grabbing; }
.r3d__stage:focus-visible { box-shadow: 0 0 0 4px rgba(46,6,6,.9), 0 0 0 6px #E6C87A; }
.r3d__stage:fullscreen { height: 100vh; clip-path: none; border: 0; box-shadow: none; background: #000; }
.r3d__stage:-webkit-full-screen { height: 100vh; clip-path: none; border: 0; box-shadow: none; background: #000; }

.r3d__scene {
	position: absolute; inset: 0;
	transform-style: preserve-3d;
	transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
	will-change: transform;
}
.r3d__layer { position: absolute; inset: 0; pointer-events: none; }

/* Lớp ảnh: phóng to hơn khung để khi nghiêng / kéo không lộ mép */
.r3d__layer--bg {
	transform: translate3d(var(--px, 0px), var(--py, 0px), 0) scale(var(--zoom, 1.18));
	will-change: transform;
	transition: transform .08s linear;
}
.r3d__img {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	opacity: 0;
	transform: scale(1.12);
	transition: opacity .55s ease, transform .9s cubic-bezier(.2,.7,.2,1);
	pointer-events: none;
}
.r3d__img.is-active { opacity: 1; transform: scale(1); }
.r3d__img.is-leaving { opacity: 0; transform: scale(.94); }

/* Ảnh 360° (Pannellum) phủ lên sân khấu */
.r3d__pano { position: absolute; inset: 0; z-index: 3; }
.r3d__pano .pnlm-container { background: #1a0404; }
.r3d.is-360 .r3d__scene { transform: none !important; }
.r3d.is-360 .r3d__layer--bg, .r3d.is-360 .r3d__glare { display: none; }
.r3d.is-360 .r3d__stage { cursor: default; }

/* Khung viền vàng nổi (di chuyển ngược lớp ảnh → cảm giác chiều sâu) */
.r3d__layer--frame {
	inset: 14px;
	border: 1px solid rgba(230,200,122,.55);
	box-shadow: inset 0 0 0 1px rgba(46,6,6,.6), 0 0 0 1px rgba(46,6,6,.6);
	clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
	transform: translate3d(calc(var(--px, 0px) * -.35), calc(var(--py, 0px) * -.35), 40px);
	z-index: 4;
}
.r3d__layer--vignette {
	z-index: 2;
	background:
		radial-gradient(120% 90% at 50% 45%, rgba(0,0,0,0) 45%, rgba(20,3,3,.55) 100%),
		linear-gradient(180deg, rgba(20,3,3,.35) 0%, rgba(20,3,3,0) 28%, rgba(20,3,3,0) 55%, rgba(20,3,3,.78) 100%);
}
/* Ánh sáng lướt theo góc nhìn */
.r3d__glare {
	position: absolute; inset: -20%;
	z-index: 3;
	pointer-events: none;
	background: radial-gradient(40% 40% at var(--gx, 50%) var(--gy, 50%), rgba(255,236,190,.22) 0%, rgba(255,236,190,0) 70%);
	mix-blend-mode: screen;
	transform: translateZ(60px);
}

/* ---------- Chữ & nút ---------- */
.r3d__hud {
	position: absolute; left: 34px; bottom: 30px; right: 34px;
	z-index: 6;
	pointer-events: none;
	color: #F7E7BC;
	text-shadow: 0 2px 12px rgba(0,0,0,.7);
	transform: translateZ(80px);
}
.r3d__kicker { font-size: .78em; letter-spacing: .22em; text-transform: uppercase; color: #E6C87A; margin-bottom: 4px; }
.r3d__name {
	font-family: 'Philosopher', 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
	font-size: clamp(1.4em, 3.2vw, 2.3em);
	line-height: 1.1;
	letter-spacing: .04em;
	text-transform: uppercase;
	background: linear-gradient(180deg, #FBF0D3 0%, #E6C87A 45%, #C8A144 75%, #A8801F 100%);
	-webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent;
	display: inline-block;
	filter: drop-shadow(0 2px 10px rgba(0,0,0,.6));
}
.r3d__counter { margin-top: 6px; font-size: .82em; letter-spacing: .12em; color: rgba(247,231,188,.8); }

.r3d__nav {
	position: absolute; top: 50%; z-index: 7;
	width: 46px !important; height: 46px !important;
	min-height: 0 !important; margin: 0 !important; padding: 0 !important;
	transform: translateY(-50%);
	font-size: 30px; line-height: 1;
	color: #F7E7BC !important;
	background: rgba(46,6,6,.55) !important;
	border: 1px solid rgba(230,200,122,.55) !important;
	border-radius: 0 !important; box-shadow: none !important;
	backdrop-filter: blur(4px);
	clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
	cursor: pointer;
	opacity: .75;
	transition: opacity .2s ease, background .2s ease;
}
.r3d__nav:hover { opacity: 1; background: rgba(110,17,19,.85) !important; }
.r3d__nav--prev { left: 22px; }
.r3d__nav--next { right: 22px; }

.r3d__tools {
	position: absolute; top: 22px; right: 22px; z-index: 7;
	display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px;
}
.r3d__tool {
	display: inline-flex; align-items: center; gap: 7px;
	height: 34px !important; min-height: 0 !important; margin: 0 !important;
	padding: 0 12px !important;
	font-size: .76em; letter-spacing: .08em; text-transform: uppercase;
	color: #E6C87A !important;
	background: rgba(46,6,6,.6) !important;
	border: 1px solid rgba(230,200,122,.45) !important;
	border-radius: 0 !important; box-shadow: none !important;
	backdrop-filter: blur(4px);
	clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
	cursor: pointer;
	transition: all .2s ease;
}
.r3d__tool:hover { background: rgba(110,17,19,.85) !important; color: #FFF3D6 !important; }
.r3d__tool.is-on { background: linear-gradient(180deg, #F2DFA6, #C39A3C) !important; color: #4A0C0C !important; border-color: #E6C87A !important; }
.r3d__tool[hidden] { display: none !important; }

.r3d__ico { display: inline-block; width: 14px; height: 14px; position: relative; }
.r3d__ico--look::before { content: ""; position: absolute; inset: 0; border: 1.5px solid currentColor; border-radius: 50%; }
.r3d__ico--look::after  { content: ""; position: absolute; left: 4.5px; top: 4.5px; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.r3d__ico--gyro::before { content: ""; position: absolute; inset: 1px 3px; border: 1.5px solid currentColor; border-radius: 3px; }
.r3d__ico--gyro::after  { content: ""; position: absolute; left: 5.5px; bottom: 2px; width: 3px; height: 1.5px; background: currentColor; }
.r3d__ico--full::before { content: ""; position: absolute; inset: 0; border: 1.5px solid currentColor; border-radius: 2px; }
.r3d__ico--full::after  { content: ""; position: absolute; left: 3px; top: 3px; right: 3px; bottom: 3px; border: 1.5px dashed currentColor; border-radius: 1px; opacity: .6; }

.r3d__book {
	display: inline-flex; align-items: center;
	height: 34px; padding: 0 16px;
	font-size: .76em; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
	color: #3A0808 !important;
	background: linear-gradient(180deg, #F7E7BC 0%, #E6C87A 50%, #C8A144 100%);
	box-shadow: 0 0 0 1px rgba(255,246,216,.5), 0 0 14px rgba(230,200,122,.35);
	clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
	transition: all .25s ease;
}
.r3d__book:hover { background: linear-gradient(180deg, #FFFBEA, #F2DFA6 50%, #D9B24E); box-shadow: 0 0 0 1px rgba(255,246,216,.8), 0 0 22px rgba(230,200,122,.6); }

.r3d__hint {
	position: absolute; left: 50%; top: 22px; z-index: 7;
	transform: translateX(-50%);
	padding: 5px 14px;
	font-size: .74em; letter-spacing: .06em;
	color: rgba(247,231,188,.9);
	background: rgba(20,3,3,.55);
	border: 1px solid rgba(230,200,122,.3);
	backdrop-filter: blur(4px);
	white-space: nowrap;
	transition: opacity .6s ease;
	pointer-events: none;
}
.r3d.is-touched .r3d__hint { opacity: 0; }
.r3d__badge360 {
	position: absolute; left: 22px; top: 22px; z-index: 7;
	padding: 4px 10px; font-size: .74em; letter-spacing: .12em; font-weight: 700;
	color: #4A0C0C; background: linear-gradient(180deg, #F2DFA6, #C39A3C);
}
.r3d__badge360[hidden] { display: none; }

/* ---------- Dải ảnh nhỏ (coverflow) ---------- */
.r3d__strip {
	display: flex; gap: 10px;
	margin-top: 16px; padding: 12px 6px;
	overflow-x: auto; overflow-y: hidden;
	scrollbar-width: thin; scrollbar-color: #B8912F transparent;
	perspective: 900px;
	scroll-snap-type: x proximity;
}
.r3d__strip::-webkit-scrollbar { height: 6px; }
.r3d__strip::-webkit-scrollbar-thumb { background: #B8912F; }
.r3d__thumb {
	flex: 0 0 auto;
	position: relative;
	width: 132px; height: 88px;
	min-height: 0 !important; margin: 0 !important; padding: 0 !important;
	background: #2E0606 !important;
	border: 1px solid rgba(184,145,47,.45) !important;
	border-radius: 0 !important; box-shadow: inset 0 0 0 2px rgba(46,6,6,.8) !important;
	clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
	transform: rotateY(var(--ty, 0deg)) translateZ(var(--tz, 0px)) scale(var(--ts, .94));
	transform-style: preserve-3d;
	opacity: .72;
	cursor: pointer;
	scroll-snap-align: center;
	transition: transform .45s cubic-bezier(.2,.7,.2,1), opacity .3s ease, border-color .3s ease;
	overflow: hidden;
}
.r3d__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.r3d__thumb:hover { opacity: 1; border-color: rgba(230,200,122,.8) !important; }
.r3d__thumb.is-active { opacity: 1; border-color: #E6C87A !important; --ts: 1.06; --tz: 30px; --ty: 0deg; box-shadow: inset 0 0 0 2px rgba(46,6,6,.8), 0 0 18px rgba(230,200,122,.35) !important; }
.r3d__thumb360 { position: absolute; left: 6px; top: 6px; padding: 1px 6px; font-size: 10px; font-weight: 700; color: #4A0C0C; background: #E6C87A; }

/* ---------- Tiêu đề trang & khối bên dưới ---------- */
.npl-room .section-title-container { margin-bottom: 18px; }
.npl-room .npl-room-desc { margin-bottom: 26px; }
.npl-room .r3d__all-title {
	margin: 10px 0 16px;
	font-size: 1.05em; letter-spacing: .12em; text-transform: uppercase;
	color: #E6C87A !important;
	display: flex; align-items: center; gap: 14px;
}
.npl-room .r3d__all-title::after { content: ""; flex: 1 1 auto; height: 1px; background: linear-gradient(90deg, rgba(184,145,47,.6), transparent); }

/* ---------- Ô phòng ở trang danh sách: nghiêng theo chuột ---------- */
.npl-rooms-grid { perspective: 1200px; }
.npl-room-tile { transform-style: preserve-3d; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s ease, border-color .3s ease, box-shadow .3s ease; will-change: transform; }
.npl-room-tile.is-tilting { transition: transform .06s linear, border-color .3s ease, box-shadow .3s ease; }
.npl-room-tile-body { transform: translateZ(30px); }

/* ---------- Responsive & giảm chuyển động ---------- */
@media (max-width: 849px) {
	.r3d { --r3d-h: clamp(260px, 58vw, 520px); }
	.r3d__hud { left: 20px; right: 20px; bottom: 20px; }
	.r3d__tools { top: 14px; right: 14px; gap: 6px; }
	.r3d__tool { height: 30px !important; padding: 0 9px !important; font-size: .7em; }
	.r3d__tool[data-act="look"] { display: none; }
	.r3d__book { height: 30px; padding: 0 12px; font-size: .7em; }
	.r3d__hint { top: auto; bottom: 92px; font-size: .68em; max-width: 90%; white-space: normal; text-align: center; }
	.r3d__nav { width: 38px !important; height: 38px !important; font-size: 24px; }
	.r3d__nav--prev { left: 12px; } .r3d__nav--next { right: 12px; }
	.r3d__thumb { width: 104px; height: 70px; }
	.r3d__layer--frame { inset: 10px; }
}
@media (prefers-reduced-motion: reduce) {
	.r3d__scene, .r3d__layer--bg, .r3d__layer--frame, .r3d__thumb, .npl-room-tile { transition: none !important; }
}
