/* Optical layer for the Model Studio experiment. Pixels inside the render surfaces
   stay in their original WebGL, canvas and video layers. */
:root {
  --studio-gutter: clamp(7px, .72vw, 18px);
}
body:not([data-phone]) {
  padding: var(--studio-gutter);
}
body::before {
  inset: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse 44% 48% at 7% 5%, rgb(155 177 191 / .54) 0%, rgb(89 109 124 / .32) 44%, transparent 81%),
    radial-gradient(ellipse 42% 48% at 97% 68%, rgb(173 151 115 / .44) 0%, rgb(107 90 72 / .25) 39%, transparent 79%),
    radial-gradient(ellipse 58% 27% at 51% 100%, rgb(125 145 155 / .25), transparent 78%),
    linear-gradient(135deg, #191c20, #0a0d10 59%, #16181a);
}

#board.instrument {
  --studio-blur: calc(10px + var(--glass-alpha) * 22px);
  max-width: none;
  border-color: rgb(247 248 246 / .62) rgb(186 191 194 / .34) rgb(112 122 132 / .54) rgb(233 236 235 / .52);
  background:
    linear-gradient(118deg, rgb(242 246 246 / .064), transparent 27%, transparent 76%, rgb(252 239 214 / .033)),
    rgb(30 32 36 / var(--glass-alpha));
  -webkit-backdrop-filter: blur(var(--studio-blur)) saturate(.84);
  backdrop-filter: blur(var(--studio-blur)) saturate(.84);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .62),
    inset 1px 0 0 rgb(240 248 250 / .16),
    inset -1px -2px 2px rgb(5 8 12 / .66),
    0 2px 0 rgb(146 153 155 / .4), 0 6px 14px -8px #000a;
}
#board.instrument:has(.view-case.is-expanded) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (min-width: 1000px) {
  body:not([data-phone]) #board.instrument {
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - var(--studio-gutter) * 2);
  }
  body:not([data-phone]) #board > .bench {
    margin-block: auto;
    width: 100%;
  }
  body:not([data-phone]):not([data-application]) .model-zone .view-case {
    --view-height: clamp(256px, min(75cqw, calc(100svh - clamp(212px, 18vw, 290px))), 1450px);
  }
}
#board > .substrate::before {
  background:
    linear-gradient(128deg, rgb(240 246 247 / .07), transparent 22%),
    linear-gradient(40deg, transparent 46%, rgb(255 255 255 / .021) 52%, transparent 65%);
}
#board > .substrate::after {
  opacity: calc(.035 + var(--glass-alpha) * .075);
}

/* The bevel is outside the viewer's rect. Its top face falls into shadow,
   and its lower edge catches the same light as the sheet behind it. */
.model-zone .viewer-unit {
  position: relative;
  --studio-reveal: clamp(5px, .52vw, 11px);
}
.model-zone .viewer-unit:not(:has(.view-case:is(:fullscreen,.is-expanded)))::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--studio-reveal));
  border-radius: calc(11px + var(--studio-reveal));
  pointer-events: none;
  background: linear-gradient(155deg, #14181c 0%, #1a1e22 35%, #333a40 68%, #667076 100%);
  box-shadow:
    0 -1px 1px rgb(0 0 0 / .8),
    0 1px 0 rgb(242 247 245 / .68),
    inset 2px 4px 5px rgb(0 0 0 / .86),
    inset -1px -2px 2px rgb(241 248 253 / .28);
}
.model-zone .view-case:not(:fullscreen):not(.is-expanded) {
  border-color: rgb(1 3 5 / .96) rgb(15 19 22 / .82) rgb(178 185 187 / .58) rgb(7 10 14 / .94);
  box-shadow:
    0 -1px 3px rgb(0 0 0 / .87),
    0 1px 1px rgb(245 249 249 / .16);
}
.model-zone .view-case:not(:fullscreen):not(.is-expanded) .scene-stage::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  border-radius: 0;
  box-shadow:
    inset 2px 8px 10px -6px rgb(0 0 0 / .95),
    inset 6px 0 9px -7px rgb(0 0 0 / .95),
    inset -4px 0 6px -5px rgb(0 0 0 / .78),
    inset 0 -1px 0 rgb(244 246 247 / .2);
}
.model-zone .view-case:not(:fullscreen):not(.is-expanded) .model-bar {
  background:
    linear-gradient(104deg, rgb(190 203 211 / .12), transparent 46%, rgb(217 203 182 / .07)),
    #26292d;
  border-bottom-color: rgb(4 5 7 / .84);
}
.model-zone .view-case:not(:fullscreen):not(.is-expanded) .stage-console {
  border-top-color: rgb(207 216 218 / .4);
  background: linear-gradient(156deg, #303337, #24272a 68%, #292b2b);
}
@media (max-width: 700px) {
  .model-zone .viewer-unit { --studio-reveal: 4px; }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  body::before { background: #17191c; }
  #board.instrument { background: #232529; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
