/* The flip-side transition: the page is a sheet of paper on a table. A click lifts it by one corner, turns it over in
   3D and the new page is printed on its back; it comes down on a thin cushion of air, glides the last few pixels and
   settles with a small bounce. */
:root {
  --paper: #f3f0e8;
  --ink: #141414;
  --table: #d8d3c7;
  --accent: #2f4bff;
  --accent-on-ink: #6f84ff;
  --edge-light: rgba(20, 20, 20, 0.14);
  --edge-dark: rgba(243, 240, 232, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--table);
  font-family: 'Newsreader Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  /* the script writes --ha and --hb (the sizes of the two big words) */
  --pad: clamp(20px, 4.2vw, 64px);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--table);
}

/* ------------------------------------------------------------------ the table and the sheet */
.deck,
.lifter,
.sheet {
  position: absolute;
  inset: 0;
}

.deck {
  transform-origin: 50% 50%;
}

.lifter,
.sheet {
  transform-style: preserve-3d;
}

.sheet {
  transform-origin: 50% 50%;
}

.shadow {
  position: absolute;
  inset: 0;
  background: #1d1a14;
  filter: blur(26px);
  opacity: 0;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.air {
  position: absolute;
  inset: 0;
  border: 1px solid var(--ink);
  opacity: 0;
  pointer-events: none;
}

.face {
  --bg: var(--paper);
  --fg: var(--ink);
  --dot: var(--accent);
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--edge-light);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* both sides stay ready on their own layer, so the one coming round is never drawn late */
  will-change: transform;
}

.face--b {
  --bg: var(--ink);
  --fg: var(--paper);
  --dot: var(--accent-on-ink);
  box-shadow: 0 0 0 1px var(--edge-dark);
}

/* the side that is down on the table is the back of the sheet */
.sheet[data-on='a'] .face--b,
.sheet[data-on='b'] .face--a {
  transform: rotateY(180deg);
}

/* with reduced motion nothing turns: the two pages lie one on the other and swap with a fade */
.stage.is-still .face {
  transform: none;
}

.face__shade {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #141414;
  opacity: 0;
  pointer-events: none;
}

/* trim marks in the corners: the page is a printed sheet */
.trim {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid currentColor;
  opacity: 0.32;
  pointer-events: none;
}

.trim--tl {
  top: 10px;
  left: 10px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.trim--tr {
  top: 10px;
  right: 10px;
  border-top-width: 1px;
  border-right-width: 1px;
}

.trim--bl {
  bottom: 10px;
  left: 10px;
  border-bottom-width: 1px;
  border-left-width: 1px;
}

.trim--br {
  bottom: 10px;
  right: 10px;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

/* ------------------------------------------------------------------ the page */
.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;
}

.foot span {
  opacity: 0.55;
}

.brand {
  font-size: 20px;
  font-weight: 560;
  font-style: normal;
  letter-spacing: -0.01em;
}

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

.nav a {
  color: inherit;
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.25s ease, color 0.25s ease;
}

.nav [aria-current] {
  opacity: 1;
}

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

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

.hero {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 56%;
  height: 0;
}

/* the big word stands on the hero line */
.big {
  position: absolute;
  left: -0.04em;
  bottom: 0;
  margin: 0;
  font-size: var(--ha, 160px);
  line-height: 0.86;
  font-weight: 300;
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.035em;
  white-space: pre;
  width: max-content;
}

.big--b {
  font-size: var(--hb, 160px);
  font-weight: 640;
  letter-spacing: -0.03em;
}

.ch {
  display: inline-block;
}

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

.kicker {
  position: absolute;
  left: 0;
  bottom: calc(var(--ha, 160px) * 0.98);
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: system-ui, sans-serif;
  opacity: 0.6;
}

.face--b .kicker {
  bottom: calc(var(--hb, 160px) * 0.98);
}

.go {
  position: absolute;
  left: 0;
  top: clamp(26px, 5vh, 46px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 17px;
  font-weight: 440;
  font-variation-settings: 'opsz' 16;
}

.below {
  position: absolute;
  left: 0;
  top: clamp(24px, 4.4vh, 40px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(20px, 3vh, 28px);
}

.below .go {
  position: relative;
  top: auto;
}

.lede {
  margin: 0;
  max-width: 36ch;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.5;
  font-variation-settings: 'opsz' 16;
  opacity: 0.64;
}

.go__text {
  display: inline-block;
}

/* the link's mark is a tiny sheet of its own: under the pointer it turns over and shows its blue back */
.leaf {
  display: inline-block;
  width: 12px;
  height: 15px;
  perspective: 60px;
}

.leaf__in {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.leaf__f,
.leaf__b {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.leaf__f {
  border: 1.5px solid currentColor;
}

.leaf__b {
  background: var(--dot);
  transform: rotateY(180deg);
}

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

  .nav {
    font-size: 14px;
  }

  .foot {
    font-size: 12px;
  }

  .go {
    font-size: 16px;
  }

  .trim {
    width: 10px;
    height: 10px;
  }

  .trim--tl,
  .trim--tr {
    top: 8px;
  }

  .trim--bl,
  .trim--br {
    bottom: 8px;
  }

  .trim--tl,
  .trim--bl {
    left: 8px;
  }

  .trim--tr,
  .trim--br {
    right: 8px;
  }
}
