/* map3d.css — หน้า about/map.html เท่านั้น (ทุกกฎอยู่ใต้ .m3d / .sheet:has(.m3d)) · flat ไม่มีไล่สี ไม่มีเงา
   สัดส่วน: กว้างสุด 1200px กึ่งกลาง · ความสูงฉากไม่เกินจอ · ตัวอักษร clamp() · จัดวางด้วย container query */
.sheet:has(> .m3d) > :is(.crumb, .m3d, .siblings) { max-width: 1200px; margin-left: auto; margin-right: auto; }
/* h1 ของแม่แบบ ("แผนผัง") ให้โปรแกรมอ่านหน้าจออ่าน ส่วนหัวที่เห็นคือ .m3d-h1 ตามแบบที่อนุมัติ */
.sheet:has(> .m3d) > h1 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.m3d { --soft: #f4ecf5; --blue: #2f5d9e; --sp: clamp(16px, .75rem + 1vw, 24px); container-type: inline-size; line-height: 1.6; }
.m3d .m3d-h1 { margin: 0 0 4px; font-size: clamp(26px, 1.2rem + 1vw, 36px); font-weight: 700; line-height: 1.45; color: var(--ink); }
.m3d .m3-sub { margin: 0 0 20px; color: var(--mute); font-size: clamp(16px, .9rem + .3vw, 18px); }
.m3d h2 { margin: 0; font-size: clamp(18px, 1rem + .3vw, 20px); line-height: 1.5; }
.m3d p { margin: 0; }


.m3d .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 20px; border-radius: 999px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.6; }
.m3d .btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.m3d .btn.ghost { background: #fff; color: var(--brand-dark); }
.m3d .btn.ghost:hover { background: var(--soft); }
.m3d .btn:focus-visible { outline: 3px solid var(--brand-dark); outline-offset: 2px; }

/* ฉาก + แผงเลือกประตู */
.m3d .m3-box { display: grid; grid-template-columns: minmax(0, 1fr); background: #fff; border-radius: 12px; overflow: hidden; }
.m3d .m3-stage { position: relative; aspect-ratio: 4 / 5; max-height: calc(100svh - 9rem); min-height: 320px; background: #e9ece4; overflow: hidden; }
.m3d .m3-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.m3d .m3-stage canvas:active { cursor: grabbing; }
.m3d .m3-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--mute); white-space: nowrap; }
.m3d .m3-stage.ready .m3-load { display: none; }
.m3d .m3-labels { position: absolute; inset: 0; pointer-events: none; }
.m3d .m3-lab { position: absolute; left: 0; top: 0; padding: 2px 10px; border-radius: 999px; background: #fff; color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap; border: 0; transition: opacity .3s; }
.m3d .m3-lab.museum { padding: 4px 16px; background: var(--brand); color: #fff; font-size: 15px; }
.m3d .m3-lab.gate { pointer-events: auto; cursor: pointer; background: var(--blue); color: #fff; }
.m3d .m3-lab.road { background: #5f6b75; color: #fff; font-weight: 400; font-size: 12px; }
/* จุดตำแหน่งรถ: วงแหวนเส้นทึบแทนเงาเดิม (flat) */
.m3d .m3-lab.car { padding: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--brand); outline: 6px solid #dcc3e0; }
.m3d .m3-stage.driving .m3-lab.gate { opacity: 0; pointer-events: none; }
.m3d .m3-now { position: absolute; left: 12px; top: 12px; max-width: calc(100% - 24px); padding: 4px 14px; border-radius: 999px; background: #fff; font-weight: 700; font-size: 14px; color: var(--brand-dark); }
.m3d .m3-hint { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px); padding: 2px 12px; border-radius: 999px; background: #fffffff0; font-size: 12px; color: var(--mute); }
.m3d .m3-hint .t { display: none; }
@media (pointer: coarse) { .m3d .m3-hint .m { display: none; } .m3d .m3-hint .t { display: inline; } }
.m3d .m3-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
.m3d .m3-track i { display: block; height: 100%; width: 0; background: var(--brand); }
.m3d .m3-stage:not(.driving) .m3-track { opacity: 0; }

.m3d .m3-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.m3d .m3-gates { display: grid; gap: 8px; }
.m3d .m3-gate { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: #f3f3f1; cursor: pointer; line-height: 1.5; }
.m3d .m3-gate:hover { background: var(--soft); }
.m3d .m3-gate[aria-pressed="true"] { background: var(--brand); color: #fff; }
.m3d .m3-gate[aria-pressed="true"] em { color: #f1e6f3; }
.m3d .m3-gate:focus-visible { outline: 3px solid var(--brand-dark); outline-offset: 2px; }
.m3d .m3-gate .no { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-weight: 700; font-size: 18px; }
.m3d .m3-gate b { display: block; }
.m3d .m3-gate em { display: block; font-style: normal; font-size: 13px; color: var(--mute); }
.m3d .m3-steps-h { margin-top: 6px; font-weight: 700; }
.m3d .m3-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.m3d .m3-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 8px; color: var(--mute); }
.m3d .m3-steps li.empty { display: block; font-size: 14px; padding: 0; }
.m3d .m3-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eee; font-size: 13px; font-weight: 700; color: var(--ink); }
.m3d .m3-steps li.past { color: var(--ink); }
.m3d .m3-steps li.past .n { background: #dcc3e0; }
.m3d .m3-steps li.on { background: var(--soft); color: var(--ink); font-weight: 700; }
.m3d .m3-steps li.on .n { background: var(--brand); color: #fff; }
.m3d .m3-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.m3d .m3-acts .btn { flex: 1 1 8rem; }

/* ที่อยู่ + คลิป */
.m3d .m3-info { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: stretch; }
.m3d .m3-addr, .m3d .m3-clip { background: #fff; border-radius: 12px; padding: var(--sp); min-width: 0; }
.m3d .m3-addr h2 { margin-bottom: 8px; }
.m3d .m3-addr p { margin-bottom: 12px; line-height: 1.7; }
.m3d .m3-clip { padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.m3d .m3-clip .player { margin-bottom: 10px; }
.m3d .m3-clip p { margin: 0 4px; }
.m3d .m3-clip .k { color: var(--mute); font-size: 13px; }
.m3d .m3-clip .t { font-weight: 700; font-size: 17px; }
.m3d .player { position: relative; aspect-ratio: 16 / 9; background: #111; border-radius: 8px; overflow: hidden; }
.m3d .player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.m3d .player > .poster { all: unset; position: absolute; inset: 0; cursor: pointer; }
.m3d .player > .poster:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.m3d .player > .poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m3d .play { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; }
.m3d .play::before { content: ""; margin-left: 4px; border-left: 15px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.m3d .dur { position: absolute; right: 6px; bottom: 6px; padding: 0 6px; border-radius: 4px; background: #111; color: #fff; font-size: 12px; line-height: 1.6; }

@container (min-width: 560px) {
  .m3d .m3-box .m3-stage { aspect-ratio: 16 / 10; }
  .m3d .m3-box .m3-panel { padding: 20px; }
}
@container (min-width: 680px) {
  .m3d .m3-info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
}
@container (min-width: 880px) {
  .m3d .m3-box { grid-template-columns: minmax(0, 1fr) clamp(320px, 34cqw, 380px); }
  /* ความสูงฉากคงที่ตามจอ (ไม่ยืดตามรายการขั้นตอน) แผงขวาสูงเท่าฉาก ถ้ายาวกว่าให้เลื่อนในแผง */
  .m3d .m3-box .m3-stage { aspect-ratio: auto; height: clamp(480px, calc(100vh - 8rem), 700px); min-height: 0; max-height: none; }
  .m3d .m3-box .m3-panel { contain: size; overflow-y: auto; }
  .m3d .m3-box .m3-hint { font-size: 13px; }
}
