/* Full-screen preview, and the order of the sections around a configurator. */
body {
  overflow-x: hidden;
}

/* .wrap and .shell cap reading columns. They must not cap the configurator. */
body > main,
body > main.wrap,
body > main.shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body > main > #configure {
  order: 0;
}

body > main > .hero,
body > main > .coaster-intro,
body > main > .box-intro {
  order: 1;
  width: min(1180px, calc(100% - 64px));
  margin-inline: auto;
}

body > main > section:not(#configure) {
  order: 2;
  width: min(1180px, calc(100% - 64px));
  margin-inline: auto;
}

/* Hidden settings give the preview the whole width. */
#configure .cfg-workspace:is([data-options=false], [data-options-open=false]) { grid-template-columns: minmax(0, 1fr); }

:is([data-box-measure], .tray-engine-control, .tray-handle, .tray-cup-handle, .case-measure, .box-model-action, .box-zone-tag) > :is(rect, text) {
  transform: scale(var(--label-scale, 1));
}

.preview-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.preview-expand svg { flex: none; width: 15px; height: 15px; }

/* Full-screen preview */
html[data-preview-full] { overflow: hidden; scrollbar-gutter: auto; }

[data-preview-immersive].cfg-workspace {
  position: fixed !important;
  inset: 0;
  z-index: 900;
  width: 100% !important;
  max-width: none !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  background: #f0eadf;
}
[data-preview-immersive] .cfg-view { min-height: 0; padding: 10px 12px; }

@media (max-width: 899px) {
  [data-preview-immersive] .cfg-view { position: relative !important; flex: 1 1 auto; }
  [data-preview-immersive] .cfg-side { flex: none; max-height: 46dvh; overflow-y: auto; }
  #configure [data-preview-immersive] :is(.box-scene, .coaster-scene, #tray-scene, .model, .model-area, .cfg-canvas-stage) { flex: 1 1 auto; height: 100%; min-height: 0; }
  [data-preview-immersive] :is(.jewelry-stage, .tray-stage) { flex: 1 1 auto; min-height: 0; }
}

@media (max-width: 780px) {
  body > main > .hero,
  body > main > .coaster-intro,
  body > main > .box-intro,
  body > main > section:not(#configure) { width: calc(100% - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
