/* ===================================================================
   DLG Labs - room.css
   Discipline ("operations room") page layer. Loads on top of tokens.css
   and site.css. Per-discipline accent is set inline via --accent on the
   .room element, so every accented surface retints automatically.

   Immersive layout (restored from the design prototype): a large,
   full-bleed animated editorial diagram is the primary visual, and a left
   briefing panel (title + tabs + scrollable sections) sits over the canvas.
   Teal token language only - the old green system is not reintroduced.
   =================================================================== */

.room { position: relative; background: var(--bg-room); }

/* ---------- immersive stage: full-viewport diagram + left briefing panel ---------- */
.room-stage {
  position: relative;
  height: calc(100vh - var(--nav-h, 76px));
  height: calc(100dvh - var(--nav-h, 76px)); /* dvh where supported; vh fallback above */
  min-height: 600px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}

/* the animated metaphor is the PROMINENT, full-bleed visual (not a faint banner) */
.room-metaphor { position: absolute; inset: 0; z-index: 0; opacity: .92; }
.room-metaphor canvas { width: 100%; height: 100%; display: block; }

/* depth + floor: a soft accent bloom to the right of the panel and a vignette
   floor so the ghost mark reads. The panel itself carries the text scrim. */
.room-stage__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(56% 58% at 70% 42%, color-mix(in oklab, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(120% 85% at 50% 120%, color-mix(in oklab, var(--bg-room) 62%, #000) 0%, transparent 64%);
}

/* left briefing panel over the canvas: opaque-to-transparent scrim keeps text legible */
.brief-panel {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2;
  width: min(640px, 52vw);
  display: flex; flex-direction: column;
  padding: clamp(26px, 3.2vw, 44px) clamp(28px, 3vw, 50px) 0 6vw;
  background: linear-gradient(90deg,
    var(--bg-room) 42%,
    color-mix(in oklab, var(--bg-room) 66%, transparent) 80%,
    transparent);
  animation: room-panel-in .7s cubic-bezier(.2, .7, .2, 1);
}
@keyframes room-panel-in { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }

.brief-panel__hd { flex: 0 0 auto; }
.brief-k {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: 14px;
}
.brief-panel__hd h1 {
  font-family: var(--disp); font-weight: 400;
  font-size: clamp(1.9rem, 3.4vw, 3.1rem); line-height: 1.03; letter-spacing: -.03em; margin: 0 0 12px;
}
.room-tag { color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.1rem); line-height: 1.5; max-width: 42ch; margin: 0; }

/* tab bar - static in the panel column; scroll-spy toggles .on */
.brief-tabs {
  flex: 0 0 auto; display: flex; gap: 20px; flex-wrap: wrap;
  margin: clamp(18px, 2.2vw, 26px) 0 0;
  border-bottom: 1px solid var(--line);
}
.brief-tabs a {
  font-family: var(--mono); font-size: .73rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); padding: 6px 0 12px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; transition: color .18s ease, border-color .18s ease;
}
.brief-tabs a:hover { color: var(--text); }
.brief-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* only the briefing body scrolls on desktop */
.brief-body {
  flex: 1 1 auto; position: relative; min-height: 0;
  overflow-y: auto;
  display: grid; gap: clamp(30px, 3.6vw, 44px);
  padding: clamp(26px, 3vw, 36px) 0 44px;
  scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--muted) 30%, transparent) transparent;
}
.brief-body::-webkit-scrollbar { width: 9px; }
.brief-body::-webkit-scrollbar-track { background: transparent; }
.brief-body::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--muted) 26%, transparent);
  border-radius: 6px; border: 2px solid transparent; background-clip: content-box;
}

/* big ghost code mark, bottom-right over the canvas */
.room-mark {
  position: absolute; right: clamp(22px, 4vw, 72px); bottom: clamp(18px, 5vh, 60px); z-index: 1;
  text-align: right; pointer-events: none; -webkit-user-select: none; user-select: none;
}
.room-mark .code {
  display: block; font-family: var(--mono); font-weight: 300;
  font-size: clamp(3.4rem, 10vw, 8.5rem); line-height: .84; letter-spacing: -.04em;
  color: color-mix(in oklab, var(--accent) 20%, transparent);
}
.room-mark .dom {
  display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--dim); margin-top: 10px;
}

/* ---------- briefing sections ---------- */
.ex-sec { scroll-margin-top: 14px; }
.ex-sec > h2 {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); margin: 0 0 18px; display: flex; align-items: center; gap: 10px;
}
.ex-sec > h2::before { content: ""; width: 16px; height: 1px; background: var(--accent-line); }
.ex-sec p { color: var(--muted); margin: 0 0 12px; max-width: 62ch; }
.ex-sec p:last-child { margin-bottom: 0; }

/* methodology steps */
.steps { display: grid; gap: 18px; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 18px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.step .n { font-family: var(--mono); font-weight: 700; font-size: .95rem; color: var(--accent); }
.step h3 { margin: 0 0 5px; font-size: 1.04rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }

/* MITRE strip */
.mitre { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.mitre__cell { background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--accent-line); border-radius: var(--radius-sm); padding: 13px 15px; transition: border-color .2s ease, transform .2s ease; }
.mitre__cell:hover { transform: translateY(-3px); border-top-color: var(--accent); }
.mitre__tac { font-family: var(--mono); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); margin: 0 0 6px; }
.mitre__tech { font-size: .9rem; color: var(--text); margin: 0 0 4px; font-weight: 500; }
.mitre__id { font-family: var(--mono); font-size: .72rem; color: var(--accent); }

/* deliverables list - single column inside the narrow briefing panel */
.deliv { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
.deliv li { position: relative; padding-left: 26px; color: var(--muted); font-size: .96rem; }
.deliv li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 9px; height: 9px; border: 2px solid var(--accent); border-radius: 2px; transform: rotate(45deg); }

/* terminal scenario */
.term { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-width: 100%; }
.term__bar { display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.term__bar .dot { width: 11px; height: 11px; border-radius: 50%; }
.term__bar .r { background: #ff5f57; } .term__bar .y { background: #febc2e; } .term__bar .g { background: #28c840; }
.term__title { font-family: var(--mono); font-size: .76rem; color: var(--dim); margin-left: 6px; }
.term__body { margin: 0; padding: 18px 20px; font-family: var(--mono); font-size: .84rem; line-height: 1.9; overflow-x: auto; color: var(--muted); white-space: pre-wrap; }
.term__body .ln { display: block; }
.term__body .ln:first-child { color: var(--accent); }

/* per-discipline CTA row (end of the briefing body) */
.brief-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 8px; }
.brief-cta p { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; min-width: 200px; }

/* IR urgent CTA - full-width below the immersive stage, visually distinct */
.ir-urgent {
  max-width: var(--maxw); margin: clamp(32px, 5vw, 56px) auto 0; padding: 0 6vw;
}
.ir-urgent__box {
  border: 1px solid var(--t-ir); border-left: 4px solid var(--t-ir); border-radius: var(--radius);
  background: color-mix(in oklab, var(--t-ir) 8%, var(--panel));
  padding: clamp(22px, 3vw, 32px); display: grid; gap: 14px;
}
.ir-urgent__k { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--t-ir); }
.ir-urgent h2 { font-family: var(--disp); font-weight: 700; font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }
.ir-urgent p { color: var(--muted); margin: 0; max-width: 70ch; }
.ir-urgent__row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-top: 4px; }
.ir-urgent__chan { font-family: var(--mono); font-size: .9rem; color: var(--text); }
.ir-urgent__chan span { color: var(--dim); }
.ir-urgent__call {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono);
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--t-ir); border: 1px solid var(--t-ir);
  border-radius: var(--radius-btn); padding: 13px 24px;
}
.ir-urgent__call:hover { filter: brightness(1.08); }

/* ---------- responsive: <=900px ----------
   The immersive side-panel does not fit narrow screens: the canvas degrades to
   a bounded, in-flow banner and the panel stacks below it. No overlap keeps the
   copy WCAG-legible; the tab bar scrolls horizontally; canvas never taps. */
@media (max-width: 900px) {
  .room-stage { height: auto; min-height: 0; overflow: visible; }

  .room-metaphor {
    position: relative; inset: auto; z-index: 0;
    height: clamp(240px, 42vh, 360px); opacity: .6; pointer-events: none;
    border-bottom: 1px solid var(--line);
    -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
  }
  .room-stage__scrim { display: none; }
  .room-mark { display: none; }

  .brief-panel {
    position: static; width: 100%; background: none; animation: none;
    padding: clamp(26px, 7vw, 40px) 6vw 0;
  }
  .brief-panel__hd h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); }

  .brief-tabs {
    position: sticky; top: var(--nav-h, 56px); z-index: 15;
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin: 22px 0 0; padding: 8px 0 0;
    background: color-mix(in oklab, var(--bg-room) 92%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .brief-tabs::-webkit-scrollbar { display: none; }
  .brief-tabs a { white-space: nowrap; flex: 0 0 auto; }

  .brief-body { overflow: visible; min-height: 0; padding: 26px 0 24px; gap: 34px; }
  .ex-sec { scroll-margin-top: calc(var(--nav-h, 56px) + 64px); }
}

@media (max-width: 620px) {
  .step { grid-template-columns: 36px 1fr; gap: 12px; padding: 16px 16px; }
}

/* reduced motion: metaphor.js renders a single static frame; kill panel entrance */
@media (prefers-reduced-motion: reduce) {
  .brief-panel { animation: none; }
}
