@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink: #111512;
  --paper: #f3f0e9;
  --white: #ffffff;
  --muted: #b7bab3;
  --rule: rgba(255, 255, 255, 0.24);
  --green: #62a56d;
  --green-dark: #173a27;
  --orange: #e06d3c;
  --gold: #c7a767;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--white);
  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.story-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(11, 15, 12, 0.78);
  backdrop-filter: blur(12px);
}

.story-nav__brand,
.story-nav__edition {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.story-nav__edition {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
}

.story-nav__rule {
  width: 28px;
  height: 1px;
  background: var(--orange);
}

.experience {
  position: relative;
  min-height: 600vh;
  background: #111711;
}

.stage {
  position: sticky;
  top: 0;
  z-index: 0;
  width: 100%;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: #c8c2b7;
}

#city-canvas,
.stage__fallback,
.stage__chapter-image,
.stage__wash,
.stage__grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#city-canvas {
  z-index: 1;
  display: block;
  pointer-events: none;
  touch-action: none;
}

body[data-chapter='5'] #city-canvas {
  pointer-events: auto;
  touch-action: pan-y;
}

.stage__fallback {
  z-index: 0;
  object-fit: cover;
  filter: saturate(0.72) contrast(1.02);
  transition: opacity 700ms ease;
}

body.scene-ready .stage__fallback {
  opacity: 0;
  pointer-events: none;
}

.stage__chapter-image {
  z-index: 2;
  object-fit: cover;
  object-position: 60% center;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.025);
  transition: opacity 650ms ease, transform 1400ms ease;
}

body[data-chapter='3'] .stage__chapter-image--occupied {
  opacity: 1;
  transform: scale(1);
}

.stage__wash {
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.82) 0%, rgba(7, 10, 8, 0.2) 42%, rgba(7, 10, 8, 0) 68%),
    linear-gradient(0deg, rgba(7, 10, 8, 0.48) 0%, rgba(7, 10, 8, 0) 40%);
  transition: background 700ms ease;
}

body[data-chapter='2'] .stage__wash {
  background:
    linear-gradient(270deg, rgba(7, 10, 8, 0.84) 0%, rgba(7, 10, 8, 0.18) 44%, rgba(7, 10, 8, 0) 72%),
    linear-gradient(0deg, rgba(7, 10, 8, 0.2) 0%, rgba(7, 10, 8, 0) 38%);
}

body[data-chapter='3'] .stage__wash {
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.52) 0%, rgba(7, 10, 8, 0.08) 48%, rgba(7, 10, 8, 0) 72%),
    linear-gradient(0deg, rgba(7, 10, 8, 0.82) 0%, rgba(7, 10, 8, 0.04) 58%);
}

body[data-chapter='4'] .stage__wash,
body[data-chapter='5'] .stage__wash {
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.72) 0%, rgba(7, 10, 8, 0.05) 48%, rgba(7, 10, 8, 0) 72%),
    linear-gradient(0deg, rgba(7, 10, 8, 0.26) 0%, rgba(7, 10, 8, 0) 35%);
}

.stage__grain {
  z-index: 4;
  pointer-events: none;
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%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)' opacity='.28'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.loader {
  position: absolute;
  z-index: 12;
  left: 28px;
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  text-transform: uppercase;
  transition: opacity 350ms ease, transform 350ms ease;
}

.loader__line {
  position: relative;
  width: 54px;
  height: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.25);
}

.loader__line::after {
  position: absolute;
  inset: 0;
  content: '';
  background: var(--orange);
  transform: translateX(-100%);
  animation: loading-line 1.2s ease-in-out infinite;
}

body.scene-ready .loader {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

@keyframes loading-line {
  50% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

.scene-key {
  position: absolute;
  z-index: 5;
  top: 88px;
  right: 28px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  text-transform: uppercase;
}

.scene-key__index {
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.prototype-label {
  position: absolute;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(10, 14, 11, 0.8);
  color: var(--white);
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0;
  transform: translate(-50%, -120%);
  pointer-events: none;
  transition: opacity 250ms ease;
}

.prototype-label span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

body[data-chapter='2'] .prototype-label {
  opacity: 1;
}

.chapters {
  position: relative;
  z-index: 10;
  margin-top: -100svh;
  pointer-events: none;
}

.chapter {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100svh;
  padding: 96px 7vw 52px;
}

.chapter__copy {
  width: min(560px, 44vw);
  pointer-events: auto;
  opacity: 0.3;
  transform: translateY(22px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.chapter.is-active .chapter__copy {
  opacity: 1;
  transform: translateY(0);
}

.chapter__copy--opening {
  align-self: flex-end;
  padding-bottom: 7vh;
}

.chapter__copy--right {
  margin-left: auto;
}

.chapter__copy--lower-left {
  align-self: flex-end;
  padding-bottom: 8vh;
}

.chapter__copy--upper-left {
  align-self: flex-start;
  padding-top: 12vh;
}

.chapter__copy--explore {
  align-self: flex-start;
  padding-top: 8vh;
}

.eyebrow {
  margin: 0 0 22px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
}

.chapter h1,
.chapter h2 {
  margin: 0;
  max-width: 760px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  letter-spacing: 0;
  text-wrap: balance;
}

.chapter h1 {
  font-size: 76px;
  line-height: 0.95;
}

.chapter h2 {
  font-size: 55px;
  line-height: 1;
}

.chapter p:not(.eyebrow) {
  max-width: 500px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  line-height: 1.65;
}

.chapter .dek {
  font-size: 19px;
  line-height: 1.55;
}

.feature-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 26px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.feature-meta > * + *::before {
  margin-right: 20px;
  color: var(--orange);
  content: '/';
}

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 38px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.scroll-cue span {
  width: 46px;
  height: 1px;
  background: var(--orange);
}

.source-link {
  display: inline-block;
  margin-top: 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  text-decoration: none;
  text-transform: uppercase;
}

.thermal-scale {
  position: absolute;
  right: 7vw;
  bottom: 54px;
  width: 240px;
  opacity: 0;
  transition: opacity 400ms ease;
}

body[data-chapter='1'] .thermal-scale {
  opacity: 1;
}

.thermal-scale > span,
.thermal-scale div {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.7);
  font-size: 9px;
  text-transform: uppercase;
}

.thermal-scale i {
  display: block;
  width: 100%;
  height: 5px;
  margin: 8px 0;
  background: linear-gradient(90deg, #d4bd64, #e06d3c, #a72f26);
}

.system-list {
  margin-top: 36px;
  border-top: 1px solid var(--rule);
}

.system-list div {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--rule);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.45;
}

.system-list b {
  color: var(--orange);
  font-size: 10px;
  font-weight: 600;
}

.chapter-rail {
  position: absolute;
  z-index: 7;
  top: 50%;
  right: 28px;
  width: 1px;
  height: 144px;
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%);
}

.chapter-rail__progress {
  position: absolute;
  inset: 0 0 auto;
  height: 16.666%;
  background: var(--orange);
  transition: transform 500ms ease;
}

.comparison {
  position: absolute;
  z-index: 15;
  right: 52px;
  bottom: 34px;
  width: 360px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(10, 14, 11, 0.9);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 350ms ease, transform 350ms ease;
}

body[data-chapter='5'] .comparison {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.comparison__head,
.comparison__labels,
.comparison__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comparison__head {
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.comparison__head output {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

#comparison-range {
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
  appearance: none;
}

#comparison-range::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, #b9b4a9, var(--green));
}

#comparison-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--green-dark);
  appearance: none;
}

#comparison-range::-moz-range-track {
  height: 3px;
  background: linear-gradient(90deg, #b9b4a9, var(--green));
}

#comparison-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--green-dark);
}

.comparison__labels {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
  text-transform: uppercase;
}

.comparison__actions {
  justify-content: flex-start;
  gap: 0;
  margin-top: 15px;
}

.comparison__actions button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.27);
  border-right: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}

.comparison__actions button:last-child {
  margin-left: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.27);
}

.comparison__actions button:nth-child(2) {
  border-right: 1px solid rgba(255, 255, 255, 0.27);
}

.comparison__actions button:hover,
.comparison__actions button:focus-visible,
.comparison__actions button.is-active {
  background: var(--paper);
  color: var(--ink);
}

.reporting-notes {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 3fr);
  gap: 7vw;
  padding: 100px 7vw 110px;
  background: var(--paper);
  color: var(--ink);
}

.reporting-notes__index {
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.reporting-notes__body h2 {
  max-width: 760px;
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 58px;
  font-weight: 500;
  line-height: 1;
}

.reporting-notes__lead {
  max-width: 850px;
  margin: 30px 0 64px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 29px;
  line-height: 1.35;
}

.reporting-notes__columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid rgba(17, 21, 18, 0.25);
}

.reporting-notes__columns > div {
  padding: 24px 28px 34px 0;
  border-right: 1px solid rgba(17, 21, 18, 0.25);
}

.reporting-notes__columns > div + div {
  padding-left: 28px;
}

.reporting-notes__columns > div:last-child {
  border-right: 0;
}

.reporting-notes h3 {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
}

.reporting-notes__columns p {
  margin: 0;
  color: #4e514c;
  font-size: 14px;
  line-height: 1.65;
}

.reporting-notes__sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(17, 21, 18, 0.25);
  font-size: 11px;
  text-transform: uppercase;
}

.reporting-notes__sources span {
  color: #6f726c;
}

.reporting-notes__sources a {
  text-underline-offset: 4px;
}

.reporting-notes__disclosure {
  margin: 30px 0 0;
  color: #6f726c;
  font-size: 11px;
}

.feature-footer {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 24px;
  padding: 26px 7vw;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--ink);
  color: rgba(255, 255, 255, 0.66);
  font-size: 10px;
  text-transform: uppercase;
}

.feature-footer a {
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
}

.feature-footer span:last-child {
  text-align: right;
}

@media (max-width: 900px) {
  .chapter h1 { font-size: 60px; }
  .chapter h2 { font-size: 45px; }
  .chapter__copy { width: min(560px, 58vw); }
  .reporting-notes { grid-template-columns: 1fr; }
  .reporting-notes__index { max-width: 180px; }
}

@media (max-width: 680px) {
  .story-nav {
    height: 56px;
    padding: 0 16px;
  }

  .story-nav__edition span:first-child,
  .story-nav__rule {
    display: none;
  }

  .experience {
    min-height: 660vh;
  }

  .stage {
    min-height: 520px;
  }

  .stage__wash,
  body[data-chapter='2'] .stage__wash,
  body[data-chapter='3'] .stage__wash,
  body[data-chapter='4'] .stage__wash,
  body[data-chapter='5'] .stage__wash {
    background: linear-gradient(0deg, rgba(7, 10, 8, 0.92) 0%, rgba(7, 10, 8, 0.34) 49%, rgba(7, 10, 8, 0.04) 76%);
  }

  .stage__chapter-image--occupied {
    object-position: 76% center;
  }

  .scene-key {
    top: 72px;
    right: 16px;
  }

  .chapter-rail {
    right: 12px;
  }

  .chapter {
    align-items: flex-end;
    min-height: 110svh;
    padding: 88px 28px 48px 20px;
  }

  .chapter__copy,
  .chapter__copy--opening,
  .chapter__copy--right,
  .chapter__copy--lower-left,
  .chapter__copy--upper-left,
  .chapter__copy--explore {
    align-self: flex-end;
    width: 100%;
    margin: 0;
    padding: 0 0 10vh;
  }

  .chapter--systems,
  .chapter--explore {
    align-items: flex-start;
  }

  .chapter--systems .chapter__copy,
  .chapter--explore .chapter__copy {
    align-self: flex-start;
    padding-top: 10vh;
  }

  .chapter h1 { font-size: 49px; }
  .chapter h2 { font-size: 39px; }
  .chapter .dek { font-size: 16px; }
  .chapter p:not(.eyebrow) { font-size: 14px; line-height: 1.55; }
  .eyebrow { margin-bottom: 14px; }

  .feature-meta {
    display: grid;
    gap: 5px;
    margin-top: 18px;
  }

  .feature-meta > * + *::before {
    content: none;
  }

  .thermal-scale {
    right: 20px;
    bottom: 28px;
    width: 150px;
  }

  .comparison {
    right: 16px;
    bottom: 18px;
    width: calc(100% - 32px);
    padding: 14px;
  }

  .prototype-label {
    display: none;
  }

  .reporting-notes {
    padding: 76px 20px 82px;
  }

  .reporting-notes__body h2 { font-size: 43px; }
  .reporting-notes__lead { margin-bottom: 48px; font-size: 24px; }
  .reporting-notes__columns { grid-template-columns: 1fr; }
  .reporting-notes__columns > div,
  .reporting-notes__columns > div + div {
    padding: 22px 0;
    border-right: 0;
    border-bottom: 1px solid rgba(17, 21, 18, 0.25);
  }

  .feature-footer {
    grid-template-columns: 1fr;
    padding: 28px 20px;
  }

  .feature-footer span:last-child { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
