/* One face: B612, Airbus's cockpit typeface. B612 Mono on the terminal. */
@font-face { font-family: "B612"; src: url("../assets/fonts/B612-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612"; src: url("../assets/fonts/B612-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "B612"; src: url("../assets/fonts/B612-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("../assets/fonts/B612Mono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("../assets/fonts/B612Mono-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
/* The display face: Teko (OFL, assets/fonts/Teko-OFL.txt), squared and condensed like vehicle markings. Latin subset. */
@font-face { font-family: "Teko"; src: url("../assets/fonts/Teko.woff2") format("woff2"); font-weight: 300 700; font-display: block; }

:root { --red: #ff5c4d; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; background: #000; color: #f2efe6; font-family: "B612", sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }

/* A one-sheet: a line on top, the picture, the title, one button. Everything centres on the device's
   screen, not on the people: --cx is the screen's centre as a fraction of the picture's width. */
.poster { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4svh 0 6svh; }
/* Each picture centres on its device. On wide screens the title is sized by JS to --tw of the picture's
   width, so it spans both people's backs. */
.art { position: relative; flex: none; transform: translateX(calc(50% - var(--cx))); }
.art-mac { display: none; aspect-ratio: 3 / 2; height: var(--ah); --cx: 48.11%; --tw: 0.6;
  --sx: 31.71%; --sy: 16.60%; --sw: 32.81%; --sh: 33.59%; }
.art-phone { aspect-ratio: 2 / 3; height: var(--ah); --cx: 54.35%;
  --sx: 29.30%; --sy: 2.73%; --sw: 50.10%; --sh: 72.79%; }
@media (min-aspect-ratio: 1/1) { .art-mac { display: block; } .art-phone { display: none; } }

/* The photograph sits in front; its screen is keyed out, so the app behind shows through and anyone
   overlapping the glass stays in front of it. The picture melts into the page on every side. */
.photo { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.art::after { content: ""; position: absolute; inset: -1px; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse 80% 86% at 50% 46%, transparent 66%, rgb(0 0 0 / .4) 85%, #000 100%),
              linear-gradient(to bottom, #000 0, transparent 7%, transparent 91%, #000 100%),
              linear-gradient(to right, #000 0, transparent 8%, transparent 88%, #000 100%); }
/* Until the title comes in, the people show nearly to the bottom; then the black rises behind it (::before). */
.art::before { content: ""; position: absolute; inset: -1px; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .6s ease; }
.poster.titled .art::before { opacity: 1; }

.screen { position: absolute; z-index: 1; left: var(--sx); top: var(--sy); width: var(--sw); height: var(--sh);
  padding: 0; border: 0; cursor: pointer; overflow: hidden; container-type: size; display: grid; place-items: center; }
.screen:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.art-mac .screen { background: #1b1a1d; filter: brightness(.9) contrast(1.04); }
.art-phone .screen { background: #1b1a1d; }   /* square: the photo's bezel is the only corner */
.app { position: relative; }
.art-mac .app { width: min(100cqw, calc(100cqh * 1060 / 752)); aspect-ratio: 1060 / 752; }
.art-phone .app { height: 100cqh; aspect-ratio: 1206 / 2622; }
.plate { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .3s; }
.plate.armed { opacity: 0; }
.poster.armed .plate.armed { opacity: 1; }
.switch { position: absolute; pointer-events: none; }
.display { position: absolute; }
/* Positions inside each app (measured from the captures). */
.art-mac .switch { left: 8.3%; top: 18.09%; width: 21.7%; height: 42.82%; }
.art-mac .display { left: 39.62%; top: 45.88%; width: 56.13%; height: 48.27%; }
.art-phone .switch { left: 19.49%; top: 52.56%; width: 61.03%; height: 39.28%; }
/* The canvas covers the terminal's red border too, and draws the border itself, so no rounding can show a sliver. */
.art-phone .display { left: 3.483%; top: 8.696%; width: 93.035%; height: 37.757%; }
.art-phone .lamp { position: absolute; left: 44.28%; top: 47.86%; width: 1.82%; aspect-ratio: 1; border-radius: 50%; background: var(--red); box-shadow: 0 0 6px var(--red); opacity: 0; transition: opacity .3s; }
.poster.armed .art-phone .lamp { opacity: 1; }
/* The tube's falloff over the whole glass; scan lines only on the terminal, as in the app. */
.crt { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 120% at 50% 48%, transparent 55%, rgb(0 0 0 / .55) 100%);
  box-shadow: inset 0 0 18px rgb(0 0 0 / .7); }
.art-mac .app::after, .art-phone .app::after { content: ""; position: absolute; left: 39.62%; top: 45.88%; width: 56.13%; height: 48.27%; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgb(0 0 0 / .16) 0 1px, transparent 1px 3px); }
.art-phone .app::after { left: 3.483%; top: 8.696%; width: 93.035%; height: 37.757%; }

/* Text: the instruction above, the title typed in below. */
.tagline { position: relative; z-index: 4; margin: 0 0 2.4svh; height: 1.4em; font-style: italic; font-size: clamp(15px, 2.2svh, 22px); text-align: center; width: 100%; }
.say { position: absolute; left: 0; right: 0; opacity: 0; transition: opacity .35s ease; }
.poster[data-step="guard"] .say[data-step="guard"],
.poster[data-step="switch"] .say[data-step="switch"],
.poster[data-step="done"] .say[data-step="done"],
.poster[data-step="align"] .say[data-step="align"],
.poster[data-step="unswitch"] .say[data-step="unswitch"] { opacity: 1; }

.title { position: relative; z-index: 4; margin: -3svh 0 0; height: 1.05em; text-align: center; white-space: nowrap;
  font-family: "Teko", "B612", sans-serif; font-weight: 700; text-transform: uppercase; line-height: 1.05; letter-spacing: .04em;
  font-size: min(8.6vw, 8.6svh); color: var(--red); }
/* The full title is laid out from the start (the untyped part transparent), so typing never shifts it. */
.rest { color: transparent; -webkit-text-stroke-color: transparent; }
.typed { position: relative; }

.action { position: relative; z-index: 4; margin-top: 3.4svh; min-height: 52px; display: grid; place-items: center; }
.buy { margin: 0; display: grid; opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .5s ease, transform .5s ease; }
.poster.done .buy, .poster.returning .buy { opacity: 1; transform: none; pointer-events: auto; }   /* back after a first throw: there from the start */
.button { display: inline-flex; align-items: center; gap: 12px; padding: 13px 24px 13px 20px; cursor: pointer; white-space: nowrap;
  font: 700 15px "B612", sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--red);
  background: transparent; border: 1.5px solid var(--red); border-radius: 8px; transition: background .15s, color .15s; }
.button img { width: 20px; height: 20px; }
.for-ios { display: none; }
.button .ios { text-transform: none; }
@media (max-aspect-ratio: 1/1) { .for-mac { display: none; } .for-ios { display: inline-flex; } }
.button:hover { background: rgb(255 92 77 / .12); }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* The code screen: a console panel over the page. Click outside or press Esc to close. */
.gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgb(0 0 0 / .78); backdrop-filter: blur(3px); }
.gate[hidden] { display: none; }
.panel { position: relative; padding: 34px 34px 28px; border: 1.3px solid rgb(219 219 212 / .86); background: #131416; text-align: center;
  box-shadow: 0 24px 60px rgb(0 0 0 / .6); animation: rise .25s ease both; }
.panel-title { position: absolute; top: -.7em; left: 50%; transform: translateX(-50%); margin: 0; padding: 0 10px; background: #131416;
  font: 700 11px/1.3 "B612", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: rgb(219 219 212 / .86); white-space: nowrap; }
.controls { display: flex; align-items: center; justify-content: center; gap: 30px; }
/* The app's odometer: digits on drums behind a black window. */
.odometer { position: relative; display: flex; gap: 3px; padding: 5px; background: #000; outline: 1px solid rgb(255 255 255 / .08); cursor: text; }
.drum { position: relative; width: 44px; height: 54px; overflow: hidden;
  background: linear-gradient(#0f0f0f, #1f1f1f, #0f0f0f); }
.drum::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgb(0 0 0 / .55), transparent 20%, transparent 80%, rgb(0 0 0 / .55)); }
.reel { position: absolute; left: 0; right: 0; top: 0; display: grid; transition: transform .32s cubic-bezier(.45, 0, .2, 1); }
.reel span { height: 54px; display: grid; place-items: center; font: 700 30px "B612", sans-serif; color: #eee; }
.odometer:focus-within .drum.next { box-shadow: inset 0 -2px 0 var(--red); }
.odometer input { position: absolute; inset: 0; opacity: 0; font-size: 16px; caret-color: transparent; }
.panel.wrong .odometer { animation: shake .36s ease; }
/* The illuminated rocker (js/rocker.js): dark until the code is right, then lit; pressed, it rocks home. */
.gate-switch { width: 84px; aspect-ratio: 168 / 216; padding: 0; border: 0; background: none; cursor: pointer; }
.gate-switch canvas { width: 100%; height: 100%; display: block; pointer-events: none; }
.gate-switch:disabled { cursor: default; }
.gate-switch.jam { animation: shake .3s ease; }
.gate-switch:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) { .buy, .say { transition: none; } }

/* ios.html: the iPhone app isn't out yet. */
.soon .title { margin: 0; }
.soon .action { margin-top: 5svh; }
a.button { text-decoration: none; }
.soon .button { padding: 13px 24px; }

/* Tall screens: the phone as big as the page allows; the title stands over the people's shoulders, below the glass. */
@media (max-aspect-ratio: 1/1) { .poster { --ah: min(calc(89svh - 130px), calc(190vw * 3 / 2)); padding: 5svh 0 3svh; }
  .tagline { margin-bottom: 3.6svh; } .action { margin-top: calc(.6svh + 8px); }
  /* Nearly the width of the page: the title is the poster's headline. */
  .title { margin-top: calc(var(--ah) * -0.06); font-size: min(11.8vw, 6.6svh); }
  /* The jacket fades out under the title, so red never sits on red. */
  .art-phone::after { background: radial-gradient(ellipse 80% 86% at 50% 46%, transparent 66%, rgb(0 0 0 / .4) 85%, #000 100%),
    linear-gradient(to bottom, #000 0, transparent 5%, transparent 92%, #000 100%); }
  .art-phone::before { background: radial-gradient(ellipse 72% 70% at 50% 44%, transparent 58%, rgb(0 0 0 / .5) 80%, #000 100%),
    linear-gradient(to bottom, transparent 80%, #000 98%); } }
/* Wide screens: 40px above the line, 40px from the line to the monitor (whose case starts 11.8% down the picture),
   the picture as big as the rest allows, and the title across the people's backs. */
@media (min-aspect-ratio: 1/1) {
  .poster { --ah: min(calc((100svh - 170px) / 0.87), calc(118vw * 2 / 3)); justify-content: flex-start; padding: 40px 0 28px; }
  .tagline { margin-bottom: 0; }
  .art-mac { margin-top: calc(40px - var(--ah) * 0.118); }
  .title { margin-top: calc(var(--ah) * -0.175); }
  .action { margin-top: 2.6svh; }
  /* Once the switch fires, before the title types, the black comes up behind it. */
  .art-mac::before {
    background: linear-gradient(to bottom, transparent 58%, rgb(0 0 0 / .6) 78%, rgb(0 0 0 / .92) 96%, #000 100%);
    /* Fades out to the sides too, so with a fire behind it there are no hard edges. */
    -webkit-mask: linear-gradient(to right, transparent 12%, #000 30%, #000 74%, transparent 90%);
    mask: linear-gradient(to right, transparent 12%, #000 30%, #000 74%, transparent 90%); }
}

/* The detonation (js/explosion.js): the room's windows fill the page behind the scene (the photographs' backgrounds
   are matted out), the glare of them lies over everything, the glass blows in, and the picture stops down to
   silhouettes against them (--expose). The blow shakes the page; then the fire dies to black. */
.poster { position: relative; z-index: 1; }
.boom { position: fixed; inset: 0; z-index: 0; width: 100vw; height: 100vh; pointer-events: none; filter: blur(.6px); }   /* a touch soft: no sampling grain */
.boom-glare { position: fixed; inset: 0; z-index: 2; width: 100vw; height: 100vh; pointer-events: none; mix-blend-mode: screen; filter: blur(22px); opacity: 0; }
.boom-shards { position: fixed; inset: 0; z-index: 3; width: 100vw; height: 100vh; pointer-events: none; }
/* While it burns, the picture's black vignette steps aside (the backgrounds are clear); below the sill is wall. */
.poster.burning .art::after { opacity: 0; }   /* at once: the flash must never show the picture's frame */
.poster.burning .art::before { opacity: 0; }   /* the people are silhouettes; its box would show on the lit wall */
.poster.burning .photo { filter: brightness(var(--expose, 1)); -webkit-mask: linear-gradient(to bottom, #000 78%, transparent 99%); mask: linear-gradient(to bottom, #000 78%, transparent 99%); }
.poster.burning .art-mac .screen { filter: brightness(calc(.9 * var(--expose, 1))) contrast(1.04); }
.poster.burning .art-phone .screen { filter: brightness(var(--expose, 1)); }
.poster.quake { animation: quake 1.2s cubic-bezier(.15, .8, .3, 1); }
@keyframes quake { 0% { transform: none; } 4% { transform: translate(-18px, 10px) rotate(-.6deg); } 10% { transform: translate(16px, -12px) rotate(.5deg); }
  18% { transform: translate(-12px, 7px) rotate(-.35deg); } 28% { transform: translate(9px, -6px) rotate(.25deg); } 40% { transform: translate(-6px, 4px); }
  55% { transform: translate(4px, -2px); } 72% { transform: translate(-2px, 1px); } 100% { transform: none; } }
.poster.burning .title .typed { text-shadow: 0 0 calc(.35em * var(--glow, 0)) rgb(255 170 110 / calc(.8 * var(--glow, 0))); }

/* The Mac console's live controls (js/panel.js): the group knob, its drum counter, and the timing knobs. */
.art-mac .app { container-type: inline-size; }
.knob { z-index: 3; cursor: pointer; outline: none; }
.knob img { position: absolute; display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.knob.dial img { inset: 0; }
.knob:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 50%; }
.knob.dot { border-radius: 50%; }
.time-mark { position: absolute; transform: translate(-50%, -50%); font: 700 0.896cqw/1 "B612", sans-serif; color: rgb(219 219 212 / .86); pointer-events: none; }
.time-mark.on { color: #fff; }
.time-mark.inf { font-size: 1.6cqw; }
.odo { z-index: 3; pointer-events: none; }
.odo-drum { position: absolute; top: 0; height: 100%; overflow: hidden; }
.odo-reel { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; transition: transform .5s cubic-bezier(.45, 0, .2, 1); }
.odo-reel span { flex: none; height: 3.066cqw; display: grid; place-items: center; font: 700 1.887cqw/1 "B612", sans-serif; color: #ededed; }
