/* Layout: the fixed-size design canvas and SPA screen switching.
   The canvas lives below the fixed .br-header (see header.css), and centers
   as a block in whatever vertical space remains down to the bottom of the
   screen. */
.br-stage-wrap {
  position: fixed;
  top: var(--br-header-h);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: transparent;
}
.br-stage-wrap.br-is-portrait {
  position: relative;
  top: auto;
  margin-top: var(--br-header-h);
  width: 100%;
  overflow: visible;
  align-items: center;
  min-height: calc(100vh - var(--br-header-h));
  min-height: calc(100dvh - var(--br-header-h));
}

.br-stage {
  position: relative;
  width: 1440px;
  height: 850px;
  flex-shrink: 0;
  transform-origin: center center;
}
.br-stage-wrap.br-is-portrait .br-stage {
  transform-origin: center center;
}

.br-screen {
  display: none;
}
.br-screen.br-is-active {
  display: block;
}

/* `translate` (not `transform`) so this composes with each element's own transform: translateX(-50%) centering instead of overriding it. */
.br-screen.br-is-active > * {
  animation: br-child-in .55s ease both;
}
.br-screen.br-is-active > *:nth-child(1) { animation-delay: 0s; }
.br-screen.br-is-active > *:nth-child(2) { animation-delay: .12s; }
.br-screen.br-is-active > *:nth-child(3) { animation-delay: .24s; }
.br-screen.br-is-active > *:nth-child(4) { animation-delay: .36s; }
.br-screen.br-is-active > *:nth-child(5) { animation-delay: .48s; }
.br-screen.br-is-active > *:nth-child(6) { animation-delay: .6s; }
.br-screen.br-is-active > *:nth-child(7) { animation-delay: .72s; }
.br-screen.br-is-active > *:nth-child(8) { animation-delay: .84s; }

@keyframes br-child-in {
  from { opacity: 0; translate: 0 18px; }
  to   { opacity: 1; translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .br-screen.br-is-active > * { animation: none; }
}

/* Fixed (not absolute) and above the header/stage-wrap z-index so the modal
   centers against the real viewport instead of just the design stage's own
   box, which sits below the header and can be letterboxed/off-center on its
   own. Already blocks clicks to whatever's behind it (covers the full
   viewport) - the transparent background is still clickable to dismiss the
   modal, it's just not tinted/darkened. */
.br-screen-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: pointer;
}

/* Fixed (not absolute) and moved out of .br-stage at runtime (see interactions.js) -
   .br-stage carries a CSS transform (the responsive scale in stage.js), and a
   transformed ancestor becomes the containing block for position:fixed descendants,
   so left nested inside .br-stage this would only ever cover the design canvas
   instead of the real viewport. */
.br-screen.br-is-popup {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: pointer;
}
.br-screen.br-is-popup > * {
  animation: none;
}

/* Explicit, literal fullscreen popup backdrop - desktop only (see header.css
   for why: .br-stage-wrap can't out-stack the header on mobile since it's
   position:static there). Sits above the header (z-index 60) so it also
   blocks/closes via the logo; .br-stage-wrap is raised above *this* in turn
   so everything already working inside the canvas (the popups above, which
   block their own screen already) stays exactly as it was. */
.br-popup-guard {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 61;
  background: transparent;
}
.br-popup-guard.br-is-visible {
  display: block;
  cursor: pointer;
}
@media (min-width: 721px) {
  .br-stage-wrap {
    z-index: 62;
    pointer-events: none;
  }
  .br-stage {
    pointer-events: auto;
  }
}
@media (max-width: 720px) {
  .br-popup-guard {
    display: none !important;
  }
}

.br-step-error {
  z-index: 10;
}

@media (max-width: 720px) {
  .br-stage-wrap,
  .br-stage-wrap.br-is-portrait {
    position: static !important;
    inset: auto;
    width: 100%;
    height: auto !important;
    min-height: calc(100vh - var(--br-header-h));
    min-height: calc(100dvh - var(--br-header-h));
    margin-top: var(--br-header-h);
    overflow: visible;
    background: transparent;
    display: block;
  }
  .br-stage {
    position: relative;
    width: 100%;
    max-width: 440px;
    height: auto;
    margin: 0 auto;
    padding: 20px 20px 24px;
    transform: none !important;
    background: transparent;
    min-height: calc(100vh - var(--br-header-h));
    min-height: calc(100dvh - var(--br-header-h));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .br-screen.br-is-active {
    width: 100%;
  }
}

@media (min-width: 721px) and (max-width: 1024px) {
  .br-stage-wrap.br-is-portrait { align-items: flex-start; }
}
