/* An engineer's notebook, marked up in red pen. One typeface, graph paper, one accent. Mobile first. */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #fbf7ee;                     /* warm cream, like a good notebook */
  --grid: rgb(140 104 60 / 0.075);      /* sepia graph-paper lines */
  --grid-major: rgb(140 104 60 / 0.12);
  --ink: #2b2620;                       /* warm graphite, 14:1 on paper */
  --ink-rule: rgb(43 38 32 / 0.5);      /* heavy rules, drawn in pencil rather than ink */
  --muted: #6d6458;                     /* 5.4:1 */
  --line: #e8e0d2;
  --tile: #f4eee3;
  --wash: #f7e9e6;
  --accent: #b23a48;                    /* red pen, 5.5:1 on paper */
  --rule: rgb(178 58 72 / 0.3);         /* the legal-pad margin line */
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino", Georgia, serif;
  --gutter: 16px;
  --margin: 0px;                        /* room left of the margin rule; set on wider screens */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.45;                    /* Butterick: 120–145% */
  font-optical-sizing: auto;
  font-variant-ligatures: common-ligatures;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-kerning: normal;
  hanging-punctuation: first;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 48rem) { body { font-size: 1.1875rem; } }
::selection { background: var(--accent); color: var(--paper); }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 120ms ease, color 120ms ease;
}
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  padding: 0.5rem 0.75rem; background: var(--ink); color: #fff;
}
.skip:focus { top: var(--gutter); }
.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.num { font-variant-numeric: lining-nums tabular-nums; }

/* ---------- The sheet: a page of the notebook, with a double red margin rule ---------- */

.sheet {
  position: relative;
  max-width: 72rem;
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  padding-inline: var(--gutter) var(--gutter);
  padding-left: calc(var(--gutter) + var(--margin));
  display: flex;
  flex-direction: column;
}
@media (min-width: 48rem) {
  .sheet { --gutter: 2.5rem; --margin: 5rem; }
  .sheet::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    left: calc(var(--gutter) + var(--margin) - 2rem);
    width: 4px;
    border-inline: 1px solid var(--rule);
    pointer-events: none;
  }
}

/* ---------- Top menu ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.5rem 1rem;
}
.wordmark, .top nav, .status, dt, .venue, .kind, .aside-link, .when {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.wordmark { text-decoration: none; font-size: 1.0625rem; }
.top nav ol { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline wavy var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
}
.no {
  color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 0.8em;
  margin-right: 0.3em;
}

/* ---------- Landing: the tagline, circled in red pen, with a footnote ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 10vh 12vh;
}
/* Three parallel lines, sized to the width so each always fits on one line (line three is the longest, ~17.5em):
   implicitly 1, 2, 3, never numbered. */
.hero { container-type: inline-size; }
.tagline {
  font-size: clamp(1.15rem, 5.6cqi, 4.5rem);
  font-weight: 340;
  line-height: 1.12;
  letter-spacing: -0.018em;
  /* Pin the display cut: Source Serif widens its letters at small optical sizes, which would break the fit on phones. */
  font-optical-sizing: none;
  font-variation-settings: "opsz" 48;
}
.tagline .line { display: block; }
.tagline .line + .line { margin-top: 0.12em; }
.tagline .line > a {
  text-decoration-line: underline;
  text-decoration-thickness: max(1px, 0.025em);
  text-decoration-color: var(--rule);
  text-underline-offset: 0.16em;
  text-decoration-skip-ink: auto;
}
.tagline .line > a:hover { text-decoration-color: var(--accent); }
.ring { position: relative; white-space: nowrap; }
.ring-art {
  position: absolute;
  left: -0.2em; top: -0.1em;
  width: calc(100% + 0.4em);
  height: calc(100% + 0.24em);
  max-width: none;
  overflow: visible;
  pointer-events: none;
}
.ring-art path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .ring-art path { stroke-dashoffset: 1; animation: draw 1.1s 0.5s cubic-bezier(0.6, 0, 0.3, 1) forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.fn { font-size: 0.32em; font-style: normal; font-weight: 600; vertical-align: super; margin-left: -0.02em; line-height: 0; }
.fn a { color: var(--accent); text-decoration: none; }
.footnote {
  margin-top: 2.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--accent);
  width: fit-content;
  min-width: 6rem;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  font-style: italic;
  color: var(--muted);
}
.fn-num { color: var(--accent); font-style: normal; font-weight: 600; font-size: 0.7em; vertical-align: super; margin-right: 0.2em; }
.footnote a { text-decoration-color: var(--rule); }
.footnote a:hover { color: var(--ink); text-decoration-color: var(--accent); }
.footnote:target { color: var(--ink); }
.page-note { margin-top: 3rem; font-size: 1rem; max-width: 36rem; }

/* ---------- Inner pages: outlined numeral, italic title, dek ---------- */

.page { flex: 1; padding-bottom: 5rem; }
.page-head {
  position: relative;
  padding-block: 3rem 2.5rem;
  margin-bottom: 1rem;
}
@media (min-width: 48rem) { .page-head { padding-block: 5.5rem 3.5rem; } }
.bignum {
  position: absolute;
  right: 0;
  top: 0.75rem;
  font-size: clamp(6rem, 2rem + 16vw, 15rem);
  line-height: 0.85;
  font-weight: 250;
  font-variant-numeric: lining-nums tabular-nums;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.page-head h1 {
  position: relative;
  font-size: clamp(2.75rem, 1.4rem + 5vw, 5.75rem);
  font-style: italic;
  font-weight: 330;
  line-height: 1;
  letter-spacing: -0.02em;
  max-width: 13ch;
  text-wrap: balance;
}
.page-thoughts .page-head h1 { max-width: 18ch; }
.dek {
  position: relative;
  margin-top: 1.1rem;
  max-width: 30rem;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  color: var(--muted);
}

.empty { font-size: 1.375rem; font-style: italic; color: var(--muted); }
.aside-link { margin-top: 2.5rem; }
.aside-link a { text-decoration: none; color: var(--muted); }
.aside-link a:hover { color: var(--accent); }

/* ---------- Lab ---------- */

.builds { display: grid; gap: 3rem; }
@media (min-width: 48rem) {
  .builds { grid-template-columns: 1fr 1fr; gap: 3.5rem 2rem; }
  .build:first-child { grid-column: 1 / -1; }
}
.shot {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--tile);
  box-shadow: 0 1px 2px rgb(42 39 35 / 0.04), 0 10px 30px -14px rgb(42 39 35 / 0.18);
}
.shot a { display: block; }
.shot img { width: 100%; }
.tile {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 0.75rem 0 2rem;
  background: linear-gradient(160deg, var(--tile) 55%, var(--wash));
}
.tile-art { width: 100%; height: 100%; }
.tile .ink { stroke: #a29d94; stroke-width: 1; }
.tile .accent-stroke { stroke: var(--accent); }
.tile .label text { fill: var(--ink); font-family: var(--serif); font-size: 13px; }
.tile .label .accent-fill { fill: var(--accent); }
.tile figcaption {
  position: absolute; left: 0.9rem; bottom: 0.6rem;
  font-size: 0.8125rem; font-style: italic; color: var(--muted);
}
.build-text { margin-top: 1.1rem; max-width: 36rem; }
.build h2 { font-size: 1.4rem; font-weight: 600; line-height: 1.25; margin-bottom: 0.2rem; }
.status { margin-top: 0.45rem; color: var(--muted); font-size: 0.9375rem; }

/* ---------- Ledgers: Thoughts, Talks, Things I Recommend ---------- */

.ledger { border-top: 1px solid var(--ink-rule); max-width: 52rem; }
.ledger cite a, .ledger .item-title a { text-decoration-color: var(--rule); }
.ledger cite a:hover { text-decoration-color: var(--accent); }
.ledger li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.25rem;
  align-items: baseline;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
}
.item-title { font-size: 1.25rem; line-height: 1.35; }
.summary { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 1rem; }
.row-link { text-decoration: none; }
.row-link:hover .item-title { color: var(--accent); }
.when, .venue, .kind { color: var(--muted); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.when { text-align: right; }
.ledger-3 li { grid-template-columns: minmax(0, 1fr) auto; }
.ledger-3 .item-title { grid-column: 1 / -1; }
.book .venue { font-variant-caps: normal; letter-spacing: 0; font-weight: 400; font-style: italic; }
cite { font-style: italic; }
@media (min-width: 40rem) {
  .ledger-3 li { grid-template-columns: minmax(0, 1fr) 10rem 3.5rem; }
  .ledger-3 .item-title { grid-column: auto; }
  .page-recommended .ledger-3 li { grid-template-columns: minmax(0, 1fr) 14rem; }
}
.page-recommended .venue { white-space: normal; }

/* ---------- Music ---------- */

.staff { max-width: 44rem; }
.staff-art { width: 100%; overflow: visible; }
.staff-art .lines line, .staff-art .bar { stroke: var(--ink); stroke-width: 1.25; opacity: 0.8; }
.staff-art .bar-thick, .staff-art .rest { fill: var(--ink); }
.staff-art .marking { fill: var(--accent); font-family: var(--serif); font-style: italic; font-size: 24px; }
.staff figcaption { margin-top: 1.5rem; }
.staff .line { display: block; font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem); font-style: italic; font-weight: 350; }
.staff .gloss { display: block; margin-top: 0.5rem; max-width: 34rem; color: var(--muted); font-size: 0.9375rem; }

/* ---------- About Me: a datasheet ---------- */

.lede {
  font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.25rem);
  font-weight: 360;
  line-height: 1.2;
  max-width: 22ch;
  text-wrap: balance;
  margin-bottom: 3rem;
}
.spec { border-top: 1px solid var(--ink-rule); max-width: 52rem; }
.spec-row {
  display: grid;
  gap: 0.25rem 2rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 40rem) { .spec-row { grid-template-columns: 13rem minmax(0, 1fr); } }
dt { color: var(--muted); padding-top: 0.2rem; }
.value { display: block; font-size: 1.3rem; line-height: 1.35; }
.spec .aside { display: block; margin-top: 0.2rem; font-style: italic; color: var(--muted); }
.sep { color: var(--accent); }
abbr[title] { text-decoration: none; cursor: help; }
.mail { text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; overflow-wrap: anywhere; }
.mail:hover { color: var(--accent); }

/* ---------- Group labels, notes, bio ---------- */

.group {
  margin: 3.25rem 0 0.9rem;
  font-size: 1rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--accent);
}
.page > .group:first-of-type, .shelf:first-child .group { margin-top: 0; }
.group-note { margin: -0.4rem 0 1rem; max-width: 38rem; font-style: italic; color: var(--muted); }
.jump { margin: 0 0 2.5rem; max-width: 46rem; }
.jump ul { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; list-style: none; margin: 0; padding: 0; font-size: 0.9375rem; font-style: italic; }
.jump a { text-decoration-color: var(--rule); }
.jump a:hover { text-decoration-color: var(--accent); }
.aside-note { margin-top: 2.5rem; max-width: 38rem; font-size: 0.9375rem; font-style: italic; color: var(--muted); }
.contact { margin-top: 3rem; font-size: 1.3rem; }
.contact .aside { display: block; margin-top: 0.3rem; font-size: 1rem; font-style: italic; color: var(--muted); }

/* Body copy, set the way Butterick asks: 45–90 characters a line, space between paragraphs (no indents too),
   hyphenation and balanced rag so the right edge stays quiet. */
.bio { max-width: 36rem; margin-bottom: 3rem; font-size: 1.1875rem; hyphens: auto; text-wrap: pretty; }
.bio p + p { margin-top: 0.8em; }
.bio p:first-child { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.75rem); line-height: 1.25; hyphens: manual; }
.bio a, .spec a:not(.mail) { text-decoration-color: var(--rule); }
.bio a:hover, .spec a:not(.mail):hover { text-decoration-color: var(--accent); }
.bio .fn { font-size: 0.6em; margin-left: 0.05em; }

/* ---------- Posts ---------- */

.prose { max-width: 38rem; hyphens: auto; text-wrap: pretty; }
.prose > .when { display: block; text-align: left; margin-bottom: 1.5rem; }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3, .prose h4 { font-weight: 600; margin-top: 2em; line-height: 1.3; }
.prose h2 { font-size: 1.4rem; }
.prose h3 { font-size: 1.15rem; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin-inline: 0; padding-left: 1rem; border-left: 2px solid var(--accent); color: var(--muted); font-style: italic; }
.prose a { text-decoration-color: var(--accent); }
.prose code { font-size: 0.9em; background: var(--tile); padding: 0.1em 0.3em; border-radius: 3px; }
.prose pre { background: var(--tile); padding: 1rem; border-radius: 6px; overflow-x: auto; font-size: 0.875rem; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2rem; }

/* ---------- Footer: fine print only ---------- */

.foot {
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
.foot p + p { margin-top: 0.15rem; }
.is-landing .foot { border-top: 0; }

@media print {
  body { background: none; }
  .sheet::before, .top nav, .skip, .bignum { display: none; }
}
