.theatre {
  position: relative; padding-top: clamp(3.6rem,6vw,6rem);
  background: radial-gradient(ellipse at 40% 48%,#142a66,transparent 66%),#060e29;
}
.theatre-heading { display: grid; grid-template-columns: 1fr minmax(15rem,23rem); gap: 2rem; align-items: end; margin-bottom: clamp(1.7rem,3.4vw,3.35rem); }
.theatre-heading h2 { margin: .95rem 0 0 -.02em; font: 700 clamp(4rem,9vw,9.6rem)/.86 var(--display); font-stretch: condensed; letter-spacing: -.005em; }
.theatre-heading h2 em, .room-bar h2 em { font: inherit; color: inherit; }
.theatre-heading > p { font-size: clamp(1rem,1.46vw,1.22rem); line-height: 1.46; color: var(--muted); }
.theatre-console { --room-colour: #9faaff; min-width: 0; }
.theatre-console.is-ready { display: grid; grid-template-columns: minmax(0,2.45fr) minmax(16.1rem,1fr); grid-template-rows: auto auto 1fr; gap: .7rem clamp(.7rem,1.4vw,1.4rem); }
.theatre-toolbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .9rem; }
.theatre-lenses { display: flex; align-items: center; gap: clamp(.6rem,1.6vw,1.6rem); }
.theatre-lenses > .eyebrow { font-size: .82rem; white-space: nowrap; }
.theatre-lens-options { display: flex; flex-wrap: wrap; gap: .3rem; }
.theatre-lens-options button, .room-button {
  min-height: 2.75rem; padding: .48rem .8rem; border: 1px solid #33477f; border-radius: 2px;
  font-size: .92rem; font-weight: 630; line-height: 1.25; color: #c9d4ef; background: #0b1638;
  transition: background .2s, border-color .2s, color .2s;
}
.theatre-lens-options button[aria-pressed="true"] { background: #19295a; border-color: var(--room-colour); color: #fff; }
.theatre-lens-options button:hover, .room-button:hover { border-color: #c8d4fa; color: #fff; }
.room-button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; background: #0b1638; white-space: nowrap; }
.room-icon { width: 1rem; height: .85rem; background:
  linear-gradient(currentColor,currentColor) left top / 38% 1px,
  linear-gradient(currentColor,currentColor) right top / 38% 1px,
  linear-gradient(currentColor,currentColor) left bottom / 38% 1px,
  linear-gradient(currentColor,currentColor) right bottom / 38% 1px,
  linear-gradient(currentColor,currentColor) left top / 1px 38%,
  linear-gradient(currentColor,currentColor) right top / 1px 38%,
  linear-gradient(currentColor,currentColor) left bottom / 1px 38%,
  linear-gradient(currentColor,currentColor) right bottom / 1px 38%;
  background-repeat: no-repeat;
}
.theatre-stage {
  grid-column: 1; grid-row: 2 / 4; position: relative; isolation: isolate; overflow: hidden;
  min-height: clamp(27.5rem,42vw,40rem); background: #050c22; border: 1px solid #33477f;
}
.theatre-visual {
  position: absolute; inset: 0; overflow: hidden; touch-action: pan-y pinch-zoom;
  background: radial-gradient(ellipse at 50% 45%,color-mix(in srgb,var(--room-colour) 20%,transparent),transparent 68%),
    linear-gradient(175deg,#0a1125,transparent 65%),
    repeating-linear-gradient(90deg,#7492ea0d 0 1px,transparent 1px 5rem),
    repeating-linear-gradient(0deg,#7492ea0d 0 1px,transparent 1px 5rem);
}
.theatre-visual::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg,#050914ab,transparent 21%,transparent 81%,#0509149c); }
.theatre-visual[data-animated] { cursor: grab; }
.theatre-visual[data-dragging] { cursor: grabbing; }
.theatre-visual canvas, .theatre-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.theatre-fallback { background: url("./hero.webp") 68% 50% / cover; }
.theatre-visual:not([data-animated]) canvas, .theatre-visual[data-animated] .theatre-fallback { display: none; }
.theatre-stage-header { position: absolute; z-index: 1; inset: clamp(.9rem,2vw,1.6rem) clamp(.9rem,2vw,1.6rem) auto; display: flex; justify-content: space-between; align-items: center; gap: .65rem; pointer-events: none; }
.theatre-identity { display: grid; gap: .16rem; }
.theatre-signature { font-size: 1.07rem; font-weight: 680; color: #f4f6ff; display: flex; align-items: center; gap: .55rem; }
.theatre-signature > span { width: .64rem; height: .64rem; rotate: 45deg; border: 1px solid var(--room-colour); }
.theatre-state { color: #c5d2f0; font: 500 .81rem/1.35 var(--mono); }
.theatre-command button { pointer-events: auto; gap: .6rem; }
.theatre-toggle-icon { position: relative; display: inline-block; width: 1rem; height: .7rem; border-block: 1.5px solid currentColor; transform: skew(-17deg); transition: transform .28s; }
.theatre-toggle-icon::after { content: ""; position: absolute; inset: calc(50% - .65px) 0 auto; height: 1.3px; background: currentColor; }
.theatre-stage[data-expanded="true"] .theatre-toggle-icon { transform: scaleX(.75) skew(16deg); }
.orbit-control { position: absolute; z-index: 1; bottom: .85rem; right: .85rem; }
/* While the page scrolls through this stretch, the console holds still and the
   breakdown plays through its four steps. */
#theatre-home.is-pinned { height: calc(var(--console-height) + var(--track)); }
#theatre-home.is-pinned > .theatre-console { position: sticky; top: var(--pin-top, 5rem); }
.model-steps {
  position: absolute; z-index: 1; left: clamp(.9rem,2vw,1.6rem); right: 10rem; bottom: clamp(.8rem,1.6vw,1.15rem);
  display: grid; gap: .6rem; justify-items: start; pointer-events: none;
}
.model-caption { max-width: 36rem; min-height: 2.8em; display: flex; align-items: end; color: #e3e9fb; font-size: .98rem; line-height: 1.4; text-shadow: 0 1px 14px #050c22, 0 0 4px #050c22; }
.model-rail { display: flex; flex-wrap: wrap; gap: .3rem; pointer-events: auto; }
.model-rail button {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 2.35rem; padding: .25rem .75rem .25rem .3rem;
  border: 1px solid #2c3f78; border-radius: 999px; color: #b9c6e6; background: #08112dd9; backdrop-filter: blur(6px);
  font-size: .85rem; font-weight: 640; transition: border-color .2s, color .2s, background .2s;
}
.model-rail button span {
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  color: #dfe6fb; background: #16244f; font: 700 .95rem/1 var(--display); font-stretch: condensed; transition: background .2s, color .2s;
}
.model-rail button:hover { border-color: #8a9de0; color: #fff; }
.model-rail button[aria-pressed="true"] { border-color: var(--room-colour); color: #fff; background: #0f1c45e6; }
.model-rail button[aria-pressed="true"] span { color: #071233; background: var(--room-colour); }
.theatre-factors { grid-column: 2; grid-row: 2; display: grid; gap: 2px; }
.theatre-factors button {
  display: flex; align-items: center; gap: .72rem; min-height: 2.83rem; padding: .53rem .9rem;
  border: 1px solid #22356b; border-left: 3px solid #304680; border-radius: 0;
  text-align: left; color: #dde5f8; background: #0b1534; font-size: 1rem; font-weight: 600; line-height: 1.22;
  transition: background .22s, color .22s, border-color .22s;
}
.theatre-factors button[data-highlighted] { border-left-color: var(--factor); }
.theatre-factors button:is(:hover,[aria-pressed="true"]) { border-color: var(--factor); background: color-mix(in srgb,var(--factor) 14%,#0a1430); color: #fff; }
.factor-dot { width: .67rem; height: .67rem; flex: none; border-radius: 50%; background: var(--factor); box-shadow: 0 0 .6rem color-mix(in srgb,var(--factor) 44%,transparent); }
.theatre-evidence, .theatre-static { padding: 1.08rem 1.12rem 1.2rem; border-top: 1px solid var(--evidence-accent,#a8b7ef); background: #0b1534; }
.theatre-evidence { grid-column: 2; grid-row: 3; align-self: stretch; }
.theatre-readout h3 { margin-bottom: .5rem; font: 700 clamp(1.9rem,2.5vw,2.8rem)/.92 var(--display); font-stretch: condensed; letter-spacing: 0; }
.theatre-readout p, .theatre-static p { color: #c4cfea; font-size: 1rem; line-height: 1.45; }
.theatre-case-link, .theatre-static a { display: inline-block; margin-top: .85rem; padding-block: .25rem; text-decoration: underline; text-underline-offset: .22em; text-decoration-color: #8796ba; color: #edf1ff; font-size: .93rem; font-weight: 680; }
.theatre-case-link:hover, .theatre-static a:hover { color: var(--accent); text-decoration-color: var(--accent); }
html:has(.theatre-room[open]) { overflow: hidden; }
.theatre-room:not([open]) { display: none; }
.theatre-room {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; margin: 0;
  padding: 0 max(1.05rem,env(safe-area-inset-right),3vw) max(1rem,env(safe-area-inset-bottom));
  border: 0; overflow: auto; overscroll-behavior: contain; color: var(--ink); background: radial-gradient(ellipse at 34% 30%,#142a66,#050c22 68%);
}
.theatre-room::backdrop { background: #02061aed; }
.theatre-room[open] { animation: room-in .34s var(--ease) both; }
@keyframes room-in { from { opacity: .3; } to { opacity: 1; } }
.room-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 0; margin-bottom: .85rem; border-bottom: 1px solid #33477f; background: #050c22f5; }
.room-bar h2 { font: 700 clamp(2rem,3vw,3.3rem)/1 var(--display); font-stretch: condensed; letter-spacing: 0; }
.theatre-room .theatre-stage { min-height: clamp(27rem,calc(100dvh - 11rem),64rem); }

@media (max-width: 905px) {
  .theatre-heading { grid-template-columns: 1fr; gap: .9rem; }
  .theatre-heading > p { max-width: 33rem; }
  .theatre-console.is-ready { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
  .theatre-stage, .theatre-factors, .theatre-evidence { grid-column: 1; grid-row: auto; }
  .theatre-stage { min-height: clamp(22rem,58vw,32.5rem); }
  .theatre-factors { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .theatre-factors button { padding-inline: .42rem; gap: .38rem; font-size: .93rem; }
  .theatre-lenses { flex-wrap: wrap; gap: .4rem; }
  .theatre-evidence { min-height: 9rem; }
  .theatre-room .theatre-stage { min-height: clamp(21rem,56dvh,35rem); }
}
@media (max-width: 650px) {
  .theatre-heading h2 { font-size: clamp(3.6rem,17vw,5.6rem); }
  .theatre-toolbar { display: grid; grid-template-columns: 1fr auto; gap: .65rem .3rem; align-items: center; }
  .theatre-lenses { display: contents; }
  .theatre-lens-options { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .theatre-lens-options button { padding: .35rem .3rem; font-size: .87rem; }
  .theatre-toolbar .room-button { grid-column: 2; grid-row: 1; font-size: .87rem; }
  .theatre-stage, .theatre-room .theatre-stage { min-height: clamp(25rem,112vw,31rem); }
  .theatre-command button { min-height: 2.75rem; padding-inline: .74rem; }
  .model-steps { right: .7rem; left: .7rem; bottom: .6rem; gap: .45rem; }
  .model-caption { font-size: .86rem; padding-right: 0; }
  .model-rail { gap: .22rem; padding-right: 7.4rem; }
  .model-rail button { padding: .2rem; min-height: 2.3rem; font-size: .8rem; }
  .model-rail button[aria-pressed="false"] { font-size: 0; gap: 0; }
  .model-rail button[aria-pressed="true"] { padding-right: .6rem; }
  .model-rail button span { font-size: .9rem; }
  .theatre-factors { display: flex; flex-wrap: wrap; gap: .26rem; }
  .theatre-factors button { flex: 1 1 44%; min-height: 2.75rem; padding-inline: .68rem; }
  .theatre-room { padding-inline: .8rem; }
  .theatre-state { font-size: .78rem; }
  .orbit-control { bottom: .55rem; right: .55rem; }
  .room-bar { margin-bottom: .55rem; }
}
@media print {
  html:has(.theatre-room[open]) { overflow: visible; }
  .theatre, .theatre-room { display: none !important; }
}
