/* Oswald, a condensed face, for headings and figures; the system face for
   reading. SIL Open Font Licence, assets/fonts/OFL.txt. The look follows turpin.dev. */
@font-face {
  font-family: "Oswald";
  src: url("/assets/fonts/oswald.woff2") format("woff2");
  font-weight: 200 700;
  font-display: swap;
}

/* Colour roles, swapped whole for dark mode. A lab notebook rather than
   turpin.dev's orange: pale sage paper, a deep culture green for the accent. */
:root {
  --display: "Oswald", "Helvetica Neue Condensed", "Arial Narrow", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
  --surface-0: #eef2ee;
  --surface-1: #fafcfa;
  --line: #d8e0da;
  --ink: #0c1512;
  --ink-2: #4a5c53;
  --accent: #0b7a58;
  --string: #a35f00;
  /* The dark blocks: deep forest by day */
  --block: #10261d;
  --block-ink: #eaf3ee;
  --block-ink-2: #b9cec3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #0c1311;
    --surface-1: #131c19;
    --line: #24332d;
    --ink: #e7f0eb;
    --ink-2: #a3b5ab;
    --accent: #3fd69a;
    --string: #e0b450;
    /* Agar green at night, dark enough for white to read on */
    --block: #0d6a4e;
    --block-ink: #fff;
    --block-ink-2: #e2f3ea;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0c1311;
  --surface-1: #131c19;
  --line: #24332d;
  --ink: #e7f0eb;
  --ink-2: #a3b5ab;
  --accent: #3fd69a;
  --string: #e0b450;
  /* Agar green at night, dark enough for white to read on */
  --block: #0d6a4e;
  --block-ink: #fff;
  --block-ink-2: #e2f3ea;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; }
a { color: var(--accent); }
code { font: 0.85em var(--mono); background: var(--surface-0); padding: 1px 5px; border-radius: 5px; }
.small { color: var(--ink-2); font-size: 14px; margin: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* The house menu: shrunk logo home, the pages on the right. */
.nav {
  display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap;
  max-width: 1100px; margin: 0 auto; padding: 18px 16px 0; font-size: 15px;
}
.nav .home {
  display: flex; align-items: flex-end; gap: 8px; margin-right: auto;
  color: var(--ink); text-decoration: none;
  font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1;
}
.nav .mark { display: flex; align-items: flex-end; gap: 2px; height: 24px; padding-bottom: 3px; }
.nav .mark i { display: block; width: 4px; border-radius: 2px; background: var(--accent); }
.nav .mark i:nth-child(1) { height: 45%; }
.nav .mark i:nth-child(2) { height: 80%; }
.nav .mark i:nth-child(3) { height: 100%; }
.nav .mark i:nth-child(4) { height: 65%; }
.nav .mark i:nth-child(5) { height: 85%; }
.nav .links { display: flex; gap: 16px; margin-left: auto; }
.nav .links a { color: var(--ink-2); text-decoration: none; }
.nav .links a:hover { color: var(--ink); }
.nav .links a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
/* Tighter on phones, so the logo and the pages share one line from 375px */
@media (max-width: 440px) {
  .nav { column-gap: 12px; }
  .nav .home { font-size: 22px; }
  .nav .mark { height: 19px; }
  .nav .links { gap: 10px; }
}

/* The opening: the name huge on the left, the latest changes on the right. */
.hero {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 48px; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 48px 16px 56px;
}
.hero h1 {
  font-size: clamp(52px, 9vw, 116px); line-height: 0.86; margin: 22px 0 18px;
  font-weight: 600; letter-spacing: -0.015em; text-transform: uppercase; white-space: nowrap;
}
.hero h1 span { color: var(--accent); }
.tagline { font-family: var(--display); font-size: clamp(24px, 3vw, 32px); line-height: 1.15; margin: 0 0 14px; }
.lede { font-size: 19px; color: var(--ink-2); margin: 0; max-width: 500px; }

/* A five-band level meter in the accent, the favicon's bars set moving. */
.meter { display: flex; align-items: flex-end; gap: 5px; height: 48px; }
.meter i {
  display: block; width: 9px; height: 100%; border-radius: 3px; background: var(--accent);
  transform-origin: bottom; animation: level 1.6s ease-in-out infinite alternate;
}
.meter i:nth-child(1) { animation-duration: 1.3s; transform: scaleY(0.45); }
.meter i:nth-child(2) { animation-duration: 0.9s; animation-delay: -0.4s; }
.meter i:nth-child(3) { animation-duration: 1.1s; animation-delay: -0.2s; }
.meter i:nth-child(4) { animation-duration: 0.8s; animation-delay: -0.6s; }
.meter i:nth-child(5) { animation-duration: 1.4s; animation-delay: -0.3s; }
@keyframes level {
  from { transform: scaleY(0.25); }
  to { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .meter i { animation: none; }
  .meter i:nth-child(odd) { transform: scaleY(0.6); }
}

.button {
  display: inline-block; text-decoration: none; font: 500 13px system-ui, sans-serif; cursor: pointer;
  color: var(--ink-2); background: var(--surface-1); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.button:hover { color: var(--accent); border-color: var(--accent); }

/* Search box on the home page, handing over to /search/ */
.find { display: flex; gap: 8px; margin: 24px 0 0; max-width: 500px; }
.find input {
  flex: 1; min-width: 0; font: 16px system-ui, sans-serif; color: var(--ink);
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px;
}
.find input:focus { outline: none; border-color: var(--accent); }
.find .button { font-size: 15px; padding: 8px 18px; }

/* The recently updated board: a lit list, like a departures board. */
.board {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 8px 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}
.board h2, .section-title {
  font-size: 15px; margin: 0 0 8px; padding: 0 14px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2);
}
.board ol { list-style: none; margin: 0; padding: 0; counter-reset: entry; }
.board a {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: baseline; gap: 4px 10px;
  padding: 9px 14px; border-radius: 9px; text-decoration: none; color: var(--ink);
  transition: background 0.15s ease;
}
.board li + li a { border-top: 1px solid var(--line); border-radius: 0; }
.board a::before {
  counter-increment: entry; content: counter(entry, decimal-leading-zero);
  font: 13px var(--mono); color: var(--ink-2);
}
.board b { font-family: var(--display); font-weight: 500; font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
.board span { color: var(--ink-2); font: 13px var(--mono); white-space: nowrap; }
.board a:hover { background: var(--surface-0); }
.board a:hover b { color: var(--accent); }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 32px; gap: 36px; }
}
@media (max-width: 480px) {
  .board a { grid-template-columns: 28px minmax(0, 1fr); }
  .board span { grid-column: 2; }
}

/* True figures, large, between the opening and the detail. */
.figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin: 0 0 56px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.figures div { padding: 22px 18px 20px 0; display: flex; flex-direction: column; gap: 4px; }
.figures b { font-family: var(--display); font-weight: 600; font-size: 56px; line-height: 1; color: var(--accent); }
.figures span { color: var(--ink-2); font-size: 15px; line-height: 1.35; max-width: 220px; }

.section-title { padding: 0; margin: 0 0 14px; }

/* Cards of different widths, the flagship dark across the top. Each card's
   heading link is stretched over the whole card. */
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 56px; }
.feature {
  position: relative; background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.feature:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08); }
.feature h3 { font-size: 26px; line-height: 1.1; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.02em; }
.feature h3 a { color: var(--ink); text-decoration: none; }
.feature h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.feature:hover h3 a { color: var(--accent); }
.feature p { margin: 0; color: var(--ink-2); }
.feature.wide { grid-column: span 2; }
.feature.wide h3 { font-size: 32px; }
.feature.wide p { font-size: 18px; max-width: 620px; }
.feature.dark {
  grid-column: 1 / -1; background: var(--block); border-color: var(--block); color: var(--block-ink);
  padding: 36px 38px;
}
.feature.dark h3 { font-size: clamp(40px, 6vw, 72px); line-height: 0.95; margin-bottom: 14px; }
.feature.dark h3 a, .feature.dark:hover h3 a { color: var(--block-ink); }
.feature.dark p { color: var(--block-ink-2); font-size: 19px; max-width: 720px; }
.feature p.kicker { font: 12px var(--mono); color: var(--accent); margin: 0 0 6px; letter-spacing: 0.02em; }
.feature.dark p.kicker { color: var(--block-ink-2); opacity: 0.8; font-size: 14px; }
.feature.dark:hover { border-color: var(--block); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22); }
@media (max-width: 820px) {
  .features { grid-template-columns: 1fr; }
  .feature.wide { grid-column: auto; }
  .feature.dark { padding: 26px 22px; }
}

.panel {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 26px 10px; margin-bottom: 56px;
}
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.panel-head .section-title { margin: 0; }
.panel.prose { max-width: none; }
.topics h2 { font-size: 24px; text-transform: uppercase; letter-spacing: 0.02em; }

/* Tag chips, on entries and in the clouds */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chips a {
  font: 13px var(--mono); padding: 3px 10px; border-radius: 999px; text-decoration: none;
  color: var(--ink-2); background: var(--surface-1); border: 1px solid var(--line);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.chips a:hover { color: var(--accent); border-color: var(--accent); }
.chips small { color: var(--accent); font-size: inherit; margin-left: 2px; }
.cloud { margin-bottom: 56px; }
.cloud a { font-size: 14px; padding: 5px 12px; }
.cloud a:target { border-color: var(--accent); color: var(--accent); }

/* Listings: A to Z, a tag's entries, search */
.listing { max-width: 820px; }
.listing h1 { font-size: clamp(44px, 8vw, 80px); line-height: 0.95; margin: 28px 0 10px; text-transform: uppercase; overflow-wrap: anywhere; }
.listing .small { margin-bottom: 24px; }
.listing .intro h1 { margin-top: 28px; }
.kicker { font: 13px var(--mono); margin: 28px 0 0; }
.kicker + h1 { margin-top: 6px; }
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; position: sticky; top: 0; padding: 8px 0; background: var(--surface-0); z-index: 1; }
.letters a {
  font-family: var(--display); font-size: 18px; text-decoration: none; color: var(--ink-2);
  min-width: 30px; text-align: center; padding: 2px 4px; border-radius: 6px;
}
.letters a:hover { color: var(--accent); background: var(--surface-1); }
.letter { font-size: 15px; color: var(--accent); margin: 28px 0 4px; scroll-margin-top: 56px; }
.entries { list-style: none; margin: 0; padding: 0; }
.entries li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline;
  border-top: 1px solid var(--line); padding: 12px 0;
}
.entries li a { min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.entries b { font-family: var(--display); font-weight: 500; font-size: 21px; color: var(--ink); line-height: 1.2; }
.entries span { color: var(--ink-2); font-size: 15px; }
.entries a:hover b { color: var(--accent); }
.entries time { color: var(--ink-2); font: 13px var(--mono); white-space: nowrap; }
@media (max-width: 560px) {
  .entries li { grid-template-columns: minmax(0, 1fr); }
}

/* An entry: the markdown, set for reading, with its details alongside */
.entry {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px 56px; align-items: start;
}
.meta {
  position: sticky; top: 24px; margin-top: 40px; font-size: 14px; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 14px;
}
.meta p { margin: 0; }
.meta span {
  display: block; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 13px; color: var(--accent);
}
@media (max-width: 900px) {
  .entry { grid-template-columns: minmax(0, 1fr); }
  .meta { position: static; margin-top: 0; border-top: 1px solid var(--line); padding-top: 20px; }
}

.prose { max-width: 760px; overflow-wrap: break-word; }
.prose > h1:first-child, .prose > :first-child { margin-top: 28px; }
.prose h1 { font-size: clamp(40px, 7vw, 68px); line-height: 0.98; text-transform: uppercase; margin: 28px 0 20px; letter-spacing: -0.005em; }
.prose h2 { font-size: 30px; line-height: 1.1; margin: 40px 0 12px; }
.prose h3 { font-size: 23px; margin: 30px 0 8px; }
.prose h4 { font-size: 17px; margin: 24px 0 6px; }
.prose h2 a, .prose h3 a, .prose h4 a { color: inherit; text-decoration: none; }
.prose h2 a:hover::after, .prose h3 a:hover::after { content: " #"; color: var(--accent); }
.prose :is(h1, h2, h3, h4) { scroll-margin-top: 16px; }
.prose p, .prose li { max-width: 70ch; }
.prose li + li { margin-top: 4px; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose iframe, .prose video { max-width: 100%; border: 0; border-radius: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose blockquote { margin: 20px 0; padding: 2px 20px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 20px 0; font-size: 15px; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 14px 8px 0; text-align: left; vertical-align: top; }
.prose th { font-family: var(--display); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; font-size: 14px; color: var(--ink-2); }
.prose code { background: var(--surface-1); border: 1px solid var(--line); }
.prose pre {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; overflow-x: auto; font-size: 14px; line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose pre.mermaid { background: var(--surface-1); text-align: center; }

.admonition { background: var(--surface-1); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 4px 20px; margin: 20px 0; }
.admonition-title { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 14px; color: var(--accent); margin-bottom: 0; }

/* Prism tokens in the site's colours, so code reads in both themes */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--ink-2); font-style: italic; }
.token.keyword, .token.selector, .token.important, .token.atrule { color: var(--accent); }
.token.string, .token.char, .token.attr-value, .token.regex { color: var(--string); }
.token.number, .token.boolean, .token.constant { color: #b8452f; }
.token.function, .token.class-name { color: #3f6fb5; }
.token.operator, .token.punctuation { color: var(--ink-2); }
.token.macro, .token.directive { color: #8a4fb0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .token.function, :root:not([data-theme="light"]) .token.class-name { color: #7fa8e8; }
  :root:not([data-theme="light"]) .token.number, :root:not([data-theme="light"]) .token.constant { color: #f0a070; }
  :root:not([data-theme="light"]) .token.macro { color: #c39be0; }
}
:root[data-theme="dark"] .token.function, :root[data-theme="dark"] .token.class-name { color: #7fa8e8; }
:root[data-theme="dark"] .token.number, :root[data-theme="dark"] .token.constant { color: #f0a070; }
:root[data-theme="dark"] .token.macro { color: #c39be0; }

/* Pagefind's search UI, in the site's colours */
#search {
  overflow-wrap: anywhere;
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--surface-1);
  --pagefind-ui-border: var(--line);
  --pagefind-ui-tag: var(--surface-0);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 10px;
  --pagefind-ui-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#search .pagefind-ui__result-link { color: var(--ink); font-family: var(--display); font-weight: 500; font-size: 20px; }
#search .pagefind-ui__result-link:hover { color: var(--accent); }
#search mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; }

footer { max-width: 1100px; margin: 40px auto 0; padding: 24px 16px 40px; border-top: 1px solid var(--line); text-align: center; color: var(--ink-2); font-size: 14px; }
footer p { margin: 0 0 6px; }
