/* The words-that-stay transition: the words two pages have in common never leave the screen. They fly to their
   place on the next page, growing or shrinking and changing weight as they go; the others fade where they are and
   the new ones rise after. */
:root {
  --paper: #f3f0e8;
  --ink: #141414;
  --muted: #847f75;
  --rule: #d3cdc1;
  --accent: #e2462a;
}

* {
  box-sizing: border-box;
}

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

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

/* ------------------------------------------------------------------ the header and the footer, shared */
.bar,
.foot {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  z-index: 3;
}

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

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

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

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

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

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

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

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

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

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

/* every word is its own box, so it can move without moving its neighbours */
.w {
  display: inline-block;
}

.dot {
  color: var(--accent);
}

/* the big full stop keeps its distance from the last letter */
.title .dot {
  margin-left: 0.03em;
}

.col {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.col--a {
  top: clamp(84px, 21vh, 220px);
}

.headline {
  margin: 0;
  font-size: var(--hs, 120px);
  line-height: 0.98;
  font-weight: 200;
  font-stretch: 100%;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.lede {
  margin: clamp(18px, 3.4vh, 34px) 0 0;
  max-width: 32ch;
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.5;
  font-weight: 420;
  color: var(--muted);
}

.col--b {
  top: clamp(84px, 19vh, 200px);
}

.sub {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 48px);
  line-height: 1.1;
  font-weight: 560;
  font-stretch: 96%;
  letter-spacing: -0.025em;
}

.col--b .lede {
  margin-top: clamp(12px, 2vh, 20px);
}

.title {
  position: absolute;
  left: var(--pad);
  bottom: calc(var(--pad) * 0.8 + 30px);
  margin: 0 0 0 -0.04em;
  font-size: var(--ts, 200px);
  line-height: 0.78;
  font-weight: 880;
  font-stretch: 122%;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

/* the link: a short arrow whose shaft stretches under the pointer */
.go {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: clamp(20px, 3.6vh, 36px);
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 560;
}

.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;
}

/* the arrow back starts right on the column's edge */
.go--back .go__arrow {
  width: 22px;
}

.go--back .go__shaft {
  left: 1px;
  transform-origin: 100% 50%;
}

.go--back .go__head {
  left: 0;
}

/* under the pointer, the words that will stay take a little ink: a hint of where they are going */
@media (hover: hover) {
  .w--share {
    transition: color 0.45s ease;
  }

  .page.is-hint .lede .w--share {
    color: var(--ink);
  }
}

/* ------------------------------------------------------------------ the words in flight */
.fly {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.flyer {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  line-height: 1;
  white-space: pre;
  will-change: transform;
}

.guide {
  position: absolute;
  left: 0;
  top: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
}

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

  .foot {
    font-size: 12px;
  }

  .go {
    font-size: 14px;
  }

  .lede {
    max-width: 30ch;
  }
}
