/* ============================================================================
 * Advanced Mode overlay — hosts the OpenReel editor iframe.
 *
 * The unified #vizzyHeader sits at the top (z 40) and is visible in both
 * modes. This overlay starts BELOW the header (top: var(--vizzy-header-
 * height)) so the same chrome stays put when switching modes — no header
 * swap, no double bar.
 *
 * Animated reveal: setting `is-open` fades the overlay in and slides it up
 * a few pixels; removing the class reverses it, and JS waits for the
 * transitionend before flipping [hidden]. Duration matches the mode-pill
 * thumb slide so the chrome change and overlay reveal feel like one motion.
 *
 * Z-index 25 — above the stage, below the settings drawer (30) and the
 * header (40). User can open settings or flip the mode pill at any time
 * without the overlay blocking.
 * ========================================================================== */

#advancedOverlay {
  position: fixed;
  top: var(--vizzy-header-height, 52px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #fff;
  overscroll-behavior: none;

  /* Initial / closing state for the animated reveal. JS toggles `is-open`
     to interpolate to the visible state. The 220ms duration matches the
     mode-pill thumb so chrome + overlay feel synchronized. */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

#advancedOverlay.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#advancedOverlay[hidden] { display: none !important; }

#advancedFrameWrap {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
}

#advancedFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0a0a0a;
}

/* Friendly message shown when openreel-dist/index.html is missing (i.e., the
   user hasn't run scripts/build-openreel.sh yet). advanced-mode.js probes the
   bundle before mounting the iframe and toggles this on if it's absent. */
#advancedMissingMsg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 12px;
  background: #0a0a0a;
}
#advancedMissingMsg[hidden] { display: none !important; }

#advancedMissingMsg h2 {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}
#advancedMissingMsg p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  max-width: 520px;
  line-height: 1.5;
}
#advancedMissingMsg pre {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
}

/* Phones and tablets: the editor goes full-screen like CapCut. The Vizzy
   header hides while Advanced is open; the editor's own ✕ (top-left) posts
   `opencut:exit` to come back to the mode switcher. */
@media (max-width: 899px), (pointer: coarse) {
  body[data-mode="advanced"] #vizzyHeader { visibility: hidden; }
  body[data-mode="advanced"] #advancedOverlay { top: 0; z-index: 45; }
}
