/* Omar's site: the studio's corner, filmed (docs/prd/0006 §8). The camera's
   stills fill the screen; the set's picture is a canvas laid on its glass; the
   request over it is the site's own layer, not in the
   room. The camera's grain and time mark show only once it is a camera. */
@font-face { font-family: VT323; src: url('fonts/VT323-Regular.woff2') format('woff2'); font-display: block; }
@font-face { font-family: OmarSans; src: url('fonts/omar-sans.otf') format('opentype'); font-display: swap; }
@font-face { font-family: OmarSerif; src: url('fonts/omar-serif-italic.otf') format('opentype'); font-display: swap; }

:root {
  --mono: 'Space Mono', ui-monospace, Consolas, monospace;
  --console: VT323, ui-monospace, monospace;
  --sans: OmarSans, system-ui, sans-serif;
  --serif: OmarSerif, Georgia, serif;
  --ink: #ece8de;
  --warm: #fca05c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); }
body { overflow: hidden; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; }

/* ------------------------------------------------------------------ the page: the camera inside the tube */
.tv { position: fixed; inset: 0; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.page { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; cursor: pointer; }
body.is-lit .page { opacity: 1; }
.page canvas { display: block; width: 100%; height: 100%; }
/* the tube's lines and curve, faint: it reads as a page, and it is a picture on glass */
.page .lines { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px); }
.page .tube { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(150% 130% at 50% 50%, transparent 62%, rgba(0, 0, 0, .45) 100%); }
body.is-tv .page { display: none; }

/* ------------------------------------------------------------------ the shot: the set, and the room round it */
.shot { position: absolute; inset: 0; visibility: hidden; }
body.is-tv .shot { visibility: visible; }
.frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.frame img { position: absolute; display: block; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.frame .close { left: 0; top: 0; width: 100%; height: 100%; }
/* before the set is switched on its corner is dark: the stills were made with it on, lighting the desk round it.
   Switched on, its light comes up with the tube (docs/prd/0006 S44) */
.frame img { transition: filter .9s cubic-bezier(.3, .7, .3, 1) .15s; }
body.is-set-off .frame img { filter: brightness(.34) saturate(.85); transition: none; }
/* the glass: the picture, its lines, the tube's curve and the room's reflection in it */
.glass { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; border-radius: 30px / 34px; background: #000; }
.glass canvas { display: block; width: 100%; height: 100%; }
.glass .lines { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .34) 0 1px, transparent 1px 3px); }
.glass .tube { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 120% at 50% 48%, transparent 55%, rgba(0, 0, 0, .62) 100%),
    linear-gradient(162deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, 0) 34%),
    radial-gradient(60% 40% at 22% 14%, rgba(255, 255, 255, .06), transparent 70%); }
.glass .glow { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 38px rgba(170, 190, 255, .09); }

/* the camera's lens, as the room's feed has it (studies/machine/machine.js, lens): its corners darken. It shows as
   the camera pulls out of the tube, so the room's first frame is the stills' last */
.lens {
  position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0; mix-blend-mode: multiply;
  background: radial-gradient(ellipse 95% 79.17% at 50% 50%, #fff 0 21%, #e8e8e8 42%, #bebebe 58%, #919191 74%, #7f7f7f 82%, #6b6b6b 100%);
}

/* ------------------------------------------------------------------ the room, loaded behind the picture
   (docs/prd/0006 S27): unseen until it takes the picture up, then it is the page */
.room { position: fixed; inset: 0; z-index: 4; width: 100%; height: 100%; border: 0; background: #000; opacity: 0; pointer-events: none; }
body.is-room .room { opacity: 1; pointer-events: auto; transition: opacity .9s ease; }
body.is-room .grain, body.is-room .cam { opacity: 0 !important; transition: opacity .9s ease; }

/* ------------------------------------------------------------------ the camera: awake from the first frame, grainier
   once its signal is breaking */
.grain {
  position: fixed; inset: -100%; z-index: 5; pointer-events: none; opacity: 0; mix-blend-mode: overlay; transition: opacity 1.4s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .9s steps(5) infinite;
}
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); } 60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } }
body.is-cam .grain { opacity: .045; transition: opacity 2.4s ease; }
body.is-camera .grain { opacity: .09; }
/* the camera's own type, burned into its picture (Omar, 30 Sep: it must feel like a camera): it records, it
   stamps the date and the time, and it has a name. The same on the site and in the room, so the one hands to the other
   without a seam */
.cam {
  position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  font: 400 11px/1 var(--mono); letter-spacing: .14em; font-variant-numeric: tabular-nums;
  color: rgba(238, 242, 236, .82); text-shadow: 0 0 1px rgba(0, 0, 0, .9), 0 0 8px rgba(0, 0, 0, .4);
}
/* one line in the top left corner, tight to the edge, clear of what the picture shows; its name in the bottom right */
.cam p { position: absolute; margin: 0; white-space: nowrap; }
.cam .timemark { word-spacing: .6em; }
.cam-top { left: max(16px, env(safe-area-inset-left)); top: max(13px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 1.5em; }
.cam-rec { display: flex; align-items: center; gap: .6em; min-width: 5.4em; font-weight: 700; }   /* its width fixed: the time lands in one place on both pages */
.cam-rec i { width: 7px; height: 7px; border-radius: 50%; background: #ff3b2f; box-shadow: 0 0 7px rgba(255, 59, 47, .75); animation: cam-rec 1s steps(1) infinite; }
@keyframes cam-rec { 50% { opacity: 0; } }
.cam-name { right: max(16px, env(safe-area-inset-right)); bottom: max(13px, env(safe-area-inset-bottom)); opacity: .8; }
/* opening (docs/prd/0006 S37): the page is empty and black; then the camera opens, an iris widening from the middle
   onto its sensor's grey, which flares and settles to black as its exposure finds the dark room */
.wake { position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0; background: #000; }
/* the camera off: black over everything (docs/prd/0006 S44) */
body.is-off .wake { opacity: 1; }
/* then it comes on: it flickers as its sensor powers up, and the dark room comes out of too much light and out of
   focus, as a camera finds its exposure and its focus */
body.is-opening .wake { animation: cam-wake 1.7s linear forwards; }
@keyframes cam-wake {
  0% { opacity: 1; } 3% { opacity: .45; } 6% { opacity: 1; } 11% { opacity: .62; } 14% { opacity: 1; }
  22% { opacity: .3; } 25% { opacity: .85; } 34% { opacity: .2; } 100% { opacity: 0; }
}
body.is-opening .shot { animation: cam-expose 2.6s cubic-bezier(.2, .6, .25, 1) both; }
@keyframes cam-expose {
  0% { filter: brightness(2.6) contrast(.7) blur(9px); }
  30% { filter: brightness(1.7) contrast(.85) blur(4px); }
  60% { filter: brightness(1.15) contrast(.96) blur(1.2px); }
  100% { filter: none; }
}
body.is-opening .grain { opacity: .12; transition: opacity 1.8s ease; }
/* then its stamp flickers on, and it starts recording */
body.is-cam .cam { opacity: 1; animation: cam-on .7s linear; }
@keyframes cam-on { 0% { opacity: 0; } 12% { opacity: 1; } 22% { opacity: .15; } 34% { opacity: 1; } 44% { opacity: .5; } 56%, 100% { opacity: 1; } }
.cam-rec { opacity: 0; }
body.is-recording .cam-rec { opacity: 1; }
body.in-room .cam { display: none; }
@media (prefers-reduced-motion: reduce) { body.is-cam .cam { animation: none; } .cam-rec i { animation: none; } body.is-opening .wake, body.is-opening .shot { animation: none; } }

/* ------------------------------------------------------------------ the keys: for keyboards and screen readers only
   Nothing sits under the picture (Omar, 30 Sep). The same actions wait here, and show only while they have the focus */
.keys {
  position: fixed; left: 12px; bottom: 12px; z-index: 8; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100vw - 24px);
  clip-path: inset(50%); opacity: 0; font: 400 16px/1 var(--console); letter-spacing: .04em;
}
.keys:focus-within { clip-path: none; opacity: 1; }
.keys button, .keys a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border: 1px solid rgba(236, 232, 222, .4); border-radius: 6px;
  background: rgba(10, 10, 10, .88); color: var(--ink); font: inherit; text-decoration: none; cursor: pointer;
}
.keys button:focus-visible, .keys a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.keys [hidden] { display: none; }
.keys-links { display: contents; }
body.is-tv .keys, body.is-leaving .keys { display: none; }

/* ------------------------------------------------------------------ the request: over the picture, forced in */
.ask {
  position: fixed; z-index: 9; left: 50%; bottom: max(12vh, 90px); width: min(460px, calc(100vw - 32px)); transform: translateX(-50%);
  padding: 20px 22px 18px; border: 1px solid rgba(236, 232, 222, .5); background: rgba(6, 7, 7, .94);
  font: 400 15px/1.45 var(--mono); color: var(--ink);
  box-shadow: -3px 0 0 rgba(255, 50, 50, .55), 3px 0 0 rgba(50, 220, 255, .55);
  opacity: 0; clip-path: inset(0 0 100% 0);
}
.ask.is-in { opacity: 1; clip-path: inset(0 0 0 0); animation: forced .9s steps(9) 1; }
@keyframes forced {
  0% { clip-path: inset(40% 0 52% 0); transform: translate(-54%, 0); }
  20% { clip-path: inset(10% 0 70% 0); transform: translate(-47%, 0); }
  40% { clip-path: inset(62% 0 8% 0); transform: translate(-51%, 0); }
  60% { clip-path: inset(0 0 30% 0); transform: translate(-49%, 0); }
  80% { clip-path: inset(0 0 4% 0); transform: translate(-50.6%, 0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(-50%, 0); }
}
.ask.is-in::after { content: ''; position: absolute; inset: 0; pointer-events: none; animation: jitter 3.2s steps(1) infinite;
  background: linear-gradient(transparent 46%, rgba(236, 232, 222, .08) 46% 49%, transparent 49%); }
@keyframes jitter { 0%, 86% { transform: none; opacity: 0; } 88% { transform: translateX(-6px); opacity: 1; } 92% { transform: translateX(4px); } 96% { opacity: 0; } }
.ask-dev { margin: 0 0 4px; font-size: 12px; letter-spacing: .22em; color: var(--warm); }
.ask h2 { margin: 0 0 6px; font: 700 19px/1.3 var(--mono); letter-spacing: -.01em; text-shadow: -1px 0 rgba(255, 50, 50, .6), 1px 0 rgba(50, 220, 255, .6); }
.ask-state { margin: 0 0 16px; color: rgba(236, 232, 222, .66); font-size: 13px; }
.ask-do { display: flex; gap: 10px; justify-content: flex-end; }
.ask-do button { min-width: 104px; padding: 10px 16px; border: 1px solid rgba(236, 232, 222, .35); background: transparent; color: var(--ink); font: 700 14px/1 var(--mono); cursor: pointer; }
.ask-do .ask-go { border-color: var(--warm); background: var(--warm); color: #111; }
.ask-do button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ask.is-connecting .ask-do { visibility: hidden; }
.ask.is-connecting .ask-state::after { content: ''; animation: dots 1s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ------------------------------------------------------------------ leaving, into the room */
.fade { position: fixed; inset: 0; z-index: 20; background: #000; opacity: 0; pointer-events: none; transition: opacity 1s ease; }
body.is-dark .fade { opacity: 1; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; top: -60px; left: 12px; z-index: 30; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--ink); color: #111; font-size: 13px; }
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ in the room: the set, up close (S29) */
body.in-room .page { transition: none; }
body.in-room #keys-plain, body.in-room .skip, body.in-room .plain, body.in-room .plain-back { display: none !important; }

/* ------------------------------------------------------------------ the plain version */
.plain, .plain-back { display: none; }
body.is-plain { overflow: auto; background: #f4f1e9; color: #242720; }
body.is-plain .tv, body.is-plain .keys, body.is-plain .ask, body.is-plain .grain, body.is-plain .cam { display: none; }
body.is-plain .plain { display: block; }
body.is-plain .plain-back { position: fixed; top: 16px; right: 16px; z-index: 5; display: block; padding: 8px 14px; border: 0; border-radius: 999px; background: #242720; color: #f4f1e9; font-size: 14px; cursor: pointer; }
.plain { max-width: 760px; margin: 0 auto; padding: 72px 20px 96px; }
.plain h1 { margin: 0 0 8px; font-size: 48px; line-height: 1; letter-spacing: -.035em; }
.plain h2 { margin: 56px 0 6px; padding-top: 16px; border-top: 1px solid #d8d3c7; font-size: 28px; letter-spacing: -.02em; }
.plain h3 { margin: 28px 0 2px; font-size: 20px; }
.plain .p-kind, .plain .p-facts, .plain .p-note { margin: 0 0 6px; color: #6d6a60; font-size: 14px; }
.plain .p-line { margin: 6px 0; font-family: var(--serif); font-size: 20px; font-style: italic; }
.plain a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .ask.is-in { animation: none; }
  .ask.is-in::after { animation: none; }
}
