/* Monochrome Minimalism — two colours, one typeface family, whitespace as the only structure. */

:root {
  --black: #000000;
  --white: #ffffff;

  --text: var(--black);
  --ground: var(--white);

  --font: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-code: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --size-meta: 0.9375rem;   /* 15px — dates, labels, captions */
  --size-body: 1.125rem;    /* 18px */
  --size-lede: 1.5rem;      /* 24px */
  --size-h3: 1.5rem;
  --size-h2: clamp(2rem, 4vw, 3rem);
  --size-h1: clamp(2.75rem, 8.2vw, 7.5rem);

  --gutter: clamp(1rem, 6vw, 7rem);
  --space-section: clamp(6rem, 16vw, 15rem);
  --space-block: clamp(3rem, 6vw, 5.5rem);
  --measure: 38rem;
}

:root[data-theme="dark"] { --text: var(--white); --ground: var(--black); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --text: var(--white); --ground: var(--black); }
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 2rem; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--size-body);
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "tnum" 0;
}

::selection { background: var(--text); color: var(--ground); }

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

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
a.plain { text-decoration: none; }
a.plain:hover { text-decoration: underline; text-decoration-thickness: 1px; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
p { margin: 0 0 1.25em; }
ul, ol { margin: 0; padding: 0; }

.skip {
  position: absolute; left: 1rem; top: -4rem; padding: 0.75rem 1rem;
  background: var(--text); color: var(--ground); z-index: 10;
}
.skip:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Frame ---------- */

.wrap { max-width: 90rem; margin: 0 auto; padding-inline: var(--gutter); }

.site-head { padding-block: 2rem; }
.site-head .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.75rem 2rem;
}
.wordmark { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.wordmark:hover { text-decoration: underline; }

.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.75rem; }
.site-nav a, .theme-toggle {
  display: inline-flex; align-items: center; min-height: 44px;
  text-decoration: none; font-weight: 400;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; }

.theme-toggle {
  background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer;
}
.theme-toggle:hover { text-decoration: underline; }

.site-foot { padding-block: var(--space-section) 3rem; }
.site-foot .cols {
  display: grid; gap: 3rem;
  grid-template-columns: 1fr;
}
.site-foot h2 { font-size: var(--size-meta); font-weight: 600; letter-spacing: 0; margin-bottom: 1rem; }
.site-foot ul { list-style: none; }
.site-foot li a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.site-foot li a:hover { text-decoration: underline; }
.site-foot .fine { margin-top: 5rem; font-size: var(--size-meta); font-weight: 300; }
@media (min-width: 900px) {
  .site-foot .cols { grid-template-columns: 3fr 2fr 2fr 4fr; }
}

/* ---------- Two-column rhythm: label in the margin, content in the column ---------- */

.section { padding-top: var(--space-section); }
.row { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.row + .row { margin-top: var(--space-block); }
.row > .side { font-size: var(--size-meta); font-weight: 500; }
.row > .side .count { font-weight: 300; }
@media (min-width: 900px) {
  .row { grid-template-columns: minmax(9rem, 3fr) 9fr; gap: 3rem; }
  .row > .side.sticky { position: sticky; top: 2rem; align-self: start; }
}

.side h2, .side-title { font-size: var(--size-meta); font-weight: 600; letter-spacing: 0; line-height: 1.6; }
.side p { font-weight: 300; margin: 0.25rem 0 0; max-width: 16rem; }

.measure { max-width: var(--measure); }

/* ---------- Type ---------- */

.display { font-size: var(--size-h1); font-weight: 500; letter-spacing: -0.055em; line-height: 0.98; max-width: 14ch; }
.display .light { font-weight: 200; }
.h2 { font-size: var(--size-h2); letter-spacing: -0.04em; }
.lede { font-size: var(--size-lede); line-height: 1.45; font-weight: 300; letter-spacing: -0.01em; max-width: 34rem; }
.meta { font-size: var(--size-meta); font-weight: 300; }
.strong { font-weight: 600; }
.light { font-weight: 300; }

.page-head { padding-top: clamp(4rem, 12vw, 11rem); }
.page-head .lede { margin-top: 2.5rem; }

/* ---------- Actions ---------- */

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2.25rem; margin-top: 3rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 0.75rem 1.5rem; background: var(--text); color: var(--ground);
  border: 1px solid var(--text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background 150ms, color 150ms;
}
.btn:hover { background: var(--ground); color: var(--text); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--ground); color: var(--text); }
.btn-ghost:hover { background: var(--text); color: var(--ground); }
.link-quiet { font-weight: 300; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.link-quiet:hover { text-decoration: underline; }
.arrow::after { content: " \2192"; }

/* ---------- Entry lists (articles, projects) ---------- */

.entries { list-style: none; }
.entries > li + li { margin-top: 2.75rem; }
.entry { display: grid; grid-template-columns: 1fr; gap: 0.35rem; }
.entry-title { font-size: 1.375rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
.entry-title a { text-decoration: none; }
.entry-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.entry-desc { font-weight: 300; margin: 0; max-width: 40rem; }
.entry-meta { font-size: var(--size-meta); font-weight: 300; font-variant-numeric: tabular-nums; }
@media (min-width: 700px) {
  .entries.dated .entry { grid-template-columns: 7.5rem 1fr; column-gap: 2rem; }
  .entries.dated .entry-meta { grid-row: 1 / span 3; padding-top: 0.35rem; }
}

.big-list { list-style: none; counter-reset: big; }
.big-list li { counter-increment: big; }
.big-list li + li { margin-top: 2rem; }
.big-list .num { font-size: var(--size-meta); font-weight: 300; font-variant-numeric: tabular-nums; }

/* Huge numerals */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 3rem 2rem; }
.figure-num { font-size: clamp(3.5rem, 8vw, 6.5rem); font-weight: 200; letter-spacing: -0.06em; line-height: 1; font-variant-numeric: tabular-nums; }
.figure-label { font-size: var(--size-meta); margin-top: 0.75rem; }

/* ---------- Photos: always greyscale ---------- */

.photo img { width: 100%; height: auto; filter: grayscale(1) contrast(1.08); }
.photo figcaption { font-size: var(--size-meta); font-weight: 300; margin-top: 0.75rem; }
.photo-tall img { aspect-ratio: 4 / 5; object-fit: cover; }
.photo-wide img { aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- Tags as plain words ---------- */

.words { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: var(--size-meta); font-weight: 300; }
.words a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.words a:hover { text-decoration: underline; }
.words a::before { content: "#"; }

/* ---------- Forms ---------- */

.field { display: flex; flex-wrap: wrap; gap: 1rem; align-items: stretch; max-width: 34rem; }
.field input[type="email"], .field input[type="search"], .search {
  flex: 1 1 14rem; min-height: 48px; border: 0; border-bottom: 1px solid var(--text);
  background: transparent; color: var(--text); font: inherit; padding: 0.5rem 0; border-radius: 0;
}
.field input::placeholder, .search::placeholder { color: var(--text); opacity: 1; font-weight: 300; }
.field input:focus-visible, .search:focus-visible { outline: none; border-bottom-width: 3px; }
.form-note { font-size: var(--size-meta); font-weight: 300; margin-top: 1rem; }
.form-status { min-height: 1.6em; margin-top: 1rem; font-weight: 500; }
.check { display: flex; gap: 0.75rem; align-items: flex-start; font-size: var(--size-meta); font-weight: 300; margin-top: 1rem; max-width: 34rem; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--text); margin-top: 0.15rem; flex: none; }

/* ---------- Article ---------- */

.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; background: var(--text);
  transform-origin: 0 50%; transform: scaleX(0); z-index: 5;
}

.article-head { padding-top: clamp(4rem, 10vw, 9rem); }
.article-head .display { font-size: clamp(2.5rem, 6.8vw, 6rem); max-width: 16ch; }
.crumbs { font-size: var(--size-meta); margin-bottom: 2.5rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.toc { font-size: var(--size-meta); }
.toc ol { list-style: none; }
.toc a { display: block; padding: 0.4rem 0; text-decoration: none; font-weight: 300; }
.toc a:hover { text-decoration: underline; }
.toc a[aria-current="true"] { font-weight: 600; }
.toc details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
@media (min-width: 900px) {
  .toc details summary { pointer-events: none; list-style: none; }
  .toc details summary::-webkit-details-marker { display: none; }
}

.prose { max-width: var(--measure); font-size: 1.1875rem; line-height: 1.7; }
.prose h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); letter-spacing: -0.035em; margin: 5rem 0 1.5rem; scroll-margin-top: 2rem; }
.prose ol, .prose ul { padding-left: 1.4em; margin: 0 0 1.5em; }
.prose li + li { margin-top: 0.4em; }
.prose code { font-family: var(--font-code); font-size: 0.88em; }
.prose em { font-style: italic; }

/* Code: an inverted block — the one solid mass allowed on the page. */
.code { margin: 2.5rem 0; max-width: 48rem; }
.code-bar { display: flex; justify-content: space-between; align-items: center; font-size: var(--size-meta); padding-bottom: 0.5rem; }
.code-bar .lang { font-weight: 600; text-transform: lowercase; }
.copy {
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer; min-height: 44px; padding: 0 0 0 1rem;
  text-decoration: underline; text-underline-offset: 0.22em; font-weight: 300;
}
.copy:hover { text-decoration-thickness: 2px; }
pre {
  margin: 0; background: var(--text); color: var(--ground); padding: 1.5rem 1.5rem 1.75rem;
  overflow-x: auto; font-family: var(--font-code); font-size: 0.9375rem; line-height: 1.65; tab-size: 2;
}
pre::selection, pre *::selection { background: var(--ground); color: var(--text); }
pre:focus-visible { outline-offset: 3px; }

/* "Why?" / "Questions for you" / "Note" become margin notes. */
.aside-note { display: grid; grid-template-columns: 1fr; gap: 0.25rem; margin: 2.5rem 0; }
.aside-note .kind { font-size: var(--size-meta); font-weight: 600; }
.aside-note p { margin: 0; font-weight: 300; font-size: 1.25rem; line-height: 1.55; }
.aside-note.question p:not(.kind) { font-style: italic; }
@media (min-width: 1200px) {
  .aside-note { grid-template-columns: 8rem 1fr; gap: 2rem; margin-left: -10rem; }
  .aside-note .kind { text-align: right; padding-top: 0.2rem; }
}
.notice { border-top: 1px solid var(--text); border-bottom: 1px solid var(--text); padding: 1.25rem 0; margin: 0 0 3rem; font-weight: 300; }
.notice strong { font-weight: 600; }

.after { margin-top: var(--space-block); }

/* ---------- Patterns ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-top: 2rem; }
.filter {
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer; min-height: 44px; padding: 0;
  font-weight: 300;
}
.filter:hover { text-decoration: underline; }
.filter[aria-pressed="true"] { font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
.result-line { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; font-size: var(--size-meta); margin-top: 2rem; }
.result-line select {
  font: inherit; color: var(--text); background: var(--ground); border: 0; border-bottom: 1px solid var(--text);
  min-height: 44px; border-radius: 0;
}
.pattern-list { list-style: none; counter-reset: pat; }
.pattern-list > li + li { margin-top: 3rem; }
.pattern-item { display: grid; grid-template-columns: 3rem 1fr; gap: 0.25rem 1rem; }
.pattern-item .num { font-size: var(--size-meta); font-weight: 300; font-variant-numeric: tabular-nums; padding-top: 0.35rem; }
.pattern-item .cat { font-size: var(--size-meta); font-weight: 300; }
.pattern-item .badge { font-weight: 600; }
.pattern-item .good { font-size: var(--size-meta); font-weight: 300; margin-top: 0.4rem; }
.pattern-item .good strong { font-weight: 600; }
.empty { display: none; }
.empty.shown { display: block; }

.three-ways { list-style: none; display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .three-ways { grid-template-columns: repeat(3, 1fr); } }
.three-ways h3 { font-size: 1.375rem; margin-bottom: 0.75rem; }
.three-ways p { font-weight: 300; margin: 0; }

/* Pattern detail tabs */
.panes { margin-top: 3rem; }
.tabbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 0; }
.tab {
  background: var(--ground); color: var(--text); border: 1px solid var(--text); margin-right: -1px;
  font: inherit; min-height: 44px; padding: 0 1.1rem; cursor: pointer; font-weight: 400;
}
.tab[aria-selected="true"] { background: var(--text); color: var(--ground); font-weight: 600; }
.tab:hover:not([aria-selected="true"]) { text-decoration: underline; }
.pane-actions { display: flex; gap: 1.5rem; }
.pane { border: 1px solid var(--text); margin-top: -1px; padding: clamp(1rem, 4vw, 2.5rem); }
.pane[hidden] { display: none; }
.pane pre { margin: calc(-1 * clamp(1rem, 4vw, 2.5rem)); }
.pane .prompt-text { max-width: var(--measure); font-weight: 300; }
.pane .prompt-text p:first-child { font-weight: 500; }

/* Hairline stat strip, rendered for real */
.hss-caption { font-size: var(--size-meta); font-weight: 300; margin: 0 0 1rem; }
.hss-caption + .hss-strip { margin-bottom: 2.5rem; }
.hss-strip { display: grid; gap: 1px; background: var(--text); border: 1px solid var(--text); grid-template-columns: 1fr; }
@media (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 42rem) { .hss-strip.four { grid-template-columns: repeat(4, 1fr); } .hss-strip.five { grid-template-columns: repeat(5, 1fr); } }
.hss-tile { background: var(--ground); color: var(--text); padding: 1rem 1.1rem; min-width: 0; text-align: left; }
.hss-label { font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; overflow-wrap: anywhere; }
.hss-value { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1.2; margin: 0.35rem 0 0.15rem; }
.hss-value.missing { font-weight: 200; }
.hss-sub { font-size: 0.875rem; font-weight: 300; }
button.hss-tile { font: inherit; border: 0; cursor: pointer; }
button.hss-tile:hover .hss-label { text-decoration: underline; }
button.hss-tile[aria-pressed="true"] { background: var(--text); color: var(--ground); }
button.hss-tile:focus-visible { outline: 3px solid var(--text); outline-offset: -6px; }
button.hss-tile[aria-pressed="true"]:focus-visible { outline-color: var(--ground); }
.hss-list { list-style: none; margin-top: 1.5rem; }
.hss-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; }
.hss-list li + li { border-top: 1px solid var(--text); }
.hss-list .state { font-weight: 300; white-space: nowrap; }
.hss-status { margin-top: 1rem; font-size: var(--size-meta); font-weight: 500; }

.use-cases { list-style: none; columns: 2 16rem; column-gap: 3rem; }
.use-cases li { break-inside: avoid; padding: 0.3rem 0; font-weight: 300; }
.use-cases li::before { content: "\2014\00a0"; }

/* ---------- About ---------- */

.timeline { list-style: none; }
.timeline > li + li { margin-top: 3.5rem; }
.timeline .period { font-size: var(--size-meta); font-weight: 300; font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: 1.75rem; margin: 0.25rem 0 0.75rem; }
.timeline .roles { list-style: none; margin-top: 1rem; font-weight: 300; }
.timeline .roles li + li { margin-top: 0.4rem; }
.timeline .roles strong { font-weight: 500; }
.career { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1.25rem 2rem; margin-bottom: 4rem; }
.career li span { display: block; font-size: var(--size-meta); font-weight: 300; }
details.reveal > summary {
  cursor: pointer; list-style: none; display: inline-flex; min-height: 48px; align-items: center;
  padding: 0.75rem 1.5rem; border: 1px solid var(--text); font-weight: 500;
}
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary:hover { background: var(--text); color: var(--ground); }
details.reveal[open] > summary { margin-bottom: 4rem; }
details.reveal[open] .when-closed { display: none; }
details.reveal:not([open]) .when-open { display: none; }

.proverbs { list-style: none; counter-reset: pv; }
.proverbs li { counter-increment: pv; font-size: clamp(1.5rem, 3.2vw, 2.5rem); font-weight: 300; letter-spacing: -0.03em; line-height: 1.2; }
.proverbs li + li { margin-top: 2rem; }
.proverbs li::before { content: counter(pv) "."; display: block; font-size: var(--size-meta); font-weight: 600; letter-spacing: 0; margin-bottom: 0.25rem; }

.skills { display: grid; gap: 3rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .skills { grid-template-columns: repeat(2, 1fr); } }
.skills h3 { font-size: 1.375rem; }
.skills p { font-weight: 300; margin: 0.5rem 0 1rem; }
.skills ul { list-style: none; }
.skills li { padding: 0.2rem 0; }

.split { display: grid; gap: 3rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: 5fr 7fr; gap: 5rem; } }

/* ---------- Home ---------- */

.hero { padding-top: clamp(5rem, 16vw, 14rem); }
.hero .lede { margin-top: 3rem; }
.hero-photo { margin-top: var(--space-section); }
@media (min-width: 900px) {
  .hero-photo { width: 58%; margin-left: auto; }
}

.shelf { list-style: none; display: grid; gap: 4rem 3rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shelf { grid-template-columns: repeat(3, 1fr); } }
.shelf .n { font-size: clamp(3rem, 5vw, 4.5rem); font-weight: 200; letter-spacing: -0.05em; line-height: 1; margin-bottom: 1.5rem; }
.shelf .entry-title { font-size: 1.5rem; }

.statement { font-size: clamp(1.75rem, 3.6vw, 3rem); font-weight: 300; letter-spacing: -0.035em; line-height: 1.2; max-width: 22ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .progress { display: none; }
}

@media print {
  .site-head, .site-foot, .progress, .toc { display: none; }
  pre { background: none; color: #000; border: 1px solid #000; }
}

/* ---------- Small adjustments ---------- */
button.hss-tile > span { display: block; }
.after-gap { margin-bottom: 3rem; }
.notice + .photo { margin-bottom: 4rem; }
.words a.nohash::before { content: none; }
.page-head nav .words { font-size: var(--size-body); font-weight: 400; }
.row > * { min-width: 0; }
.figure-num { margin: 0; }
.entry-title + .entry-desc { margin-top: 0.25rem; }
.prose > * { max-width: 100%; }

/* UI pattern library article */
.prose .prose-fig { margin: 2.5rem 0; }
.prose .prose-fig img { filter: none; border: 1px solid var(--text); }
.prose .aside-note .note-body p + p { margin-top: .9rem; }
.prose .live-pattern a.btn { white-space: normal; text-decoration: none; height: auto; }
.prose p code { overflow-wrap: anywhere; }
