/* =========================================================================
   劇場模式：全螢幕場景、章節卡、電影字幕、閒置淡出的控制列
   導覽頁與首頁開場共用
   ========================================================================= */

/* class 的 display 會蓋掉 [hidden] 的預設樣式，這裡統一補回來 */
.theater [hidden] {
	display: none !important;
}

.theater {
	margin: 0;
	background: #07161a;
	color: #eaf3f0;
	overflow: hidden;
	overscroll-behavior: none;
}

.stage {
	position: fixed;
	inset: 0;
	overflow: hidden;
	background: #07161a;
}

/* 兩個場景槽輪流使用，交叉溶接時一個淡入、一個淡出 */
.scene-slot {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 1.4s ease;
}

.scene-slot.on {
	opacity: 1;
}

.scene {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

/* 每一片光影都往外溢出 20%，緩慢位移時邊緣才不會露出底色 */
.scene-layer {
	position: absolute;
	inset: -22%;
	will-change: transform, opacity;
}

/* 場景插畫：壓在光影之上、字幕之下，用很慢的推鏡帶景深 */
.scene-art {
	position: absolute;
	inset: -8%;
	will-change: transform;
}

.scene-art svg {
	width: 100%;
	height: 100%;
	display: block;
}

/* 窄螢幕：插畫完整顯示並靠下，避免只看到構圖正中央 */
.scene-art.fit {
	inset: auto 0 0 0;
	height: 76%;
}

/* 有現場照片時，照片當底、光影收斂，插畫讓位 */
.scene-photo {
	position: absolute;
	inset: -10%;
	background-size: cover;
	background-position: center;
	will-change: transform;
}

.scene.has-photo {
	background: #05100f;
}

.scene.has-photo .scene-layer {
	opacity: 0.42;
}

.scene.has-photo .scene-art {
	display: none;
}

.mote {
	position: absolute;
	border-radius: 50%;
	opacity: 0;
	will-change: transform, opacity;
}

.vignette {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(125% 92% at 50% 44%, transparent 42%, rgba(2, 10, 12, 0.76) 100%);
}

/* =========================================================================
   場景動態
   ========================================================================= */

@keyframes sc-drift-up {
	from {
		transform: translate3d(0, 14%, 0) scale(1.04);
	}
	to {
		transform: translate3d(0, -16%, 0) scale(1.28);
	}
}

@keyframes sc-drift-side {
	from {
		transform: translate3d(-9%, 2%, 0) scale(1.08);
	}
	to {
		transform: translate3d(9%, -2%, 0) scale(1.2);
	}
}

@keyframes sc-breathe {
	0%,
	100% {
		opacity: 0.5;
	}
	50% {
		opacity: 0.95;
	}
}

@keyframes sc-flicker {
	0%,
	100% {
		opacity: 0.62;
	}
	38% {
		opacity: 0.92;
	}
	54% {
		opacity: 0.7;
	}
	71% {
		opacity: 1;
	}
}

@keyframes sc-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes sc-sweep {
	from {
		transform: translate3d(-34%, 0, 0);
	}
	to {
		transform: translate3d(34%, 0, 0);
	}
}

@keyframes sc-sway {
	from {
		transform: translate3d(-3%, 0, 0) scale(1.06);
	}
	to {
		transform: translate3d(3%, 0, 0) scale(1.12);
	}
}

@keyframes sc-ken-burns {
	from {
		transform: scale(1.03) translate3d(0, 0, 0);
	}
	to {
		transform: scale(1.2) translate3d(-3%, -4%, 0);
	}
}

@keyframes sc-mote-rise {
	0% {
		transform: translate3d(0, 18vh, 0) scale(0.5);
		opacity: 0;
	}
	14% {
		opacity: var(--mote-o, 0.5);
	}
	84% {
		opacity: var(--mote-o, 0.5);
	}
	100% {
		transform: translate3d(var(--mote-x, 2vw), -92vh, 0) scale(1.15);
		opacity: 0;
	}
}

/* =========================================================================
   HUD：上下兩列，閒置時整組淡出
   ========================================================================= */

.hud {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 20;
	transition: opacity 0.55s ease, transform 0.55s ease;
}

.stage.idle .hud {
	opacity: 0;
	pointer-events: none;
}

.stage.idle .hud-top {
	transform: translateY(-12px);
}

.stage.idle .hud-bottom {
	transform: translateY(12px);
}

.hud-top {
	top: 0;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: linear-gradient(180deg, rgba(3, 13, 15, 0.7), transparent);
}

.hud-bottom {
	bottom: 0;
	padding: 18px;
	background: linear-gradient(0deg, rgba(3, 13, 15, 0.82), transparent);
}

.hud-btn {
	appearance: none;
	border: 0;
	background: rgba(255, 255, 255, 0.08);
	color: #eaf3f0;
	width: 38px;
	height: 38px;
	border-radius: 999px;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	display: grid;
	place-items: center;
	text-decoration: none;
	flex-shrink: 0;
	transition: background-color 0.15s ease;
}

.hud-btn:hover {
	background: rgba(255, 255, 255, 0.18);
}

.hud-title {
	flex: 1;
	min-width: 0;
}

.hud-chapter {
	font-family: var(--font-serif);
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hud-zone {
	font-size: 12px;
	color: #9ec6bb;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.demo-chip {
	font-size: 11px;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba(228, 160, 32, 0.2);
	border: 1px solid rgba(228, 160, 32, 0.45);
	color: #f0cd8a;
	white-space: nowrap;
	flex-shrink: 0;
}

/* 章節時間軸：一段一條，走過的填滿、目前這段隨字推進 */
.timeline {
	display: flex;
	gap: 4px;
	margin-bottom: 16px;
}

.tl-seg {
	flex: 1;
	height: 3px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
	overflow: hidden;
	cursor: pointer;
}

.tl-fill {
	display: block;
	height: 100%;
	width: 0;
	background: #e4a020;
	transition: width 0.18s linear;
}

.hud-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
}

.play-big {
	appearance: none;
	border: 0;
	width: 62px;
	height: 62px;
	border-radius: 999px;
	background: #e4a020;
	color: #10211f;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
	transition: transform 0.15s ease, background-color 0.15s ease;
}

.play-big:hover {
	background: #f2b234;
	transform: scale(1.05);
}

.play-big:active {
	transform: scale(0.95);
}

.hud-row .hud-btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.rate-group {
	display: flex;
	gap: 4px;
	margin-left: 6px;
}

.rate-group button {
	appearance: none;
	border: 1px solid rgba(255, 255, 255, 0.22);
	background: transparent;
	color: #cfe3dd;
	font-family: inherit;
	font-size: 12px;
	padding: 5px 9px;
	border-radius: 999px;
	cursor: pointer;
}

.rate-group button[aria-pressed='true'] {
	background: rgba(255, 255, 255, 0.92);
	color: #10211f;
	border-color: transparent;
}

/* =========================================================================
   章節卡
   ========================================================================= */

.chapter-card {
	position: absolute;
	inset: 0;
	z-index: 30;
	display: grid;
	place-content: center;
	text-align: center;
	padding: 24px;
	background: rgba(3, 12, 14, 0.86);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.75s ease, visibility 0.75s;
	pointer-events: none;
}

.chapter-card.on {
	opacity: 1;
	visibility: visible;
}

.ch-no {
	font-size: 12px;
	letter-spacing: 0.34em;
	color: #9ec6bb;
	margin-bottom: 14px;
}

.ch-title {
	font-family: var(--font-serif);
	font-size: clamp(1.55rem, 5.6vw, 2.7rem);
	font-weight: 700;
	color: #fff;
	line-height: 1.35;
}

.ch-rule {
	width: 0;
	height: 1px;
	background: #6fa79a;
	margin: 22px auto 0;
}

.chapter-card.on .ch-rule {
	width: 120px;
	transition: width 1s ease 0.25s;
}

.ch-zone {
	margin-top: 18px;
	font-size: 13px;
	color: #9ec6bb;
}

/* =========================================================================
   電影字幕
   ========================================================================= */

.caption {
	position: absolute;
	left: 50%;
	bottom: 21%;
	transform: translateX(-50%);
	z-index: 15;
	width: min(88%, 30em);
	text-align: center;
	font-size: clamp(1.02rem, 2.5vw, 1.45rem);
	line-height: 1.9;
	letter-spacing: 0.02em;
	color: #f4faf8;
	text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8), 0 0 3px rgba(0, 0, 0, 0.85);
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.caption .rest {
	opacity: 0;
}

.caption .caret {
	display: inline-block;
	width: 2px;
	height: 1em;
	vertical-align: -0.14em;
	margin: 0 2px;
	background: #f4faf8;
	animation: caret-blink 1s steps(1, end) infinite;
}

.caption.idle .caret {
	animation: none;
	opacity: 0.35;
}

@keyframes caret-blink {
	0%,
	50% {
		opacity: 1;
	}
	51%,
	100% {
		opacity: 0;
	}
}

/* =========================================================================
   片頭選單與覆蓋層
   ========================================================================= */

.title-screen {
	position: absolute;
	inset: 0;
	z-index: 25;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	padding: 32px 24px;
	overflow-y: auto;
}

.ts-kicker {
	font-size: 12px;
	letter-spacing: 0.28em;
	color: #9ec6bb;
	margin-bottom: 16px;
}

.title-screen h1 {
	font-family: var(--font-serif);
	font-size: clamp(1.9rem, 7vw, 3.2rem);
	color: #fff;
	margin: 0 0 14px;
}

.ts-sub {
	color: #b9d5cd;
	font-size: 14px;
	margin: 0 0 32px;
	max-width: 26em;
}

.ts-routes {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: min(100%, 25em);
}

.ts-route {
	appearance: none;
	border: 1px solid rgba(255, 255, 255, 0.22);
	background: rgba(255, 255, 255, 0.06);
	color: #eaf3f0;
	font-family: inherit;
	text-align: left;
	padding: 15px 18px;
	border-radius: 12px;
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.ts-route:hover {
	background: rgba(255, 255, 255, 0.13);
	border-color: rgba(255, 255, 255, 0.4);
	transform: translateY(-1px);
}

.ts-route strong {
	display: block;
	font-family: var(--font-serif);
	font-size: 17px;
	margin-bottom: 4px;
}

.ts-route span {
	font-size: 12px;
	color: #9ec6bb;
}

.link-btn {
	appearance: none;
	border: 0;
	background: none;
	color: #9ec6bb;
	font-family: inherit;
	font-size: 13px;
	margin-top: 22px;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 4px;
}

.overlay {
	position: absolute;
	inset: 0;
	z-index: 40;
	background: rgba(3, 12, 14, 0.93);
	overflow-y: auto;
	padding: 24px 20px 40px;
	animation: overlay-in 0.28s ease-out;
}

@keyframes overlay-in {
	from {
		opacity: 0;
	}
}

.overlay h2 {
	font-family: var(--font-serif);
	font-size: 20px;
	color: #fff;
	margin: 0 0 6px;
}

.overlay .ov-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
}

.overlay p {
	color: #b9d5cd;
	font-size: 13px;
	line-height: 1.9;
	max-width: 34em;
}

.ov-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ov-item {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	appearance: none;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.05);
	color: #eaf3f0;
	font-family: inherit;
	text-align: left;
	padding: 13px 16px;
	border-radius: 10px;
	cursor: pointer;
}

.ov-item:hover {
	background: rgba(255, 255, 255, 0.12);
}

.ov-item.current {
	border-color: #e4a020;
}

.ov-num {
	font-size: 12px;
	color: #9ec6bb;
	width: 2.2em;
	flex-shrink: 0;
}

.ov-item .ov-body {
	flex: 1;
	min-width: 0;
}

.ov-item .ov-title {
	font-size: 15px;
}

.ov-item .ov-zone {
	font-size: 12px;
	color: #9ec6bb;
}

.ov-check {
	color: #7fc0ae;
	flex-shrink: 0;
}

/* 播完的收尾卡 */
.end-card {
	position: absolute;
	inset: 0;
	z-index: 35;
	display: grid;
	place-content: center;
	text-align: center;
	gap: 18px;
	padding: 28px;
	background: rgba(3, 12, 14, 0.9);
	animation: overlay-in 0.5s ease-out;
}

.end-card h2 {
	font-family: var(--font-serif);
	font-size: clamp(1.4rem, 5vw, 2rem);
	color: #fff;
	margin: 0;
}

.end-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
}

.end-actions a,
.end-actions button {
	appearance: none;
	border: 1px solid rgba(255, 255, 255, 0.28);
	background: transparent;
	color: #eaf3f0;
	font-family: inherit;
	font-size: 14px;
	padding: 11px 18px;
	border-radius: 999px;
	text-decoration: none;
	cursor: pointer;
}

.end-actions .primary {
	background: #e4a020;
	border-color: #e4a020;
	color: #10211f;
}

@media (prefers-reduced-motion: reduce) {
	.scene-layer,
	.scene-art,
	.scene-photo,
	.mote {
		animation: none !important;
	}

	.scene-slot {
		transition: none;
	}
}

/* =========================================================================
   工作台：場景背景 + 浮在上面的毛玻璃面板 + 分步流程
   給客服、預約、商品、購物車、報價這幾頁用
   ========================================================================= */

.stage-work .hud-top {
	background: linear-gradient(180deg, rgba(3, 13, 15, 0.78), transparent);
}

.panel-wrap {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	align-content: center;
	gap: 16px;
	padding: 88px 16px 28px;
	overflow: hidden;
}

/* 步驟指示器 */
.steps {
	display: flex;
	align-items: center;
	gap: 8px;
	width: min(560px, 100%);
	flex-wrap: wrap;
	justify-content: center;
}

.steps:empty {
	display: none;
}

.step {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 12px;
	color: #8fb3aa;
	white-space: nowrap;
}

.step .dot {
	width: 20px;
	height: 20px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	display: grid;
	place-items: center;
	font-size: 11px;
	flex-shrink: 0;
}

.step.on {
	color: #fff;
}

.step.on .dot {
	background: #e4a020;
	border-color: #e4a020;
	color: #10211f;
	font-weight: 700;
}

.step.done .dot {
	background: rgba(255, 255, 255, 0.85);
	border-color: transparent;
	color: #10211f;
}

.step .bar {
	width: 22px;
	height: 1px;
	background: rgba(255, 255, 255, 0.24);
}

/* 毛玻璃面板：裡面沿用 shared.css 的元件，所以做成亮底 */
.stage-panel {
	position: relative;
	width: min(560px, 100%);
	max-height: calc(100vh - 190px);
	overflow-y: auto;
	overflow-x: hidden;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(20px) saturate(1.15);
	-webkit-backdrop-filter: blur(20px) saturate(1.15);
	border-radius: 20px;
	box-shadow: 0 30px 80px rgba(2, 10, 12, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
	padding: 24px 22px;
	color: var(--ink);
}

@supports (max-height: 100dvh) {
	.stage-panel {
		max-height: calc(100dvh - 190px);
	}
}

.stage-panel.roomy {
	width: min(880px, 100%);
}

.stage-panel h2 {
	font-size: var(--t-md);
	margin-bottom: var(--s2);
}

.stage-panel > .lede {
	color: var(--ink-45);
	font-size: var(--t-sm);
	margin-bottom: var(--s4);
}

/* 面板底部的主要動作列 */
.panel-actions {
	display: flex;
	gap: var(--s2);
	margin-top: var(--s5);
	padding-top: var(--s4);
	border-top: 1px solid var(--line);
}

.panel-actions .btn {
	flex: 1;
}

.panel-actions .btn.back {
	flex: 0 0 auto;
}

/* 步驟之間的橫向切換 */
@keyframes panel-in-fwd {
	from {
		opacity: 0;
		transform: translateX(34px);
	}
}

@keyframes panel-in-back {
	from {
		opacity: 0;
		transform: translateX(-34px);
	}
}

@keyframes panel-in-up {
	from {
		opacity: 0;
		transform: translateY(22px);
	}
}

.stage-panel.enter-fwd {
	animation: panel-in-fwd 0.34s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.stage-panel.enter-back {
	animation: panel-in-back 0.34s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.stage-panel.enter-up {
	animation: panel-in-up 0.4s cubic-bezier(0.22, 0.8, 0.3, 1);
}

/* 完成畫面：面板中央的大勾與單號 */
.done-mark {
	width: 56px;
	height: 56px;
	border-radius: 999px;
	background: var(--glass-soft);
	color: var(--glass-deep);
	display: grid;
	place-items: center;
	font-size: 26px;
	margin: 0 auto var(--s4);
	animation: done-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes done-pop {
	from {
		transform: scale(0.4);
		opacity: 0;
	}
}

/* 展品特寫：可拖曳轉動觀看 */
.exhibit-stage {
	position: absolute;
	left: 0;
	right: 0;
	top: 74px;
	/* 下半部留給資訊面板，展品要完整落在上半部 */
	bottom: 50%;
	z-index: 8;
	display: grid;
	place-items: center;
	perspective: 1200px;
	cursor: grab;
	touch-action: pan-y;
}

.exhibit-stage.dragging {
	cursor: grabbing;
}

.exhibit-turn {
	width: min(36vh, 62vw);
	aspect-ratio: 1;
	transform-style: preserve-3d;
	will-change: transform;
}

.exhibit-turn svg {
	width: 100%;
	height: 100%;
	display: block;
	filter: drop-shadow(0 26px 40px rgba(0, 0, 0, 0.45));
}

.exhibit-hint {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 11px;
	letter-spacing: 0.1em;
	color: rgba(214, 240, 232, 0.7);
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.exhibit-stage.touched .exhibit-hint {
	opacity: 0;
}

/* 商品頁的資訊面板從下方滑上來，蓋住下段 */
.stage-work.showcase .panel-wrap {
	align-content: end;
	padding-bottom: 20px;
}

.stage-work.showcase .stage-panel {
	max-height: 48vh;
}

@media (prefers-reduced-motion: reduce) {
	.stage-panel,
	.done-mark {
		animation: none !important;
	}
}
