@font-face {
  font-family: Newsreader;
  src: url(/fonts/newsreader.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* Everything is sized from one unit, --u (the body text size, = 1rem), so the whole
   page scales as one piece and fits the screen without scrolling.
   - Wide screens, where the text column hits its max width: the page height grows
     with --u, so --u follows the screen height (--k-tall × svh).
   - Narrower screens, where the text fills the width: the largest --u that fits
     was measured over a grid of window sizes and is close to a straight line in
     height and width; --k-h × svh + --k-w × vw sits about 6% under it.
   Measured across phones, tablets and desktops in portrait and landscape. */
:root {
  --sand: #f4efec;
  --ink: #1f2322;
  --ember: #b4452a;

  --u-min: 11px;
  --u-max: clamp(24px, max(1.1vw, 2.2svh), 28px);
  --u-scale: 1;
  --k-tall: 2.83;
  --k-h: 1.68;
  --k-w: 1.13;
  --u: clamp(var(--u-min),
    min(var(--k-tall) * 1svh, var(--k-h) * 1svh + var(--k-w) * 1vw) * var(--u-scale),
    var(--u-max));

  /* Layout */
  --h-align: start;
  --shift: 0%;
  --grow-top: 1.5rem;
  --pad-top: 1.3rem;
  --pad-bottom: 1rem;
  --pad-x: 1.25rem;
  --measure: 37.5rem;

  /* Wordmark */
  --wm-size: 6.8rem;
  --wm-weight: 600;
  --wm-track: -0.02em;
  --wm-x: 0rem;
  --wm-y: 0rem;
  --gap-wm: 2.2rem;
  --grow-wm: 2.5rem;

  /* Text */
  --lead-size: 1rem;
  --lead-weight: 600;
  --lead-leading: 1.25;
  --lead-space: 0.375em;
  --body-size: 1rem;
  --body-weight: 400;
  --body-leading: 1.25;
  --para-gap: 0.76rem;

  /* Call to action and footer */
  --gap-cta: 2.2rem;
  --grow-cta: 2rem;
  --cta-size: 1rem;
  --cta-weight: 600;
  --gap-foot: 2.2rem;
  --foot-size: 0.7rem;
  --foot-weight: 400;
  --foot-align: flex-start;
}

/* Short, wide screens (phones on their side, small laptop windows):
   a longer line keeps the text to fewer lines. */
@media (orientation: landscape) and (max-height: 540px) {
  :root {
    --u-min: 10px;
    --u-max: 20px;
    --kl-w: 1.2;
    --kl-b: 5px;
    --kl-h: 3.85;
    --u: clamp(var(--u-min), min(var(--kl-w) * 1vw + var(--kl-b), var(--kl-h) * 1svh) * var(--u-scale), var(--u-max));
    --pad-top: 1rem;
    --measure: 46rem;
    --wm-size: 3.6rem;
    --gap-wm: 1.4rem;
    --para-gap: 0.5rem;
    --lead-space: 0em;
    --grow-top: 0.5rem;
    --grow-wm: 1rem;
    --grow-cta: 1rem;
    --gap-cta: 1.4rem;
    --gap-foot: 1.4rem;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  line-height: 1.25;
  letter-spacing: -0.005em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ember); color: var(--sand); }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: var(--h-align);
  text-align: var(--h-align);
  padding:
    max(var(--pad-top), env(safe-area-inset-top))
    max(var(--pad-x), 16px, env(safe-area-inset-right))
    max(var(--pad-bottom), env(safe-area-inset-bottom))
    max(var(--pad-x), 16px, env(safe-area-inset-left));
}
/* Spare height first opens up the space above the wordmark, below it and above
   "Get in touch", each by up to its --grow-* amount; the rest goes above the footer. */
.page::before { content: ""; flex-grow: 1; max-height: var(--grow-top); }
.wm, .intro, .cta { margin-left: var(--shift); }

/* The wordmark. The text is always there; parsec.js paints the nebula over it. */
.wm {
  /* On narrow screens the wordmark is capped to the width ("Parsec" is 3em wide). */
  font-size: min(var(--wm-size), (100vw - 2 * max(var(--pad-x), 16px)) / 3.15);
  position: relative;
  flex-grow: 2;
  max-height: calc(1em + var(--grow-wm));
  margin-bottom: var(--gap-wm);
  transform: translate(var(--wm-x), var(--wm-y));
}
.wm__text {
  margin: 0;
  font-size: 1em;
  line-height: 1;
  font-weight: var(--wm-weight);
  letter-spacing: var(--wm-track);
  white-space: nowrap;
}
.wm canvas {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.wm.is-live canvas { opacity: 1; }

.intro {
  max-width: var(--measure);
  display: flex;
  flex-direction: column;
  gap: var(--para-gap);
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-leading);
}
.intro p { margin: 0; text-wrap: pretty; }
.intro .lead {
  font-size: var(--lead-size);
  font-weight: var(--lead-weight);
  line-height: var(--lead-leading);
  margin-block: var(--lead-space);
}

.cta {
  flex-grow: 2;
  max-height: calc(1.25em + var(--grow-cta));
  display: flex;
  align-items: flex-end;
  margin: var(--gap-cta) 0 0;
  font-size: var(--cta-size);
  font-weight: var(--cta-weight);
}
.cta a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.cta a:hover { color: var(--ember); }
.cta a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 4px;
  border-radius: 2px;
}

.foot {
  align-self: stretch;
  flex-grow: 1;
  display: flex;
  align-items: flex-end;
  justify-content: var(--foot-align);
  margin-top: var(--gap-foot);
  font-size: var(--foot-size);
  font-weight: var(--foot-weight);
}
