/* ─────────────────────────────────────────────────────────────────────────────
   stage.css - votivepatina-stage

   Shared styles for the live-performance surfaces (performer / audience / admin).
   Loaded ALONGSIDE styles.css, so it inherits the oulipo tokens (--ink, --bg,
   --font-*, etc.) and the shared component styles (the decay canvas, .det-box).
   Vanilla CSS, oulipo brand: white page, black-opacity ink, mono captions,
   serif/naskh for the prayer text. No shadows, no rounded blobs, no gradients.
   ──────────────────────────────────────────────────────────────────────────── */

/* the `hidden` attribute must win over the flex/grid display rules below
   (author `display:flex` would otherwise override the UA `[hidden]` rule). */
[hidden] {
  display: none !important;
}

.stage {
  min-height: 100vh;
  margin: 0 auto;
  max-width: 720px;
  padding: 1.25rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* the live count - a quiet mono caption, the brand's metadata register */
.stage-readout {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.stage-readout b {
  color: var(--ink-strong);
  font-weight: 600;
}

/* the prayer line: translit (mono), arabic (naskh, RTL), english (serif italic) */
.station-line {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.station-translit {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.station-arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  font-size: 1.9rem;
  line-height: 1.4;
  color: var(--warm-ink);
}
.station-english {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink);
}

/* the long narration (performer screen) */
.station-narration {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink);
  max-width: 36rem;
  margin: 0 auto;
}

/* the movement prompt (audience phone) */
.station-prompt {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
}

/* the single audience action - "pass the peace" - on-brand, squared button */
.peace-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  padding: 0.85rem 1.6rem;
  cursor: pointer;
  transition:
    opacity var(--t-micro) var(--ease-out),
    border-color var(--t-micro) var(--ease-out);
}
.peace-btn:hover {
  opacity: 0.7;
}
.peace-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.peace-btn .pb-en {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.peace-btn .pb-ar {
  font-family: var(--font-arabic);
  direction: rtl;
  font-size: 1.05rem;
  color: var(--warm-ink);
}

/* a brief confirmation flash after a peace registers */
.peace-flash {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  min-height: 1.1rem;
}

/* the tap-to-join entry gate */
.join-gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
}
.join-gate h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  color: var(--ink-muted);
  margin: 0;
}
.join-note {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--ink-subtle);
  max-width: 22rem;
}

/* the audience/performer image */
.stage-image-wrap {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 360px;
}
.stage-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
}

/* the dismissible on-image overlay (audience: station line + prompt over the image).
   The same visual treatment is reused on the main page in US-010. */
.img-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-panel);
  /* translucent so the decaying image reads THROUGH the text - an on-image
     overlay, not an opaque card. A thin scrim keeps the serif legible. */
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(1px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.6rem 1.2rem 1.2rem;
  overflow-y: auto;
}
.img-overlay[hidden] {
  display: none;
}
.img-overlay-close {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0.3rem 0.55rem;
  min-height: 44px;
  min-width: 44px;
}
.img-overlay-close:hover {
  color: var(--ink-strong);
}

/* admin console: a plain operator panel */
.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--ink-subtle);
  padding-bottom: 0.8rem;
}
.admin-row label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.admin-row input[type="number"] {
  font-family: var(--font-mono);
  font-size: 1rem;
  width: 5.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}
.admin-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
  transition: opacity var(--t-micro) var(--ease-out);
}
.admin-btn:hover {
  opacity: 0.7;
}
.admin-btn[data-variant="danger"] {
  border-color: var(--yolo-red);
  color: var(--yolo-red);
}
.admin-state {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
}

/* ── performer stage mode (the projected screen) ──────────────────────────── */
/* when in stage mode, the normal pray UI is hidden and the performer view shown.
   The "?" (about) stays - it is restyled to sit just right of the QR button. */
body[data-stage="performer"] .page,
body[data-stage="performer"] .console-handle,
body[data-stage="performer"] .console-drawer {
  display: none !important;
}

/* the "?" about button, restyled in stage mode to match the QR button's
   treatment (squared, mono) and made a touch more present on the projection. */
body[data-stage="performer"] .about-toggle {
  border-radius: 4px;
  font-family: var(--font-mono);
  font-style: normal;
  opacity: 0.8;
}

/* ── access controls, top-right: [ SHOW QR ] [ ? ] (reference screenshot) ──── */
.stage-qr-btn {
  position: fixed;
  top: 1rem;
  right: 3.7rem; /* sits just left of the 40px "?" at right:1rem */
  z-index: 61;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    opacity var(--t-micro) var(--ease-out),
    border-color var(--t-micro) var(--ease-out);
}
.stage-qr-btn:hover,
.stage-qr-btn:focus-visible {
  color: var(--ink-strong);
  border-color: var(--ink-strong);
}
.stage-qr-btn .qr-glyph {
  font-size: 0.95rem;
  line-height: 1;
}

/* the QR overlay: a big scannable code + the join URL, dismissible */
.qr-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-about);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.97);
}
.qr-overlay[hidden] {
  display: none;
}
.qr-overlay .qr-code {
  width: min(70vmin, 460px);
  height: auto;
}
.qr-overlay .qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}
.qr-overlay .qr-url {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  word-break: break-all;
  text-align: center;
  max-width: 30rem;
}
.qr-overlay .qr-caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink);
}
.performer-stage {
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}
.perf-head {
  text-align: center;
}
.perf-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--ink-muted);
  margin: 0 0 0.4rem;
}
.perf-body {
  display: flex;
  gap: 2.5rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.perf-image-wrap {
  flex: 0 0 auto;
  width: min(38vw, 320px);
}
.perf-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
}
.perf-text {
  flex: 1 1 0;
  max-width: 34rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.perf-text .station-line {
  text-align: left;
  align-items: flex-start;
}

/* the threads of light: one per station, lit as each station completes */
.perf-threads {
  display: flex;
  gap: 0.7rem;
  width: 100%;
  max-width: 640px;
}
.perf-thread {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}
.perf-thread-line {
  width: 100%;
  border-top: 2px dashed var(--ink-subtle);
  transition:
    border-color 700ms var(--ease-out),
    border-top-style 0ms;
}
.perf-thread[data-lit="true"] .perf-thread-line {
  border-top-style: solid;
  border-top-color: var(--glow);
  filter: drop-shadow(0 0 4px var(--glow));
}
.perf-thread-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-subtle);
}
.perf-thread[data-lit="true"] .perf-thread-num {
  color: var(--ink-muted);
}

@media (max-width: 720px) {
  .perf-body {
    flex-direction: column;
    gap: 1.5rem;
  }
  .perf-image-wrap {
    width: min(70vw, 260px);
  }
  .perf-text .station-line {
    text-align: center;
    align-items: center;
  }
}

/* offline/loopback + finale banners */
.stage-banner {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  text-align: center;
}
.is-finale .station-arabic {
  color: var(--ink-strong);
}
