:root {
  /* Roboto Condensed for small technical annotations */
  --dune: #F3E4C8;
  --umber: #221C17;
  --terracotta: #B7663E;
  --sage: #6F7E5A;
  --clay: #8A6A4B;
  --graphite: #4C5961;
  --ash: #D7C19D;
  --font-head: "Oswald", sans-serif;
  --font-body: "Newsreader", serif;
  --font-tech: "Roboto Condensed", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--dune);
  color: var(--umber);
  font-family: var(--font-body);
  overflow-x: hidden;
}

.grain, .field-grid, .scroll-meter {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.grain {
  opacity: .28;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(34, 28, 23, .07) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 50%, rgba(138, 106, 75, .08) 0 1px, transparent 1px),
    radial-gradient(circle at 40% 90%, rgba(111, 126, 90, .06) 0 1px, transparent 1px);
  background-size: 31px 37px, 47px 53px, 61px 67px;
  mix-blend-mode: multiply;
}

.field-grid {
  opacity: .26;
  background:
    linear-gradient(115deg, transparent 0 17%, rgba(76, 89, 97, .18) 17.1% 17.25%, transparent 17.35% 47%, rgba(183, 102, 62, .22) 47.1% 47.28%, transparent 47.38% 100%),
    linear-gradient(90deg, rgba(76, 89, 97, .16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(76, 89, 97, .11) 1px, transparent 1px);
  background-size: 100% 100%, 92px 92px, 92px 92px;
  mask-image: radial-gradient(circle at 50% 45%, black 0 42%, transparent 78%);
}

.scroll-meter {
  inset: auto 0 0 0;
  height: 3px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 30;
}

.atlas-nav {
  position: fixed;
  right: 2.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  font-family: var(--font-tech);
}

.atlas-nav a {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 89, 97, .42);
  border-radius: 50%;
  color: var(--graphite);
  text-decoration: none;
  background: rgba(243, 228, 200, .72);
  transition: border-color .5s ease, color .5s ease, transform .5s ease, background .5s ease;
}

.atlas-nav a.active {
  color: var(--terracotta);
  border-color: var(--terracotta);
  background: rgba(215, 193, 157, .62);
  transform: translateX(-.35rem);
}

.chapter {
  position: relative;
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 6rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .92fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 8rem);
  isolation: isolate;
  overflow: hidden;
}

.chapter::before {
  content: attr(data-chapter);
  position: absolute;
  left: 3vw;
  bottom: 2.5vh;
  font-family: var(--font-head);
  font-size: clamp(5rem, 16vw, 18rem);
  line-height: .78;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(138, 106, 75, .075);
  z-index: -1;
}

.hero {
  grid-template-columns: 1fr;
  align-content: center;
  padding-right: clamp(2rem, 10vw, 11rem);
}

.corner-fold {
  position: absolute;
  right: 0;
  top: 0;
  width: clamp(90px, 12vw, 180px);
  aspect-ratio: 1;
  background: linear-gradient(135deg, rgba(215, 193, 157, .1) 0 49%, rgba(138, 106, 75, .23) 50%, rgba(215, 193, 157, .8) 100%);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.eyebrow, .coordinate-label, figcaption {
  font-family: var(--font-tech);
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--graphite);
  font-size: .78rem;
}

.wordmark, h2 {
  font-family: var(--font-head);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .055em;
  margin: 0;
  color: var(--umber);
}

.wordmark {
  font-size: clamp(4.6rem, 13vw, 15.5rem);
  line-height: .9;
  max-width: 8ch;
}

h2 {
  font-size: clamp(4rem, 9vw, 11rem);
  line-height: .86;
  max-width: 8ch;
}

h2 em {
  color: var(--terracotta);
  font-style: normal;
}

.statement p:not(.eyebrow), .opening-note, .ending-line {
  font-size: clamp(1.25rem, 2vw, 2.05rem);
  line-height: 1.22;
  max-width: 30rem;
  color: rgba(34, 28, 23, .82);
}

.narrow p:not(.eyebrow) { max-width: 25rem; }

.hero-map {
  position: relative;
  min-height: 38vh;
  margin-top: clamp(1rem, 4vh, 3rem);
}

.node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--font-tech);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--clay);
}

.node i {
  display: block;
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 0 10px rgba(183, 102, 62, .11);
}

.node-you { left: 5%; top: 14%; }
.node-other { right: 4%; bottom: 11%; }
.node-other i { background: var(--sage); box-shadow: 0 0 0 10px rgba(111, 126, 90, .12); }

.draw-line {
  position: absolute;
  overflow: visible;
  pointer-events: none;
}

.draw-line path {
  fill: none;
  stroke: var(--terracotta);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: url(#none);
}

.hero-line { inset: 2rem 4vw 0 4vw; width: calc(100% - 8vw); height: 100%; }
.diagonal-line { left: 4vw; top: 18vh; width: 80vw; height: 58vh; z-index: -1; opacity: .86; }
.reverse path { stroke: var(--sage); }

.coordinate-label {
  position: absolute;
  border-top: 1px solid rgba(76, 89, 97, .28);
  padding-top: .5rem;
}

.label-a { right: 17vw; top: 20vh; }
.label-b { left: 7vw; bottom: 12vh; }
.final-a { left: 9vw; bottom: 18vh; }
.final-b { right: 12vw; top: 23vh; }

.artifact {
  position: relative;
  margin: 0;
  justify-self: center;
  width: min(42vw, 520px);
  min-width: 300px;
  transform: translate3d(0, 0, 0);
  transition: transform .9s cubic-bezier(.2, .7, .1, 1);
}

.artifact::before, .final-instrument::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(183, 102, 62, .13), transparent 62%);
  z-index: -1;
}

.instrument, .final-instrument svg { width: 100%; display: block; overflow: visible; }

.ash-fill { fill: rgba(215, 193, 157, .56); stroke: rgba(138, 106, 75, .28); stroke-width: 1.4; }
.ash-fill.small { fill: rgba(215, 193, 157, .38); }
.ring, .orbit { fill: none; stroke: var(--graphite); stroke-width: 1.6; stroke-dasharray: 4 10; opacity: .7; transform-origin: center; }
.slow { animation: orbit 44s linear infinite; }
.counter { animation: orbit 58s linear infinite reverse; stroke: var(--sage); }
.sand-arc { fill: none; stroke: var(--clay); stroke-width: 5; stroke-linecap: round; opacity: .45; stroke-dasharray: 2 12; }
.thread { fill: none; stroke: var(--terracotta); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 8 8; }
.moon.clay { fill: var(--B7663E, #B7663E); opacity: .88; }
.moon.sage { fill: var(--sage); opacity: .86; }
.eclipse { fill: rgba(76, 89, 97, .11); stroke: rgba(76, 89, 97, .36); }
.cup { fill: rgba(215, 193, 157, .72); stroke: var(--umber); stroke-width: 2; }
.cup.second { fill: rgba(111, 126, 90, .27); }
.node-mark, .constellation circle { fill: var(--terracotta); }
.stone { fill: var(--ash); stroke: var(--graphite); stroke-width: 1.5; }
.stone.second { fill: rgba(183, 102, 62, .32); }

figcaption {
  margin-top: 1rem;
  padding-left: 2rem;
  position: relative;
}

figcaption::before {
  content: "";
  position: absolute;
  left: 0;
  top: .5em;
  width: 1.25rem;
  border-top: 2px solid var(--terracotta);
}

.z-right { grid-template-columns: minmax(280px, .92fr) minmax(0, 1fr); }
.z-right .statement { justify-self: end; }

.finale {
  grid-template-columns: 1fr;
  text-align: center;
  justify-items: center;
  gap: 1rem;
}

.finale h2 { max-width: none; }

.final-instrument {
  position: relative;
  width: min(62vw, 560px);
  margin: -1rem auto;
  transition: transform .9s cubic-bezier(.2, .7, .1, 1);
}

.final-thread {
  fill: none;
  stroke: var(--terracotta);
  stroke-width: 3;
  stroke-dasharray: 10 9;
}

.ending-line { margin: 0; max-width: 34rem; }

.chapter.is-active .draw-line path { animation: draw 2.8s cubic-bezier(.47, 0, .2, 1) forwards; }
.chapter.is-active .statement, .chapter.is-active .artifact, .chapter.is-active .final-instrument, .chapter.is-active .opening-note { animation: settle 1.1s ease both; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes settle {
  from { opacity: .2; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .chapter, .z-right { grid-template-columns: 1fr; align-content: center; }
  .atlas-nav { right: .8rem; }
  .artifact { width: min(82vw, 460px); }
  .wordmark { font-size: clamp(3.8rem, 17vw, 8rem); }
  h2 { font-size: clamp(3.3rem, 15vw, 7rem); }
  .diagonal-line { width: 95vw; left: -2vw; opacity: .58; }
  .node { font-size: .68rem; }
}
