/* One text column with section names hung in a left margin on wide screens.
   System fonts only: Helvetica Neue on Apple devices, its metric clones elsewhere. */

:root {
  color-scheme: light dark;
  --paper: oklch(0.985 0.003 250);
  --ink: oklch(0.22 0.014 255);
  --muted: oklch(0.46 0.014 255);
  --link: oklch(0.45 0.15 258);
  /* 4.6:1 to the paper: the underline is the cue that does not depend on colour. */
  --link-line: oklch(0.55 0.1 258);
  --code-ground: oklch(0.935 0.008 255);
  --leading: 1.55;

  --sans: "Helvetica Neue", "Nimbus Sans", FreeSans, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Type scale: ratio 1.25 from the 18 px body. */
  --step-0: 1.125rem;
  --step-1: 1.40625rem;
  --step-6: 4.2915rem;

  --label: 12rem;
  --gap: 2.5rem;
  --measure: 35rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.205 0.012 255);
    --ink: oklch(0.915 0.008 250);
    --muted: oklch(0.74 0.012 250);
    --link: oklch(0.8 0.1 245);
    --link-line: oklch(0.8 0.1 245 / 0.6);
    --code-ground: oklch(0.285 0.014 255);
    /* Light type on a dark ground reads thinner; it needs a little more air. */
    --leading: 1.6;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 1.25rem 5rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: var(--leading);
  overflow-wrap: break-word;
}

header,
main {
  max-width: var(--measure);
  margin-inline: auto;
}

h1,
h2,
p,
ul {
  margin: 0;
}

nav {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

nav a {
  padding: 0.5rem;
  margin-inline-end: -0.5rem;
}

h1 {
  margin-top: 1.5rem;
  /* The 13.5vw cap keeps the surname in one piece when text is enlarged on a phone. */
  font-size: min(clamp(2.5rem, 1.5rem + 3.75vw, var(--step-6)), 13.5vw);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* Role line and intro: step 1 on wide screens, a little smaller on phones. */
.role {
  margin-top: 0.5rem;
  font-size: clamp(var(--step-0), 1rem + 1vw, var(--step-1));
  line-height: 1.3;
  color: var(--muted);
}

.intro {
  margin-top: 2.5rem;
  font-size: clamp(var(--step-0), 1rem + 1vw, var(--step-1));
  line-height: 1.45;
}

section {
  margin-top: 3rem;
}

h2 {
  margin-bottom: 0.75rem;
  font-size: var(--step-0);
  font-weight: 700;
  line-height: inherit;
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

/* The parenthetical in a section name is a note to the name, not part of it. */
h2 span {
  font-weight: 400;
  color: var(--muted);
}

/* One spacing value inside sections: list items sit as far apart as paragraphs. */
p + p,
li + li {
  margin-top: 1em;
}

ul {
  padding-left: 1.1em;
}

li::marker {
  color: var(--muted);
}

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--link-line);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
}

/* A filled link, not a ring: a ring drew over the full stop after a link.
   The transparent outline turns visible in forced-colours mode. */
a:focus-visible {
  outline: 2px solid transparent;
  border-radius: 2px;
  background: var(--link);
  color: var(--paper);
  text-decoration: none;
}

code {
  padding: 0.1em 0.2em;
  border-radius: 0.25em;
  background: var(--code-ground);
  font-family: var(--mono);
  font-size: 0.875em;
  white-space: nowrap;
}

/* The GitHub handle is a string to type, with a 3 in place of an e: the code face shows each character exactly. */
.handle {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* Model and dataset names stay on one line; a break inside them misreads as two names.
   An em query follows the reader's font size: with text at 200% on a phone the column is
   narrower than the longest name, so there the names wrap instead of scrolling sideways. */
@media (min-width: 20em) {
  .nowrap {
    white-space: nowrap;
  }
}

/* Wide screens: section names hang in a left column, text stays in one measure. */
@media (min-width: 56rem) {
  header,
  main {
    max-width: calc(var(--label) + var(--gap) + var(--measure));
  }

  h1 {
    margin-top: 4rem;
  }

  .intro {
    margin-top: 3.5rem;
    margin-left: calc(var(--label) + var(--gap));
  }

  section {
    display: grid;
    grid-template-columns: var(--label) minmax(0, var(--measure));
    column-gap: var(--gap);
    margin-top: 3.5rem;
  }

  h2 {
    margin-bottom: 0;
  }

  /* Bullets hang in the gutter so item text lines up with the paragraphs. */
  ul {
    padding-left: 0;
  }
}
