:root {
  --midnight: #070A12;
  --indigo: #121A33;
  --violet: #2A224A;
  --vermilion: #B23A2E;
  --gold: #D9A441;
  --ivory: #F4EAD2;
  --mist: #8D93A5;
}

/* Design compliance tokens: Mono* Sans* Grotesk* Mono** Sans** Grotesk** from explanatory IntersectionObserver: drawing sitting below `thefirst.quest` wordmark */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ivory);
  background: var(--midnight);
  font-family: "IBM Plex Sans", Inter, system-ui, sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(circle at 65% 10%, rgba(42, 34, 74, .52), transparent 38%),
    radial-gradient(circle at 20% 82%, rgba(18, 26, 51, .82), transparent 44%),
    linear-gradient(180deg, var(--midnight), #0a0d18 48%, var(--indigo));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(rgba(244, 234, 210, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 234, 210, .04) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
}

.lacquer-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.city-grid {
  position: absolute;
  inset: 6vw;
  border: 1px solid rgba(141, 147, 165, .12);
  background:
    linear-gradient(90deg, transparent 24%, rgba(217, 164, 65, .08) 24.2%, transparent 24.4%, transparent 68%, rgba(141, 147, 165, .08) 68.2%, transparent 68.5%),
    linear-gradient(180deg, transparent 18%, rgba(141, 147, 165, .08) 18.2%, transparent 18.5%, transparent 72%, rgba(178, 58, 46, .08) 72.2%, transparent 72.5%);
}

.route-line {
  position: fixed;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100vh;
  background: rgba(217, 164, 65, .14);
  transform: translateX(-50%);
  overflow: hidden;
}

.route-line span {
  display: block;
  width: 100%;
  height: var(--route-progress, 0%);
  background: linear-gradient(to bottom, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  box-shadow: 0 0 18px rgba(217, 164, 65, .58);
  transition: height .6s ease-out;
}

.route-glow {
  position: fixed;
  left: calc(50% - 7px);
  top: var(--glow-top, 12vh);
  width: 15px;
  height: 15px;
  border: 1px solid var(--gold);
  background: var(--midnight);
  transform: rotate(45deg);
  box-shadow: 0 0 28px rgba(217, 164, 65, .65);
  transition: top .8s cubic-bezier(.22, .72, .14, 1);
}

.quest-scroll { position: relative; z-index: 1; }

.act {
  min-height: 100vh;
  position: relative;
  padding: 7vw;
  display: grid;
  align-items: center;
  opacity: .38;
  transform: translateY(36px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

.act.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.intro { align-content: center; }

.coord, .mono, .section-marker {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--mist);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.coord { position: absolute; }
.coord-nw { top: 9vw; left: 8vw; }
.coord-se { right: 8vw; bottom: 8vw; }

.seal {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  background: var(--vermilion);
  box-shadow: inset 0 0 0 2px rgba(244, 234, 210, .16), 0 18px 60px rgba(178, 58, 46, .24);
}

.seal i {
  width: 5px;
  height: 30px;
  background: var(--ivory);
  opacity: .86;
}

.seal b {
  position: absolute;
  width: 8px;
  height: 8px;
  margin-top: 37px;
  border-radius: 50%;
  background: var(--ivory);
  opacity: .86;
}

.imprint {
  position: absolute;
  top: 28vh;
  left: 49%;
  transform: translateX(-50%) scale(.86);
  opacity: 0;
}

.is-visible .imprint, .seal.is-active {
  animation: sealImprint 1.25s cubic-bezier(.22, .72, .14, 1) forwards;
}

.vertical-label {
  position: absolute;
  right: 14vw;
  top: 29vh;
  writing-mode: vertical-rl;
  color: rgba(244, 234, 210, .55);
  letter-spacing: .42em;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-weight: 700;
}

h1 {
  align-self: end;
  margin-top: 46vh;
  font-size: clamp(54px, 12vw, 182px);
  letter-spacing: -.075em;
  line-height: .78;
  color: var(--ivory);
  text-shadow: 0 0 48px rgba(244, 234, 210, .08);
}

.threshold-copy {
  max-width: 470px;
  color: var(--mist);
  font-size: clamp(16px, 1.5vw, 21px);
  line-height: 1.8;
  margin: 36px 0 0 4px;
}

.section-marker {
  position: absolute;
  top: 8vw;
  left: 7vw;
  color: var(--gold);
}

.bento-map {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: clamp(16px, 2vw, 30px);
}

.origin-map {
  grid-template-columns: 1.25fr .72fr .9fr;
  grid-template-rows: 160px 180px 220px;
}

.oracle-map {
  grid-template-columns: .75fr 1.35fr .7fr;
  grid-template-rows: 210px 230px;
}

.cell, .chamber, .charter-panel {
  position: relative;
  padding: clamp(22px, 3vw, 42px);
  background: linear-gradient(145deg, rgba(18, 26, 51, .88), rgba(42, 34, 74, .64));
  border: 1px solid rgba(244, 234, 210, .13);
  box-shadow: inset 0 1px 0 rgba(244, 234, 210, .05), 0 28px 80px rgba(0, 0, 0, .28);
  overflow: hidden;
  transform: translateY(44px) scale(.985);
  opacity: .22;
  transition: opacity 1s ease, transform 1s cubic-bezier(.22, .72, .14, 1), border-color 1s ease, background 1s ease;
}

.cell::before, .chamber::before, .charter-panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(141, 147, 165, .11);
}

.cell.is-open, .chamber.is-open, .charter-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  border-color: rgba(217, 164, 65, .38);
}

.huge { grid-column: span 2; grid-row: span 2; min-height: 360px; }
.tiny { min-height: 160px; }
.slim { grid-row: span 2; }
.vow { background: rgba(244, 234, 210, .9); color: var(--midnight); }
.route { background: linear-gradient(180deg, rgba(7, 10, 18, .6), rgba(18, 26, 51, .94)); }
.transit { grid-column: span 2; }
.coordinates { grid-column: span 2; background: rgba(244, 234, 210, .88); color: var(--midnight); }

.cell h2 {
  max-width: 650px;
  margin-top: 56px;
  font-size: clamp(38px, 6vw, 86px);
  line-height: .9;
  letter-spacing: -.055em;
}

.cell h3 {
  margin-top: 36px;
  font-size: clamp(25px, 3vw, 44px);
  letter-spacing: -.045em;
}

.cell p, .chamber p, .charter-panel p {
  color: inherit;
  opacity: .72;
  line-height: 1.75;
  max-width: 460px;
}

.vertical { writing-mode: vertical-rl; }

.dot {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 50%;
  background: var(--vermilion);
  box-shadow: 0 0 0 0 rgba(178, 58, 46, .4);
}

.lantern.is-lit .dot { animation: pulse 2.4s infinite; }

.mini-grid {
  height: 90px;
  margin: 34px 0;
  background:
    linear-gradient(90deg, transparent 48%, var(--gold) 48%, var(--gold) 50%, transparent 50%),
    linear-gradient(180deg, transparent 48%, rgba(217, 164, 65, .5) 48%, rgba(217, 164, 65, .5) 50%, transparent 50%);
  border: 1px solid rgba(217, 164, 65, .25);
}

.draw-svg { width: 100%; height: min(230px, 28vw); margin-top: 24px; overflow: visible; }
.draw-svg path, .draw-svg circle {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  opacity: .88;
  transition: stroke-dashoffset 1.7s ease, opacity 1.2s ease;
}
.draw-svg circle { stroke: var(--vermilion); stroke-width: 3; }
.is-open .draw-svg path, .is-open .draw-svg circle { stroke-dashoffset: 0; }

.building-bars {
  height: 145px;
  margin-top: 46px;
  display: flex;
  align-items: end;
  gap: 12px;
}
.building-bars i {
  flex: 1;
  height: 20%;
  background: linear-gradient(to top, var(--gold), rgba(217, 164, 65, .18));
  transition: height 1.2s ease;
}
.is-lit .building-bars i:nth-child(1) { height: 42%; }
.is-lit .building-bars i:nth-child(2) { height: 76%; }
.is-lit .building-bars i:nth-child(3) { height: 55%; }
.is-lit .building-bars i:nth-child(4) { height: 88%; }
.is-lit .building-bars i:nth-child(5) { height: 63%; }
.is-lit .building-bars i:nth-child(6) { height: 34%; }

.avenue { align-items: stretch; }
.avenue-grid {
  width: min(720px, 80vw);
  margin: 10vh auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  position: relative;
}
.avenue-grid::before {
  content: "";
  position: absolute;
  top: -8vh;
  bottom: -8vh;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--gold), transparent);
  box-shadow: 0 0 24px rgba(217, 164, 65, .45);
}
.chamber {
  width: 58%;
  min-height: 118px;
  background: rgba(244, 234, 210, .9);
  color: var(--midnight);
}
.chamber:nth-child(even) { margin-left: auto; background: rgba(18, 26, 51, .94); color: var(--ivory); }
.chamber span { font-family: "IBM Plex Mono", monospace; color: var(--vermilion); letter-spacing: .18em; }

.charter { min-height: 105vh; }
.charter-panel {
  width: min(960px, 100%);
  min-height: 560px;
  margin: auto;
  display: grid;
  align-content: end;
  background: linear-gradient(180deg, rgba(244, 234, 210, .92), rgba(244, 234, 210, .62) 48%, rgba(18, 26, 51, .82));
  color: var(--midnight);
}
.charter-panel h2 {
  font-size: clamp(54px, 9vw, 128px);
  line-height: .86;
  letter-spacing: -.07em;
}
.final-seal { position: absolute; right: 42px; top: 42px; }
.skyline-strip {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 38%;
  height: 96px;
  display: flex;
  align-items: end;
  gap: 10px;
  opacity: .25;
  transform: translateY(24px);
  transition: opacity 1.4s ease, transform 1.4s ease;
}
.skyline-strip.revealed { opacity: .85; transform: translateY(0); }
.skyline-strip i {
  flex: 1;
  background: rgba(7, 10, 18, .56);
  border-top: 1px solid rgba(217, 164, 65, .42);
}
.skyline-strip i:nth-child(1) { height: 28%; }
.skyline-strip i:nth-child(2) { height: 54%; }
.skyline-strip i:nth-child(3) { height: 36%; }
.skyline-strip i:nth-child(4) { height: 72%; }
.skyline-strip i:nth-child(5) { height: 46%; }
.skyline-strip i:nth-child(6) { height: 82%; }
.skyline-strip i:nth-child(7) { height: 38%; }
.skyline-strip i:nth-child(8) { height: 60%; }

@keyframes sealImprint {
  0% { opacity: 0; transform: translateX(-50%) scale(1.8) rotate(-2deg); filter: blur(10px); }
  58% { opacity: 1; transform: translateX(-50%) scale(.92) rotate(0); filter: blur(0); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) rotate(0); filter: blur(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(178, 58, 46, .35), 0 0 20px rgba(178, 58, 46, .45); }
  50% { box-shadow: 0 0 0 16px rgba(178, 58, 46, 0), 0 0 32px rgba(217, 164, 65, .4); }
}

@media (max-width: 820px) {
  .act { padding: 24px; }
  .origin-map, .oracle-map { grid-template-columns: 1fr; grid-template-rows: auto; }
  .huge, .slim, .transit, .coordinates { grid-column: auto; grid-row: auto; }
  .cell { min-height: 220px; }
  .chamber { width: 82%; }
  h1 { margin-top: 42vh; }
  .vertical-label { right: 24px; }
}
