/* One-screen 3D carousel for phones and tablets, including wide touch screens. */
.compact-tools, .lid-control-label, .project-dots { display: none; }

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
  html { scrollbar-gutter: auto; }
  .studio-app {
    min-width: 0; height: 100svh; height: 100dvh; min-height: 420px;
    display: flex; flex-direction: column;
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  }
  .studio-header { height: auto; flex: 0 0 auto; padding-top: env(safe-area-inset-top); }
  .studio-header .studio-header-inner { width: calc(100% - 32px); min-height: 72px; }
  .studio-header .brand { padding-left: 0; font-size: 26px; }
  .studio-header .studio-nav { height: 72px; }
  .studio-header .studio-nav a {
    min-height: 72px; min-width: 82px; padding: 0 12px; font-size: 15px;
  }
  .studio-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.15); }
  .studio-layout {
    flex: 1; min-height: 0;
    grid-template-areas: "viewer" "tools" "config";
    grid-template-rows: minmax(160px, 1fr) auto auto;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .viewer {
    --viewer-top: 64; --viewer-bottom: 72;
    width: min(960px, calc(100% - 32px)); height: 100%; min-height: 0;
  }
  #sceneCanvas { touch-action: none; cursor: grab; }
  .viewer-heading { top: 10px; left: 4px; width: calc(100% - 8px); pointer-events: auto; }
  .section-eyebrow { margin-bottom: 4px; font-size: 10px; }
  h1 { font-size: 23px; }
  .view-toggle, .versions-section { display: none; }
  .project-dots {
    display: flex; position: absolute; z-index: 6; bottom: 2px; left: 0; right: 0;
    align-items: center; justify-content: center;
  }
  .project-dot {
    position: relative; display: grid; place-items: center; width: 44px; height: 44px;
    padding: 0; border: 0; background: transparent; cursor: pointer;
  }
  .project-dot::before {
    content: ""; width: 7px; height: 7px; border-radius: 8px;
    background: #c7c1b8; transition: width 160ms ease, background 160ms ease;
  }
  .project-dot.is-active::before { width: 22px; background: var(--accent); }
  .project-dot-number {
    position: absolute; top: 0; left: 0; right: 0; visibility: hidden;
    color: var(--accent-dark); font-size: 10px; line-height: 12px;
    font-weight: 600; font-variant-numeric: tabular-nums; text-align: center;
  }
  .project-dot.is-active .project-dot-number { visibility: visible; }
  .project-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 6px; }
  .compact-tools {
    grid-area: tools; display: block;
    width: min(560px, calc(100% - 40px)); margin: 0 auto; padding: 4px 0 0;
  }
  .lid-control { position: relative; top: auto; right: auto; width: 100%; height: auto; display: grid; }
  .lid-control.is-hinting::after { left: 0; bottom: 10px; width: 24px; height: 24px; }
  .lid-control-label {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    color: #4c4741; font-size: 14px; line-height: 20px; font-weight: 600;
  }
  .lid-control-label output { color: var(--accent-dark); font-variant-numeric: tabular-nums; }
  #desktopLidSlider {
    width: 100%; height: 44px; min-height: 44px;
    writing-mode: horizontal-tb; direction: ltr;
  }
  #desktopLidSlider::-webkit-slider-runnable-track {
    width: 100%; height: 4px;
    background: linear-gradient(to right, var(--accent) 0 var(--range-progress, 0%), #d8d4ce var(--range-progress, 0%) 100%);
  }
  #desktopLidSlider::-webkit-slider-thumb {
    width: 24px; height: 24px; margin: -10px 0 0;
    box-shadow: 0 0 0 4px rgba(243, 91, 0, 0.12);
  }
  #desktopLidSlider::-moz-range-track, #desktopLidSlider::-moz-range-progress { width: 100%; height: 4px; }
  #desktopLidSlider::-moz-range-thumb { width: 24px; height: 24px; }
  .config-panel {
    width: min(560px, calc(100% - 40px)); grid-template-columns: minmax(0, 1fr);
    gap: 0; padding: 8px 0 0; border: 0;
  }
  .field-label { margin-bottom: 6px; font-size: 14px; line-height: 20px; }
  .material-control { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .segment-button { min-height: 44px; }
}

@media (max-width: 760px) {
  .studio-header .studio-header-inner { width: 100%; min-height: 0; flex-direction: column; }
  .studio-header .brand {
    display: flex; align-items: center; justify-content: center;
    min-height: 56px; font-size: clamp(24px, 7.4vw, 30px);
  }
  .studio-header .studio-nav { width: 100%; height: 44px; }
  .studio-header .studio-nav a {
    flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; font-size: 14px;
  }
  .studio-header .studio-nav a:first-child { border-left: 0; }
  h1 { font-size: 21px; }
}

@media (max-width: 1100px) and (max-height: 540px) and (orientation: landscape),
       (hover: none) and (pointer: coarse) and (max-height: 540px) and (orientation: landscape) {
  .studio-app { min-height: 300px; }
  .studio-header .studio-header-inner {
    width: calc(100% - 32px); min-height: 44px; flex-direction: row;
  }
  .studio-header .brand { min-height: 44px; font-size: 23px; }
  .studio-header .studio-nav { width: auto; height: 44px; }
  .studio-header .studio-nav a { min-height: 44px; min-width: 56px; padding: 0 8px; font-size: 13px; }
  .studio-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "viewer viewer" "tools config";
    grid-template-rows: minmax(140px, 1fr) auto;
    column-gap: 28px; padding-inline: max(24px, calc((100% - 960px) / 2));
  }
  .viewer { --viewer-top: 36; --viewer-bottom: 44; width: 100%; }
  .viewer-heading { top: 6px; }
  h1 { font-size: 19px; }
  .section-eyebrow { display: none; }
  .project-dots { bottom: 0; }
  .compact-tools, .config-panel { width: 100%; padding: 4px 0 0; }
}
