:root {
  --ink: #10100f;
  --paper: #f3efde;
  --sky: #9fddf1;
  --acid: #e8ff3e;
  --orange: #ff5b21;
  --red: #c92819;
  --blue: #2038a7;
  --depth-progress: 0;
}

* {
  box-sizing: border-box;
}

html {
  background: #10100f;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--paper);
  background: #10100f;
  font-family: "Helvetica Neue", Arial, sans-serif;
  overflow-x: clip;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 12px 16px;
  color: #10100f;
  background: var(--acid);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.depth-gauge {
  position: fixed;
  z-index: 60;
  inset: 22px 22px auto auto;
  display: grid;
  grid-template-columns: 3px auto;
  gap: 0 12px;
  align-items: stretch;
  color: var(--paper);
  mix-blend-mode: difference;
  pointer-events: none;
}

.gauge-rule {
  position: relative;
  grid-row: 1 / 3;
  width: 3px;
  height: 74px;
  background: rgb(255 255 255 / 25%);
}

.gauge-rule span {
  position: absolute;
  inset: 0 0 auto;
  height: calc(var(--depth-progress) * 100%);
  background: currentColor;
}

.gauge-copy {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

#depth-number {
  min-width: 3ch;
  font-size: clamp(23px, 3vw, 40px);
  font-weight: 900;
  line-height: .86;
  letter-spacing: -.07em;
}

.unit,
.layer-name {
  font: 700 10px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.layer-name {
  max-width: 18ch;
  margin-top: 8px;
}

.chapter {
  position: relative;
  height: 205vh;
}

.surface {
  height: 175vh;
}

.crust,
.lithosphere {
  height: 180vh;
}

.upper-mantle,
.transition {
  height: 185vh;
}

.lower-mantle {
  height: 215vh;
}

.d-double-prime,
.outer-core {
  height: 235vh;
}

.end-chapter {
  height: 118vh;
}

.scene-frame {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100svh;
  min-height: 590px;
  overflow: hidden;
  isolation: isolate;
}

.depth-card {
  position: absolute;
  z-index: 12;
  top: clamp(70px, 10vh, 110px);
  left: clamp(24px, 8vw, 120px);
  width: min(620px, 80vw);
}

.depth-card .chapter-number {
  margin: 0 0 20px;
  font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .2em;
}

.depth-card h2 {
  margin: 0 0 24px;
  font-size: clamp(50px, 8.3vw, 126px);
  font-weight: 900;
  line-height: .81;
  letter-spacing: -.085em;
}

.depth-card p:last-child {
  max-width: 48ch;
  margin: 0;
  font: 650 clamp(15px, 1.45vw, 20px)/1.35 "Helvetica Neue", Arial, sans-serif;
}

.dark-card {
  color: #fff9e8;
}

.sky {
  position: absolute;
  inset: 0 0 54%;
  background: var(--sky);
  border-bottom: 6px solid var(--ink);
}

.sun {
  position: absolute;
  top: 11%;
  right: 10%;
  width: min(14vw, 160px);
  aspect-ratio: 1;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
}

.cloud {
  position: absolute;
  width: 190px;
  height: 28px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: -4px;
  border: 4px solid var(--ink);
  border-radius: 50% 50% 0 0;
  background: var(--paper);
}

.cloud::before {
  left: 27px;
  width: 62px;
  height: 52px;
}

.cloud::after {
  right: 25px;
  width: 76px;
  height: 69px;
}

.cloud-a {
  top: 13%;
  left: 7%;
}

.cloud-b {
  top: 27%;
  right: 25%;
  transform: scale(.68);
}

.street {
  position: absolute;
  inset: auto 0 0;
  height: 36%;
  background: #ece8d5;
  border-top: 5px solid var(--ink);
}

.street::after {
  content: "";
  position: absolute;
  inset: auto 0 12%;
  height: 7px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 55px, transparent 55px 94px);
}

.house {
  position: absolute;
  bottom: 30%;
  left: 12%;
  width: 110px;
  height: 65px;
  border: 4px solid var(--ink);
  background: var(--orange);
}

.house::before {
  content: "";
  position: absolute;
  left: -13px;
  top: -52px;
  width: 92px;
  height: 92px;
  border-top: 4px solid var(--ink);
  border-left: 4px solid var(--ink);
  background: var(--red);
  transform: rotate(45deg);
  z-index: -1;
}

.house span {
  position: absolute;
  right: 18px;
  bottom: 0;
  width: 24px;
  height: 42px;
  border: 4px solid var(--ink);
  border-bottom: 0;
  background: var(--acid);
}

.tree {
  position: absolute;
  right: 19%;
  bottom: 12%;
  width: 22px;
  height: 92px;
  border: 4px solid var(--ink);
  background: #a66c33;
}

.tree span {
  position: absolute;
  left: 50%;
  bottom: 56px;
  width: 120px;
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: 48% 52% 46% 54%;
  background: #2fa664;
  transform: translateX(-50%);
}

.hydrant {
  position: absolute;
  left: 37%;
  bottom: 20%;
  width: 22px;
  height: 46px;
  border: 4px solid var(--ink);
  border-radius: 5px 5px 0 0;
  background: var(--orange);
}

.bus-stop {
  position: absolute;
  right: 7%;
  bottom: 24%;
  padding: 5px;
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--acid);
  font: 900 9px/1 ui-monospace, monospace;
}

.bus-stop::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 3px;
  height: 55px;
  background: var(--ink);
}

.surface-earth {
  position: absolute;
  inset: 46% 0 0;
  background:
    radial-gradient(circle at 14% 20%, #e1c36f 0 3px, transparent 4px),
    radial-gradient(circle at 76% 40%, #ead483 0 5px, transparent 6px),
    #ba8d4f;
}

.surface-earth::after {
  content: "";
  position: absolute;
  inset: 22% 0 0;
  background:
    repeating-linear-gradient(8deg, transparent 0 36px, rgb(55 34 19 / 18%) 37px 40px),
    #69482d;
  clip-path: polygon(0 12%, 9% 5%, 21% 15%, 32% 7%, 46% 16%, 59% 2%, 71% 13%, 85% 6%, 100% 12%, 100% 100%, 0 100%);
}

.roots {
  position: absolute;
  z-index: 2;
  top: 0;
  width: 4px;
  height: 42%;
  background: var(--ink);
  transform-origin: top;
}

.roots::before,
.roots::after {
  content: "";
  position: absolute;
  top: 34%;
  width: 3px;
  height: 70%;
  background: var(--ink);
  transform-origin: top;
}

.roots::before {
  transform: rotate(28deg);
}

.roots::after {
  transform: rotate(-36deg);
}

.roots-a {
  right: 19%;
  transform: rotate(6deg);
}

.roots-b {
  left: 16%;
  height: 29%;
  transform: rotate(-9deg);
}

.buried {
  position: absolute;
  z-index: 3;
  color: var(--ink);
}

.coin {
  left: 40%;
  top: 33%;
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #e4c24f;
  font: 800 9px/1 monospace;
  transform: rotate(18deg);
}

.key {
  right: 33%;
  top: 52%;
  font: 900 52px/1 serif;
  transform: rotate(-32deg);
}

.opening {
  position: absolute;
  z-index: 10;
  top: clamp(70px, 10vh, 105px);
  left: clamp(22px, 5.5vw, 85px);
  width: min(920px, 88vw);
  color: var(--ink);
}

.eyebrow {
  margin: 0 0 18px;
  font: 900 clamp(9px, 1vw, 13px)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .2em;
}

.opening h1 {
  margin: 0;
  font-size: clamp(59px, 10.3vw, 162px);
  font-weight: 900;
  line-height: .72;
  letter-spacing: -.09em;
  text-transform: uppercase;
}

.opening h1 em {
  position: relative;
  display: inline-block;
  margin-top: .13em;
  padding: .08em .12em .11em;
  color: var(--acid);
  background: var(--ink);
  font-style: normal;
  font-size: .57em;
  letter-spacing: -.06em;
  transform: rotate(-1deg);
}

.dek {
  width: min(46ch, 80vw);
  margin: 27px 0 0;
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 700;
  line-height: 1.25;
}

.scroll-cue {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  font: 900 10px/1 ui-monospace, monospace;
  letter-spacing: .15em;
}

.scroll-cue i {
  width: 56px;
  height: 2px;
  background: var(--ink);
  transform: rotate(90deg);
  transform-origin: left;
  animation: cue 1.4s ease-in-out infinite;
}

@keyframes cue {
  50% { transform: translateY(22px) rotate(90deg); }
}

.crust .scene-frame {
  color: #17120d;
  background:
    linear-gradient(7deg, transparent 0 55%, rgb(70 39 20 / 35%) 56% 58%, transparent 59%),
    repeating-linear-gradient(2deg, #e2b95d 0 78px, #9e6235 79px 84px, #cb8846 85px 152px);
}

.strata {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(172deg, transparent 0 70px, rgb(36 20 12 / 25%) 71px 75px);
}

.root-web {
  position: absolute;
  left: 9%;
  top: -10%;
  width: 28%;
  height: 72%;
  border-left: 8px solid #322011;
  border-bottom: 5px solid #322011;
  border-radius: 0 0 0 80%;
  transform: skewX(-18deg);
}

.root-web::before,
.root-web::after {
  content: "";
  position: absolute;
  border-left: 4px solid #322011;
  border-bottom: 4px solid #322011;
  border-radius: 0 0 0 100%;
}

.root-web::before {
  inset: 18% auto auto 18%;
  width: 70%;
  height: 55%;
}

.root-web::after {
  inset: 36% auto auto 45%;
  width: 70%;
  height: 48%;
}

.pipe {
  position: absolute;
  border: 16px solid #604c3e;
  border-top: 0;
  border-radius: 0 0 50px 50px;
}

.pipe-a {
  left: 0;
  bottom: 13%;
  width: 42%;
  height: 24%;
}

.pipe-b {
  right: -5%;
  bottom: 6%;
  width: 34%;
  height: 40%;
  border-color: #315d68;
}

.subway {
  position: absolute;
  right: 4%;
  top: 20%;
  width: min(47vw, 620px);
  height: 130px;
}

.subway .tunnel {
  position: absolute;
  inset: 0;
  border: 17px solid #281c15;
  border-radius: 70px;
  background: #0d0d0c;
}

.train {
  position: absolute;
  inset: 34px 18px 27px 62px;
  display: flex;
  gap: 12px;
  padding: 13px;
  border: 4px solid #17120d;
  border-radius: 18px 9px 9px 18px;
  background: var(--acid);
  transform: translateX(calc(var(--local-progress) * -12%));
}

.train i {
  flex: 1;
  border: 3px solid #17120d;
  background: var(--sky);
}

.light-card {
  top: 12%;
  max-width: 560px;
}

.lost-object {
  position: absolute;
  z-index: 5;
  padding: 10px;
  border: 4px solid #17120d;
  background: var(--paper);
  box-shadow: 10px 10px 0 rgb(33 20 11 / 22%);
  font: 800 9px/1.25 ui-monospace, monospace;
}

.lost-phone {
  right: 17%;
  bottom: 17%;
  width: 90px;
  height: 150px;
  border-radius: 12px;
  color: var(--acid);
  background: #17120d;
  transform: rotate(14deg);
}

.lost-phone::before {
  content: "";
  display: block;
  width: 33px;
  height: 4px;
  margin: 0 auto 48px;
  border-radius: 9px;
  background: #777;
}

.time-capsule {
  left: 39%;
  bottom: 9%;
  display: flex;
  flex-direction: column;
  width: 170px;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.distance-note {
  position: absolute;
  z-index: 5;
  right: 5%;
  bottom: 6%;
  margin: 0;
  padding-left: 10px;
  border-left: 5px solid currentColor;
  font: 900 10px/1.35 ui-monospace, monospace;
  text-transform: uppercase;
}

.lithosphere .scene-frame {
  color: #f8f3db;
  background:
    radial-gradient(circle at 17% 29%, #637188 0 1px, transparent 2px),
    radial-gradient(circle at 78% 61%, #637188 0 2px, transparent 3px),
    #2e3444;
}

.fault {
  position: absolute;
  inset: -15% auto;
  width: 48%;
  border: 14px solid #111522;
  background:
    repeating-linear-gradient(162deg, #687183 0 36px, #3e4657 37px 40px, #768091 41px 72px);
}

.fault-left {
  left: -13%;
  transform: rotate(8deg);
}

.fault-right {
  right: -20%;
  transform: rotate(-15deg);
}

.crystal {
  position: absolute;
  clip-path: polygon(50% 0, 100% 32%, 77% 100%, 20% 88%, 0 30%);
  background: var(--acid);
  box-shadow: inset 18px 0 rgb(255 255 255 / 45%);
}

.c1 { right: 22%; top: 19%; width: 80px; height: 160px; transform: rotate(17deg); }
.c2 { right: 9%; bottom: 9%; width: 45px; height: 90px; transform: rotate(-25deg); background: #8de7ff; }
.c3 { left: 17%; bottom: 13%; width: 55px; height: 110px; transform: rotate(43deg); background: #ff7459; }

.cache-fossil {
  position: absolute;
  right: 9%;
  bottom: 13%;
  width: min(480px, 56vw);
  transform: rotate(-4deg);
}

.fossil-label {
  display: block;
  margin-bottom: 9px;
  font: 800 9px/1 monospace;
  letter-spacing: .17em;
}

.fossil-window {
  position: relative;
  height: 190px;
  padding: 23px;
  border: 7px solid #171b28;
  border-radius: 45% 55% 47% 53%;
  color: #212534;
  background: #8a91a0;
  box-shadow: inset 0 0 0 11px rgb(241 232 201 / 16%);
}

.fossil-window b {
  font: 900 15px/1.2 ui-monospace, monospace;
}

.fossil-window i {
  position: absolute;
  bottom: 25px;
  width: 32px;
  aspect-ratio: 1;
  border: 4px solid #353b4b;
  border-radius: 50%;
}

.fossil-window i:nth-child(2) { left: 26%; }
.fossil-window i:nth-child(3) { left: 46%; }
.fossil-window i:nth-child(4) { left: 66%; }

.cookie-layer {
  position: absolute;
  left: 7%;
  bottom: 6%;
  display: flex;
  gap: 12px;
  align-items: center;
  font: 800 10px/1 monospace;
  text-transform: uppercase;
}

.cookie-layer i {
  width: 27px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #bd8950;
  box-shadow: inset 6px 3px #815a35;
}

.upper-mantle .scene-frame {
  color: #fff9e8;
  background: #d8461d;
}

.convection {
  position: absolute;
  border: clamp(40px, 7vw, 100px) solid #ef7b1f;
  border-left-color: #ffbb2f;
  border-bottom-color: #a4201e;
  border-radius: 50%;
  opacity: .85;
}

.convection-a { left: -18%; top: -26%; width: 64vw; aspect-ratio: 1; transform: rotate(calc(var(--local-progress) * 80deg)); }
.convection-b { right: -12%; bottom: -29%; width: 72vw; aspect-ratio: 1; transform: rotate(calc(var(--local-progress) * -60deg)); }
.convection-c { left: 36%; top: 27%; width: 34vw; aspect-ratio: 1; transform: rotate(calc(var(--local-progress) * 110deg)); }

.olivine {
  position: absolute;
  width: 36px;
  aspect-ratio: 1;
  border: 4px solid #211b0f;
  background: var(--acid);
  transform: rotate(45deg);
}

.o1 { left: 16%; bottom: 22%; }
.o2 { right: 14%; top: 18%; width: 23px; }
.o3 { right: 32%; bottom: 13%; width: 58px; }

.correction {
  position: absolute;
  z-index: 10;
  right: 6%;
  bottom: 8%;
  margin: 0;
  padding: 18px;
  color: #22140b;
  background: var(--acid);
  font: 900 clamp(10px, 1.2vw, 14px)/1.55 ui-monospace, monospace;
  transform: rotate(2deg);
}

.correction del {
  text-decoration-thickness: 4px;
}

.correction ins {
  text-decoration: none;
  font-size: 1.45em;
}

.transition .scene-frame {
  color: #e9f8ff;
  background: #10206f;
}

.transition .scene-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #09195d, transparent 20% 80%, #09195d);
  pointer-events: none;
}

.pressure-rings {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%) scale(calc(.68 + var(--local-progress) * .25));
}

.pressure-rings i {
  position: absolute;
  inset: 50%;
  width: calc(180px + var(--ring) * 130px);
  aspect-ratio: 1;
  border: clamp(12px, 1.5vw, 25px) solid #37b9ee;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.pressure-rings i:nth-child(1) { --ring: 0; opacity: 1; }
.pressure-rings i:nth-child(2) { --ring: 1; opacity: .78; }
.pressure-rings i:nth-child(3) { --ring: 2; opacity: .58; }
.pressure-rings i:nth-child(4) { --ring: 3; opacity: .37; }
.pressure-rings i:nth-child(5) { --ring: 4; opacity: .18; }

.group-chat {
  position: absolute;
  z-index: 12;
  left: 7%;
  bottom: 7%;
  width: min(390px, 55vw);
  padding: 18px;
  border: 4px solid #e9f8ff;
  color: #10206f;
  background: #e9f8ff;
  transform: rotate(-2deg);
}

.group-chat > p {
  margin: 0 0 11px;
  font: 900 9px/1 ui-monospace, monospace;
}

.group-chat ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.group-chat li {
  width: fit-content;
  max-width: 88%;
  padding: 7px 10px;
  border-radius: 13px;
  background: #bfdef0;
  font-size: 13px;
  font-weight: 650;
}

.group-chat li:nth-child(even) {
  margin-left: auto;
  background: #b5ff5d;
}

.lower-mantle .scene-frame {
  color: #fff9e8;
  background: #8e1e1a;
}

.heat-column {
  position: absolute;
  bottom: -28%;
  width: 31vw;
  height: 120%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(#fa7a20, #c32c1a 58%, #6f1517);
  filter: saturate(1.15);
}

.hc-a { left: -5%; transform: rotate(-8deg) translateY(calc(var(--local-progress) * -5%)); }
.hc-b { left: 38%; width: 24vw; transform: translateY(calc(var(--local-progress) * -9%)); }
.hc-c { right: -4%; transform: rotate(9deg) translateY(calc(var(--local-progress) * -3%)); }

.slab {
  position: absolute;
  z-index: 2;
  width: 47vw;
  height: 74px;
  padding: 18px;
  border: 5px solid #1e253e;
  color: #e8f5ff;
  background: #344568;
  font: 900 11px/1 ui-monospace, monospace;
  letter-spacing: .12em;
  transform-origin: right;
}

.slab-a { right: -9%; top: 21%; transform: rotate(24deg) translateX(calc(var(--local-progress) * 12%)); }
.slab-b { left: -8%; bottom: 17%; transform: rotate(-17deg) translateX(calc(var(--local-progress) * 8%)); }

.layout-engine {
  position: absolute;
  z-index: 13;
  right: 5%;
  bottom: 5%;
  width: min(520px, 51vw);
  height: min(420px, 47vh);
  border: 6px solid #140d0c;
  color: #130d0c;
  background: #e6d750;
  box-shadow: 15px 15px 0 rgb(31 10 6 / 28%);
  transform: rotate(1deg);
}

.layout-engine > p {
  margin: 0;
  padding: 12px;
  border-bottom: 5px solid #140d0c;
  font: 900 11px/1 ui-monospace, monospace;
  letter-spacing: .14em;
}

.layout-engine small {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 26ch;
  text-align: right;
  font: 800 9px/1.2 ui-monospace, monospace;
  text-transform: uppercase;
}

.gear {
  position: absolute;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 12px dashed #140d0c;
  border-radius: 50%;
  font: 900 11px/1 ui-monospace, monospace;
}

.g1 { left: 8%; top: 25%; width: 34%; transform: rotate(calc(var(--local-progress) * 100deg)); }
.g2 { left: 37%; top: 40%; width: 28%; transform: rotate(calc(var(--local-progress) * -130deg)); }
.g3 { right: 7%; top: 23%; width: 25%; transform: rotate(calc(var(--local-progress) * 160deg)); }

.code-conveyor {
  position: absolute;
  inset: auto 0 17%;
  display: flex;
  gap: 28px;
  overflow: hidden;
  padding: 8px 0;
  border-block: 3px solid #140d0c;
  font: 900 10px/1 ui-monospace, monospace;
  white-space: nowrap;
}

.code-conveyor span {
  transform: translateX(calc(var(--local-progress) * -130px));
}

.d-double-prime .scene-frame {
  color: #fff5dd;
  background:
    repeating-radial-gradient(ellipse at 50% 120%, #280d20 0 32px, #52152e 33px 62px, #7c2030 63px 97px);
}

.seismic-lines {
  position: absolute;
  inset: 0;
  opacity: .5;
  background:
    linear-gradient(115deg, transparent 0 47%, #ffb628 48% 49%, transparent 50%),
    linear-gradient(65deg, transparent 0 52%, #ffb628 53% 54%, transparent 55%);
}

.worksite {
  position: absolute;
  z-index: 1;
  right: 8%;
  bottom: 100%;
  width: min(560px, 64vw);
  height: 158px;
  opacity: var(--crew-opacity, 1);
  transform: translateY(calc(var(--crew-rise, 0) * -1px));
  transition: opacity .12s linear;
}

.worker {
  position: absolute;
  bottom: 0;
  width: 39px;
  height: 92px;
  border-radius: 14px 14px 4px 4px;
  background: #f07b22;
  transform-origin: bottom;
}

.worker::before {
  content: "";
  position: absolute;
  top: -26px;
  left: 4px;
  width: 31px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e5b487;
}

.worker::after {
  content: "";
  position: absolute;
  top: -30px;
  left: 0;
  width: 40px;
  height: 14px;
  border-radius: 18px 18px 4px 4px;
  background: var(--acid);
}

.worker i,
.worker b {
  position: absolute;
  top: 23px;
  width: 39px;
  height: 8px;
  background: #f07b22;
  transform-origin: 4px 4px;
}

.worker i { left: 30px; transform: rotate(-38deg); }
.worker b { right: 30px; transform: rotate(40deg); }

.w1 { left: 12%; animation: work 1.1s ease-in-out infinite; }
.w2 { left: 46%; height: 84px; transform: scale(.9); animation: work .85s ease-in-out infinite reverse; }
.w3 { right: 7%; height: 98px; transform: scale(1.06); animation: work 1.35s ease-in-out infinite; }

@keyframes work {
  50% { transform: rotate(5deg); }
}

.sparks {
  position: absolute;
  width: 60px;
  aspect-ratio: 1;
  background: repeating-conic-gradient(from 0deg, transparent 0 17deg, #fff7a0 18deg 22deg, transparent 23deg 45deg);
  animation: spark .8s steps(2) infinite;
}

.s1 { left: 27%; bottom: -26px; }
.s2 { right: 20%; bottom: -22px; animation-delay: .35s; }

@keyframes spark {
  50% { transform: rotate(24deg) scale(.7); opacity: .55; }
}

.caution {
  position: absolute;
  right: 34%;
  bottom: 2px;
  padding: 8px;
  border: 4px solid #151111;
  color: #151111;
  background: #ffd64c;
  font: 900 9px/.95 ui-monospace, monospace;
  transform: rotate(-3deg);
}

#buried-footer {
  position: fixed;
  z-index: 55;
  left: 4%;
  right: 4%;
  top: calc(var(--footer-y, 66) * 1vh);
  bottom: auto;
  display: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  padding: 12px 4%;
  border: 7px solid #151111;
  color: #151111;
  background: var(--acid);
  box-shadow: 0 14px 0 rgb(0 0 0 / 20%);
  transform: rotate(calc(var(--footer-rotation, 0) * 1deg));
  transform-origin: 72% 50%;
  will-change: top, transform;
  pointer-events: none;
}

body:not(.footer-sequence-active) #buried-footer {
  display: none;
}

#buried-footer::before {
  content: "";
  position: absolute;
  inset: -12px -7px auto;
  height: 11px;
  border-inline: 7px solid #151111;
  background: repeating-linear-gradient(135deg, #151111 0 13px, #ffd64c 14px 27px);
}

#buried-footer b {
  font: 900 clamp(31px, 5vw, 75px)/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -.08em;
}

#buried-footer small {
  font: 900 9px/1.2 ui-monospace, monospace;
  letter-spacing: .08em;
}

.bolt {
  position: absolute;
  top: 50%;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #151111;
}

.bolt-a { left: 1%; }
.bolt-b { right: 1%; }

.outer-core .scene-frame {
  color: #17100c;
  background: #ff6c13;
}

.outer-core .scene-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 120%, #fff0a3 0 12%, transparent 13%),
    linear-gradient(135deg, rgb(255 234 85 / 0%) 15%, rgb(255 234 85 / 45%) 16% 18%, transparent 19% 52%, rgb(255 234 85 / 38%) 53% 55%, transparent 56%);
}

.iron-flow {
  position: absolute;
  width: 75vw;
  height: 38vh;
  border: clamp(40px, 8vw, 120px) solid #d7350f;
  border-left-color: #ffb11b;
  border-radius: 50%;
}

.flow-a { left: -27%; bottom: -10%; transform: rotate(calc(var(--local-progress) * 48deg)); }
.flow-b { right: -31%; top: -8%; transform: rotate(calc(var(--local-progress) * -43deg)); }

.magnetic-field {
  position: absolute;
  inset: 50%;
}

.magnetic-field i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(180px + var(--field) * 130px);
  height: calc(400px + var(--field) * 75px);
  border: 4px solid rgb(29 15 8 / 45%);
  border-block: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(calc((var(--field) - 2) * 8deg));
}

.magnetic-field i:nth-child(1) { --field: 0; }
.magnetic-field i:nth-child(2) { --field: 1; }
.magnetic-field i:nth-child(3) { --field: 2; }
.magnetic-field i:nth-child(4) { --field: 3; }
.magnetic-field i:nth-child(5) { --field: 4; }

.core-card {
  color: #17100c;
}

.compass-party {
  position: absolute;
  right: 10%;
  bottom: 8%;
  width: min(350px, 38vw);
  aspect-ratio: 1;
  border: 6px solid #17100c;
  border-radius: 50%;
  background: rgb(255 238 159 / 23%);
}

.compass-party span {
  position: absolute;
  inset: 11px auto auto 50%;
  font: 900 13px/1 ui-monospace, monospace;
}

.compass-party i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 40%;
  background: #17100c;
  transform-origin: 50% 92%;
  transform: translate(-50%, -92%) rotate(calc(var(--needle) * 72deg + var(--local-progress) * 390deg));
}

.compass-party i::before {
  content: "";
  position: absolute;
  top: -15px;
  left: -7px;
  border: 9px solid transparent;
  border-bottom-color: #17100c;
  transform: translateY(-50%);
}

.compass-party i:nth-of-type(1) { --needle: 0; }
.compass-party i:nth-of-type(2) { --needle: 1; }
.compass-party i:nth-of-type(3) { --needle: 2; }
.compass-party i:nth-of-type(4) { --needle: 3; }
.compass-party i:nth-of-type(5) { --needle: 4; }

.end-frame {
  display: grid;
  place-items: center;
  color: #fff8de;
  background: #0b0711;
}

.core-glow {
  position: absolute;
  left: 50%;
  bottom: -47vw;
  width: min(94vw, 1100px);
  aspect-ratio: 1;
  border: clamp(22px, 3vw, 50px) solid #ff5318;
  border-radius: 50%;
  background: #fff0a3;
  box-shadow:
    0 0 0 7vw #ca2e17,
    0 0 120px 10vw rgb(255 76 20 / 55%);
  transform: translateX(-50%);
}

.end-copy {
  position: relative;
  z-index: 5;
  width: min(1000px, 88vw);
  margin-top: -7vh;
}

.end-copy h2 {
  margin: 0;
  font-size: clamp(56px, 9.6vw, 150px);
  font-weight: 900;
  line-height: .78;
  letter-spacing: -.085em;
}

.end-copy h2 em {
  color: var(--acid);
  font-style: normal;
}

.end-copy > p:not(.eyebrow, .source-note) {
  max-width: 50ch;
  margin: 28px 0;
  font-size: clamp(16px, 1.7vw, 22px);
  font-weight: 650;
  line-height: 1.35;
}

#return-button {
  min-height: 52px;
  padding: 13px 18px;
  border: 3px solid var(--acid);
  border-radius: 0;
  color: #0b0711;
  background: var(--acid);
  font: 900 11px/1 ui-monospace, monospace;
  letter-spacing: .1em;
  cursor: pointer;
}

#return-button:hover {
  color: var(--acid);
  background: transparent;
}

#return-button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
}

#return-button span {
  padding-left: 17px;
  font-size: 19px;
}

.source-note {
  position: absolute;
  left: 0;
  top: calc(100% + 22px);
  max-width: 57ch;
  margin: 0;
  color: rgb(255 248 222 / 58%);
  font: 650 9px/1.4 ui-monospace, monospace;
  text-transform: uppercase;
}

.depth-stamp {
  position: absolute;
  right: 6%;
  bottom: 7%;
  z-index: 4;
  color: #160d09;
  font-size: clamp(55px, 11vw, 170px);
  font-weight: 900;
  line-height: .65;
  letter-spacing: -.08em;
  text-align: center;
  transform: rotate(-8deg);
}

.depth-stamp small {
  font-size: .23em;
  letter-spacing: .3em;
}

@media (max-width: 740px) {
  .depth-gauge {
    inset: calc(12px + env(safe-area-inset-top)) 12px auto auto;
  }

  .gauge-rule {
    height: 54px;
  }

  .chapter {
    height: 185vh;
  }

  .surface {
    height: 165vh;
  }

  .crust,
  .lithosphere,
  .upper-mantle,
  .transition {
    height: 170vh;
  }

  .lower-mantle {
    height: 195vh;
  }

  .d-double-prime,
  .outer-core {
    height: 220vh;
  }

  .end-chapter {
    height: 112vh;
  }

  .scene-frame {
    min-height: 540px;
  }

  .opening {
    top: max(69px, calc(54px + env(safe-area-inset-top)));
    width: 92vw;
  }

  .opening h1 {
    font-size: clamp(53px, 17.2vw, 84px);
    line-height: .76;
  }

  .opening h1 em {
    font-size: .48em;
  }

  .dek {
    width: 68vw;
    margin-top: 18px;
    font-size: 14px;
  }

  .scroll-cue {
    margin-top: 18px;
  }

  .sky {
    bottom: 57%;
  }

  .cloud {
    transform: scale(.58);
  }

  .cloud-a {
    left: -12%;
  }

  .cloud-b {
    display: none;
  }

  .sun {
    top: 22%;
    right: 5%;
    width: 21vw;
  }

  .house {
    left: 7%;
    transform: scale(.7);
    transform-origin: bottom left;
  }

  .tree {
    right: 12%;
    transform: scale(.7);
    transform-origin: bottom;
  }

  .hydrant {
    left: 58%;
    transform: scale(.7);
  }

  .bus-stop {
    display: none;
  }

  .depth-card {
    top: max(74px, calc(58px + env(safe-area-inset-top)));
    left: 20px;
    width: calc(100vw - 40px);
  }

  .depth-card h2 {
    font-size: clamp(49px, 15.6vw, 78px);
  }

  .depth-card p:last-child {
    max-width: 72vw;
    font-size: 14px;
  }

  .subway {
    top: auto;
    right: -18%;
    bottom: 20%;
    width: 98vw;
    transform: rotate(-4deg);
  }

  .lost-phone {
    right: 7%;
    bottom: 7%;
    transform: scale(.77) rotate(14deg);
  }

  .time-capsule {
    left: 9%;
    bottom: 7%;
    transform: scale(.76) rotate(-8deg);
  }

  .distance-note {
    right: 4%;
    bottom: 2%;
    max-width: 53vw;
    font-size: 8px;
  }

  .fault-left {
    left: -42%;
    width: 80%;
  }

  .fault-right {
    right: -52%;
    width: 87%;
  }

  .cache-fossil {
    right: 5%;
    bottom: 13%;
    width: 88vw;
  }

  .fossil-window {
    height: 156px;
  }

  .cookie-layer {
    left: 4%;
    bottom: 4%;
    max-width: 91vw;
    font-size: 8px;
  }

  .cookie-layer i {
    width: 19px;
  }

  .c1 { right: 7%; top: 29%; }
  .c3 { left: 5%; }

  .correction {
    right: -3%;
    bottom: 8%;
    transform: scale(.82) rotate(3deg);
  }

  .pressure-rings {
    transform: translate(-50%, -43%) scale(.58);
  }

  .group-chat {
    left: 5%;
    right: auto;
    bottom: 5%;
    width: 85vw;
  }

  .slab {
    width: 74vw;
    font-size: 8px;
  }

  .slab-a {
    right: -24%;
    top: 36%;
  }

  .slab-b {
    left: -17%;
    bottom: 4%;
  }

  .layout-engine {
    right: 5%;
    bottom: 10%;
    width: 90vw;
    height: 35vh;
    min-height: 265px;
  }

  .layout-engine small {
    width: 24ch;
    font-size: 7px;
  }

  .worksite {
    right: -4%;
    bottom: 100%;
    width: 104vw;
    transform: translateY(calc(var(--crew-rise, 0) * -1px)) scale(.8);
    transform-origin: right bottom;
  }

  #buried-footer {
    left: 2%;
    right: 2%;
    min-height: 65px;
    padding-inline: 6%;
  }

  #buried-footer small {
    max-width: 14ch;
    font-size: 7px;
  }

  .compass-party {
    right: -12%;
    bottom: 3%;
    width: 62vw;
  }

  .end-copy {
    width: calc(100vw - 40px);
    margin-top: -18vh;
  }

  .end-copy h2 {
    font-size: clamp(52px, 16.5vw, 80px);
  }

  .end-copy > p:not(.eyebrow, .source-note) {
    width: 81vw;
    margin-block: 20px;
    font-size: 14px;
  }

  .depth-stamp {
    right: 4%;
    bottom: 4%;
    font-size: 78px;
  }

  .core-glow {
    bottom: -38vw;
    width: 120vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}
