/**
 * AI automation theatre: a pinned-free 3D stage with real HTML steps beneath it.
 * Without WebGL (or with reduced motion) the stage shows a static diagram instead.
 */
.theatre { padding-block: clamp(64px, 8vw, 128px); }
.theatre .sec__bar { margin-bottom: clamp(24px, 3.4vw, 48px); }
.theatre__head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(24px, 5vw, 96px); align-items: end; margin-bottom: clamp(28px, 4vw, 56px); }
.theatre__head .t-xl { max-width: 18ch; font-size: clamp(2.3rem, 5vw, 5.2rem); }
.theatre__tabs { display: flex; flex-wrap: wrap; width: max-content; max-width: 100%; border: 1px solid var(--line-strong); margin-bottom: 14px; }
.theatre__tab {
  appearance: none; background: transparent; color: var(--fg); border: 0; border-right: 1px solid var(--line-strong);
  padding: 15px 24px; display: inline-flex; gap: 12px; align-items: baseline; cursor: pointer;
  font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: 1.05rem; letter-spacing: 0.02em; text-transform: uppercase;
  transition: background-color 0.3s var(--ease), color 0.3s;
}
.theatre__tab:last-child { border-right: 0; }
.theatre__tab .mono { color: var(--accent); }
.theatre__tab:hover { background: rgba(237, 234, 226, 0.08); }
.theatre__tab[aria-checked="true"] { background: var(--cobalt); color: var(--bone); }
.theatre__tab[aria-checked="true"] .mono { color: var(--bone); }

.theatre__stage { position: relative; background: var(--ink); border: 1px solid var(--line-strong); overflow: hidden; }
.theatre.is-live .theatre__stage, .theatre.will-live .theatre__stage { aspect-ratio: 2.6 / 1; max-height: 78svh; min-height: 400px; }
.theatre.will-live:not(.is-live) .theatre__static { display: none; }
.theatre__loading { display: none; position: absolute; inset: 0; place-items: center; color: var(--muted); }
.theatre.will-live:not(.is-live) .theatre__loading { display: grid; }
.theatre__go { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; background: none; font-size: 0; }
.theatre__go:focus-visible { opacity: 1; outline: 3px solid var(--signal); outline-offset: 4px; background: transparent; }
.theatre__step { position: relative; }
.theatre__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; touch-action: pan-y; }
.theatre.is-live .theatre__canvas { display: block; }
.theatre.is-live .theatre__static { display: none; }

.theatre__static { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.theatre__col { background: var(--ink); padding: clamp(18px, 2vw, 30px); display: flex; flex-direction: column; gap: 12px; color: var(--soft); font-size: 0.95rem; line-height: 1.4; }
.theatre__col .mono { color: var(--accent); }
.theatre__col ul { display: flex; flex-direction: column; gap: 8px; }
.theatre__col b { display: block; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; color: var(--muted); }
.theatre__col em { color: var(--accent); font-style: normal; }
.theatre__card { background: var(--bone); color: var(--ink); padding: 14px; }

.theatre__hud, .theatre__ctrl { display: none; position: absolute; left: 14px; right: 14px; z-index: 2; }
.theatre.is-live .theatre__hud, .theatre.is-live .theatre__ctrl { display: flex; }
.theatre__hud { top: 12px; justify-content: space-between; pointer-events: none; color: var(--soft); }
.theatre__ctrl { bottom: 14px; align-items: center; gap: 10px; pointer-events: none; }
.theatre__ctrl > * { pointer-events: auto; }
.theatre__approve {
  appearance: none; display: inline-flex; align-items: center; gap: 12px; margin-right: auto;
  height: 48px; padding: 0 22px; white-space: nowrap; border: 1px solid var(--line-strong); background: rgba(10, 12, 26, 0.72); color: var(--soft);
  font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.theatre__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.theatre__approve.is-waiting { background: var(--bone); color: var(--ink); border-color: var(--bone); animation: theatre-pulse 1.3s ease-in-out infinite; }
.theatre__approve.is-waiting .theatre__dot { background: var(--cobalt); }
.theatre__approve:disabled { cursor: default; }
@keyframes theatre-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(112, 131, 255, 0.7); } 50% { box-shadow: 0 0 0 10px rgba(112, 131, 255, 0); } }
.theatre__mini { appearance: none; height: 48px; padding: 0 16px; border: 1px solid var(--line-strong); background: rgba(10, 12, 26, 0.72); color: var(--fg); text-transform: uppercase; cursor: pointer; }
.theatre__mini:hover { background: var(--bone); color: var(--ink); }
.theatre__mini.is-hot { background: var(--cobalt); border-color: var(--cobalt); color: var(--bone); }

.theatre__steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); margin-top: clamp(18px, 2vw, 28px); }
.theatre__step { border-top: 3px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.4s; }
.theatre.is-live .theatre__step { cursor: pointer; }
.theatre__step.is-on { border-top-color: var(--cobalt-light); }
.theatre__step .theatre__n { color: var(--muted); }
.theatre__step.is-on .theatre__n { color: var(--accent); }
.theatre__step p { color: var(--soft); font-size: 0.98rem; line-height: 1.4; }
.theatre__note { margin-top: 22px; max-width: 70ch; }
.theatre__rails { margin-top: clamp(48px, 6vw, 96px); }

@media (max-width: 900px) {
  .theatre__head { grid-template-columns: 1fr; }
  .theatre.is-live .theatre__stage, .theatre.will-live .theatre__stage { aspect-ratio: 1.25 / 1; min-height: 320px; }
  .theatre__static { grid-template-columns: 1fr 1fr; }
  .theatre__steps { grid-template-columns: 1fr 1fr; }
  .theatre__tab { padding: 13px 16px; font-size: 0.92rem; }
  .theatre__approve { height: 44px; padding: 0 12px; gap: 8px; font-size: 0.82rem; white-space: nowrap; }
  .theatre__mini { height: 44px; padding: 0 12px; }
}
@media (max-width: 560px) {
  .theatre__static, .theatre__steps { grid-template-columns: 1fr; }
  .theatre__tabs { width: 100%; }
  .theatre__tab { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .theatre__tab:last-child { border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .theatre__approve.is-waiting { animation: none; } }
