/* T1 — Coach viewport tiers (COACH-DESKTOP-VIEWPORT · S0)
   Perimetro: coach desktop/laptop + Space family. Esclusi Portal/share/privacy.
   Gate dispositivo: (hover: hover) and (pointer: fine) = solo PC con mouse/trackpad.
   Touch (tablet/smartphone): bande responsive nei CSS di pagina — non sovrascritte qui.

   ── Tier A · Desktop sacro (≥1281px larghezza) ──
   Layout fluido vw/clamp invariato (plan tablet pre-pilota).

   ── Tier B · Tablet landscape coach (768–1280px) ──
   iPad Air ~1180: polish dedicato in gateway_styles / style_4 / space CSS.
   VINCE sempre su Tier C — anche DevTools (pointer: fine emulato).

   ── Tier C · Laptop finestra stretta (fine pointer, max-width ≤1100) ──
   Canvas fisso + scroll H/V — no reflow vw, no stack §3.6.
   Soglia 1100 = sotto banda tablet winged 1101–1280 (no collisione iPad).
   Palco: bleed 0, sigillo scroll col documento, rail come S1b (non overlap card).

   ── Tier D · Touch portrait / smartphone ──
   Stack, rotate-lock, disclaimer — solo (pointer: coarse) nelle MQ di pagina.

   ── Studio (S5) · eccezione ──
   Scroll su html · canvas 1280 · chrome cockpit (back, cluster, toolbox) absolute sul
   canvas in Tier C — mai position:fixed viewport (overlap player/beam). */

:root {
  --t1-coach-desktop-sacred-min: 1281px;
  --t1-coach-tablet-landscape-max: 1280px;
  --t1-coach-desktop-narrow-max: 1100px;
  --t1-coach-desktop-canvas-w: 1280px;
  --t1-coach-desktop-canvas-min-h: 720px;
  /* Studio Tier C — fascia dx per cluster + toolbox (fuori player/note) */
  --t1-studio-chrome-gutter: 168px;
}

/* Tier C · scroll pagina — fine pointer coach (Gateway + Space) */
@media (hover: hover) and (pointer: fine) {
  html:has(body.gateway-app),
  html:has(body.t1s-root--archivio),
  html:has(body.ps-root--archivio),
  html:has(body.gs-root.t1s-root--archivio),
  html:has(body.cs-root--archivio),
  html:has(body.guide-root.t1s-root--archivio) {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    max-height: none;
  }

  body.gateway-app,
  body.t1s-root.t1s-root--archivio,
  body.ps-root.ps-root--archivio,
  body.gs-root.t1s-root--archivio,
  body.cs-root.cs-root--archivio,
  body.guide-root.t1s-root--archivio {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    max-height: none;
    max-width: none;
  }
}

/* Tier C · canvas minimo — solo max-width ≤1100 (fuori Tier B 1101–1280) */
@media (hover: hover) and (pointer: fine) and (max-width: 1100px) {
  body.t1s-root.t1s-root--archivio,
  body.ps-root.ps-root--archivio,
  body.gs-root.t1s-root--archivio,
  body.cs-root.cs-root--archivio,
  body.guide-root.t1s-root--archivio {
    min-width: var(--t1-coach-desktop-canvas-w);
    min-height: var(--t1-coach-desktop-canvas-min-h);
    box-sizing: border-box;
  }

  body.gateway-app {
    position: relative;
    --gw-shell-pad-x: 60px;
    --gw-palco-delta-gap-y: 56px;
    --gw-palco-winged-gap-y: 40px;
    --gw-palco-winged-gap-x-void: 48px;
    --gw-palco-winged-bleed-void: 0px;
    --gw-palco-winged-nudge-y: 16px;
    --gw-palco-delta-gap-x: 28px;
    --gw-palco-spacing: 16px;
    --t1-palco-plancia-gap-void: 22px;
    --t1-palco-plancia-btn-min-void: 160px;
  }

  body.gateway-app .gateway-sigillo {
    position: absolute;
    top: 25px;
    left: 25px;
  }

  .gateway-shell.gateway-shell--palco {
    position: relative;
    min-width: var(--t1-coach-desktop-canvas-w);
    max-width: var(--t1-coach-desktop-canvas-w);
    width: 100%;
    min-height: 800px;
    box-sizing: border-box;
  }

  /* Rail: stessa altezza Tier B S1b — non centrata sulle card */
  body[data-gateway-film="void"] .gateway-shell.gateway-shell--palco .gateway-right-cluster,
  .gateway-shell.gateway-shell--palco .gateway-right-cluster {
    position: absolute;
    right: max(14px, env(safe-area-inset-right, 0px));
    top: clamp(128px, 24vh, 272px);
    transform: none;
  }

  .gateway-shell.gateway-shell--palco .gateway-fs-hint-host {
    position: absolute;
    top: max(18px, env(safe-area-inset-top, 0px));
    right: max(18px, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: auto;
    transform: none;
  }

  body[data-gateway-film="void"] .gateway-shell--palco .gw-layout--winged .gateway-carousel {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .gateway-shell.gateway-shell--palco .gw-layout--winged .gateway-carousel {
    grid-template-columns: 340px 1fr 340px;
    column-gap: 48px;
    row-gap: 40px;
  }

  .gateway-shell.gateway-shell--palco .gw-layout--winged .gateway-carousel__base--gallery,
  .gateway-shell.gateway-shell--palco .gw-layout--winged .gateway-carousel__base--right,
  .gateway-shell.gateway-shell--palco .gw-layout--winged .gateway-carousel__core,
  .gateway-shell.gateway-shell--palco .gw-layout--winged .gateway-carousel__vertex {
    width: 340px;
  }

  .gateway-shell.gateway-shell--palco .gw-layout--delta .gateway-carousel {
    grid-template-columns: 340px 1fr 340px;
    row-gap: 48px;
  }

  .gateway-shell.gateway-shell--palco .gw-layout--delta .gateway-carousel__vertex,
  .gateway-shell.gateway-shell--palco .gw-layout--delta .gateway-carousel__base--left,
  .gateway-shell.gateway-shell--palco .gw-layout--delta .gateway-carousel__base--right {
    width: 340px;
  }

  .gateway-shell.gateway-shell--palco .gateway-brand-lockup--palco .gateway-brand-title {
    font-size: 1.72rem;
  }

  .gateway-shell.gateway-shell--palco .gateway-brand-lockup--palco .gateway-brand-tagline {
    font-size: 0.82rem;
  }

  /* Tier C · Studio — canvas 1280 + gutter chrome + scroll html */
  html:has(body.app-shell) {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    max-height: none;
  }

  body.app-shell {
    position: relative;
    box-sizing: border-box;
    min-width: calc(var(--t1-coach-desktop-canvas-w) + var(--t1-studio-chrome-gutter, 168px));
    padding-right: var(--t1-studio-chrome-gutter, 168px);
    min-height: var(--t1-coach-desktop-canvas-min-h);
    max-width: none;
    overflow: hidden;
    height: max(100vh, var(--t1-coach-desktop-canvas-min-h));
    --t1-sidebar-width: 360px;
  }

  /* Chrome cockpit + beam clinico + toolbox: coordinate documento (scroll orizzontale) */
  body.app-shell .cockpit-back-gateway,
  body.app-shell .cockpit-cluster-hint-host,
  body.app-shell .drawing-toolbox,
  body.app-shell #holographic-overlay-root,
  body.app-shell .holographic-hud-anchor {
    position: absolute;
  }

  body.app-shell .drawing-toolbox {
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
  }

  body.app-shell #holographic-overlay-root {
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: max(100vh, var(--t1-coach-desktop-canvas-min-h));
  }

  body.app-shell .holographic-holo-beam__track {
    width: min(
      480px,
      calc(
        var(--t1-coach-desktop-canvas-w)
          - var(--t1-rail-width, 92px)
          - var(--t1-sidebar-width, 360px)
          - 120px
      )
    );
  }

}
