/* 3D sheet rack viewport with HUD overlays. */
.scene { position: relative; aspect-ratio: 5 / 4.4; min-height: 420px; border: 1px solid var(--line-2); border-radius: 20px; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, #1b2129 0%, #0c0f13 60%); box-shadow: 0 40px 120px -40px #000, 0 0 0 1px #ffffff06 inset; isolation: isolate; }
.scene__canvas { position: absolute; inset: 0; cursor: grab; touch-action: pan-y; }
.scene__canvas:active { cursor: grabbing; }
.scene__canvas canvas { width: 100% !important; height: 100% !important; }

.scene__hud { position: absolute; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.scene__hud--top { top: 16px; left: 16px; right: 64px; justify-content: space-between; }

.scene-card { position: absolute; z-index: 2; top: 60px; right: 16px; width: 210px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: #0b0e12d9; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 50px -20px #000; transition: border-color .3s, transform .3s var(--ease); }
.scene-card.is-active { border-color: #ff6a1a88; }
.scene-card__eyebrow { color: var(--muted); font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; }
.scene-card__loc { margin-top: 2px; font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; letter-spacing: .02em; color: var(--text); }
.scene-card__material { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--text-2); font-size: .85rem; font-weight: 600; }
.scene-card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.scene-card__stats dt { color: var(--muted); font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.scene-card__stats dd { margin: 0; font-family: var(--font-mono); font-size: .88rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.scene-card__sync { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--green); font-size: .74rem; font-weight: 600; }

.scene-feed { position: absolute; z-index: 2; left: 16px; bottom: 64px; display: grid; gap: 6px; width: min(340px, calc(100% - 260px)); margin: 0; padding: 0; list-style: none; pointer-events: none; }
.scene-feed li { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: #0b0e12cc; border: 1px solid var(--line); color: var(--text-2); font-size: .74rem; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: feed-in .5s var(--ease); }
.scene-feed li:nth-child(2) { opacity: .7; }
.scene-feed li:nth-child(3) { opacity: .4; }
.scene-feed b { margin-right: 6px; color: var(--accent); font-family: var(--font-mono); font-weight: 700; }
@keyframes feed-in { from { opacity: 0; transform: translateY(8px); } }

.scene__filters { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 16px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.scene__filters::-webkit-scrollbar { display: none; }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 34px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: #0b0e12cc; color: var(--text-2); font-size: .78rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: all .18s; }
.filter-chip:hover { color: var(--text); border-color: #ffffff40; }
.filter-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #140a03; }

.scene__hint { position: absolute; z-index: 1; left: 18px; top: 54px; color: #ffffff55; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; transition: opacity .6s; }
.scene.is-touched .scene__hint { opacity: 0; }

.scene__fallback { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 40px; background: repeating-linear-gradient(0deg, #ffffff05 0 2px, transparent 2px 22px), var(--panel); text-align: center; color: var(--text-2); }
.scene__fallback[hidden] { display: none; }

.scene-card--left { right: auto; left: 16px; }
.scene-feed--right { left: auto; right: 16px; bottom: 16px; width: min(380px, calc(100% - 32px)); }
.scene__hint--right { left: auto; right: 18px; }
.scene--bender { aspect-ratio: 5 / 4; container-type: inline-size; }
/* Narrow bender viewports (any screen size): status card becomes a bottom strip so the machine stays visible */
@container (max-width: 720px) {
    .scene--bender .scene-card { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; padding: 10px 12px; }
    .scene--bender .scene-card__eyebrow, .scene--bender .scene-card__sync { display: none; }
    .scene--bender .scene-card__loc { margin: 0; font-size: 1rem; }
    .scene--bender .scene-card__material { margin: 0; font-size: .78rem; }
    .scene--bender .scene-card__stats { grid-template-columns: repeat(4, auto); justify-content: space-between; margin-top: 8px; padding-top: 8px; }
    .scene--bender .scene-feed { display: none; }
}
.badge--experimental { background: var(--accent); border-color: var(--accent); color: #140a03; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

@media (max-width: 640px) {
    .scene-card--left { left: 12px; right: 12px; bottom: 12px; }
    .scene--bender .scene-feed { display: none; }
    .scene { aspect-ratio: auto; height: 520px; }
    .scene-card { top: auto; left: 12px; right: 12px; bottom: 60px; width: auto; padding: 10px 12px; }
    .scene-card__eyebrow, .scene-card__sync { display: none; }
    .scene-card__loc { margin: 0; font-size: 1rem; }
    .scene-card__material { margin: 0; font-size: .78rem; }
    .scene-card__stats { grid-template-columns: repeat(4, auto); justify-content: space-between; margin-top: 8px; padding-top: 8px; }
    .scene-card__stats dd { font-size: .78rem; }
    .scene-feed { display: none; }
    .scene__hint { display: none; }
}

/* Expand to full screen: the scene takes every gesture (one-finger orbit, pinch, twist) */
.scene__expand { position: absolute; z-index: 4; top: 14px; right: 14px; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: #0b0e12d9; color: var(--text); cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .2s, background .2s; }
.scene__expand:hover { border-color: var(--accent); }
.scene__expand svg { width: 18px; height: 18px; }
.scene.is-expanded { position: fixed; inset: 0; z-index: 200; width: 100vw; height: 100vh; height: 100dvh; min-height: 0; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; }
.scene.is-expanded .scene__expand { top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); width: 48px; height: 48px; background: var(--accent); border-color: var(--accent); color: #140a03; }
.scene.is-expanded .scene__hud--top { top: max(16px, env(safe-area-inset-top)); }
body.scene-open { overflow: hidden; }
body.scene-open .site-header { visibility: hidden; }

.scene__touch-hint, .scene__expanded-hint { position: absolute; z-index: 1; left: 50%; translate: -50% 0; margin: 0; padding: 6px 12px; border-radius: 999px; background: #0b0e12cc; color: var(--text-2); font-family: var(--font-mono); font-size: .64rem; letter-spacing: .04em; white-space: nowrap; pointer-events: none; transition: opacity .6s; }
.scene__touch-hint { top: 44%; display: none; }
.scene__expanded-hint { bottom: max(24px, env(safe-area-inset-bottom)); display: none; }
@media (pointer: coarse) {
    .scene__touch-hint { display: block; }
    .scene__hint { display: none; }
}
.scene.is-touched .scene__touch-hint { opacity: 0; }
.scene.is-expanded .scene__touch-hint { display: none; }
.scene.is-expanded .scene__expanded-hint { display: block; animation: hint-fade 4s ease forwards; }
@keyframes hint-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
