/* The computer screen. Its first frame is drawn identically on the 3D screen texture
   (see screenTexture() in main.js), so arriving at it is seamless. After that a short
   narrated film plays on a canvas. Keep the bar, intro and colours in step with main.js. */
.os {
  --bg: #f5f3f1;
  --ink: #0b0b0b;
  --soft: #8a8681;
  --line: #e4e1dc;
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', system-ui, sans-serif;
  opacity: 0; pointer-events: none;
  transition: opacity .5s ease;
}
.os.is-open { opacity: 1; pointer-events: auto; }

.os__bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.os__bar svg { width: 18px; height: auto; flex: none; }
.os__bar b { font-weight: 600; }

/* first frame: the prompt alone, as on the 3D screen */
.os__intro {
  position: absolute; inset: 40px 0 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(26px, 4.6vw, 72px); font-weight: 500; line-height: 1; white-space: nowrap;
  pointer-events: none;
}
.os__intro.is-gone { visibility: hidden; }
.os__intro span { display: inline-flex; align-items: center; }
.os__caret { display: block; width: .5em; height: 1em; margin-left: .12em; background: var(--ink); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

#storyCanvas { position: absolute; inset: 40px 0 0; width: 100%; height: calc(100% - 40px); display: block; }

/* the spoken line, quiet, for anyone watching without sound */
.os__line {
  position: absolute; left: 0; right: 0; bottom: 84px; z-index: 2;
  padding: 0 max(24px, env(safe-area-inset-left, 0px));
  text-align: center; font-size: clamp(13px, 1.1vw, 15px); color: var(--soft);
  transition: opacity .3s ease;
}

.os__controls {
  position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom, 0px)); z-index: 3;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(20, 20, 20, .08);
}
.os__btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%;
  color: var(--ink); transition: background .15s;
}
.os__btn svg { width: 18px; height: 18px; }
.os__btn:hover, .os__btn:focus-visible { background: #ecebe8; outline: none; }
.os__btn .i-play { display: none; }
.os.is-paused .os__btn .i-play { display: inline; }
.os.is-paused .os__btn .i-pause { display: none; }
.os__track { width: min(200px, 34vw); height: 3px; margin: 0 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.os__track i { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); }

/* until the film is live, show only what the 3D screen showed */
.os__line, .os__controls { transition: opacity .6s ease; }
.os:not(.is-live) .os__line, .os:not(.is-live) .os__controls { opacity: 0; pointer-events: none; }

@media (max-width: 760px) {
  .os__line { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .os, .os__line, .os__controls { transition: none; }
}

/* the waitlist on the screen, after the end card */
.os__wait {
  position: absolute; left: 50%; top: 56%; z-index: 3; width: min(520px, calc(100% - 32px));
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity .6s ease, transform .6s ease; text-align: center;
}
.os.is-waitlist .os__wait { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.os__wait > p { margin: 0 0 16px; font-size: clamp(16px, 1.5vw, 19px); color: var(--soft); }
.wl--os { margin: 0 auto; justify-content: center; }
.wl--os input { background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(20, 20, 20, .06); }
.wl--os input:focus { border-color: var(--ink); }
.wl--os button { background: var(--ink); }
.wl--os button:hover { background: #333; }
.wl--os .wl__msg { color: var(--ink); text-align: center; margin-left: 0; }
.os.is-waitlist .os__line { opacity: 0; }
