/* letter: plain letters set on a poster grid. White paper, near-black ink, one signal red
   at full strength (the top bar, links, where you are), one grotesk, a twelve-column grid
   and heavy rules. No boxes, shadows, gradients or greys. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #111111;
  --signal: #d62718;

  --unit: 1.5rem;
  --gutter: clamp(1rem, 4vw, 6rem);
  --gap: clamp(0.75rem, 1.6vw, 1.5rem);

  --size-display: clamp(3rem, 1.2rem + 7.4vw, 6rem);
  --size-large: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  --size-body: 1.125rem;
  --size-label: 0.875rem;

  --rule-heavy: 0.375rem;
  --rule: 0.125rem;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  border-top: var(--unit) solid var(--signal);
  font: 400 var(--size-body) / 1.6 "Archivo", system-ui, sans-serif;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--signal);
  text-decoration-line: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 0.2em; }
a:focus-visible {
  outline: 0.1875rem solid var(--ink);
  outline-offset: 0.1875rem;
  text-decoration-thickness: 0.2em;
}

img { max-width: 100%; height: auto; display: block; }

/* ---- The page and its grid ---------------------------------------------------- */

.page {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--unit) * 4);
}

.masthead,
.prose {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
}

/* On every page but the home page: the way home, in the label voice. */
.runner {
  display: flex;
  gap: var(--unit);
  padding-top: var(--unit);
  font-size: var(--size-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.runner a { color: var(--ink); text-decoration: none; }
.runner a:hover, .runner a:focus-visible, .runner a[aria-current] { color: var(--signal); }

/* ---- Masthead: the title set large, the memo beside it ------------------------- */

.masthead {
  align-items: end;
  padding: calc(var(--unit) * 2) 0 calc(var(--unit) * 1.5);
  border-bottom: var(--rule-heavy) solid var(--ink);
  margin-bottom: calc(var(--unit) * 1.5);
}

.masthead h1 {
  grid-column: 1 / 9;
  margin: 0;
  font-size: var(--size-display);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.masthead--article h1 { font-size: clamp(2.25rem, 1rem + 4.6vw, 4.5rem); line-height: 1; }

.masthead__aside { grid-column: 9 / 13; }

/* On the home page the name stacks into one solid block, with the photo beside it at the
   block's height, and the memo bottom-aligned to both. */
.masthead--home h1 { grid-column: 1 / 6; max-width: 8ch; }

.masthead__photo {
  grid-column: 6 / 9;
  width: calc(var(--size-display) * 1.84);
  aspect-ratio: 1;
  object-fit: cover;
}

.memo dl { margin: 0; }
.memo dl > div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: var(--gap);
  padding: 0.25rem 0;
}
.memo dt {
  font-size: var(--size-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-top: 0.15rem;
}
.memo dd { margin: 0; line-height: 1.4; }
.memo__links { margin: 0.75rem 0 0; font-weight: 700; }

/* ---- Prose: labels in the first columns, the reading column beside them -------- */

.prose { container-type: inline-size; }

.prose > * { grid-column: 3 / 10; margin: 0 0 1rem; max-width: 68ch; }

.prose > h2 {
  grid-column: 1 / 3;
  position: relative;
  margin: calc(var(--unit) * 1.5) 0 1rem;
  padding-top: var(--unit);
  font-size: var(--size-label);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-transform: uppercase;
}
/* The rule above each section runs the full width of the grid, not only the label's
   columns. */
.prose > h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100cqi;
  height: var(--rule);
  background: var(--ink);
}
.prose > h2 + * { margin-top: calc(var(--unit) * 1.5); padding-top: var(--unit); }
.prose > :first-child { margin-top: 0; }
/* The masthead's heavy rule already opens the page: the first section adds no rule of its own. */
main > .prose:first-child > h2:first-child { padding-top: 0; }
main > .prose:first-child > h2:first-child::before { display: none; }
main > .prose:first-child > h2:first-child + * { padding-top: 0; }
.prose > h2 + pre { padding-top: var(--unit); margin-top: calc(var(--unit) * 2.5); }
.prose > h2:first-child + * { margin-top: 0; }

.prose > h3 {
  font-size: var(--size-large);
  font-weight: 700;
  line-height: 1.3;
  margin-top: calc(var(--unit) * 1.5);
  margin-bottom: 0.5rem;
}

.prose strong { font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.25rem; }

/* A quotation speaks in the large size at the regular weight, so it never reads as a heading. */
.prose blockquote {
  margin: calc(var(--unit) * 1.5) 0;
  font-size: var(--size-large);
  font-weight: 400;
  line-height: 1.4;
}
.prose blockquote p { margin: 0 0 0.75rem; }

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.prose pre {
  grid-column: 3 / 12;
  max-width: none;
  padding: var(--unit);
  overflow-x: auto;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9375rem;
  line-height: 1.55;
  tab-size: 2;
}
.prose pre code { font-size: inherit; }
.prose pre::selection, .prose pre ::selection { background: var(--signal); color: var(--paper); }

.prose table {
  grid-column: 3 / 12;
  max-width: none;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.prose th, .prose td { text-align: left; padding: 0.5rem 1rem 0.5rem 0; border-bottom: var(--rule) solid var(--ink); vertical-align: top; }
.prose th { font-size: var(--size-label); letter-spacing: 0.04em; text-transform: uppercase; }

.prose hr { grid-column: 1 / -1; max-width: none; border: 0; height: var(--rule); background: var(--ink); }

.prose > p > img:only-child { width: 100%; }

/* ---- The list of articles ---------------------------------------------------- */

.prose .articles { list-style: none; padding: 0; }
.articles li {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  column-gap: var(--gap);
  padding: 0.75rem 0;
  border-bottom: var(--rule) solid var(--ink);
}
.articles li + li { margin-top: 0; }
.articles li:last-child { border-bottom: 0; }
.articles li:first-child { padding-top: 0; }
.articles__when { margin: 0; padding-top: 0.45rem; font-size: var(--size-label); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-variant-numeric: tabular-nums; line-height: 1.5; }
.articles__when { grid-row: span 2; }
.articles__when span, .articles__when time { display: block; }
.articles a { font-size: var(--size-large); font-weight: 700; line-height: 1.3; color: var(--ink); text-decoration: none; }
.articles a:hover, .articles a:focus-visible { color: var(--signal); }
.articles li:first-child a { color: var(--signal); }
.articles__summary { grid-column: 2; margin: 0.25rem 0 0; }

/* Newer and older articles, at the foot of one. */
.turn { margin-top: calc(var(--unit) * 2); }
.turn a {
  display: block;
  padding: 0.75rem 0;
  border-top: var(--rule) solid var(--ink);
  text-decoration: none;
}
.turn__label { display: block; color: var(--ink); font-size: var(--size-label); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.turn__title {
  font-size: var(--size-large);
  font-weight: 700;
  line-height: 1.3;
  text-decoration-line: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}
.turn a:hover .turn__title, .turn a:focus-visible .turn__title { text-decoration-thickness: 0.2em; }

/* ---- Footer ---------------------------------------------------------------------- */

footer {
  margin-top: calc(var(--unit) * 3);
  padding-top: var(--unit);
  border-top: var(--rule-heavy) solid var(--ink);
}
footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem var(--unit); font-weight: 700; }

/* ---- Narrow screens: one column, the order unchanged --------------------------- */

@media (max-width: 52rem) {
  .masthead { padding-top: var(--unit); }
  .masthead h1, .masthead--home h1, .masthead__photo, .masthead__aside { grid-column: 1 / -1; }
  .masthead__photo { margin-top: var(--unit); }
  .masthead__aside { margin-top: var(--unit); }
  .masthead__photo { max-width: 10rem; }
  .prose > *, .prose > h2, .prose pre, .prose table { grid-column: 1 / -1; }
  .prose > h2 + *, .prose > h2 + pre { margin-top: 0; }
  .prose > h2 + * { padding-top: 0; }
  .prose > h2 + pre { padding-top: var(--unit); }
  .articles li { grid-template-columns: 1fr; }
  .articles__when { grid-row: auto; padding-top: 0; display: flex; gap: 0.75rem; }
  .articles__summary { grid-column: 1; }
}

@media print {
  body { border-top: 0; }
  a { color: var(--ink); }
}
