:root {
  color-scheme: dark;
  --backdrop: #101113;
  --ink: #0a0a0a;
  --paper: #fbf9f4;
  --muted: #b6b6b6;
  --bar-height: 49px;
  --reader-width: 860px;
  --panel-gap: clamp(9px, 1.7vw, 19px);
  --scene-gap: clamp(34px, 7vw, 105px);
  font-family: "Instrument Sans", system-ui, sans-serif;
  scroll-padding-block-start: calc(var(--bar-height) + 14px);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--backdrop); color: var(--paper); }
a { color: inherit; text-underline-offset: 4px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #c2daff; outline-offset: 3px; }

.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}
.skip:focus {
  position: fixed;
  z-index: 5;
  inset: 6px auto auto 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 14px;
}

.reader-bar {
  position: sticky;
  inset-block-start: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--bar-height);
  padding-inline: clamp(14px, 4vw, 56px);
  background: var(--backdrop);
}
.wordmark {
  font: italic 19px/1.1 Georgia, serif;
  text-decoration: none;
}
.scene-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  list-style-type: none;
}
.scene-menu summary::-webkit-details-marker { display: none; }
.scene-menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: translateY(-2px) rotate(45deg);
}
.scene-menu[open] summary::after { transform: translateY(1px) rotate(225deg); }
.scene-menu nav {
  position: absolute;
  inset: 100% clamp(8px, 3vw, 48px) auto auto;
  width: min(272px, calc(100vw - 16px));
  max-height: calc(100vh - 60px);
  max-height: calc(100dvh - 60px);
  overflow: auto;
  padding: 5px 12px;
  background: #18191c;
  border: 1px solid #414247;
}
.scene-menu nav a {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding-inline: 10px;
  font-size: 14px;
  text-decoration-color: transparent;
}
.scene-menu nav a:hover, a:hover { text-decoration-color: currentColor; }
.scene-menu nav a[aria-current] { color: #b8d4fc; text-decoration-color: currentColor; }
#reading-progress {
  appearance: none;
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 2px;
  border: 0;
  background: #2c2d30;
  color: #a6b4c7;
}
#reading-progress::-webkit-progress-bar { background: #2c2d30; }
#reading-progress::-webkit-progress-value { background: #a6b4c7; }
#reading-progress::-moz-progress-bar { background: #a6b4c7; }

#reader { width: min(calc(100% - 32px), var(--reader-width)); margin-inline: auto; }
.scene { display: flex; flex-direction: column; gap: var(--panel-gap); }
.scene + .scene { margin-block-start: var(--scene-gap); }
.scene:focus:not(:focus-visible) { outline: none; }
.scene figure { margin: 0; min-inline-size: 0; }
.cover { justify-content: center; align-items: center; padding-block: clamp(12px, 3vw, 32px) 12px; }
.cover-art { width: min(100%, 490px, calc((100svh - 135px) * .666)); }
.cover-art .art { width: 100%; aspect-ratio: 561 / 842; }
.cover-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; }
.cover-actions a, .reader-end a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 13px;
  font-size: 14px;
  color: var(--muted);
}
.cover-actions .primary {
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.cover-actions .primary:hover { background: #fff; text-decoration: underline; }
.inside-cover { width: min(100%, 690px); margin-inline: auto; background: #000; }
.inside-cover:focus { outline: none; }
.inside-cover .art { aspect-ratio: 595 / 842; }
.inside-cover .media { aspect-ratio: 595 / 842; }
.motion .inside-cover { display: block; height: 160svh; }
.motion .inside-cover .media {
  position: sticky;
  top: var(--bar-height);
  width: min(100%, calc((100svh - var(--bar-height) - 16px) * 595 / 842));
  margin-inline: auto;
}
.quote {
  width: min(100%, 690px);
  margin-inline: auto;
  min-height: clamp(350px, 75svh, 780px);
  background: #050505;
  justify-content: center;
}
.scene.quote { margin-block-start: clamp(12px, 2vw, 26px); }
.scene.quote:focus { outline: none; }
blockquote { position: relative; margin: 0; padding-inline: 11%; }
blockquote p {
  margin: 0 0 20px;
  font: italic clamp(20px, 3.2vw, 35px)/1.26 Georgia, serif;
}
.quote blockquote p { color: #fff; }
.motion .quote-ink:not(.quote-vapour) {
  filter: blur(calc(7px * var(--quote-dissolve, 0)));
  opacity: calc(1 - var(--quote-dissolve, 0));
  transform: translateY(calc(-12px * var(--quote-dissolve, 0)));
}
.motion .quote-vapour {
  /* The hidden attribute also keeps these copies out of older cached layouts. */
  display: block !important;
  position: absolute;
  inset-block-start: 0;
  inset-inline: 11%;
  pointer-events: none;
  user-select: none;
}
.motion .quote-vapour-near {
  opacity: var(--quote-near, 0);
  filter: blur(calc(3px + 11px * var(--quote-dissolve, 0)));
  transform: translate(calc(16px * var(--quote-dissolve, 0)), calc(-28px * var(--quote-dissolve, 0)))
    rotate(calc(-3deg * var(--quote-dissolve, 0))) scaleX(calc(1 + .10 * var(--quote-dissolve, 0)));
}
.motion .quote-vapour-far {
  opacity: var(--quote-far, 0);
  filter: blur(calc(8px + 14px * var(--quote-dissolve, 0)));
  transform: translate(calc(-22px * var(--quote-dissolve, 0)), calc(-57px * var(--quote-dissolve, 0)))
    rotate(calc(4deg * var(--quote-dissolve, 0))) scaleX(calc(1 + .15 * var(--quote-dissolve, 0)));
}
blockquote cite {
  display: inline-block;
  position: relative;
  padding-block-start: 15px;
  color: #c5c5c7;
  font: normal 10px/1.2 "Instrument Sans", system-ui, sans-serif;
  letter-spacing: .34em;
  text-transform: uppercase;
}
blockquote cite::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 29px;
  border-block-start: 1px solid #8e8e91;
}

.panel { position: relative; container-type: inline-size; background: #000; }
.media { position: relative; z-index: 0; overflow: hidden; aspect-ratio: var(--ratio); }
.art { display: block; width: 100%; height: auto; }
.media > .art { height: 100%; object-fit: cover; }
.illustration-motion { display: none; }
.motion .illustration-motion {
  position: absolute;
  display: block;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.captions {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.caption, .closing-caption {
  --inset: max(5px, var(--offset-x));
  position: absolute;
  width: max-content;
  max-width: min(calc(100% - 2 * var(--inset)), max(16rem, calc(var(--cap-width) + 2cqw)));
  margin: 0;
  padding: clamp(5px, .9cqw, 9px) clamp(7px, 1.3cqw, 13px);
  background: var(--paper);
  border: 1px solid #101010;
  color: var(--ink);
  font: italic 700 clamp(14px, 2.03cqw, 18px)/1.18 "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  text-wrap: pretty;
  overflow-wrap: break-word;
  pointer-events: auto;
}
.caption.top { top: max(5px, var(--offset-y)); }
.caption.bottom { bottom: max(5px, var(--offset-y)); }
.caption.left { left: var(--inset); }
.caption.right { right: var(--inset); }

.pair, .triptych { display: grid; gap: var(--panel-gap); }
.triptych { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.triptych .caption {
  --inset: max(3px, var(--offset-x));
  padding-inline: clamp(4px, 2.2cqw, 8px);
  font-size: clamp(11px, 5.5cqw, 17px);
}
.rescue-pair { grid-template-columns: minmax(0, 202fr) minmax(0, 333fr); }
.van-pair { grid-template-columns: minmax(0, 210fr) minmax(0, 325fr); }
.memories { grid-template-columns: minmax(0, 322fr) minmax(0, 213fr); }

.rock-chute { gap: 0; }
.rock-chute .panel + .panel { margin-block-start: clamp(7px, 1.8vw, 18px); }
.rock-chute .panel:nth-of-type(n+5) { margin-block-start: clamp(5px, 1vw, 10px); }
.rock-chute .panel:nth-of-type(n+7) { margin-block-start: 4px; }
.rock-chute .panel.last-slide { margin-block-start: 2px; }
.scene.underwater { margin-block-start: clamp(17px, 4svh, 40px); }
.scene.first-awakening, .scene.second-awakening { margin-block-start: clamp(32px, 10svh, 100px); }
.first-awakening > .panel:nth-of-type(3) { margin-block-start: clamp(15px, 4svh, 38px); }
.moons {
  position: relative;
  align-self: center;
  width: min(100%, 690px);
  overflow: hidden;
  aspect-ratio: 595 / 842;
  background: #0a1017;
}
.moons > .art { height: 100%; object-fit: cover; }
.moons .panel {
  position: absolute;
  width: 80.168%;
  border: 1px solid #5b7084;
}
.moon-open { top: 19.596%; left: 13.782%; }
.moon-shut { top: 58.076%; left: 3.361%; }
.moons .caption { font-size: clamp(12px, 2.75cqw, 16px); }
.time-slices { align-self: center; width: min(100%, 760px); }
.transport .caption { font-size: clamp(12px, 2.03cqw, 18px); }

.shadow-stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--panel-gap); }
.shadow-frame .caption { font-size: clamp(13px, 2.8cqw, 17px); }
.shadow-frame { min-inline-size: 0; }
.motion .shadow-flow {
  height: 390vh;
  height: 390svh;
  position: relative;
}
.motion .shadow-stage {
  position: sticky;
  inset-block-start: var(--bar-height);
  height: calc(100vh - var(--bar-height));
  height: calc(100svh - var(--bar-height));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  width: min(100%, calc((100svh - var(--bar-height) - 36px) * 1.312));
  margin-inline: auto;
  isolation: isolate;
}
.motion .shadow-frame {
  grid-area: 1 / 1;
  opacity: 0;
}
.motion .shadow-frame:first-child { opacity: 1; }
.motion .shadow-frame .caption { font-size: clamp(14px, 2.1cqw, 18px); }
.motion .shadow-frame:not(.caption-active) .captions { opacity: 0; }
.motion .shadow-flow:not([data-stage-ready]) .shadow-frame:first-child .captions { opacity: 1; }

.motion .panel:is([data-reveal="awakening"], [data-reveal="tower"], [data-reveal="xray"]) > .media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: #000;
  opacity: var(--veil, 0);
}
.motion [data-reveal="tower"] > .media::after {
  background: linear-gradient(100deg, transparent 28%, #141418e8 74%, #111 100%);
}
.motion [data-reveal="xray"] > .media::after {
  background: radial-gradient(ellipse at 62% 51%, #020202e8 9%, #03030372 59%, transparent 100%);
}

.motion .moons > .art, .motion .moons .media > .art {
  filter: brightness(var(--moon-light, 1));
}

.motion [data-reveal="chute"] .art {
  transform-origin: 34% 48%;
  transform: scale(var(--chute-scale, 1));
}
.motion [data-reveal="watch"] > .media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  backdrop-filter: blur(var(--watch-blur, 0px));
  mask-image: radial-gradient(ellipse 32% 42% at 38% 39%, #000 42%, transparent 100%);
}
.portrait-mattes { display: none; }
.motion .portrait-mattes {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.portrait-mattes span {
  position: absolute;
  inset-block: 0;
  background: #080809;
  opacity: calc(.86 * (1 - clamp(0, (var(--portrait-progress, 1) - var(--slice-start)) * 3.6, 1)));
}

.closing { background: #000; }
.closing-art {
  position: relative;
  container-type: inline-size;
  width: min(100%, 690px);
  margin-inline: auto;
  aspect-ratio: 595 / 842;
}
.circle {
  position: absolute;
  aspect-ratio: 1;
  border-radius: 50%;
}
.closing-caption {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 28px);
}
.signoff {
  position: absolute;
  inset: 84% 0 auto;
  margin: 0;
  text-align: center;
  font: italic clamp(19px, 4cqw, 32px)/1.18 Georgia, serif;
}
.reader-end { text-align: center; padding-block: 15px 40px; }

@media (max-width: 700px) {
  #reader { width: min(calc(100% - 20px), var(--reader-width)); }
  .pair, .shadow-stage { grid-template-columns: minmax(0, 1fr); }
  .rescue-pair { gap: clamp(17px, 6vw, 30px); }
  .reach .media { aspect-ratio: auto; }
  .reach .art {
    width: 74%;
    height: auto;
    aspect-ratio: var(--ratio);
    margin-inline-start: auto;
  }
  .memories .panel:last-child { width: min(78%, 345px); align-self: start; justify-self: end; }
  .mobile-band { display: flex; flex-direction: column; }
  .mobile-band .captions {
    position: relative;
    padding: 0 7px;
  }
  .mobile-band .caption { position: static; max-width: 100%; }
  .mobile-band.band-top .captions { order: -1; margin-block-end: -7px; }
  .mobile-band.band-bottom .captions { margin-block-start: -7px; }
  .mobile-band .caption.right { margin-inline-start: auto; }
}
@media (max-width: 370px) {
  .transport .caption { font-size: 11.5px; padding-block: 3px; }
  .moons .caption { padding: 4px 5px; font-size: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; }
}
