/* Stage, reset and idiot-proofing.
 *
 * The stage is a hard-coded 375x647 constant (map decision 66). No vh/dvh/svh/lvh,
 * no env(safe-area-inset-*), no branching on navigator.standalone — anywhere.
 * It is pinned to y=0 so our content sits under the real iOS status bar
 * (decision 19: black-translucent + viewport-fit=cover) and centred horizontally,
 * because width does not change when the keyboard opens but height does
 * (decision 28: the layout viewport shrank 793 -> 417).
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Anything a browser does that Messenger doesn't is a continuity error (07). */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

:focus,
:focus-visible {
  outline: none;
}

html,
body {
  height: 100%; /* backdrop only — never a layout unit for the stage */
  /* TICKET 15, decision 141/142: this is not a backdrop on the hero phone, it is
   * the ~20px strip iOS owns below our viewport. The strip takes html/body's
   * background — not theme_color, not background_color, not .stage — and it
   * repaints live. On the 14 Pro the stage floats inside a taller viewport and
   * this reads as a letterbox; on the SE the stage IS the viewport, so the only
   * thing this colour ever paints is that strip, directly under the white
   * composer, on camera for all of scene 2.
   *
   * So the device-correct value is the DEFAULT and the letterbox is the flag
   * (?letterbox), never the other way round: the failure mode is shipping black,
   * and it is invisible on the only device we can test on until the handover. */
  background: var(--c-thread-bg);
  overflow: hidden;
  overscroll-behavior: none;
  font: var(--t-message);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.stage {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--stage-w);
  height: var(--stage-h);
  overflow: hidden;
  background: var(--c-thread-bg);
  /* Kills double-tap-to-zoom without touching pan or the click that follows a
   * tap (ticket 11). The actor double-taps a bubble eventually, and a zoomed
   * prop mid-take cannot be recovered on camera. */
  touch-action: manipulation;
}

/* The fail-loud panel moved to operator.css with ticket 11 — it needs the way
 * out (revert the paste, fall back to the built-in config) as much as it needs
 * the line number, and both live in the operator layer. */

/* --------------------------------------------------------------- dev harness */

/* ?letterbox paints the old black backdrop, so the stage's bounds are visible
 * on a desktop or on the 14 Pro's taller viewport. Dev only — on the hero SE
 * this is the shipping bug 15 found (decision 142). */
html.letterbox,
body.letterbox {
  background: #000;
}

/* ?x2 renders the stage at 2x for a 750x1294 screenshot that can be overlaid on
 * the 750x1334 stills. Never reachable on the device build. */
body.x2 {
  overflow: visible;
}
body.x2 .stage {
  left: 0;
  transform: scale(2);
  transform-origin: top left;
}

/* ?overlay=<file> pins a reference still over the stage at 50% for the A/B. */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--stage-w);
  z-index: 90;
  opacity: 0.5;
  pointer-events: none;
}
