/* Ember's show screen (/ember) — stands, TVs and trade shows
 * (forgeos-ember-show.js; the face is forgeos-guide's).
 *
 * One idea: an ember glowing in the site's night. The room sees Ember first
 * -- a large, living face with its own warm light -- and beside it one thing
 * at a time: a line of the story, or a real first screen with its label.
 * Everything is sized in --u, the smaller of a hundredth of the width and a
 * 16:9 share of the height, so 1280x720, 1920x1080 and 3840x2160 are the same
 * picture at three scales and nothing ever scrolls. Always dark: a screen in
 * a hall is not a page somebody reads in the morning.
 * No inline styles: the page is served under style-src 'self'. */

body.show {
  --u: min(1vw, 1.7778vh);
  --night: #0b0d14;
  --night-2: #12141e;
  --ash: #f6efe9;
  --ash-2: #c9bcb4;
  --ash-3: #93877f;
  --flame: #ff6a1f;
  --core: #ffb547;
  --char: #2a160c;
  margin: 0; height: 100vh; height: 100dvh; overflow: hidden; color: var(--ash);
  background:
    radial-gradient(calc(var(--u) * 70) calc(var(--u) * 60) at 22% 52%, rgba(255, 106, 31, .16), transparent 70%),
    radial-gradient(calc(var(--u) * 120) calc(var(--u) * 80) at 100% 100%, rgba(79, 70, 229, .14), transparent 70%),
    var(--night);
  font-family: var(--font); -webkit-font-smoothing: antialiased;
}
/* Parked above the page, not 9999px to the side: right-to-left, a far-left
 * box is scrollable, and Arabic opened /os/app on a blank screen 9999px wide
 * (site-wide test, 2026-10-15). Nothing above the top can be scrolled to. */
body.show .skip-link { position: absolute; left: 0; top: -200px; }
body.show .skip-link:focus { left: calc(var(--u) * 2); top: calc(var(--u) * 2); z-index: 10; background: var(--ash); color: var(--night); padding: 8px 12px; border-radius: 8px; }

/* ── The quiet frame ─────────────────────────────────────────────────── */
.show-top {
  position: fixed; inset: 0 0 auto; z-index: 3; display: flex; align-items: center; gap: calc(var(--u) * 2);
  padding: calc(var(--u) * 1.8) calc(var(--u) * 2.6);
}
.show-top .brand { display: inline-flex; align-items: center; gap: calc(var(--u) * .8); color: var(--ash); font-weight: 650; font-size: calc(var(--u) * 1.35); letter-spacing: -.01em; }
.show-top .brand img { width: calc(var(--u) * 1.9); height: calc(var(--u) * 1.9); }
.show-top .brand small { display: block; font-size: .62em; font-weight: 500; color: var(--ash-3); letter-spacing: 0; }
.show-way { margin-left: auto; display: flex; gap: calc(var(--u) * 1.6); font-size: calc(var(--u) * 1); }
.show-way a { color: var(--ash-3); }
.show-way a:hover, .show-way a:focus-visible { color: var(--ash); }
.show-mic { margin: 0 0 0 auto; display: inline-flex; align-items: center; gap: calc(var(--u) * .7); padding: calc(var(--u) * .5) calc(var(--u) * 1.1);
  border-radius: 999px; background: rgba(255, 106, 31, .16); color: var(--ash); font-size: calc(var(--u) * 1.05); font-weight: 600; }
.show-mic[hidden] { display: none; }
.show-mic:not([hidden]) + .show-way { margin-left: calc(var(--u) * 2); }
.show-mic-dot { width: calc(var(--u) * .8); height: calc(var(--u) * .8); border-radius: 50%; background: var(--flame); box-shadow: 0 0 0 calc(var(--u) * .35) rgba(255, 106, 31, .3); }

/* The legal links, quiet in the bottom corner: there for anyone who looks. */
.show-foot { position: fixed; right: calc(var(--u) * 3.4); bottom: calc(var(--u) * 1); z-index: 2; }
.show-foot nav { display: flex; gap: calc(var(--u) * 1.4); font-size: calc(var(--u) * .8); }
.show-foot a { color: var(--ash-3); }
.show-foot a:hover, .show-foot a:focus-visible { color: var(--ash); }

/* ── The stage: Ember and her two invitations left, the story right ──── */
.stage {
  height: 100%; box-sizing: border-box; display: grid; outline: 0;
  grid-template-columns: 36fr 64fr; grid-template-rows: minmax(0, 1fr) auto;
  padding: calc(var(--u) * 6) calc(var(--u) * 3.4) calc(var(--u) * 2.6);
  column-gap: calc(var(--u) * 4); row-gap: calc(var(--u) * 1.2);
}
.stage-ember { position: relative; grid-row: 1 / span 2; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 2.4); }
.stage-face { position: relative; flex: none; margin-top: auto; width: calc(var(--u) * 24); height: calc(var(--u) * 24); }
.stage-face::before {
  content: ""; position: absolute; left: 50%; top: 56%; width: 175%; height: 175%; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 181, 71, .30), rgba(255, 106, 31, .12) 55%, transparent);
  pointer-events: none;
}
.stage-face .fg-face { width: 100%; height: 100%; filter: drop-shadow(0 0 calc(var(--u) * 3) rgba(255, 106, 31, .45)); }
/* The face's own halo is a hard disc at this size; the stage's glow is the halo here. */
.stage-face .fg-glow { opacity: calc(var(--fg-level) * .45); }

.stage-talk {
  position: relative; display: inline-flex; align-items: center; gap: calc(var(--u) * 1); min-height: 48px;
  padding: calc(var(--u) * 1.25) calc(var(--u) * 2.6) calc(var(--u) * 1.25) calc(var(--u) * 2.1);
  border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 650; letter-spacing: -.01em;
  font-size: calc(var(--u) * 1.75); color: var(--char);
  background: linear-gradient(180deg, #ffd27a, var(--core) 45%, #ff8f3a);
  box-shadow: 0 calc(var(--u) * 1) calc(var(--u) * 3.2) calc(var(--u) * -1) rgba(255, 106, 31, .7), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.stage-talk svg { width: calc(var(--u) * 2); height: calc(var(--u) * 2); }
.stage-talk:hover { filter: brightness(1.05); }
.stage-talk:focus-visible { outline: calc(var(--u) * .3) solid var(--ash); outline-offset: calc(var(--u) * .4); }
.stage-talk[aria-pressed="true"] { background: var(--flame); color: #fff; }

.stage-type { display: flex; gap: calc(var(--u) * .8); width: min(100%, calc(var(--u) * 34)); }
.stage-type[hidden] { display: none; }
.stage-type input { flex: 1; min-width: 0; min-height: 44px; padding: 0 calc(var(--u) * 1.4); border-radius: 999px; border: 1px solid rgba(246, 239, 233, .25);
  background: rgba(246, 239, 233, .06); color: var(--ash); font: inherit; font-size: calc(var(--u) * 1.2); }
.stage-type button { min-height: 44px; padding: 0 calc(var(--u) * 1.6); border-radius: 999px; border: 0; background: var(--ash); color: var(--night); font: inherit; font-weight: 600; font-size: calc(var(--u) * 1.1); cursor: pointer; }

/* ── The story: one beat at a time ───────────────────────────────────── */
.stage-story { position: relative; grid-column: 2; grid-row: 1; display: grid; align-items: center; min-height: 0; }
.loop { list-style: none; margin: 0; padding: 0; display: grid; height: 100%; }
.loop > li { grid-area: 1 / 1; align-self: center; display: grid; gap: calc(var(--u) * 2); }
.show-live .loop > li { opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility 0s linear .7s; }
.show-live .loop > li.is-on { opacity: 1; visibility: visible; transition: opacity .7s ease; }
.loop > li + li { display: none; }
.show-live .loop > li + li { display: grid; }
.loop[hidden] { display: none; }

.loop li[data-beat="story"] p {
  margin: 0; max-width: 17ch; font-size: calc(var(--u) * 5); line-height: 1.04; font-weight: 640; letter-spacing: -.035em;
  text-wrap: balance; color: var(--ash);
}
/* An example: Ember's line on top, the real first screen under it. */
.loop li[data-beat="example"] { grid-template-columns: 1fr; gap: calc(var(--u) * 1.8); }
.loop li[data-beat="example"] p { order: -1; }
.loop li[data-beat="example"] figure { margin: 0; width: min(calc(var(--u) * 46), 1280px); }
.loop li[data-beat="example"] img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top;
  max-height: calc(100vh - var(--u) * 27); max-height: calc(100dvh - var(--u) * 27);
  border-radius: calc(var(--u) * 1.2); background: var(--night-2);
  box-shadow: 0 0 0 1px rgba(246, 239, 233, .14), 0 calc(var(--u) * 3) calc(var(--u) * 7) calc(var(--u) * -2) rgba(0, 0, 0, .8),
    0 0 calc(var(--u) * 8) calc(var(--u) * -2) rgba(255, 106, 31, .35);
}
.loop li[data-beat="example"] figcaption { margin-top: calc(var(--u) * 1.1); font-size: calc(var(--u) * 1.15); line-height: 1.4; color: var(--ash-3); }
.loop li[data-beat="example"] p { margin: 0; max-width: 34ch; font-size: calc(var(--u) * 2.3); line-height: 1.22; font-weight: 560; letter-spacing: -.02em; color: var(--ash); text-wrap: pretty; }
.show .avail-tag { font-size: calc(var(--u) * .95); padding: calc(var(--u) * .15) calc(var(--u) * .6); border-radius: calc(var(--u) * .45); margin-right: calc(var(--u) * .5); }
.show .avail-tag[data-availability=here] { background: rgba(74, 222, 128, .16); color: #86efac; }
.show .avail-tag[data-availability=experimental] { background: rgba(165, 180, 252, .16); color: #c7d2fe; }

/* ── Talking ─────────────────────────────────────────────────────────── */
.talk { display: grid; gap: calc(var(--u) * 1.6); align-content: center; }
.talk[hidden] { display: none; }
.talk-you { margin: 0; font-size: calc(var(--u) * 1.8); line-height: 1.3; color: var(--ash-3); max-width: 40ch; }
.talk-ember { margin: 0; font-size: calc(var(--u) * 3.1); line-height: 1.16; font-weight: 600; letter-spacing: -.025em; color: var(--ash); max-width: 26ch; text-wrap: pretty; }
/* A longer answer is set smaller, so every answer fits the screen whole. */
.talk-ember.is-long { font-size: calc(var(--u) * 2.4); max-width: 32ch; }
.talk-ember.is-longer { font-size: calc(var(--u) * 1.95); max-width: 40ch; line-height: 1.22; }
.talk-shots { display: flex; gap: calc(var(--u) * 1.6); }
.talk-shots:empty { display: none; }
.talk-shots .ep-example { margin: 0; width: calc(var(--u) * 22); }
.talk-shots .ep-example a { display: block; color: var(--ash-2); font-size: calc(var(--u) * 1); }
.talk-shots .ep-example img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: calc(var(--u) * .8); box-shadow: 0 0 0 1px rgba(246, 239, 233, .14); }
.talk-shots figcaption { margin-top: calc(var(--u) * .6); }
/* Talking, Ember steps back a little so the typing box and the code both fit. */
.is-talking .stage-face { width: calc(var(--u) * 20); height: calc(var(--u) * 20); }
.is-talking .stage-ember { gap: calc(var(--u) * 1.8); }
.is-talking .stage-face::before { background: radial-gradient(closest-side, rgba(255, 181, 71, .42), rgba(255, 106, 31, .18) 55%, transparent); }

/* ── The caption line and the code ───────────────────────────────────── */
/* The caption sits under the story; the code under Ember, at the foot of her
 * column, so neither can ever sit over a picture or a line. */
.stage-caption { grid-column: 2; grid-row: 2; align-self: end; margin: 0; min-height: 1.35em; max-width: 60ch;
  font-size: calc(var(--u) * 1.3); line-height: 1.35; color: var(--ash-2); }
.stage-qr {
  flex: none; margin-top: auto; display: flex; align-items: center; gap: calc(var(--u) * 1.4);
  padding: calc(var(--u) * 1) calc(var(--u) * 1.8) calc(var(--u) * 1) calc(var(--u) * 1);
  border-radius: calc(var(--u) * 1.6); background: rgba(18, 20, 30, .82); box-shadow: 0 0 0 1px rgba(246, 239, 233, .12);
}
.qr { width: calc(var(--u) * 11); height: calc(var(--u) * 11); border-radius: calc(var(--u) * .7); overflow: hidden; background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-light { fill: #fff; }
.qr-dark { fill: #0b0d14; }
.qr-words { margin: 0; display: grid; gap: calc(var(--u) * .3); }
.qr-words b { font-size: calc(var(--u) * 1.6); font-weight: 650; letter-spacing: -.015em; color: var(--ash); }
.qr-where { font-size: calc(var(--u) * 1.1); color: var(--core); }

/* ── Ember breathes; the glow answers her voice ──────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .show-live .stage-face::before { animation: show-breathe 6s ease-in-out infinite; }
  .show-live .stage-face .fg-face[data-state="idle"] { animation-duration: 5.5s; }
  .show-mic-dot { animation: show-pulse 1.4s ease-in-out infinite; }
}
@keyframes show-breathe { 0%, 100% { transform: translate(-50%, -50%) scale(.94); opacity: .85; } 50% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; } }
@keyframes show-pulse { 0%, 100% { box-shadow: 0 0 0 calc(var(--u) * .2) rgba(255, 106, 31, .45); } 50% { box-shadow: 0 0 0 calc(var(--u) * .6) rgba(255, 106, 31, 0); } }

/* ── The operator's controls (?operator=1) ───────────────────────────── */
.operator {
  position: fixed; left: 16px; bottom: 16px; z-index: 5; width: 300px; max-height: calc(100vh - 32px); overflow: auto;
  display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: #f6efe9; color: #1a1210; font-size: 14px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .8);
}
.operator[hidden] { display: none; }
.operator h2 { margin: 0; font-size: 16px; }
.operator-why { margin: 0; color: #5a4d46; font-size: 13px; }
.operator label { display: grid; gap: 4px; font-weight: 600; }
.operator .op-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.operator select, .operator input[type="password"] { min-height: 36px; border-radius: 8px; border: 1px solid #c9bcb4; padding: 0 8px; font: inherit; background: #fff; color: inherit; }
.op-row { display: flex; flex-wrap: wrap; gap: 8px; }
.op-row button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid #c9bcb4; background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.op-row .op-start { background: var(--flame); border-color: transparent; color: #fff; }

/* Narrow screens (a phone that opened the link): stack, still no scroll. */
@media (max-aspect-ratio: 1/1) {
  body.show { --u: min(1.6vw, 1vh); }
  .stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; padding-top: calc(var(--u) * 9); }
  .stage-ember { grid-row: 1; gap: calc(var(--u) * 2); }
  .stage-face { margin-top: 0; width: calc(var(--u) * 20); height: calc(var(--u) * 20); }
  .stage-story { grid-column: 1; grid-row: 2; }
  .stage-caption { grid-column: 1; grid-row: 3; }
  .loop li[data-beat="story"] p { font-size: calc(var(--u) * 4.4); }
  .stage-qr { display: none; }
}
