:root {
  color-scheme: dark;
  --ink: #f2efe7;
  --paper: #e9e4d9;
  --night: #151713;
  --moss: #a4ad83;
  --line: rgb(242 239 231 / 32%);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--night);
  color: var(--ink);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

html.is-loading,
body.is-loading {
  overflow: hidden;
  touch-action: none;
}

a,
button {
  color: inherit;
}

button {
  font: inherit;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right))
    max(26px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgb(164 173 131 / 10%), transparent 32%),
    var(--night);
  color: var(--ink);
  transition: opacity 0.75s var(--ease), visibility 0.75s;
}

.loader::before,
.loader::after {
  position: absolute;
  border: 1px solid rgb(242 239 231 / 9%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.loader::before {
  width: min(84vw, 560px);
  aspect-ratio: 1;
}

.loader::after {
  width: min(58vw, 390px);
  aspect-ratio: 1;
}

.loader__center {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(78vw, 320px);
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 0.48s var(--ease), transform 0.6s var(--ease), filter 0.6s var(--ease);
}

.loader.is-complete .loader__center {
  opacity: 0;
  filter: blur(7px);
  transform: translateY(-10px) scale(0.98);
}

.loader.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loader__mark {
  display: grid;
  width: 27px;
  height: 27px;
  margin-bottom: clamp(44px, 9svh, 78px);
  place-items: center;
  border: 1px solid rgb(242 239 231 / 30%);
  border-radius: 50%;
  font-family: Didot, "Iowan Old Style", Baskerville, serif;
  font-size: 14px;
  line-height: 1;
}

.loader__number {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: Didot, "Iowan Old Style", Baskerville, serif;
  font-size: clamp(82px, 25vw, 126px);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  line-height: 0.75;
  letter-spacing: -0.07em;
}

.loader__number sup {
  margin: 2px 0 0 9px;
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.loader__line {
  width: 100%;
  height: 1px;
  margin-top: 17px;
  overflow: hidden;
  background: rgb(242 239 231 / 16%);
}

.loader__line span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--moss);
  transform: scaleX(0);
  transform-origin: left center;
}

.loader__status {
  min-height: 12px;
  margin-top: 31px;
  color: rgb(242 239 231 / 58%);
  font-size: 8px;
  line-height: 1.4;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.loader__retry {
  margin-top: 24px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.site-header {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0
    max(18px, env(safe-area-inset-left));
  mix-blend-mode: difference;
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: #fff;
  text-decoration: none;
  pointer-events: auto;
}

.brand__mark {
  font-family: Didot, "Iowan Old Style", Baskerville, serif;
  font-size: 27px;
  line-height: 0.85;
}

.brand__name {
  font-size: 8px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chapter-count {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.chapter-count i {
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.story {
  position: relative;
  background: var(--night);
}

.story__stage {
  position: sticky;
  z-index: 1;
  top: 0;
  height: 100svh;
  overflow: hidden;
  background: #11130f;
}

.media-frame,
.story-video,
.media-vignette,
.grain {
  position: absolute;
  inset: 0;
}

.media-frame {
  overflow: hidden;
  background: #1a1b17;
  transition: filter 0.45s var(--ease), opacity 0.45s var(--ease);
}

.story__stage.is-moving .media-frame {
  filter: brightness(0.88);
}

.story__stage.is-jumping .media-frame {
  opacity: 0.72;
}

.story-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  filter: saturate(0.92) contrast(1.02);
  opacity: 1;
  transition: opacity 0.08s linear;
}

.story-video--reverse {
  z-index: 1;
  opacity: 0;
}

.story__stage.is-reversing .story-video:not(.story-video--reverse) {
  opacity: 0;
}

.story__stage.is-reversing .story-video--reverse {
  opacity: 1;
}

.media-vignette {
  z-index: 2;
  background:
    linear-gradient(to bottom, rgb(9 11 8 / 20%) 0, transparent 23%),
    linear-gradient(to top, rgb(11 13 10 / 94%) 0, rgb(11 13 10 / 54%) 25%, transparent 61%);
  pointer-events: none;
}

.grain {
  z-index: 3;
  pointer-events: none;
  opacity: 0.08;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.chapter-layer {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 60px));
  left: 0;
  min-height: 290px;
  padding: 0 42px 0 max(22px, env(safe-area-inset-left));
  pointer-events: none;
}

.chapter {
  position: absolute;
  inset: 0 42px 0 max(22px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  visibility: hidden;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.65s var(--ease),
    visibility 0.5s;
}

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

.chapter__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--moss);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.chapter__eyebrow::before {
  width: 20px;
  height: 1px;
  background: currentColor;
  content: "";
}

.chapter h1,
.chapter h2 {
  max-width: 345px;
  margin: 0;
  font-family: Didot, "Iowan Old Style", Baskerville, serif;
  font-size: clamp(40px, 12.5vw, 62px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.chapter h1 em,
.chapter h2 em {
  font-weight: 400;
}

.chapter__text {
  max-width: 320px;
  margin: 17px 0 0;
  color: rgb(242 239 231 / 76%);
  font-size: 11px;
  line-height: 1.48;
  letter-spacing: 0.04em;
}

.chapter__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: min(100%, 330px);
  margin: 18px 0 0;
  padding: 13px 0 0;
  border-top: 1px solid rgb(242 239 231 / 24%);
}

.chapter__facts div {
  min-width: 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.65s var(--ease);
}

.chapter__facts div:nth-child(2) {
  transition-delay: 0.08s;
}

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

.chapter__facts dt,
.chapter__facts dd {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter__facts dt {
  margin-bottom: 4px;
  color: rgb(242 239 231 / 49%);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.chapter__facts dd {
  color: var(--ink);
  font-family: Didot, "Iowan Old Style", Baskerville, serif;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.chapter-nav {
  position: absolute;
  z-index: 8;
  right: max(15px, env(safe-area-inset-right));
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(-50%);
}

.chapter-nav button {
  position: relative;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.chapter-nav button::before,
.chapter-nav button::after {
  position: absolute;
  top: 50%;
  right: 0;
  height: 1px;
  content: "";
  transition: width 0.45s var(--ease), opacity 0.45s;
}

.chapter-nav button::before {
  width: 7px;
  background: rgb(255 255 255 / 50%);
}

.chapter-nav button::after {
  width: 0;
  background: var(--ink);
}

.chapter-nav button.is-active::after {
  width: 15px;
}

.story__stage.is-reading .chapter-nav button.is-active::after {
  transform-origin: right center;
  animation: reading-lock 0.9s linear both;
}

@keyframes reading-lock {
  from {
    transform: scaleX(0.12);
  }
  to {
    transform: scaleX(1);
  }
}

.chapter-nav button.is-active::before {
  opacity: 0;
}

.scroll-cue {
  position: absolute;
  z-index: 5;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(22px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgb(255 255 255 / 68%);
  transition: opacity 0.35s;
}

.scroll-cue.is-hidden {
  opacity: 0;
}

.scroll-cue span {
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.scroll-cue svg {
  width: 11px;
  height: 16px;
  overflow: visible;
  stroke: currentColor;
  stroke-width: 1.2px;
  animation: nudge 1.8s var(--ease) infinite;
}

.story__stage.is-reading .scroll-cue svg {
  opacity: 0.3;
  animation: none;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

.buffer-indicator {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  display: none;
  width: 32px;
  height: 32px;
  margin: -16px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
}

.buffer-indicator.is-visible {
  display: block;
}

.buffer-indicator span {
  position: absolute;
  inset: -1px;
  border-top: 1px solid var(--ink);
  border-radius: inherit;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.story-step {
  height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.outro {
  position: relative;
  z-index: 5;
  min-height: 100svh;
  padding: max(100px, 14svh) max(24px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  overflow: hidden;
  background: var(--paper);
  color: var(--night);
  scroll-snap-align: start;
}

.outro::after {
  position: absolute;
  right: -38vw;
  bottom: -29vw;
  width: 84vw;
  height: 84vw;
  border: 1px solid rgb(21 23 19 / 13%);
  border-radius: 50%;
  content: "";
}

.outro__eyebrow {
  margin: 0 0 21svh;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.outro h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: Didot, "Iowan Old Style", Baskerville, serif;
  font-size: clamp(48px, 14vw, 76px);
  font-weight: 400;
  line-height: 0.91;
  letter-spacing: -0.05em;
}

.outro h2 em {
  font-weight: 400;
}

.outro__copy {
  max-width: 380px;
  margin: 28px 0 42px;
  color: rgb(21 23 19 / 68%);
  font-size: 12px;
  line-height: 1.6;
}

.outro__link {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 13px 0;
  border-bottom: 1px solid currentColor;
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.outro__link svg {
  width: 26px;
  stroke: currentColor;
  stroke-width: 1.2px;
  transition: transform 0.4s var(--ease);
}

.outro__link:hover svg {
  transform: translateX(7px);
}

.outro footer {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  color: rgb(21 23 19 / 48%);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.noscript {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  left: 20px;
  margin: 0;
  padding: 16px;
  background: #fff;
  color: #111;
  font-size: 13px;
}

@media (min-width: 800px) {
  .site-header {
    padding: 28px 34px 0;
  }

  .story__stage {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) min(56.25vh, 560px) minmax(280px, 1fr);
    background:
      radial-gradient(circle at 50% 35%, rgb(164 173 131 / 8%), transparent 38%),
      #11130f;
  }

  .media-frame {
    position: relative;
    grid-column: 2;
    height: 100svh;
    box-shadow: 0 0 90px rgb(0 0 0 / 44%);
  }

  .chapter-layer {
    top: 50%;
    right: calc(50% + min(31vh, 310px));
    bottom: auto;
    left: clamp(40px, 7vw, 120px);
    min-height: 350px;
    padding: 0;
    transform: translateY(-50%);
  }

  .chapter {
    inset: 0;
    justify-content: center;
  }

  .chapter h1,
  .chapter h2 {
    max-width: 440px;
    font-size: clamp(54px, 5.1vw, 88px);
  }

  .chapter__text {
    max-width: 310px;
    font-size: 12px;
  }

  .chapter__facts {
    width: 310px;
  }

  .chapter-nav {
    right: 34px;
  }

  .scroll-cue {
    bottom: 28px;
    left: 34px;
  }

  .outro {
    display: grid;
    grid-template-columns: minmax(160px, 0.55fr) 1.45fr 0.7fr;
    align-content: center;
    gap: 5vw;
    padding: 8vw;
  }

  .outro__eyebrow {
    align-self: start;
    margin: 14px 0 0;
  }

  .outro h2 {
    font-size: clamp(72px, 8vw, 138px);
  }

  .outro__copy {
    align-self: end;
    margin: 0 0 72px;
    font-size: 14px;
  }

  .outro__link {
    grid-column: 3;
    align-self: end;
    justify-self: start;
    margin-top: -58px;
  }

  .outro::after {
    right: -21vw;
    bottom: -35vw;
    width: 70vw;
    height: 70vw;
  }
}

@media (max-width: 799px) {
  .story__stage {
    touch-action: none;
  }
}

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

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