/* Night Edition. Rules: design/DESIGN.md. Tokens: design/tokens.css (inlined by base.html).
   Use role variables (--link, --button-bg, ...), never palette variables, except where
   DESIGN.md names a palette value directly (focus ring). */

/* ---------- Fonts (self-hosted, SIL OFL, Latin subset) ---------- */
@font-face { font-family: Anton; src: url(/fonts/anton-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url(/fonts/inter-tight-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url(/fonts/source-serif-4-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url(/fonts/source-serif-4-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url(/fonts/source-serif-4-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url(/fonts/source-serif-4-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url(/fonts/source-serif-4-latin-700-italic.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--body);
  font: 400 var(--s-body)/var(--lh-body) var(--f-ui);
  overflow-x: hidden;
}
img, svg, iframe, video { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--c-vermilion); outline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; color: var(--heading); }
p { margin: 0 0 1em; }

.container { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 8px; z-index: 10; background: var(--button-bg); color: var(--button-fg); padding: 8px 12px; }

/* ---------- Type roles ---------- */
.display-1, .display-2, .display-post, .year__num, .work__index {
  font-family: var(--f-display); font-weight: 400; text-transform: uppercase;
  line-height: var(--lh-display); letter-spacing: 0.005em; color: var(--heading);
}
.display-1 { font-size: var(--s-display-1); }
.display-2 { font-size: var(--s-display-2); }
.display-post { font-size: var(--s-display-post); overflow-wrap: anywhere; hyphens: auto; }
.display-over-art { -webkit-text-stroke: 14px var(--page-bg); paint-order: stroke fill; }

.title-1 { font: 600 var(--s-title-1)/var(--lh-title) var(--f-title); color: var(--heading); }

.meta, .kicker {
  font: 500 var(--s-meta)/1.4 var(--f-mono); text-transform: uppercase;
  letter-spacing: var(--tr-mono); color: var(--meta); margin: 0;
}

.tape {
  display: inline-block; margin: 0 0 24px;
  background: var(--tape-bg); color: var(--tape-fg);
  font: 700 var(--s-meta)/1 var(--f-mono); letter-spacing: var(--tr-tape); text-transform: uppercase;
  padding: 10px 16px; transform: rotate(-2deg);
}

/* ---------- Header and footer ---------- */
.site-header { border-bottom: 1px solid var(--rule); position: relative; z-index: 2; background: var(--page-bg); }
.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 32px; min-height: 76px; padding-block: 12px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 12px; min-height: var(--touch);
  font: 400 24px/1 var(--f-display); letter-spacing: var(--tr-wordmark);
  text-transform: uppercase; color: var(--heading); text-decoration: none;
}
.wordmark::before { content: ""; width: 12px; height: 12px; background: var(--action-link-mark); flex: none; }
.wordmark:hover { color: var(--heading); }
.wordmark--small { font-size: 18px; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.site-header nav a, .site-footer nav a {
  display: inline-flex; align-items: center; min-height: var(--touch);
  font: 500 var(--s-meta)/1 var(--f-mono); text-transform: uppercase; letter-spacing: var(--tr-mono);
  color: var(--nav); text-decoration: none;
}
.site-header nav a:hover, .site-footer nav a:hover { color: var(--nav-current); }
.site-header nav a[aria-current="page"] { color: var(--nav-current); box-shadow: inset 0 -2px 0 var(--nav-current-mark); }

.site-footer { border-top: 1px solid var(--rule); margin-top: var(--section-pad); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 32px; padding-block: 32px 48px;
}

/* ---------- Buttons and links ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--button-h); padding: 0 24px;
  background: var(--button-bg); color: var(--button-fg); border: 1px solid var(--button-bg);
  font: 700 var(--s-meta)/1 var(--f-mono); text-transform: uppercase; letter-spacing: var(--tr-mono);
  text-decoration: none;
}
.btn:hover { background: var(--link-hover); border-color: var(--link-hover); color: var(--button-fg); }
.btn--ghost { background: transparent; color: var(--heading); border-color: var(--button-ghost-border); }
.btn--ghost:hover { background: var(--heading); color: var(--page-bg); }

.action {
  display: inline-flex; align-items: center; min-height: var(--touch);
  font: 500 var(--s-meta)/1 var(--f-mono); text-transform: uppercase; letter-spacing: var(--tr-mono);
  color: var(--action-link);
  text-decoration: underline 2px var(--action-link-mark); text-underline-offset: 8px;
}
.action:hover { color: var(--link); }

/* ---------- Sections ---------- */
.section { border-top: 1px solid var(--rule); padding-block: var(--section-pad); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px 32px; margin-bottom: 48px;
}
.kicker { margin-bottom: 16px; }

.page-head { padding-block: var(--section-pad); }
.page-head .meta { margin-bottom: 20px; }
.page-head .intro, .page-head .intro p { font-size: var(--s-lede); max-width: var(--lede-measure); margin-top: 24px; color: var(--body); }
.page-head--short { min-height: 50vh; }

/* ---------- Home hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(48px, 8vw, 112px) var(--section-pad); }
.hero__art { position: absolute; top: 0; right: 0; width: min(600px, 54%); pointer-events: none; }
.hero__inner { position: relative; }
.hero .display-1 { max-width: 9ch; }
.lede { max-width: var(--lede-measure); margin-top: 32px; }
.lede p { font-size: var(--s-lede); color: var(--body); }

/* ---------- Cards and rows ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.card {
  display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--heading);
  border-top: 4px solid var(--post-hue);
}
.card__art { display: block; width: 100%; aspect-ratio: 600 / 340; background: var(--panel-bg); }
.card .meta { margin-top: 8px; }
.card__title { font: 600 var(--s-title-3)/var(--lh-title) var(--f-title); }
.card:hover .card__title { color: var(--link); }

.rows { list-style: none; margin: 40px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.row {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 4px 24px; padding: 16px 0; border-bottom: 1px solid var(--rule);
}
.row a { color: var(--heading); text-decoration: none; font: 600 19px/var(--lh-title) var(--f-title); flex: 1 1 320px; }
.row a:hover { color: var(--link); }
.row .meta { white-space: nowrap; }

/* ---------- Writing ---------- */
.year-chart { display: block; margin-top: 48px; height: auto; max-width: 100%; overflow: visible; }
.year-chart circle { fill: var(--c-vermilion); }
.year-chart text { font: 500 12px var(--f-mono); fill: var(--meta); text-anchor: middle; letter-spacing: 0.08em; }
.year-chart .year-chart__count { fill: var(--heading); }

.feature {
  display: flex; flex-wrap: wrap; align-items: center; gap: 32px 48px;
  text-decoration: none; color: var(--heading); border-top: 4px solid var(--post-hue); padding-top: 32px;
}
.feature__art { flex: 1 1 360px; max-width: 600px; aspect-ratio: 600 / 340; }
.feature__text { flex: 1 1 400px; }
.feature__title { font-size: clamp(40px, 5vw, 64px); margin-bottom: 20px; }
.feature:hover .feature__title { color: var(--link); }

.year { display: flex; flex-wrap: wrap; gap: 16px 48px; padding-block: 40px; border-top: 1px solid var(--rule); }
.year:first-child { border-top: 0; padding-top: 0; }
.year__head { flex: 0 0 200px; }
.year__num { font-size: var(--s-display-year); margin-bottom: 8px; }
.year__rows { flex: 1 1 400px; margin: 0; }
.year__rows .row:first-child { padding-top: 0; }
.year .rows { border-top: 0; }

/* ---------- Post ---------- */
.post-head { position: relative; overflow: hidden; padding-block: clamp(32px, 6vw, 72px) clamp(48px, 7vw, 96px); }
.post-head__art { position: absolute; top: 0; right: 0; width: min(600px, 54%); pointer-events: none; }
.post-head__inner { position: relative; }
.post-head .action { display: flex; width: max-content; margin-bottom: 32px; }
.post-head .display-post { max-width: 16ch; margin-bottom: 32px; }

.sheet { background: var(--sheet-bg); color: var(--sheet-body); padding-block: clamp(48px, 7vw, 96px); }
.sheet__body {
  max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter);
  font: 400 var(--s-reading)/var(--lh-reading) var(--f-reading);
  overflow-wrap: break-word;
}
.sheet__body > :first-child { margin-top: 0; }
.sheet__body p, .sheet__body ul, .sheet__body ol, .sheet__body table, .sheet__body figure { margin: 0 0 1.1em; }
.sheet__body h1, .sheet__body h2, .sheet__body h3, .sheet__body h4 {
  color: var(--sheet-heading); font-family: var(--f-title); font-weight: 600; line-height: var(--lh-title);
  margin: 1.8em 0 0.6em;
}
.sheet__body h1, .sheet__body h2 { font-size: var(--s-title-2); }
.sheet__body h3 { font-size: var(--s-title-3); }
.sheet__body h4 { font-size: 20px; }
.sheet__body a { color: var(--sheet-link); }
.sheet__body a:hover { color: var(--sheet-heading); }
.sheet__body strong { font-weight: 700; color: var(--sheet-heading); }
.sheet__body li { margin-bottom: 0.35em; }
.sheet__body hr { border: 0; border-top: 1px solid rgba(28, 28, 31, 0.2); margin: 2em 0; }
.sheet__body img { display: block; margin: 1.5em auto; }
.sheet__body iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; margin: 1.5em 0; }
.sheet__body table { border-collapse: collapse; font: 400 16px/1.5 var(--f-ui); display: block; overflow-x: auto; }
.sheet__body th, .sheet__body td { border-bottom: 1px solid rgba(28, 28, 31, 0.2); padding: 8px 12px 8px 0; text-align: left; vertical-align: top; }
.sheet__body code { font: 400 0.85em var(--f-mono); background: rgba(28, 28, 31, 0.07); padding: 0.1em 0.3em; }
.sheet__body pre {
  background: var(--panel-bg); color: var(--body); padding: 20px 24px; overflow-x: auto;
  font: 400 15px/1.6 var(--f-mono); margin: 1.5em 0;
}
.sheet__body pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

/* Pull quote: Anton mark above italic serif; trailing dash line becomes the attribution. */
.sheet__body blockquote { margin: 2em 0; padding: 0; border: 0; }
.sheet__body blockquote::before {
  content: "\201C"; display: block; height: 0.55em;
  font: 400 96px/1 var(--f-display); color: var(--quote-mark);
}
.sheet__body blockquote p { font-style: italic; font-size: var(--s-quote); line-height: 1.45; color: var(--sheet-heading); }
.sheet__body blockquote p.attribution {
  font: 500 var(--s-meta)/1.5 var(--f-mono); font-style: normal; text-transform: uppercase;
  letter-spacing: var(--tr-mono); color: var(--sheet-meta);
}
.sheet__body blockquote p.attribution a { color: var(--sheet-meta); }

.pager {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px;
  padding-block: 56px 0;
}
.pager__link {
  display: flex; flex-direction: column; gap: 12px; padding-top: 20px;
  border-top: 1px solid var(--heading); text-decoration: none; color: var(--heading);
}
.pager__link--next { text-align: right; align-items: flex-end; }
.pager__title { font: 600 var(--s-title-3)/var(--lh-title) var(--f-title); }
.pager__link:hover .pager__title { color: var(--link); }

/* ---------- Work ---------- */
.work-list { display: flex; flex-direction: column; gap: var(--section-pad); }
.work { display: flex; flex-wrap: wrap; gap: 32px 48px; align-items: flex-start; }
.work__art { flex: 0 1 480px; aspect-ratio: 600 / 340; background: var(--panel-bg); }
.work__body { flex: 1 1 400px; }
.work__index { font-size: 56px; color: var(--index-number); margin: 0 0 16px; }
.work .title-1 { margin-bottom: 16px; }
.work__body > p:not(.work__index) { max-width: 60ch; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 32px; padding: 0; }
.chip {
  border: 1px solid var(--chip-border); padding: 6px 12px;
  font: 500 var(--s-meta-small)/1.3 var(--f-mono); text-transform: uppercase; letter-spacing: var(--tr-mono); color: var(--body);
}
.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 48px; }
.work--compact { flex-wrap: nowrap; gap: 24px; }
.work--compact .work__index { flex: none; }
.work--compact .title-1 { font-size: var(--s-title-2); }

/* ---------- CTA band ---------- */
.band { position: relative; overflow: hidden; background: var(--band-bg); color: var(--band-fg); padding-block: var(--section-pad); }
.band::after {
  content: ""; position: absolute; top: -160px; right: -160px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, var(--c-vermilion) 3.5px, transparent 4px) 0 0 / 16px 16px;
  pointer-events: none;
}
.band__inner { position: relative; z-index: 1; }
.band h2, .band .display-1 { color: var(--band-fg); }
.band p { font-size: var(--s-lede); max-width: var(--lede-measure); margin: 24px 0 32px; }
.band .btn { background: var(--band-button-bg); color: var(--band-button-fg); border-color: var(--band-button-bg); }
.band .btn:hover { background: var(--button-bg); border-color: var(--button-bg); color: var(--button-fg); }
.band a:not(.btn) { color: var(--sheet-link); }
.band a:not(.btn):hover { color: var(--band-fg); }

/* ---------- Working with me ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-top: 32px; }
.wwm-fit, .wwm-not { display: block; }
.wwm-fit h2, .wwm-not h2, .wwm-reach h2 { font-family: var(--f-display); font-weight: 400; text-transform: uppercase; line-height: var(--lh-display); font-size: var(--s-display-2); margin-bottom: 48px; }
.wwm-fit { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.wwm-fit > :not(.fit-card) { grid-column: 1 / -1; }
.fit-card { margin: 0; padding: 28px; background: var(--panel-bg); border-top: 1px solid var(--rule); }
.fit-card strong { display: block; margin-bottom: 12px; color: var(--heading); font: 600 var(--s-title-3)/var(--lh-title) var(--f-title); }
.seniority { margin-top: 24px; max-width: 70ch; font-size: var(--s-lede); }
.seniority .tape { margin: 0 16px 12px 0; }
.wwm-reach h2 { color: var(--band-fg); margin-bottom: 32px; }
.wwm-reach p { max-width: 60ch; }
.wwm-not ul { list-style: none; margin: 0 0 40px; padding: 0; border-top: 1px solid var(--rule); }
.wwm-not li { display: flex; flex-wrap: wrap; gap: 8px 32px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.wwm-not li strong { flex: 0 0 360px; max-width: 100%; color: var(--heading); font: 600 20px/var(--lh-title) var(--f-title); }
.wwm-not li span { flex: 1 1 400px; }
.wwm-not > p { max-width: 70ch; }
.prose { max-width: var(--measure); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .hero__art, .post-head__art { width: 80%; opacity: 0.55; }
  .display-over-art { -webkit-text-stroke-width: 5px; }
  .display-post { line-height: 0.95; }
  .pager__link--next { text-align: left; align-items: flex-start; }
  .work--compact { flex-wrap: wrap; }
}
.band__title { font-size: clamp(56px, 8.5vw, 120px); }
