/* The aperture transition: a lens diaphragm of a few thin-edged blades turns shut over the old page, a pinhole of
   colour stays for a breath, then the blades turn open on the new page and its title widens out of the hole. */
:root {
  --paper: #f3f0e8;
  --stone: #e6e2d8;
  --ink: #141414;
  --muted: #8a857b;
  --blade: #151412;
  --blade-edge: #625d54;
  --stop: #9a958a;
  --accent: #e8452c;
}

* {
  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 --ts (the size of the titles) and --tt (where a title's top sits from the centre) */
  --pad: clamp(20px, 4.2vw, 64px);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

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

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

.page--a {
  background: var(--paper);
}

.page--b {
  background: var(--stone);
}

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

.brand {
  font-size: 17px;
  font-weight: 640;
  font-stretch: 80%;
  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;
}

.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 title, centred on the hole */
.hero {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 50%;
  height: 0;
}

.title {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--tt, -80px);
  margin: 0;
  text-align: center;
  font-size: var(--ts, 140px);
  line-height: 1;
  font-weight: 560;
  letter-spacing: -0.035em;
  white-space: pre;
}

.ch {
  display: inline-block;
  font-stretch: calc(var(--w, 100) * 1%);
  font-weight: var(--g, 560);
}

.below {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--tt, -80px) + var(--ts, 140px) * 1.06 + clamp(14px, 2.6vh, 30px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 2.8vh, 28px);
  text-align: center;
}

.lede {
  margin: 0;
  max-width: 36ch;
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.5;
  font-stretch: 92%;
  color: var(--muted);
}

/* the link: its words widen a little and the small lens on it closes */
.go {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 540;
}

.go__text {
  display: inline-block;
  font-stretch: calc(var(--w, 100) * 1%);
}

.go__iris {
  width: 18px;
  height: 18px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.go__hex {
  transform-box: view-box;
  transform-origin: 10px 10px;
}

/* ------------------------------------------------------------------ the lens */
.spot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  z-index: 3;
  pointer-events: none;
}

.iris {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 4;
  pointer-events: none;
}

.iris__blades {
  fill: var(--blade);
}

.iris__edges {
  fill: none;
  stroke: var(--blade-edge);
  stroke-width: 1;
  stroke-linecap: round;
}

.stop {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 5;
  text-align: center;
  font-size: 11px;
  font-weight: 460;
  font-stretch: 86%;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--stop);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

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

  .nav {
    font-size: 13px;
  }

  .foot {
    font-size: 12px;
  }

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