:root {
  --paper: #f2f0e9;
  --paper-soft: #e9e6dc;
  --ink: #171816;
  --muted: #66665f;
  --line: #cbc8bc;
  --signal: #e8502c;
  --signal-dark: #c73e1c;
  --night: #1a2525;
  --code-bg: #e7e4da;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino,
    Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shell: 86rem;
  --article: 48rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141716;
    --paper-soft: #1d211f;
    --ink: #efeee8;
    --muted: #aaa9a1;
    --line: #393c38;
    --signal: #ff6841;
    --signal-dark: #ff7957;
    --night: #0d1211;
    --code-bg: #202421;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--signal);
  color: #fff;
}

img {
  max-width: 100%;
}

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

.site-shell {
  width: min(100% - 3rem, var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Shared masthead */
.site-header {
  min-height: 6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-mark {
  display: grid;
  width: 2.35rem;
  aspect-ratio: 1;
  place-items: center;
  background: var(--signal);
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  transition: transform 180ms ease, background-color 180ms ease;
}

.site-title:hover .site-mark {
  background: var(--signal-dark);
  transform: rotate(-4deg);
}

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.4rem);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a,
.footer-links a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.35em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.site-nav a:hover,
.footer-links a:hover {
  color: var(--signal);
  text-decoration-color: currentColor;
}

.eyebrow {
  margin: 0;
  color: var(--signal);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Home: poster-like opening */
.hero {
  min-height: calc(100svh - 6rem);
  display: grid;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(30rem, 1.2fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
  padding-block: clamp(3rem, 7vw, 7rem);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero h1 {
  max-width: 17ch;
  margin: 0.6em 0 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.6vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  margin-top: 2.5rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  border-bottom: 1px solid currentColor;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.text-link span {
  transition: transform 160ms ease;
}

.text-link:hover {
  color: var(--signal);
}

.text-link:hover span {
  transform: translate(0.15rem, -0.15rem);
}

.text-link--primary {
  color: var(--signal);
}

.hero-feature {
  position: relative;
  display: block;
  min-width: 0;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}

.hero-feature::before {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 4.25rem;
  height: 0.3rem;
  background: var(--signal);
  content: "";
  transition: width 350ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-feature:hover::before {
  width: 100%;
}

.hero-visual {
  display: grid;
  min-height: 29rem;
  padding: clamp(1rem, 3vw, 3.5rem);
  place-items: center;
  overflow: hidden;
}

.hero-visual img {
  display: block;
  width: 100%;
  filter: saturate(0.8);
  transition: filter 350ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-feature:hover .hero-visual img {
  filter: saturate(1);
  transform: scale(1.025);
}

.hero-feature-caption {
  position: relative;
  min-height: 11rem;
  padding: 1.4rem clamp(1.4rem, 3vw, 2.5rem) 2rem;
  background: var(--night);
  color: #f2f0e9;
}

.hero-feature-caption > p {
  display: flex;
  justify-content: space-between;
  margin: 0 4rem 1rem 0;
  color: #aeb6b1;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-feature-caption h2 {
  max-width: 22ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.feature-arrow {
  position: absolute;
  right: 1.75rem;
  bottom: 1.65rem;
  color: var(--signal);
  font-size: 2rem;
  line-height: 1;
  transition: transform 200ms ease;
}

.hero-feature:hover .feature-arrow {
  transform: translate(0.25rem, -0.25rem);
}

/* Home: writing archive */
.writing {
  padding-block: clamp(6rem, 11vw, 10rem);
}

.section-heading {
  display: grid;
  grid-template-columns: 0.55fr 1fr 0.85fr;
  gap: 2rem;
  align-items: end;
  margin-bottom: clamp(2rem, 5vw, 4.5rem);
}

.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.section-heading > p:last-child {
  max-width: 25rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.post-item {
  border-bottom: 1px solid var(--line);
}

.post-link {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) 3rem;
  gap: 1.5rem;
  align-items: start;
  padding-block: clamp(2rem, 4vw, 3.5rem);
}

.post-index {
  padding-top: 0.2rem;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.post-entry {
  display: grid;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(15rem, 1.1fr);
  gap: 1.5rem 4rem;
}

.post-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.post-title {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
  transition: color 180ms ease;
}

.post-summary {
  max-width: 38rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.post-arrow {
  justify-self: end;
  color: var(--muted);
  font-size: 1.45rem;
  line-height: 1;
  transition: color 180ms ease, transform 180ms ease;
}

.post-link:hover .post-title,
.post-link:focus-visible .post-title,
.post-link:hover .post-arrow,
.post-link:focus-visible .post-arrow {
  color: var(--signal);
}

.post-link:hover .post-arrow,
.post-link:focus-visible .post-arrow {
  transform: translate(0.25rem, -0.25rem);
}

/* Home: closing statement */
.about-band {
  background: var(--night);
  color: #f2f0e9;
}

.about-band-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.text-link--light {
  color: #f2f0e9;
}

/* Article frame */
.article-shell {
  width: min(100% - 3rem, 68rem);
  margin-inline: auto;
}

.post {
  padding-bottom: clamp(5rem, 10vw, 9rem);
}

.post-header {
  padding-block: clamp(4rem, 9vw, 8rem) clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--ink);
}

.post-header h1 {
  max-width: 18ch;
  margin: 0.28em 0 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.06em;
  line-height: 0.94;
  text-wrap: balance;
}

.post-deck {
  max-width: 40rem;
  margin: clamp(2rem, 5vw, 4.5rem) 0 0 auto;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.018em;
  line-height: 1.3;
}

.post-byline {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin: 3rem 0 0 auto;
  max-width: 40rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-byline p {
  margin: 0;
}

.post-back {
  display: block;
  width: fit-content;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-back:hover {
  color: var(--signal);
}

.post-content {
  max-width: var(--article);
  margin: clamp(3rem, 8vw, 6.5rem) auto 0;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  line-height: 1.78;
}

.post-content > :first-child {
  margin-top: 0;
}

.post-content > p:first-child {
  font-size: clamp(1.35rem, 2.3vw, 1.75rem);
  letter-spacing: -0.015em;
  line-height: 1.55;
}

.post-content p {
  margin: 0 0 1.6rem;
}

.post-content h2 {
  margin: 4rem 0 1.25rem;
  font-family: var(--sans);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.post-content h3 {
  margin: 3rem 0 1rem;
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 2.5rem 0 0.75rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.6rem;
  padding-left: 1.45rem;
}

.post-content li {
  margin-bottom: 0.55rem;
  padding-left: 0.25rem;
}

.post-content li::marker {
  color: var(--signal);
}

.post-content blockquote {
  margin: 2.75rem 0;
  padding: 0.25rem 0 0.25rem 2rem;
  border-left: 0.3rem solid var(--signal);
  color: var(--ink);
  font-size: 1.25em;
  font-style: italic;
  line-height: 1.5;
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content a {
  color: var(--signal-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.post-content a:hover {
  text-decoration-thickness: 2px;
}

.post-content figure {
  width: min(64rem, calc(100vw - 3rem));
  margin: 3.5rem 50%;
  transform: translateX(-50%);
}

.post-content figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.post-content figcaption {
  max-width: var(--article);
  margin: 0.8rem auto 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
}

/* Per-post overrides: OSDI authorship inflation */
[data-post="2026-07-10-osdi-authorship-inflation"] .post-deck {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
}

[data-post="2026-07-10-osdi-authorship-inflation"] .post-content figure {
  width: min(40rem, calc(100vw - 3rem));
}

.post-content .katex-display {
  margin: 2rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.3rem 0;
}

.post-content code {
  padding: 0.12em 0.35em;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.84em;
}

.post-content pre {
  margin: 2rem -2rem;
  padding: 1.5rem 2rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.6;
}

.post-content pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  scroll-margin-top: 1.5rem;
}

.heading-anchor {
  margin-left: 0.35rem;
  color: var(--muted) !important;
  opacity: 0;
  text-decoration: none !important;
  transition: opacity 120ms ease;
}

.post-content h2:hover .heading-anchor,
.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor,
.post-content h5:hover .heading-anchor,
.post-content h6:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.post-content table {
  display: block;
  width: 100%;
  max-width: min(60rem, calc(100vw - 3rem));
  margin: 2.5rem 50%;
  overflow-x: auto;
  border-collapse: collapse;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 0.85rem;
}

.post-content th,
.post-content td {
  min-width: 7rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.post-content thead th {
  border-bottom-color: var(--ink);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-content li:has(> input[type="checkbox"]) {
  margin-left: -1.45rem;
  list-style: none;
}

.post-content li > input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--signal);
}

.post-content .footnotes {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Syntax highlighting */
.hljs-comment,
.hljs-quote {
  color: #6a737d;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-type {
  color: #9d249d;
}

.hljs-string,
.hljs-attr,
.hljs-regexp,
.hljs-addition {
  color: #347a32;
}

.hljs-number,
.hljs-symbol,
.hljs-meta {
  color: #916300;
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
  color: #326fd2;
}

.hljs-built_in,
.hljs-class .hljs-title,
.hljs-title.class_ {
  color: #a85e00;
}

.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-property,
.hljs-deletion {
  color: #c13f34;
}

@media (prefers-color-scheme: dark) {
  .hljs-comment,
  .hljs-quote {
    color: #8b918d;
  }

  .hljs-keyword,
  .hljs-selector-tag,
  .hljs-literal,
  .hljs-type {
    color: #d884e5;
  }

  .hljs-string,
  .hljs-attr,
  .hljs-regexp,
  .hljs-addition {
    color: #9aca78;
  }

  .hljs-number,
  .hljs-symbol,
  .hljs-meta {
    color: #e0a66d;
  }

  .hljs-title,
  .hljs-section,
  .hljs-name,
  .hljs-selector-id,
  .hljs-selector-class {
    color: #76b7f1;
  }

  .hljs-built_in,
  .hljs-class .hljs-title,
  .hljs-title.class_ {
    color: #e7c16d;
  }

  .hljs-variable,
  .hljs-template-variable,
  .hljs-tag,
  .hljs-property,
  .hljs-deletion {
    color: #ee7c83;
  }
}

/* Footer */
.site-footer {
  min-height: 9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1rem 2rem;
}

/* Deliberate, restrained motion */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .hero-copy > *,
  .hero-feature {
    animation: rise-in 700ms both cubic-bezier(0.22, 1, 0.36, 1);
  }

  .hero-copy > :nth-child(2) {
    animation-delay: 80ms;
  }

  .hero-copy > :nth-child(3) {
    animation-delay: 160ms;
  }

  .hero-feature {
    animation-delay: 180ms;
  }

  @keyframes rise-in {
    from {
      opacity: 0;
      transform: translateY(1.2rem);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 4rem;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  }

  .hero-visual {
    min-height: auto;
  }

  .section-heading {
    grid-template-columns: 1fr 1fr;
  }

  .section-heading .eyebrow {
    grid-column: 1 / -1;
  }

  .post-entry {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

}

@media (max-width: 640px) {
  .site-shell,
  .article-shell {
    width: min(100% - 2rem, var(--shell));
  }

  .site-header {
    min-height: 5rem;
  }

  .site-title > span:last-child {
    display: none;
  }

  .site-nav {
    gap: 1rem;
    font-size: 0.67rem;
  }

  .site-nav a:nth-child(2) {
    display: none;
  }

  .hero {
    padding-block: 4rem;
  }

  .hero h1 {
    font-size: clamp(1.4rem, 5vw, 1.9rem);
  }

  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-feature-caption > p span:last-child {
    display: none;
  }

  .section-heading {
    grid-template-columns: 1fr;
  }

  .section-heading .eyebrow {
    grid-column: auto;
  }

  .section-heading h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .post-link {
    grid-template-columns: 2rem minmax(0, 1fr) 1.5rem;
    gap: 0.75rem;
  }

  .post-title {
    font-size: 1.4rem;
  }

  .post-summary {
    display: none;
  }

  .about-band-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .post-header h1 {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }

  .post-deck {
    margin-left: 0;
  }

  .post-byline {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
    margin-left: 0;
  }

  .post-content blockquote,
  .post-content pre {
    margin-inline: 0;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-block: 2rem;
  }

  .footer-links {
    justify-content: flex-start;
  }
}
