:root {
  --ink: #070a0e;
  --paper: #f0ece5;
  --muted: #9b9da1;
  --copper: #cf8b67;
  --hairline: rgba(240, 236, 229, 0.24);
  --page-gutter: clamp(1.5rem, 3.6vw, 4.5rem);
  --media-x: 27vw;
  --media-y: 12vh;
  --media-width: 65vw;
  --media-height: 76vh;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: auto;
  background: var(--ink);
  scrollbar-width: none;
}

html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  color: var(--paper);
  background: var(--ink);
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}

.sr-only,
.frame-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.noscript {
  position: fixed;
  z-index: 20;
  inset: 1rem 1rem auto;
  margin: 0;
  padding: 0.85rem 1rem;
  color: var(--paper);
  background: #171b20;
  border: 1px solid var(--hairline);
}

.sequence {
  position: relative;
  height: 700vh;
  min-height: 280rem;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
}

#sequence-canvas {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--ink);
}

.interface {
  position: absolute;
  inset: 0;
  padding: clamp(1.4rem, 3vw, 3.25rem) var(--page-gutter);
  pointer-events: none;
}

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  color: #eef0ef;
}

.masthead.is-scroll-hidden {
  opacity: 0;
  visibility: hidden;
}

.monogram {
  color: #eef0ef;
  pointer-events: auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 2.7vw, 3.2rem);
  line-height: 0.8;
  letter-spacing: -0.12em;
  text-decoration: none;
}

.project-name,
.chapter__index,
.scroll-cue,
.loader p {
  text-transform: uppercase;
  letter-spacing: 0.28em;
}

.project-name {
  margin: 0;
  color: #eef0ef;
  font-size: clamp(0.6rem, 0.68vw, 0.78rem);
  font-weight: 500;
  white-space: nowrap;
}

.chapter-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(1.4rem, 3.6vw, 4rem);
  pointer-events: auto;
}

.chapter-nav[hidden] { display: none; }

.chapter-nav a {
  position: relative;
  padding: 0.9rem 0;
  color: #d5d9dd;
  font-family: Arial, sans-serif;
  font-size: clamp(0.6rem, 0.68vw, 0.75rem);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 180ms ease;
}

.chapter-nav a:hover,
.chapter-nav a[aria-current] { color: #f3f3ee; }

.chapter-nav a[aria-current]::after {
  content: "";
  position: absolute;
  bottom: 0.2rem;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #dfbf8b;
  box-shadow: 0 0 5px #dfbf8b66;
  transform: translateX(-50%);
}

.menu-toggle {
  margin-left: clamp(0.5rem, 2vw, 2rem);
  width: 44px;
  height: 44px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #aeb5bc;
  cursor: pointer;
  pointer-events: auto;
}

.menu-toggle span { width: 100%; height: 1px; background: currentColor; }
.menu-toggle:hover { color: #eef0ef; }
.chapter-nav a:focus-visible,
.menu-toggle:focus-visible,
.monogram:focus-visible { outline: 1px solid #dfbf8b; outline-offset: 5px; }

.chapters {
  position: absolute;
  left: var(--page-gutter);
  bottom: clamp(1.5rem, 4vh, 3rem);
  width: min(19rem, calc(100vw - 5rem));
  height: 9rem;
  text-shadow: 0 2px 12px #070a0e, 0 1px 3px #070a0e;
}

.chapter {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  transform: translateY(1.1rem);
  visibility: hidden;
  will-change: opacity, transform;
}

.chapter.is-visible { visibility: visible; }

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

.chapter__index {
  margin: 0;
  color: var(--copper);
  font-size: clamp(0.6rem, 0.72vw, 0.78rem);
  font-weight: 500;
}

.chapter h2 {
  margin: 0.65rem 0 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 2.8vw, 3rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.chapter__description {
  max-width: 23rem;
  margin: 0.65rem 0 0;
  color: #c0c1c3;
  font-size: 0.8rem;
  line-height: 1.6;
}

.scroll-cue {
  position: absolute;
  left: calc(var(--media-x) + var(--media-width) / 2);
  bottom: clamp(1.2rem, 2.5vw, 2.5rem);
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  color: var(--copper);
  font-size: 0.6rem;
  transform: translateX(-50%);
  transition: opacity 300ms ease, transform 300ms ease;
}

.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 2.1rem;
  background: linear-gradient(var(--copper) 50%, transparent 50%);
  background-size: 100% 200%;
  animation: scroll-line 1.7s ease-in-out infinite;
}

.scroll-cue__line::after {
  content: "";
  position: absolute;
  left: -0.23rem;
  bottom: 0.05rem;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1px solid var(--copper);
  border-bottom: 1px solid var(--copper);
  transform: rotate(45deg);
}

.progress {
  position: absolute;
  top: 50%;
  right: clamp(1rem, 2.2vw, 2.5rem);
  transform: translateY(-50%);
}

.progress__track {
  position: relative;
  width: 1px;
  height: clamp(11rem, 33vh, 20rem);
  background: var(--hairline);
}

.progress__fill {
  position: absolute;
  inset: 0;
  background: var(--copper);
  transform: scaleY(0);
  transform-origin: top;
  will-change: transform;
}

.progress__marker {
  position: absolute;
  left: 50%;
  width: 0.65rem;
  height: 0.65rem;
  border: 1px solid rgba(240, 236, 229, 0.42);
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
  transition: border-color 240ms ease, background-color 240ms ease, box-shadow 240ms ease;
}

.progress__marker:nth-of-type(2) { top: 0; }
.progress__marker:nth-of-type(3) { top: 33.333%; }
.progress__marker:nth-of-type(4) { top: 66.666%; }
.progress__marker:nth-of-type(5) { top: 100%; }

.progress__marker.is-active {
  border-color: var(--copper);
  background: var(--copper);
  box-shadow: 0 0 0 0.2rem var(--ink), 0 0 0 0.26rem var(--copper);
}

.loader {
  position: absolute;
  left: calc(var(--media-x) + var(--media-width) / 2);
  bottom: clamp(1.4rem, 3vw, 2.8rem);
  width: min(18rem, calc(100vw - 4rem));
  transform: translateX(-50%);
  transition: opacity 400ms ease, visibility 400ms ease;
}

.loader.is-complete {
  opacity: 0;
  visibility: hidden;
}

.loader__bar {
  height: 1px;
  overflow: hidden;
  background: rgba(240, 236, 229, 0.2);
}

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

.loader p {
  display: flex;
  justify-content: space-between;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.55rem;
}

@keyframes scroll-line {
  0% { background-position: 0 -100%; }
  55%, 100% { background-position: 0 100%; }
}

@media (max-width: 900px) {
  :root {
    --page-gutter: 1.25rem;
    --media-x: 0px;
    --media-y: 5.5rem;
    --media-width: 100vw;
    --media-height: 48vh;
  }

  .sequence {
    height: 600vh;
    min-height: 230rem;
  }

  .interface { padding-top: 1.4rem; }

  .menu-toggle { margin-left: auto; flex-shrink: 0; }
  .chapter-nav {
    position: absolute;
    top: calc(100% + 1rem);
    right: 0;
    padding: 0.75rem 1.5rem;
    align-items: flex-end;
    flex-direction: column;
    gap: 0.25rem;
    background: rgba(18, 26, 34, 0.96);
    border: 1px solid rgba(213, 217, 221, 0.12);
  }

  .project-name {
    max-width: 62vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chapters {
    left: var(--page-gutter);
    top: auto;
    bottom: 5.2rem;
    width: calc(100vw - 2 * var(--page-gutter));
    min-width: 0;
    height: 9rem;
    transform: none;
  }

  .chapter { justify-content: flex-end; }

  .chapter h2 {
    margin-top: 0.8rem;
    font-size: clamp(2rem, 8vw, 2.65rem);
  }

  .chapter__description {
    margin-top: 0.8rem;
    font-size: 0.82rem;
  }

  .progress {
    top: auto;
    right: auto;
    left: 50%;
    bottom: 2.1rem;
    width: min(58vw, 15rem);
    transform: translateX(-50%);
  }

  .progress__track {
    width: 100%;
    height: 1px;
  }

  .progress__fill {
    transform: scaleX(0);
    transform-origin: left;
  }

  .progress__marker { top: 50% !important; }
  .progress__marker:nth-of-type(2) { left: 0; }
  .progress__marker:nth-of-type(3) { left: 33.333%; }
  .progress__marker:nth-of-type(4) { left: 66.666%; }
  .progress__marker:nth-of-type(5) { left: 100%; }

  .scroll-cue {
    left: 50%;
    bottom: 3.8rem;
  }

  .loader {
    left: 50%;
    bottom: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue__line {
    animation: none;
    background: var(--copper);
  }

  .scroll-cue,
  .loader,
  .progress__marker { transition: none; }
}
