/* The proofreader's marks transition: the page changes the way a proof is corrected. A red hairline strikes the old
   title out, the proofreader writes «del» in the margin and the letters disappear one by one; then a caret pops up on
   the baseline, «ins» goes in the margin, and the new title comes out of the caret letter by letter. */
:root {
  --paper: #f4f1ea;
  --ink: #161514;
  --muted: #8b867c;
  --rule: #ddd7cc;
  --accent: #d6361e;
}

* {
  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 {
  --pad: clamp(20px, 4.4vw, 72px);
  --mw: clamp(40px, 7vw, 84px);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

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

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

.foot {
  bottom: calc(var(--pad) * 0.7);
  font-size: 12px;
  color: var(--muted);
  font-stretch: 92%;
}

.brand {
  font-size: 18px;
  font-weight: 640;
  font-stretch: 76%;
  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.3s;
}

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

/* ------------------------------------------------------------------ the margin */
.margin {
  position: absolute;
  top: calc(var(--pad) * 0.7 + 34px);
  bottom: calc(var(--pad) * 0.7 + 30px);
  right: var(--pad);
  width: var(--mw);
  border-left: 1px solid var(--rule);
  z-index: 3;
  pointer-events: none;
}

.mark {
  position: absolute;
  left: 50%;
  width: calc(var(--mw) * 0.62);
  top: var(--my, 40%);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
}

.mark svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.mark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark__word {
  font-size: clamp(10px, 1.1vw, 13px);
  font-weight: 560;
  font-stretch: 78%;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ------------------------------------------------------------------ the pages */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: calc(var(--pad) * 1.8) calc(var(--pad) + var(--mw) + var(--pad) * 0.6) calc(var(--pad) * 1.8) var(--pad);
  visibility: hidden;
}

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

.col {
  width: 100%;
  max-width: 980px;
}

.kicker {
  margin: 0 0 0.9em;
  font-size: clamp(12px, 1.3vw, 15px);
  font-weight: 520;
  font-stretch: 84%;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.title {
  margin: 0;
  font-size: min(12.6vw, 13vh, 132px);
  line-height: 1.02;
  font-weight: 690;
  letter-spacing: -0.025em;
}

.line {
  display: block;
  white-space: nowrap;
}

/* every letter of the title: GSAP moves .ch, the width axis comes from --w */
.ch {
  display: inline-block;
  font-stretch: calc(var(--w, 100) * 1%);
  will-change: transform;
}

.sp {
  display: inline-block;
  width: 0.24em;
}

.text {
  margin: 1.1em 0 1.4em;
  max-width: 30em;
  font-size: clamp(14px, 1.45vw, 18px);
  line-height: 1.45;
  font-weight: 380;
  font-stretch: 96%;
  color: #3b3934;
}

/* ------------------------------------------------------------------ the link */
.go {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(14px, 1.4vw, 17px);
  font-weight: 560;
  font-stretch: 86%;
  padding: 6px 0;
  transition: font-stretch 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.go__arrow {
  display: inline-flex;
  align-items: center;
}

.go__shaft {
  display: block;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.go__head {
  width: 8px;
  height: 12px;
  margin-left: -6px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.go--back .go__head {
  margin-left: 0;
  margin-right: -6px;
}

/* the little caret that waits under the link */
.go::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 9px;
  height: 6px;
  background: var(--accent);
  clip-path: polygon(0 100%, 50% 0, 100% 100%, 82% 100%, 50% 36%, 18% 100%);
  transform: translateY(4px) scale(0.4);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
}

@media (hover: hover) {
  .go:hover {
    font-stretch: 100%;
  }

  .go:hover .go__shaft {
    width: 34px;
  }

  .go:hover::after {
    transform: none;
    opacity: 1;
  }
}

.go:active {
  font-stretch: 78%;
}

.go:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 6px;
}

/* ------------------------------------------------------------------ the red ink over the page */
.ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}

.ink path {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 560px) {
  .foot span:last-child {
    display: none;
  }

  .text {
    max-width: none;
  }
}
