/* The split-line transition: a hairline cuts the page in two, the halves slide apart like a drawer opening up and
   down, and the next page widens out of the gap, its title running in along the line. Going back, the halves slide
   shut over it and the line closes like a seam. */
:root {
  --paper: #f1eee8;
  --ink: #171614;
  --muted: #8b867d;
  --night: #171614;
  --night-ink: #efebe4;
  --night-muted: #8e897f;
  --line: #d4522a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  font-family: 'Instrument Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  /* the script writes --cut (where the line runs), --hs and --ts (the sizes of the two big lines) */
  --pad: clamp(20px, 4.2vw, 64px);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
}

/* ------------------------------------------------------------------ the pages */
.page {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.page.is-on {
  visibility: visible;
}

.page--a {
  background: var(--paper);
  color: var(--ink);
  z-index: 2;
}

.page--b {
  background: var(--night);
  color: var(--night-ink);
  z-index: 1;
}

.bar,
.foot {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.bar {
  top: calc(var(--pad) * 0.8);
}

.foot {
  bottom: calc(var(--pad) * 0.8);
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.page--b .foot {
  color: var(--night-muted);
}

.brand {
  font-size: 17px;
  font-weight: 640;
  font-stretch: 82%;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 32px);
  font-size: 14px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s ease;
}

.page--b .nav a {
  color: var(--night-muted);
}

.nav a[aria-current] {
  color: inherit;
}

.page--b .nav a[aria-current] {
  color: var(--night-ink);
}

@media (hover: hover) {
  .nav a:not([aria-current]):hover {
    color: var(--line);
  }
}

a:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 6px;
  border-radius: 2px;
}

/* ------------------------------------------------------------------ the first page */
.hero {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: var(--cut, 50%);
  height: 0;
}

.headline {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  font-size: var(--hs, 160px);
  line-height: 1;
  font-weight: 520;
  font-stretch: 84%;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.kicker {
  position: absolute;
  left: 0;
  bottom: calc(var(--hs, 160px) * 0.62);
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.go {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  font-weight: 520;
}

.go--next {
  position: absolute;
  left: 0;
  top: calc(var(--hs, 160px) * 0.6);
}

.go__text {
  display: inline-block;
}

.go__arrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 30px;
  height: 12px;
}

.go__shaft {
  position: absolute;
  top: 50%;
  height: 1.5px;
  width: 16px;
  margin-top: -0.75px;
  background: currentColor;
}

.go__head {
  position: absolute;
  top: 0;
  width: 8px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.go--next .go__shaft {
  left: 0;
  transform-origin: 0 50%;
}

.go--next .go__head {
  left: 9px;
}

.go--back .go__shaft {
  right: 0;
  transform-origin: 100% 50%;
}

.go--back .go__head {
  right: 9px;
}

/* ------------------------------------------------------------------ the second page */
.title {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  font-size: var(--ts, 140px);
  line-height: 1;
  font-weight: 480;
  letter-spacing: -0.04em;
  white-space: pre;
}

.ch {
  display: inline-block;
  transform-origin: 50% 82%;
  font-stretch: calc(var(--w, 100) * 1%);
  will-change: transform;
}

.below {
  position: absolute;
  left: 0;
  top: clamp(22px, 3.4vh, 36px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(20px, 3vh, 30px);
}

.lede {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.5;
  color: var(--night-muted);
}

/* ------------------------------------------------------------------ the cut */
.halves {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.half {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.half__clip {
  position: absolute;
  inset: 0;
}

.half--top .half__clip {
  clip-path: inset(0 0 calc(100% - var(--cut, 50%)) 0);
}

.half--bottom .half__clip {
  clip-path: inset(var(--cut, 50%) 0 0 0);
}

.half__clip > .page {
  visibility: visible;
}

.cut {
  position: absolute;
  left: 0;
  top: var(--cut, 50%);
  width: 100%;
  height: 1px;
  margin-top: -0.5px;
  background: var(--line);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 4;
  pointer-events: none;
}

@media (max-width: 600px) {
  .brand {
    font-size: 16px;
  }

  .foot {
    font-size: 12px;
  }

  .go {
    font-size: 14px;
  }
}
