/* MAJLIS Studio, October 2026: one-screen layout.
   Desktop: the page never scrolls (the footer is gone; the side panel scrolls on its own).
   Phones and tablets (900px and narrower): the rug preview sits on top, the controls form a
   scrolling sheet below it, and the price and Request Quote stay pinned to the bottom edge.
   Anchored on #studio#studio (two ids) so it outranks the Studio's older rules. */

html:has(#studio), body:has(#studio) { height: 100%; overflow: hidden !important; }
html body #studio#studio.app { height: 100vh !important; height: 100dvh !important; max-height: 100dvh; overflow: hidden; }

@media (max-width: 900px) {
  html body #studio#studio.app { display: block !important; position: relative; }
  html body #studio#studio.app > main.workspace {
    display: grid !important; grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 44dvh) minmax(0, 1fr) !important;
    height: 100dvh !important; min-height: 0 !important; overflow: hidden !important;
  }
  html body #studio#studio.app.is-3d > main.workspace { grid-template-rows: minmax(0, 56dvh) minmax(0, 1fr) !important; }
  html body #studio#studio.app .mobile-live-preview { display: none !important; }

  /* preview */
  html body #studio#studio.app .stage {
    position: relative !important; display: block !important; height: auto !important; min-height: 0 !important;
    overflow: hidden !important; border: 0 !important; border-bottom: 1px solid var(--v2-line) !important;
  }
  html body #studio#studio.app .stage .stage-tools {
    position: absolute !important; top: var(--studio-nav-h, 34px) !important; left: 0 !important; right: 0 !important;
    z-index: 6; transform: none !important; display: flex !important; flex-wrap: nowrap !important; gap: 6px !important;
    width: auto !important; max-width: none !important; margin: 0 !important; padding: 8px 12px !important;
    overflow-x: auto !important; overflow-y: hidden !important; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  html body #studio#studio.app .stage .stage-tools::-webkit-scrollbar { display: none; }
  html body #studio#studio.app .stage .stage-tools button {
    flex: none !important; grid-column: auto !important; min-width: 0 !important; min-height: 36px !important;
    padding: 0 14px !important; font-size: 10.5px !important; letter-spacing: .14em !important; white-space: nowrap !important;
  }
  html body #studio#studio.app:not(.is-3d) .stage .view-2d.active {
    position: absolute !important; inset: 0 !important; height: auto !important; min-height: 0 !important;
    display: grid !important; place-items: center !important;
    padding: calc(var(--studio-nav-h, 34px) + 58px) 20px 14px !important; box-sizing: border-box !important;
  }
  html body #studio#studio.app .rug-2d-wrap { width: min(54vw, 280px) !important; height: 100% !important; max-height: 100% !important; }
  html body #studio#studio.app .rug-zoom-controls.only-2d {
    position: absolute !important; inset: auto 10px 8px auto !important; transform: none !important; margin: 0 !important;
    padding: 3px !important; gap: 3px !important; z-index: 5; flex-direction: column !important;
  }
  html body #studio#studio.app .rug-zoom-controls button { width: 32px !important; height: 32px !important; }
  html body #studio#studio.app .rug-zoom-controls .zoom-readout, html body #studio#studio.app .rug-zoom-controls span { display: none !important; }
  html body #studio#studio.app .game-corner-preview-2d, html body #studio#studio.app #majlis2dLiveSwatchStackClean { display: none !important; }

  /* price and quote, pinned to the bottom edge */
  html body #studio#studio.app:not(.is-3d) .stage .summary,
  html body #studio#studio.app.is-3d .stage .summary {
    position: fixed !important; inset: auto 0 0 0 !important; width: auto !important; margin: 0 !important; z-index: 160;
    display: grid !important; grid-template-columns: 1fr 1fr auto !important; align-items: center !important; gap: 0 14px !important;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) !important;
    border: 0 !important; border-top: 1px solid var(--v2-line) !important; background: var(--v2-ivory) !important; box-shadow: 0 -8px 24px rgba(40,12,4,.08) !important;
  }
  html body #studio#studio.app .summary > div { display: none !important; }
  html body #studio#studio.app .summary > div:nth-child(1), html body #studio#studio.app .summary > div:nth-child(4) { display: block !important; }
  html body #studio#studio.app .summary span { font-size: 9px !important; letter-spacing: .14em !important; line-height: 1.2 !important; color: var(--v2-muted) !important; }
  html body #studio#studio.app .summary > div:nth-child(4) span { font-size: 0 !important; }
  html body #studio#studio.app .summary > div:nth-child(4) span::before { content: "Estimate"; font-size: 9px; letter-spacing: .14em; }
  html body #studio#studio.app .summary b { display: block !important; margin: 3px 0 0 !important; font-size: 15px !important; text-align: left !important; }
  html body #studio#studio.app .summary button { grid-column: auto !important; min-height: 46px !important; padding: 0 20px !important; font-size: 11px !important; letter-spacing: .16em !important; }

  /* controls sheet */
  html body #studio#studio.app aside.panel {
    display: flex !important; flex-direction: column !important; position: relative !important; height: auto !important; min-height: 0 !important;
    overflow-y: auto !important; overflow-x: hidden !important; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    border: 0 !important; padding: 4px 0 calc(92px + env(safe-area-inset-bottom)) !important;
  }
  html body #studio#studio.app aside.panel::before { display: none !important; }
  html body #studio#studio.app aside.panel > * { order: 10; flex: none; }
  html body #studio#studio.app aside.panel > .v2-rug-group { order: 1; }
  html body #studio#studio.app aside.panel > #v2ColorBook { order: 2; }
  html body #studio#studio.app aside.panel > .group:has(#swatches) { order: 3; }
  html body #studio#studio.app aside.panel > .material-preference { order: 30; }
  html body #studio#studio.app aside.panel > .group:has(#codeInput2d) { order: 31; }
  html body #studio#studio.app aside.panel > .panel-actions { order: 40; }
  html body #studio#studio.app aside.panel .material-preference p { display: none !important; }
  html body #studio#studio.app aside.panel .group { padding: 12px 14px !important; }
  html body #studio#studio.app aside.panel .swatches { grid-template-columns: repeat(6, 1fr) !important; gap: 8px !important; }
  html body #studio#studio.app aside.panel .swatches button { min-height: 44px; }
}
@media (max-width: 900px) and (max-height: 640px) {
  html body #studio#studio.app > main.workspace { grid-template-rows: minmax(0, 38dvh) minmax(0, 1fr) !important; }
}

/* v2.12 no visible scrollbars; scrolling still works */
html,body,*{scrollbar-width:none;-ms-overflow-style:none}
html::-webkit-scrollbar,body::-webkit-scrollbar,*::-webkit-scrollbar{display:none;width:0;height:0}

/* 2026-10-16: the colour sheet scrolls under the price bar; a selected swatch never rises above it */
@media (max-width: 900px) {
  html body #studio#studio.app aside.panel { isolation: isolate; z-index: 0; }
}
