@font-face {
  font-family: VGA;
  src: url(media/PxPlus_IBM_VGA_8x16.ttf) format("truetype");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #040504;
  --paper: #d6d9cc;
  --line: #5c6366;
  --green: #77de8a;
  color: var(--paper);
  background: var(--ink);
  font: 22px/1.24 VGA, monospace;
}
* { box-sizing: border-box }
body, figure, blockquote, h1, h2 { margin: 0 }
a { color: inherit; text-underline-offset: .2em }
a:hover { color: var(--green) }
:focus-visible { outline: 3px solid #ffdf92; outline-offset: 4px }
.shell { width: min(1260px, 92%); margin-inline: auto }
header, .readout { background: #0e100f; border-block: 1px solid var(--line) }
.bar, nav, figcaption, .closing { display: flex; align-items: center; justify-content: space-between; gap: 1em }
.bar { min-height: 54px }
.bar, figcaption, .play, .wishlist, .pending { font: 20px/1.15 VGA, monospace }
header a, footer>a { text-decoration: none; padding-block: 10px }
header .bar>a { color: var(--green); text-transform: uppercase }
nav { gap: 1.4em }

body {
  --grain: url(media/industrial-grain.png);
  --plate: linear-gradient(110deg,#fff4,#0001), var(--grain);
  --edge: inset 2px 2px #d7d9c177, inset -3px -3px #050605cf;
  background: repeating-linear-gradient(0deg,#0e120f 0 2px,#090c0a 2px 5px);
}
.hero { isolation: isolate; position: relative; background: #030704; }
.hero::before { content: ""; position: absolute; inset: 0 0 0 25%; z-index: -1; background: linear-gradient(90deg,#030704,transparent 40%), url(media/librarian.webp) center / cover no-repeat }
.hero-copy { padding: clamp(32px,4vw,62px) clamp(24px,5vw,78px) 76px; width: min(56%,630px) }
h1 { align-self: end }
h1 img { width: clamp(180px,19vw,270px); display: block; image-rendering: pixelated }
.monitor, .screens canvas, .screens .loop, .still { border: 4px ridge #696e68; background: #070808 }
.monitor { position: relative; width: 100%; margin: 0 auto; box-shadow: 0 6px 24px #0009 }
video { width: 100%; display: block; aspect-ratio: 16/9; background: black }
figcaption { padding: 7px 10px; background: #191c19; border-top: 1px solid var(--line); font-size: 18px }
figcaption span { color: var(--green) }
.play { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-65%); border: 2px outset #bdf0bc; background: var(--green); color: #071108; padding: 10px 18px; cursor: pointer }
.monitor.ready .play { display: block }
.pitch { margin: 16px 0; max-width: 41ch }
.wishlist, .pending { width: fit-content; align-self: start }
.pending { color: #b0beac; font-size: 18px }
.wishlist { display: inline-block; text-decoration: none; background: var(--green); color: var(--ink); border: 2px outset #cbefc8; padding: 10px 16px }
.wishlist:hover { background: #bdf0bc; color: var(--ink) }
.readout { color: var(--green); padding: 20px 0 }
blockquote { font: clamp(20px,2vw,28px)/1.18 VGA, monospace }
blockquote::before { content: "> "; color: #d7ead2 }
.story { padding: clamp(15px,2vw,36px); margin-block: 34px; border: 2px ridge #8c9288; background: #080b09bd }
article { max-width: 860px; margin: 0 auto 48px }
h2 { font: clamp(30px,3vw,48px)/1.02 VGA, monospace; text-wrap: balance }
article p { margin: 14px 0 0 }
.still { width: 100%; height: auto; margin-top: 20px; display: block }
.screens { display: none }
.closing { background: #080b09f5; padding-inline: 22px; border-block: 1px solid var(--line); padding-block: 36px; color: var(--green) }
footer { background: #080b09f5; padding-inline: 20px; padding-block: 18px 0; color: #aab0a5 }
footer small { font: 16px/1.25 VGA, monospace }
.skip { position: absolute; z-index: 2; transform: translateY(-200%); padding: 8px; background: black }
.skip:focus { transform: none }
.story.enhanced { display: grid; grid-template-areas: "display text"; grid-template-columns: minmax(0,1.45fr) minmax(0,1fr); gap: clamp(12px,2vw,30px) }
.enhanced .screens { grid-area: display; display: block; position: sticky; top: max(20px, calc(48vh - 15vw)); align-self: start }
.screens canvas { width: 100%; height: auto; display: block }
.enhanced article { min-height: 64vh; display: flex; flex-direction: column; justify-content: center; margin: 0; padding: 22px clamp(16px,2vw,32px); background: #0b100d; border-block-start: 3px double #687663 }
.enhanced .still { display: none }
@media (max-width: 740px) {
   .hero::before { inset: 0 0 auto; height: 230px; background: linear-gradient(0deg,#030704,transparent 38%),linear-gradient(90deg,#030704aa,transparent 50%),url(media/librarian.webp) 65% center / cover }
  .hero-copy { width: 100%; padding: 75px 18px 62px }
  .hero-copy .pitch { margin-top: 60px }
  h1 img { width: 86px }

  .pitch { max-width: none }
  .story { padding-block: 24px }
  .story.enhanced { display: block; padding: 0 }
  .enhanced article { padding: 24px 0; min-height: 62vh; justify-content: flex-start }
  .closing, footer.bar { align-items: flex-start; flex-direction: column }
}
@media (max-width: 740px) {
  .opening { display: grid; isolation: isolate; margin: auto }
  .opening .hero { display: grid; grid-template-columns: minmax(0, 1fr) }
  .opening .hero-copy { display: contents }
  .opening .hero::before { content: none }
  .opening h1 { grid-area: 1/1; display: flex; align-items: center; padding: 16px; min-height: 210px; background: linear-gradient(90deg,#020602 4%,transparent 53%),url(media/librarian.webp) right center / auto 100% no-repeat }
  .opening h1 img { width: clamp(90px,24vw,145px) }
  .opening .monitor { grid-area: auto; width: 100% }
  .opening .pitch { grid-area: 3/1; margin: 20px 0 12px }
  .opening .cta { grid-area: 4/1; padding-bottom: 22px }
}

/* The casing follows the page openings. Only its material comes from the zone skins. */
header, .opening, .readout, .story, .closing, footer {
  background-image: var(--plate);
  background-size: auto,100vw 100vh;
  box-shadow: var(--edge);
}
header, .readout, .story, .closing, footer {
  width: min(1416px,98%); margin-inline: auto;
}
header { padding: 7px clamp(12px,2vw,36px) }
header .bar, footer.bar {
  min-height: 40px; background-color: #101511;
  border: 2px inset #5b665c; padding-inline: 16px;
}
.opening {
  width: 100%;
  margin-inline: auto;
}
@media (min-width: 1921px) and (min-aspect-ratio: 2/1) {
  .console-frame { max-width: max(1920px, 200vh) }
}
.opening .hero { width: 100%; max-width: 1320px; border: 3px inset #555d50 }
.hero-copy { max-width: 600px }
.pitch { max-width: 36ch; text-shadow: 1px 2px #020502 }
.monitor { padding: 8px; background-image: var(--plate); background-size: auto,100vw 100vh; border: 3px outset #777c68; margin-bottom: 0 }
video, .screens canvas, .screens .loop { border: 3px inset #5b6658 }
.readout { padding: 10px clamp(12px,2vw,30px) }
.readout blockquote {
  width: 100%; padding: 12px 18px; border: 3px inset #424d42;
  background: #07100b; color: #9be5a4;
}
.story { margin-block: 12px; padding: clamp(14px,2.6vw,40px); position: relative }
.chapters { grid-area: text; min-width: 0; border: 3px inset #626857; background: #0a100c }
.enhanced .screens {
  padding: clamp(9px,1.4vw,22px); background-image: var(--plate); background-size: auto,100vw 100vh;
  box-shadow: inset 1px 1px #ecedc080,inset -2px -2px #0a0d09,0 0 0 2px #262b20;
}
.enhanced .screens::after, .closing::before {
  content: ""; display: block; margin: 9px 0 0 auto; width: 54px; height: 7px;
  background: repeating-linear-gradient(115deg,#0d100c 0 3px,#c3c1aa80 4px,#555744 5px 7px);
}
.enhanced article { padding: 28px clamp(18px,3vw,44px); overflow-wrap: break-word }
article h2 { color: #acedb4 }
article p { max-width: 57ch }
article p:last-child { color: #c2d0ba }
.closing { position: relative; padding: 24px clamp(20px,4vw,60px); background-color: #0c1510; background-blend-mode: multiply; }
.closing::before { position: absolute; right: 12px; bottom: 8px }
footer.bar { margin-block: 8px; padding: 12px 22px; background-image: none }
@media (max-width: 740px) {
  .opening .pitch, .opening .cta { margin: 0; padding: 12px 14px; background: #0b100d }
  .opening .pitch { margin-top: 0; max-width: none }
  .opening .cta { padding-top: 0 }
  .story:not(.enhanced) article { padding: 14px }
}

/* Three game pixels of casing at the 640-wide reference size. */
body {
  --bezel: clamp(9px, 1.15vw, 18px);
  --well: linear-gradient(#030605a8,#030605bd), var(--grain);
  --lip: inset 2px 3px #020302cc, inset -1px -2px #dadfc173;
}
header, .readout, .story, .monitor, .enhanced .screens { padding: var(--bezel) }
.opening .hero { max-width: none }
.story { margin-block: var(--bezel); background-image: var(--well); }
.story .chapters { border: 0; background: none }
.story article { border: 0; background: transparent; padding: 0; }
.chapter-well, header .bar, .readout blockquote, figcaption, .closing {
  background-image: var(--well); background-size: auto,100vw 100vh;
  box-shadow: var(--lip); border: 1px solid #30372e;
}
.chapter-well { padding: clamp(18px,2.4vw,36px); width: 100%; }
.story:not(.enhanced) article { padding: var(--bezel) }
.enhanced .screens { z-index: 1 }
.enhanced .screens::after { display: none }
@media (min-width: 741px) {
  .story.enhanced { grid-template: "stage" auto / 1fr; gap: 0; }
  .enhanced .screens, .enhanced .chapters { grid-area: stage }
  .enhanced .screens { width: calc(54% - var(--bezel)); justify-self: start; }
  .enhanced.reversed .screens { justify-self: end; }
  .enhanced article {
    /* Leave half a display above and below the text so it clears the
       sticky image on both sides of a zone boundary. */
    padding-block: min(17vw,246px); justify-content: center;
    width: 46%; margin-left: auto; margin-right: 0;
  }
  .enhanced article.copy-left { margin-right: auto; margin-left: 0; }
}

header,.opening,.readout,.story,.closing,.monitor,.enhanced .screens,
.chapter-well,header .bar,.readout blockquote,figcaption {
  background-attachment: scroll,fixed;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.hero-copy { padding-block: clamp(42px,5vw,78px) }
/* ReadoutTooltip: a one-texel rule, inverted title strip and console ground. */
.chapter-well {
  padding: 0;
  background: var(--ink);
  border: 2px solid var(--line);
  box-shadow: none;
}
.chapter-well h2 {
  background: var(--paper); color: var(--ink);
  padding: .22em .5em; font: 1.2rem/1.08 VGA, monospace;
  text-transform: uppercase; text-wrap: wrap;
}
.chapter-well h2::before { content: "> " }
.chapter-well p:last-child {
  padding: .65em .8em .8em; margin: 0;
  color: #afc5b2; font-size: 1rem; line-height: 1.35;
}
.chapter-well .still { margin: 0; border: 0 }
.opening { background-image: var(--well); }
.hero::before { box-shadow: inset 0 0 0 100vmax #02090436 }
.pitch, .cta { position: relative; }
@media (max-width:740px) {
  .opening h1 { box-shadow: inset 0 0 0 100vmax #02090442 }
  .opening h1 img { position: relative }
  .opening .pitch { grid-row: 2 }
  .opening .cta { grid-row: 3 }

  .enhanced article { min-height: auto; padding-block: clamp(32px,12vh,96px) }
  footer.bar { flex-direction: row; align-items: center; flex-wrap: wrap }
}
@media (forced-colors: active) {
  .chapter-well { border-color: CanvasText }
  .chapter-well h2 { border-bottom: 1px solid CanvasText }
}
.screens.swap-in { display: none }
@media (min-width:741px) {
  .story.enhanced .swap-in.visible { display: block; justify-self: end }
  .story.enhanced.reversed .swap-in.visible { justify-self: start }
}
@media (max-width:740px) {

  .opening h1 { min-height: 225px }
}
.screens { mask-size: 100% 100%; mask-repeat: no-repeat }

/* Let the last dissolve finish with its display still pinned and the
   matching readout visible, even when the rest of the page is short. */
@media (max-width: 740px) {
  .story.enhanced .screens {
    top: 0;
    padding: 0;
    background: var(--ink);
    box-shadow: none;
  }
  .story.enhanced .screens :is(canvas, .loop) { border: 0 }
  .story.enhanced .chapters { container-type: inline-size }
  .story.enhanced article { padding-inline: var(--bezel) }
  .story.enhanced article:last-child {
    justify-content: flex-end;
    padding-bottom: clamp(18px,4vh,40px);
    min-height: calc(100vh - 56.25vw + 96px);
    min-height: calc(100dvh - 56.25cqw + 96px);
  }
}


/* A single casing supplies all outer rails and inter-panel dividers. */
.console-frame, .console-frame > main, .opening {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--bezel);
}
.console-frame {
  margin-inline: auto;
  padding: var(--bezel);
  border: 2px solid;
  border-color: #c4c3aa #38392d #25271e #929582;
  background-image: var(--plate);
  background-attachment: scroll, fixed;
  background-size: auto, 100vw 100vh;
  image-rendering: pixelated;
  box-shadow: var(--edge);
}
.console-frame :is(.opening, .readout) {
  border: 0;
  padding: 0;
  background: none;
  box-shadow: none;
}
.console-frame :is(.readout, .story, .closing, footer.bar) {
  width: 100%;
  margin: 0;
}
.opening .monitor {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.hero-bezel .hero, .console-frame .story {
  border: 3px solid;
  border-color: #191c15 #8d907d #afb09a #36392d;
}
.hero-bezel .hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 3px 4px #0009, inset 5px 7px #0004;
}

/* Canvas supplies the dissolve. The native image plays the console loop at rest. */
.screens .loop { display: none; width: 100%; height: auto; aspect-ratio: 16 / 9 }
.screens.playing .loop { display: block }
.screens.playing canvas { display: none }
