/* Public editor chrome only. Artwork, DOM order and private renderers keep
   their original geometry. Measurements never alter the regional bar itself. */
@media screen {
  html[data-editor-sticky="active"] {
    scroll-padding-top: calc(var(--edui-sticky-stack, 0px) + 12px);
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] [data-editor-sticky-header] {
    position: sticky !important;
    top: var(--edui-market-offset, var(--store-market-height, 0px)) !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] [data-editor-sticky-preview] {
    top: var(--edui-sticky-stack, 0px) !important;
    height: calc(100svh - var(--edui-sticky-stack, 0px)) !important;
    min-height: 0 !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] .city-preview[data-editor-sticky-preview] {
    height: calc(100vh - var(--edui-sticky-stack, 0px)) !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] .wedding-preview[data-editor-sticky-preview] {
    height: auto !important;
    min-height: calc(100dvh - var(--edui-sticky-stack, 0px)) !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] [data-editor-sticky-fixed-control="tools"],
  body[data-editor-appearance="unified"][data-editor-sticky="active"] [data-editor-sticky-fixed-control="language"] {
    top: calc(var(--edui-market-offset, 0px) + 16px) !important;
  }

  body.neb-language-inline[data-editor-appearance="unified"][data-editor-sticky="active"] [data-editor-sticky-fixed-control="language"] {
    top: calc(var(--edui-market-offset, 0px) + 14px) !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] [data-editor-sticky-fixed-control="city-language"] {
    top: calc(var(--edui-market-offset, 0px) + 10px) !important;
  }

  /* Document scroll padding carries the measured chrome height. Do not add
     the old hard-coded header margin a second time at the scroll target. */
  body[data-editor-appearance="unified"][data-editor-sticky="active"] :is(.memory-controls, .lunar-controls, .solar-controls, .voice-controls, .wedding-controls) {
    scroll-margin-top: 16px !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] :is(.city-panel, .panel-scroll) {
    scroll-padding-top: 16px;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] .city-panel[data-editor-sticky-scroll-panel] {
    height: calc(100vh - var(--edui-sticky-stack, 0px)) !important;
  }

  body[data-editor-appearance="unified"][data-editor-sticky="active"] .city-layout:has(>.city-panel[data-editor-sticky-scroll-panel]) {
    min-height: calc(100vh - var(--edui-sticky-stack, 0px)) !important;
  }

  /* The stellar mobile fullscreen stays inset:0. Hide only the regional
     chrome while that overlay owns the screen, retaining its flow space. */
  body.wiz[data-editor-appearance="unified"].preview-full > .store-market {
    visibility: hidden;
  }

  @media (min-width: 901px) {
    body.wiz[data-editor-appearance="unified"][data-editor-sticky="active"] .wrap.wiz {
      height: calc(100vh - var(--edui-sticky-stack, 0px)) !important;
      min-height: 0 !important;
    }
  }

  @media (max-width: 900px) {
    /* overflow-x:hidden creates a separate body scroll container. Clip keeps
       the existing horizontal crop while sticky elements follow the viewport. */
    @supports (overflow-x: clip) {
      html[data-editor-sticky="active"]:has(>body.wiz),
      body.wiz[data-editor-appearance="unified"][data-editor-sticky="active"] {
        overflow-x: clip !important;
      }
    }
  }
}
