/* tokens.css — the design system in one place.
   Change the look here first. Everything in site.css reads these. */

:root {
  /* Type. One serif for everything you read; a monospace for small labels. */
  --serif: "Newsreader", "Charter", "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Scale. Body sits at 19px on a desk, 17px in a hand. */
  --text: 1.1875rem;
  --text-small: 0.9375rem;
  --label: 0.75rem;
  --lede: 1.375rem;
  --h1: clamp(2.25rem, 1.4rem + 3vw, 3.25rem);
  --h2: 1.5rem;
  --h3: 1.125rem;
  --leading: 1.6;
  --leading-tight: 1.12;
  --measure: 34em;          /* about 66 characters at body size */

  /* Space. More than feels right. */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2.5rem;
  --s-5: 4rem;
  --s-6: 6.5rem;
  --gutter: 1.25rem;
  --page: 44rem;

  /* Colour: paper and ink, one accent. */
  --paper: #f6f3ec;
  --paper-2: #efebe2;
  --ink: #1c1a17;
  --ink-2: #5b564e;
  --rule: #d9d3c7;
  --accent: #9a3b26;
  --accent-ink: #7f2f1e;
  --selection: #efd9cf;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151412;
    --paper-2: #1d1b18;
    --ink: #eae5db;
    --ink-2: #a49d91;
    --rule: #2c2925;
    --accent: #e08a6f;
    --accent-ink: #f0a58d;
    --selection: #3a2a24;
  }
}

@media (max-width: 40em) {
  :root {
    --text: 1.0625rem;
    --lede: 1.2rem;
    --h2: 1.35rem;
    --s-5: 3rem;
    --s-6: 4.5rem;
  }
}

/* site.css — layout and components. Colours, type and spacing come from tokens.css.
   Rule of thumb: if you want to change how the site feels, edit tokens.css.
   If you want to change how a page is arranged, edit here. */

/* Reset, small on purpose */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }

/* Page */
html {
  font-family: var(--serif);
  font-size: 100%;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: var(--paper);
  color: var(--ink);
}
body {
  font-size: var(--text);
  line-height: var(--leading);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--selection); }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
a:hover { color: var(--accent-ink); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: var(--gutter); top: -3rem; background: var(--ink); color: var(--paper); padding: 0.4em 0.8em; border-radius: 3px; }
.skip:focus { top: var(--s-2); z-index: 10; }

.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header { padding: var(--s-3) 0 var(--s-2); }
.site-header .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding-bottom: var(--s-2); }
.brand { font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: 0.005em; }
.brand:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); }
.nav { display: flex; gap: var(--s-3); list-style: none; font-family: var(--mono); font-size: var(--label); letter-spacing: 0.08em; text-transform: uppercase; }
.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.35em; text-decoration-color: var(--accent); }

/* Main */
main { flex: 1; padding: var(--s-5) 0 var(--s-6); }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--s-3); }
.prose > h2 { margin-top: var(--s-5); }
.prose > h2 + * { margin-top: var(--s-2); }
.prose > h3 { margin-top: var(--s-4); }

h1 { font-size: var(--h1); line-height: var(--leading-tight); font-weight: 500; letter-spacing: -0.012em; text-wrap: balance; }
h2 { font-size: var(--h2); line-height: 1.25; font-weight: 500; letter-spacing: -0.005em; text-wrap: balance; }
h3 { font-size: var(--h3); line-height: 1.35; font-weight: 500; }
strong, b { font-weight: 600; }
em { font-style: italic; }

/* Run-in heads: a bold phrase that opens a paragraph, the way a book does it. */
b.runin { font-weight: 600; }
b.runin::after { content: " "; }

.label { font-family: var(--mono); font-size: var(--label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.lede { font-size: var(--lede); line-height: 1.45; }
.subtitle { font-size: var(--lede); line-height: 1.4; font-style: italic; color: var(--ink-2); }
.meta { font-family: var(--mono); font-size: var(--label); letter-spacing: 0.06em; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: var(--text-small); }

/* Lists in prose */
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 0.6em; }
.prose li::marker { color: var(--ink-2); }
.prose blockquote { border-left: 2px solid var(--rule); padding-left: var(--s-3); color: var(--ink-2); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s-5) 0; }
.prose code { font-family: var(--mono); font-size: 0.85em; background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 3px; }

/* The arrow link used for calls to action */
.go { display: inline-block; margin-top: var(--s-3); }
.prose p > .go { margin-top: 0; }
.go::after { content: " \2192"; }

/* Hero */
.hero { max-width: var(--measure); }
.hero h1 { margin-bottom: var(--s-3); }
.hero .lede { max-width: 30em; }

/* Section: a label above, a hairline below the group */
.section { margin-top: var(--s-6); }
.section > .label { display: block; margin-bottom: var(--s-3); }

/* Index lists (work, writing): no cards, rules between rows */
.index { list-style: none; border-top: 1px solid var(--rule); max-width: var(--measure); }
.index li { padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); }
.index .title { font-size: var(--h2); line-height: 1.25; font-weight: 500; letter-spacing: -0.005em; text-wrap: balance; }
.index .title a { color: var(--ink); text-decoration: none; }
.index .title a:hover { color: var(--accent); }
.index .meta { margin-top: 0.3em; }
.index p { margin-top: 0.5em; color: var(--ink-2); }
.index .ext::after { content: " \2197"; color: var(--ink-2); font-size: 0.85em; }

/* Timeline on About: year on the left in mono */
.timeline { list-style: none; max-width: var(--measure); }
.prose ul.timeline { padding-left: 0; }
.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--s-2); padding: var(--s-2) 0; border-top: 1px solid var(--rule); }
.timeline li:last-child { border-bottom: 1px solid var(--rule); }
.timeline .when { font-family: var(--mono); font-size: var(--label); letter-spacing: 0.06em; color: var(--ink-2); padding-top: 0.45em; }
.timeline .who { font-weight: 600; }
@media (max-width: 40em) { .timeline li { grid-template-columns: 1fr; gap: 0.25rem; } }

/* Article (case study) frame */
.article-head { max-width: var(--measure); margin-bottom: var(--s-5); }
.article-head .label { display: block; margin-bottom: var(--s-2); }
.article-head h1 { margin-bottom: var(--s-2); }
.article-head .subtitle { margin-top: var(--s-2); }
.article-nav { margin-top: var(--s-6); padding-top: var(--s-3); border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: var(--s-3); max-width: var(--measure); font-size: var(--text-small); }
.article-nav a { color: var(--ink); text-decoration: none; }
.article-nav a:hover { color: var(--accent); }
.article-nav .label { display: block; margin-bottom: 0.25em; }
.article-nav .next { text-align: right; margin-left: auto; }

/* Contact */
.contact-line { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--rule); }
.contact-line .label { display: block; margin-bottom: var(--s-1); }
.contact-line a { font-size: var(--lede); }

/* Footer */
.site-footer { padding: var(--s-4) 0 var(--s-4); color: var(--ink-2); font-size: var(--text-small); }
.site-footer .wrap { border-top: 1px solid var(--rule); padding-top: var(--s-3); display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.site-footer ul { list-style: none; display: flex; gap: var(--s-3); }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }

/* Print: the page, not the chrome */
@media print {
  .site-header, .site-footer, .article-nav, .skip { display: none; }
  main { padding: 0; }
  a { color: inherit; text-decoration: none; }
}
