@font-face {
  font-family: "Benne";
  src: url("/fonts/benne.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #141414;
  --muted: #6b6b6b;
  --rule: #d4d4d4;
  --figure: 0.13;
  --serif: "Benne", "Iowan Old Style", Georgia, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f0e;
    --ink: #e8e6e1;
    --muted: #8f8d88;
    --rule: #4a4844;
    --figure: 0.16;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  /* Where Descartes's figure sits: its width, its top, and how far it bleeds off the left. */
  --figure-width: min(104vw, 56svh * 1200 / 1468);
  --figure-top: 10svh;
  --figure-left: -10vw;

  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 48px;
  min-height: 100svh;
  padding: 40px 24px 32px;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The figure, drawn in the ink colour and faded out at its foot. */
body::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--ink);
  opacity: var(--figure);
  pointer-events: none;
  -webkit-mask-image: url("/images/descartes-perception.png"),
    linear-gradient(#000 55%, transparent 95%);
  mask-image: url("/images/descartes-perception.png"),
    linear-gradient(#000 55%, transparent 95%);
  -webkit-mask-size: var(--figure-width) auto, 100% calc(var(--figure-width) * 1468 / 1200);
  mask-size: var(--figure-width) auto, 100% calc(var(--figure-width) * 1468 / 1200);
  -webkit-mask-position: left var(--figure-left) top var(--figure-top), left 0 top var(--figure-top);
  mask-position: left var(--figure-left) top var(--figure-top), left 0 top var(--figure-top);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.name {
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

main {
  align-self: end;
}

.mission {
  font-size: clamp(1.75rem, 1.1rem + 2.2vw, 2.75rem);
  line-height: 1.16;
  letter-spacing: -0.005em;
}

.mission span {
  display: block;
  text-wrap: balance;
}

.chiron {
  margin-top: 1.5rem;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 1rem;
  color: var(--muted);
}

small {
  font-size: inherit;
}

a {
  color: inherit;
}

a,
.chiron span {
  text-decoration-line: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 200ms ease;
}

a:hover,
.chiron a:hover span {
  text-decoration-color: currentColor;
}

/* Chiron's link underlines the word and sets an arrow beside it, drawn at Benne's weight. */
.chiron a {
  text-decoration-line: none;
}

.arrow {
  width: 0.75em;
  height: 0.5em;
  margin-left: 0.3em;
  vertical-align: -0.04em;
  fill: none;
  stroke: currentColor;
  stroke-width: 55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

footer a:hover {
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 1px;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* Side by side: the figure on the left, its eyes level with the words it looks across at. */
@media (min-width: 60rem) {
  body {
    --figure-width: min(46vw, 56rem);
    --figure-top: calc(46svh - var(--figure-width) * 0.2);
    --figure-left: 0px;

    gap: 0;
    padding: 56px 6vw 48px min(50vw, var(--figure-width) + 4rem);
  }

  main {
    align-self: center;
  }

  .mission {
    font-size: 2.5rem;
  }
}

/* Wide screens set everything a step larger. */
@media (min-width: 100rem) {
  html {
    font-size: 112.5%;
  }
}

@media (min-width: 140rem) {
  html {
    font-size: 125%;
  }
}

/* The words arrive once: the name, what is scarce, then what we make abundant. The links are there from the start. */
@media (prefers-reduced-motion: no-preference) {
  body::before {
    animation: appear 1200ms both ease-out;
  }

  .name {
    animation: rise 700ms both cubic-bezier(0.2, 0, 0, 1);
  }

  .mission span:first-child {
    animation: rise 900ms 120ms both cubic-bezier(0.2, 0, 0, 1);
  }

  .mission span:last-child {
    animation: rise 900ms 600ms both cubic-bezier(0.2, 0, 0, 1);
  }

  .arrow {
    transition: transform 200ms ease;
  }

  .chiron a:hover .arrow {
    transform: translateX(0.12em);
  }
}

@keyframes appear {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
