/* ===================================================================
   DLG Labs - room-mobile-b.css
   Mobile treatment "B - static metaphor band + opaque briefing sheet".

   Loaded AFTER room.css, so these rules override room.css's current
   <=900px block by both higher specificity (scoped under .room) and
   source order. DESKTOP (>900px) IS NEVER TOUCHED: every rule lives
   inside a max-width media query.

   Previous model (fixed full-viewport canvas + translucent glass sheet)
   is retired: measured, 0% of pixels under the sheet differed by more
   than 8/255 with the canvas on vs off, so the glass was blurring a
   diagram nobody could see while costing contrast on every paragraph.
   Tuning the alpha was tried three times and is not the lever.

   Current model: the diagram is a STATIC, bounded band directly under
   the nav - visible on its own terms, at full opacity, faded out at the
   bottom - and the briefing below it sits on the opaque --bg-room. Text
   contrast is therefore the token contrast (>=9.5:1) with no bleed.

   Stacking model:
     .room                -> single stacking context (isolation)
       [.] .room-metaphor : in flow, z-index 0 -> the band
       [.] content .brief-panel / .ir-urgent / .contact : z-index 1
   =================================================================== */

@media (max-width: 900px) {

  /* --- .room stays the ONE stacking context for the room subtree. ------- */
  .room { isolation: isolate; }

  /* stage stops clipping/containing and drops ITS stacking context so the
     stage does not paint atomically over the sections below it. */
  .room .room-stage {
    position: static;
    height: auto;
    min-height: 0;
    overflow: visible;
    isolation: auto;
    border-bottom: 0;
  }

  /* the diagram: a static band in the flow, at the top of the page. Full
     opacity (nothing is layered over it now), masked out at the bottom so it
     dissolves into the sheet instead of ending on a hard edge. */
  .room .room-metaphor {
    position: relative;
    inset: auto;
    z-index: 0;
    width: auto;
    height: clamp(210px, 34vh, 320px);
    opacity: 1;
    pointer-events: none;
    border-bottom: 0;
    -webkit-mask-image: linear-gradient(180deg, #000 0, #000 66%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 0, #000 66%, transparent 100%);
  }
  .room .room-metaphor canvas {
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  /* the desktop bloom scrim and the ghost code mark add noise over the band */
  .room .room-stage__scrim,
  .room .room-mark { display: none; }

  /* ---------------- the briefing sheet ----------------
     Opaque, full-bleed, hairline-separated from the band above it. */
  .room .brief-panel {
    position: relative;
    z-index: 1;
    width: auto;
    margin: 0;
    padding: 0;                                  /* inset moved to children */
    background: var(--bg-room);
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
    border: 0;
    border-top: 1px solid color-mix(in oklab, var(--accent) 24%, var(--line));
    border-radius: 0;
    box-shadow: none;
    animation: none;                             /* no slide-in on the sheet */
  }

  /* header (kicker / h1 / tagline) */
  .room .brief-panel__hd {
    padding: clamp(22px, 6vw, 32px) clamp(20px, 6vw, 32px) 0;
  }
  /* capped at 2.4rem so the 900 -> 901px handover does not shrink the title:
     room-desktop-c.css starts at the same 38.4px. */
  .room .brief-panel__hd h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); }
  .room .room-tag { color: var(--muted); max-width: none; }

  /* tab bar: sticky under the nav, horizontally scrollable, with the three
     affordances the bar was missing - an edge fade, snap points and a visible
     thin scrollbar. Opaque so section text cannot be read through it.
     scroll-padding-inline must match the bar's own inline padding or the first
     snap pins OVERVIEW 21px against the sheet edge. */
  .room .brief-tabs {
    position: sticky;
    top: var(--nav-h, 76px);
    z-index: 15;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: clamp(20px, 6vw, 32px);
    scrollbar-width: thin;
    scrollbar-color: color-mix(in oklab, var(--accent) 55%, transparent) transparent;
    gap: 4px;
    margin: clamp(16px, 4vw, 22px) 0 0;
    padding: 4px clamp(20px, 6vw, 32px) 0;
    background: var(--bg-room);
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
    border-bottom: 1px solid var(--line);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent);
  }
  .room .brief-tabs::-webkit-scrollbar { height: 3px; }
  .room .brief-tabs::-webkit-scrollbar-track { background: transparent; }
  .room .brief-tabs::-webkit-scrollbar-thumb {
    background: color-mix(in oklab, var(--accent) 55%, transparent);
    border-radius: 2px;
  }
  .room .brief-tabs a {
    white-space: nowrap;
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 12px 12px 15px;                     /* >=44px tap target */
  }

  /* sections scroll within the page (over the fixed diagram), on the glass */
  .room .brief-body {
    overflow: visible;
    min-height: 0;
    display: grid;
    gap: clamp(28px, 6vw, 36px);
    padding: clamp(24px, 6vw, 34px) clamp(20px, 6vw, 32px) clamp(30px, 9vw, 44px);
  }

  /* the sticky tab bar is ~52px, so anchored sections clear nav + bar */
  .room .ex-sec { scroll-margin-top: calc(var(--nav-h, 76px) + 60px); }
  .room .ex-sec > h2 { color: var(--muted); font-size: .9rem; letter-spacing: .06em; }
  .room .ex-sec p { font-size: 1rem; }

  /* body copy sizes bumped for legible reading on a phone */
  .room .step p,
  .room .deliv li,
  .room .brief-cta p { font-size: 1rem; }
  .room .mitre__tech { font-size: .95rem; }

  /* single-column MITRE strip: no chance of horizontal overflow on narrow
     viewports (min-width tracks removed for mobile). */
  .room .mitre { grid-template-columns: 1fr; }

  /* content below the stage keeps its own paint order above the band */
  .room .ir-urgent,
  .room .contact { position: relative; z-index: 1; }
}

/* ---------------- <=520px refinement ---------------- */
@media (max-width: 520px) {
  /* --nav-h is 64px here (site.css), so the sticky offsets follow it. */
  .room .room-metaphor { height: clamp(190px, 30vh, 260px); }
  .room .brief-panel__hd { padding-left: clamp(16px, 5vw, 22px); padding-right: clamp(16px, 5vw, 22px); }
  .room .brief-tabs {
    padding-left: clamp(16px, 5vw, 22px); padding-right: clamp(16px, 5vw, 22px);
    scroll-padding-inline: clamp(16px, 5vw, 22px);
  }
  .room .brief-body { padding-left: clamp(16px, 5vw, 22px); padding-right: clamp(16px, 5vw, 22px); }
}

/* ---------------- landscape phones ---------------- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  /* a 210px band plus a sticky nav and tab bar leaves nothing for the text */
  .room .room-metaphor { height: clamp(120px, 30vh, 160px); }
  .room .brief-tabs { position: static; }
  .room .ex-sec { scroll-margin-top: calc(var(--nav-h, 48px) + 12px); }
}
