@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Overwritten by daylight.js on load; these are the midday values so the page
     is correct even if the script never runs. */
  --bg: #f6f3ec;
  --ink: #1b1a18;
  --accent: #8c6a3f;
  --muted: #4e4b46;
  --rule: #d8d3ca;
  /* rem, not ch: ch resolves against each element's own font size, so the prose
     and the rule below it silently disagreed about how wide "the measure" is. */
  --measure: 29rem;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 1200ms linear, color 1200ms linear;
}

/* The moving ground. Sits behind everything; the flat body background is the
   fallback when WebGL is unavailable. */
#backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Paper tooth. Sits above the ground, under the type, and never intercepts a click. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  /* Above main, so the WebGL canvas gets the same tooth as the paper around it —
     below it, the wordmark's ground read as a clean rectangle on a grained page. */
  z-index: 5;
  opacity: 0.42;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

main {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  max-width: 58rem;
  margin: 0 auto;
  padding: 2.5rem clamp(1.5rem, 6vw, 4rem);
}

/* The hero. The <h1> is the real content and the fallback; once WebGL is running
   the canvas covers it and the heading goes to screen readers only. */
.wordmark {
  position: relative;
  width: 100%;
  height: clamp(5rem, 16vw, 13rem);
  margin-bottom: 0.75rem;
}

.wordmark h1 {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  margin: 0;
  font-size: clamp(2.75rem, 9.9vw, 7.25rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.wordmark canvas {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  transition: opacity 260ms ease;
}

.wordmark.is-live canvas { opacity: 1; }

/* Kept in the accessibility tree, taken out of the visual one. */
.wordmark.is-live h1 {
  clip-path: inset(50%);
  pointer-events: none;
}

.line {
  margin: 0;
  max-width: var(--measure);
  font-size: clamp(1rem, 1.65vw, 1.1875rem);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--muted);
  text-wrap: pretty;
}

.line a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 180ms ease;
}

.line a:hover { color: var(--accent); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  /* Shares the text measure so the rule ends where the prose does, rather than
     running on to the column edge for no reason. */
  max-width: var(--measure);
  margin-top: 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.links a {
  position: relative;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.15rem;
  transition: color 200ms ease;
}

/* The rule draws in from the left rather than just appearing. */
.links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.links a:hover,
.links a:focus-visible { color: var(--ink); }

.links a:hover::after,
.links a:focus-visible::after { transform: scaleX(1); }

/* The line and the links arrive just behind the wordmark, staggered by --delay,
   so the page assembles rather than appearing all at once. */
.reveal {
  animation: rise 760ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(0.55rem); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .links a::after { transition: none; }
  .wordmark canvas { transition: none; }
  .reveal { animation: none; }
}
