:root {
  --paper: #FAFAF8;
  --surface: #F1EEE6;
  --ink: #121316;
  --muted: #5A606A;
  --hairline: #E7E4DC;
  --lime: #D4F796;
  --radius: 4px;
  --measure: 68ch;
  --gutter: clamp(20px, 5vw, 48px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 10;
}
.skip:focus { left: 12px; top: 12px; }

.wrap {
  width: min(880px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- masthead ---------- */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 28px;
  border-bottom: 1px solid var(--hairline);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Newsreader", serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.wordmark .dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--lime);
  border: 1px solid rgba(18, 19, 22, 0.35);
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
nav a {
  font-size: 15px;
  color: var(--muted);
  padding-block: 4px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 0 100%;
  transition: background-size 200ms ease-out, color 150ms ease-out;
}
nav a:hover {
  color: var(--ink);
  background-size: 100% 1.5px;
}

/* ---------- lead ---------- */
.lead { padding-block: clamp(44px, 8vw, 84px) clamp(36px, 6vw, 60px); }

h1 {
  font-family: "Newsreader", serif;
  font-weight: 500;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 16ch;
  margin: 0 0 24px;
}

.lead p {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
  margin: 0 0 32px;
}
.lead p strong { color: var(--ink); font-weight: 500; }
.lead .thesis { color: var(--ink); }
.lead p a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.lead p a:hover { text-decoration-thickness: 2px; }

.nowline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--ink);
  margin: 0;
}
.nowline .dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lime);
  border: 1px solid rgba(18, 19, 22, 0.35);
}
.nowline .meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}
.nowline a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.nowline a:hover { text-decoration-thickness: 2px; }

/* ---------- sections ---------- */
section { padding-block: 56px; }
section + section { border-top: 1px solid var(--hairline); }

h2 {
  font-family: "Newsreader", serif;
  font-weight: 600;
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: -0.01em;
  margin: 0 0 32px;
}
h2 .anchor { color: var(--ink); }
h2 .anchor:hover { text-decoration: underline; text-underline-offset: 4px; }

.project + .project { border-top: 1px solid var(--hairline); }

.project {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 1.6fr auto;
  gap: 16px 32px;
  align-items: baseline;
  padding-block: 28px;
}

.project .name {
  font-family: "Newsreader", serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.project .name a:hover { text-decoration: underline; text-underline-offset: 4px; }

.chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 2px 8px 1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: translateY(-1px);
}
.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.chip.live .dot { background: #9CCB4A; }

.project .desc {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 58ch;
}

.project .link {
  font-size: 15px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-block: 4px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 0 100%;
  transition: background-size 200ms ease-out;
}
.project .link:hover { background-size: 100% 1.5px; }
.project .link svg { transition: transform 200ms ease-out; }
.project .link:hover svg { transform: translate(2px, -2px); }

/* ---------- about ---------- */
.about p {
  max-width: var(--measure);
  margin: 0 0 20px;
  font-size: 18px;
}
.about p:last-child { margin-bottom: 0; }
.about a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.about a:hover { text-decoration-thickness: 2px; }

/* ---------- contact ---------- */
.contact .grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}
.contact .item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  padding-block: 6px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 0 100%;
  transition: background-size 200ms ease-out;
}
.contact .item:hover { background-size: 100% 1.5px; }
.contact .item .label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.btn {
  display: inline-block;
  margin-top: 36px;
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: var(--radius);
  transition: background 150ms ease-out;
}
.btn:hover { background: #2A2D33; }
.btn:active { background: #000; }

/* ---------- post pages ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  padding-block: 6px;
  margin: 56px 0 8px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 0 100%;
  transition: background-size 200ms ease-out;
}
.back:hover { color: var(--ink); background-size: 100% 1.5px; }
.back svg { transition: transform 200ms ease-out; }
.back:hover svg { transform: translate(-2px, 0); }

.post-body { max-width: var(--measure); padding-block: 8px 56px; }
.post-body .post-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 20px;
}
.post-body h1 {
  max-width: none;
  font-size: clamp(32px, 4.6vw, 48px);
  margin-bottom: 18px;
}
.post-body p {
  font-size: 18px;
  margin: 0 0 22px;
}
.post-body h2 {
  font-size: 25px;
  margin: 48px 0 16px;
}
.post-body a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.post-body a:hover { text-decoration-thickness: 2px; }
.post-body ul { padding-left: 20px; margin: 0 0 22px; }
.post-body li { margin-bottom: 8px; }
.post-body .post-close {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 16px;
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--hairline);
  padding-block: 32px 56px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}


/* ---------- stack diagram (post part 2) ---------- */
.stack {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px 0 12px;
}
.stack .band-rect { stroke: var(--hairline); stroke-width: 1; fill: none; }
.stack .band-fill { fill: var(--surface); }
.stack .band-title { font-family: "Newsreader", serif; font-weight: 600; font-size: 20px; fill: var(--ink); }
.stack .band-ex { font-family: "JetBrains Mono", monospace; font-size: 12px; fill: var(--muted); }
.stack .band-num { font-family: "JetBrains Mono", monospace; font-size: 12px; fill: var(--muted); }
.stack .cap-title { font-family: "Newsreader", serif; font-weight: 600; font-size: 22px; fill: var(--ink); }
.stack .cap-sub { font-family: "JetBrains Mono", monospace; font-size: 12px; fill: var(--muted); }
.stack .cap-dot { fill: var(--lime); stroke: rgba(18, 19, 22, 0.35); stroke-width: 1; }
.stack .arrow { fill: var(--lime); stroke: var(--ink); stroke-width: 0.75; }

.caption {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 26px;
  max-width: 60ch;
}

.post-sources {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--muted);
  max-width: 62ch;
}
.post-sources a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.post-sources a:hover { text-decoration-thickness: 2px; }

/* ---------- narrow screens ---------- */
@media (max-width: 700px) {
  .project {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }
  .project .desc { max-width: none; }
  .lead p { font-size: 18px; }
}