/* NOMAD /system — interactive pavilion page. Reuses tokens from /styles.css. */

.sys { background: #e7e4df; color: var(--ink); }
.sys [hidden] { display: none !important; }
.sys-nav { mix-blend-mode: normal; color: var(--ink); }
.sys-logo { opacity: 1 !important; transform: none !important; width: 86px; }
.sys-logo .wm { fill: var(--ink); stroke: var(--ink); }

.sys-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 34%); align-items: start; }

/* ---- stage (sticky viewer) */
.stage { grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100svh; padding: 64px 0 var(--gut) var(--gut); }
.stage-frame { position: relative; width: 100%; height: 100%; border-radius: 6px; overflow: hidden; background: #e7e4df; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
.stage-canvas:active { cursor: grabbing; }
.stage-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage-dims { position: absolute; inset: 0; pointer-events: none; }
.dim-label { position: absolute; left: 0; top: 0; padding: 3px 7px; border-radius: 99px; background: #fff; font: 500 11px/1 var(--mono); color: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.08); white-space: nowrap; transition: opacity .2s; }
.dim-label[data-status="CONFLICT"] { background: #d42a1e; color: #fff; }
.stage-badge { position: absolute; left: 14px; top: 12px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: rgba(10,10,10,.55); }

.stage-tools { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; pointer-events: none; }
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 99px; background: rgba(255,255,255,.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 2px 14px rgba(0,0,0,.08); pointer-events: auto; }
.seg button, .seg .cam {
  height: 30px; padding: 0 12px; border-radius: 99px; font: 700 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink);
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.seg .cam { appearance: none; -webkit-appearance: none; border: 0; background: transparent; cursor: pointer; padding-right: 22px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.seg button:hover { background: rgba(10,10,10,.06); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.seg button em { font-style: normal; font-weight: 400; font-family: var(--mono); text-transform: none; letter-spacing: 0; opacity: .6; margin-left: 4px; }

/* ---- inspector */
.inspector { position: absolute; top: 44px; right: 12px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 110px); overflow: auto; padding: 18px 18px 16px; border-radius: 6px; background: rgba(255,255,255,.95); backdrop-filter: blur(12px); box-shadow: 0 10px 40px rgba(0,0,0,.14); font-size: 13px; line-height: 1.35; }
.insp-close { position: absolute; top: 8px; right: 10px; font-size: 20px; line-height: 1; padding: 4px; }
.insp-k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); margin-bottom: 6px; }
.insp-t { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 8px; padding-right: 20px; }
.insp-status { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.insp-status i, .legend span::before, .oq i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #999); display: inline-block; }
.insp-d { color: rgba(10,10,10,.7); margin-bottom: 12px; }
.insp-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font: 400 12px/1.3 var(--mono); margin: 0 0 12px; }
.insp-dl dt { color: var(--grey); }
.insp-dl dd { margin: 0; text-align: right; }
.insp-h { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); margin: 6px 0; }
.insp-src { font: 400 12px/1.35 var(--mono); display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.insp-src li span { color: var(--grey); }
.insp-issues p { margin-top: 6px; padding: 8px 10px; border-radius: 4px; background: #fbefe9; color: #7a2a12; font-size: 12px; }
.insp-issues b { font-family: var(--mono); font-weight: 500; margin-right: 6px; }

.legend { position: absolute; top: 40px; left: 12px; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 6px; background: rgba(255,255,255,.9); font: 400 11px/1.2 var(--mono); }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend span::before { content: ""; }
.legend [data-s="SOURCE_VERIFIED"]::before, .oq [data-s="SOURCE_VERIFIED"] { --c: #2e9e5b; }
.legend [data-s="DESIGN_INFERENCE"]::before { --c: #e0a21b; }
.legend [data-s="ASSUMPTION"]::before { --c: #e46b1f; }
.legend [data-s="CONFLICT"]::before { --c: #d42a1e; }
.legend [data-s="ENGINEERING_PENDING"]::before { --c: #7b5cd6; }

/* ---- chapters */
.chapters { grid-column: 2; grid-row: 1; padding: 0 var(--gut) 0 clamp(20px, 2.4vw, 40px); }
.chap { min-height: 100svh; display: flex; flex-direction: column; justify-content: safe center; gap: 20px; padding: 90px 0 60px; opacity: .35; transition: opacity .5s var(--ease); }
.chap.is-active { opacity: 1; }
.chap .h-l { font-size: clamp(32px, 3.3vw, 54px); }
.sys-facts { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid rgba(10,10,10,.15); }
.sys-facts li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(10,10,10,.15); }
.sys-facts li span:first-child { color: var(--grey); }
.hint { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); }
.asm { font-size: 12px; display: flex; flex-direction: column; gap: 0; border-top: 1px solid rgba(10,10,10,.15); counter-reset: a; }
.asm li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(10,10,10,.15); }
.asm li span { color: var(--grey); }
.variants { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.variants button { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 6px; border: 1px solid rgba(10,10,10,.18); font-size: 13px; text-align: left; }
.variants button i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); flex: none; }
.variants button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.oq { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.35; }
.oq li { display: grid; grid-template-columns: 54px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(10,10,10,.12); }
.oq li b { font: 500 11px/1.4 var(--mono); }
.sys-foot { padding-top: 24px; background: var(--ink); }
.dim { color: rgba(10,10,10,.62); }

@media (max-width: 900px) {
  .sys-main { display: block; }
  .stage { position: sticky; top: 0; height: 58svh; padding: 56px 10px 8px; z-index: 5; background: #e7e4df; }
  .chapters { padding: 0 var(--gut); }
  .chap { min-height: 72svh; padding: 40px 0; }
  .stage-tools { left: 6px; right: 6px; bottom: 6px; gap: 4px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .stage-tools::-webkit-scrollbar { display: none; }
  .seg { flex: none; }
  .seg button, .seg .cam { height: 28px; padding: 0 10px; }
  .inspector { top: auto; bottom: 46px; max-height: 60%; }
  .legend { top: 30px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .chap { opacity: 1; }
}

/* ---- Release 1.1: panels, context menu, scene toggles */
.seg-sep { width: 1px; height: 18px; background: rgba(10,10,10,.15); margin: 0 4px; }
.seg .open-btn { background: var(--red); color: #fff; }
.seg .open-btn:hover { background: #a81c13; }
.seg .open-btn[aria-pressed="true"] { background: var(--ink); }
.panel { position: absolute; left: 12px; top: 40px; width: min(300px, calc(100% - 24px)); padding: 14px; border-radius: 8px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 34px rgba(0,0,0,.14); display: flex; flex-direction: column; gap: 10px; z-index: 3; }
.panel-k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); }
.panel-k em { font-style: normal; color: var(--red); margin-left: 4px; }
.panel input[type="range"] { width: 100%; accent-color: var(--red); }
.panel-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; }
.panel-row button { height: 28px; padding: 0 12px; border-radius: 99px; border: 1px solid rgba(10,10,10,.2); font: 700 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; }
.panel-row button:hover { background: var(--ink); color: #fff; }
.panel-note { font-size: 11px; line-height: 1.35; color: rgba(10,10,10,.6); }
.seg-in { box-shadow: none; background: rgba(10,10,10,.05); align-self: flex-start; }
.vis-chip { position: absolute; right: 12px; top: 10px; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 99px; background: var(--ink); color: #fff; font: 500 11px/1 var(--mono); z-index: 4; }
.vis-chip button { height: 24px; padding: 0 10px; border-radius: 99px; background: #fff; color: var(--ink); font: 700 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .05em; }
.env-loading { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.92); font-size: 11px; z-index: 4; }
.ctx { position: absolute; z-index: 20; min-width: 230px; padding: 6px; border-radius: 8px; background: rgba(255,255,255,.98); box-shadow: 0 12px 40px rgba(0,0,0,.22); font-size: 13px; }
.ctx li button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 5px; }
.ctx li button:hover, .ctx li button:focus-visible { background: rgba(10,10,10,.07); outline: none; }
.ctx-head { padding: 6px 10px 4px; font: 500 10px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--grey); }
.ctx-sep { height: 1px; margin: 4px 6px; background: rgba(10,10,10,.1); }
.chap-cta { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-line { border: 1px solid rgba(10,10,10,.35); color: var(--ink); }
.btn-line:hover { border-color: var(--ink); background: rgba(10,10,10,.05); }
.warn { padding: 10px 12px; border-radius: 6px; background: #fbefe9; color: #7a2a12; font-size: 13px; line-height: 1.35; }
@media (max-width: 900px) {
  .panel { top: auto; bottom: 46px; left: 6px; width: calc(100% - 12px); padding: 10px; gap: 6px; }
  .panel-note { display: none; }
  .vis-chip { top: 6px; right: 6px; }
}
