:root {
  --text: #20242a;
  --muted: #626a73;
  --accent: #376c8a;
  --background: #fbfbfa;
  --line: #dde1e4;
  --width: min(920px, calc(100% - 36px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: #244f68; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { width: var(--width); margin-inline: auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--width);
  margin: 0 auto;
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--line);
}
.wordmark { color: var(--text); font-size: .95rem; font-weight: 700; text-decoration: none; }
.wordmark span { color: var(--accent); }
.tabs { display: flex; gap: 20px; }
.tabs a { padding: 2px 0; color: var(--muted); font-size: .78rem; text-decoration: none; }
.tabs a:hover, .tabs a[aria-current="page"] { color: var(--text); border-bottom: 1px solid var(--accent); }

.hero {
  display: grid;
  grid-template-columns: 1fr 125px;
  gap: 18px;
  align-items: center;
  padding: 14px 0 17px;
}
.eyebrow, .section-number {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: .67rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.hero h1, .page-intro h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.hero .eyebrow { margin-bottom: 5px; font-size: .59rem; }
.hero h1 { font-size: 1.45rem; }
.intro { max-width: 600px; margin: 4px 0 6px; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.contact-row { display: flex; flex-wrap: wrap; gap: 11px; }
.contact-row a { font-size: .68rem; }
.portrait-wrap { width: 125px; margin: 0; }
.portrait-wrap img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 4px; object-fit: cover; }

.section-grid {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 18px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.section-grid h2, .section-heading h2, .empty-state h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.025em;
}
.body-large { max-width: 720px; margin: 7px 0 0; color: var(--muted); font-size: .9rem; }

.publications { padding: 24px 0; border-top: 1px solid var(--line); }
.section-heading {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}
.section-heading .section-number { align-self: start; }
.section-heading > p:last-child { margin: 0; color: var(--muted); font-size: .75rem; }
.paper-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.paper {
  display: grid;
  grid-template-columns: 45px 1fr 14px;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.paper:hover { background: #f5f6f6; }
.paper-year, .software-index, .rating-number { color: var(--muted); font: .67rem "DM Mono", monospace; }
.paper a { color: var(--text); font-size: .88rem; font-weight: 600; line-height: 1.35; text-decoration: none; }
.paper a:hover { color: var(--accent); text-decoration: underline; }
.paper p { margin: 3px 0 0; color: var(--muted); font-size: .69rem; line-height: 1.4; }
.paper-arrow { color: var(--muted); font-size: .75rem; }
.featured-paper { color: inherit; background: transparent; }
.featured-paper .paper-year, .featured-paper p { color: var(--muted); }

.software-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.software-card { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 3px; color: var(--text); text-decoration: none; }
.software-card:hover { border-color: #b9c1c6; background: #f7f8f8; }
.software-card h3 { margin: 10px 0 6px; font-size: 1rem; }
.software-card p { margin: 0 0 12px; color: var(--muted); font-size: .78rem; }
.software-card > span:last-child { color: var(--accent); font-size: .7rem; }

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .72rem;
}
.site-footer p { margin: 0; }
.site-footer span { color: var(--accent); }

.subpage { min-height: calc(100vh - 125px); padding: 42px 0 60px; }
.page-intro {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  align-items: end;
  padding-bottom: 32px;
}
.page-intro .eyebrow { grid-column: 1 / -1; margin-bottom: -10px; }
.page-intro h1 { font-size: 1.5rem; }
.page-intro > p:last-child { margin: 0; color: var(--muted); font-size: .9rem; }
.empty-state { padding: 28px; border: 1px solid var(--line); }
.empty-state h2 { font-size: 1rem; font-weight: 500; }
.blog-list { border-top: 1px solid var(--line); }
.blog-entry { display: block; padding: 18px 2px 20px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.blog-entry:hover h2 { color: var(--accent); }
.blog-entry-meta { margin: 0 0 6px; color: var(--muted); font: .62rem "DM Mono", monospace; }
.blog-entry h2 { margin: 0; font-size: 1rem; line-height: 1.35; transition: color .15s ease; }
.blog-entry > p:not(.blog-entry-meta) { max-width: 610px; margin: 6px 0; color: var(--muted); font-size: .76rem; }
.blog-entry-link { color: var(--accent); font: .62rem "DM Mono", monospace; }
.compact-footer { margin-top: -25px; }

.ratings-list { border-top: 1px solid var(--line); }
.rating-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.rating-row h2 { margin: 0; font-size: .95rem; font-weight: 500; }
.rating-row h2 small { color: var(--muted); font-size: .75em; font-weight: 400; }
.rating-row h2 a { color: inherit; text-decoration: none; }
.rating-score { display: flex; align-items: baseline; min-width: 78px; justify-content: flex-end; color: var(--muted); font-family: "DM Mono", monospace; }
.rating-score strong { color: var(--text); font-size: 1.25rem; font-weight: 600; }
.rating-score span { margin-left: 3px; font-size: .65rem; }
.top-rated, .critical-rating { color: inherit; background: transparent; }
.top-rated .rating-number, .top-rated .rating-score, .top-rated .rating-score strong,
.critical-rating .rating-number, .critical-rating .rating-score, .critical-rating .rating-score strong { color: inherit; }
.critical-rating { border-left: 2px solid #b64a4a; padding-left: 8px; }
.rating-footnote { margin: 14px 0 0; color: var(--muted); font-size: .68rem; }

/* Blog posts */
.post-shell { max-width: 820px; padding: 32px 0 56px; }
.post-header { max-width: 720px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.post-topline { margin: 0 0 8px; color: var(--accent); font: .64rem "DM Mono", monospace; text-transform: uppercase; letter-spacing: .04em; }
.post-header h1 { max-width: 700px; margin: 0; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.15; letter-spacing: -.035em; }
.post-deck { max-width: 650px; margin: 10px 0 0; color: var(--muted); font-size: .94rem; }
.post-meta { margin: 13px 0 0; color: var(--muted); font: .65rem "DM Mono", monospace; }
.draft-badge { display: inline-block; margin-right: 8px; padding: 2px 6px; border: 1px solid #c6a94c; border-radius: 2px; color: #705d19; background: #fffbea; text-transform: uppercase; }
.post-body { color: #30353a; font-size: .91rem; line-height: 1.68; }
.post-body > :first-child { margin-top: 0; }
.post-body h2 { margin: 34px 0 10px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--text); font-size: 1.25rem; line-height: 1.3; }
.post-body h3 { margin: 25px 0 8px; color: var(--text); font-size: 1rem; }
.post-body p { margin: 10px 0; }
.post-body ul, .post-body ol { padding-left: 22px; }
.post-body li { margin: 5px 0; }
.post-body blockquote { margin: 15px 0; padding: 9px 13px; border-left: 3px solid #aebdc6; color: var(--muted); background: #f6f8f9; }
.post-body blockquote p { margin: 0; }
.post-body .post-disclaimer { margin: 22px 0 0; padding: 11px 13px; border: 1px solid var(--line); border-left: 3px solid #aebdc6; border-radius: 3px; color: var(--muted); background: #f6f8f9; font-size: .72rem; line-height: 1.55; }
.post-body .post-disclaimer strong { color: var(--text); }
.post-body table { display: block; width: 100%; margin: 14px 0 21px; overflow-x: auto; border-collapse: collapse; font-size: .72rem; white-space: nowrap; }
.post-body th, .post-body td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: right; }
.post-body th { color: var(--text); background: #f3f5f6; font-weight: 600; }
.post-body th:first-child, .post-body td:first-child { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--background); }
.post-body th:first-child { background: #f3f5f6; }
.post-body .table-with-note { display: grid; grid-template-columns: minmax(0, 1fr) 155px; gap: 12px; align-items: start; margin: 14px 0 21px; }
.post-body .table-scroll { min-width: 0; overflow-x: auto; }
.post-body .table-with-note table { display: table; margin: 0; overflow: visible; }
.post-body .table-note { align-self: end; margin: 0 0 2px; color: var(--muted); font: .6rem/1.45 "DM Mono", monospace; text-align: right; }
.post-body code { padding: 1px 4px; border-radius: 2px; background: #eef1f2; font-size: .85em; }
.post-body pre { overflow-x: auto; padding: 12px; border: 1px solid var(--line); border-radius: 3px; background: #f5f6f6; }
.post-body pre code { padding: 0; background: transparent; }
.post-body mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: 3px 0; }
.post-body img { display: block; max-width: 100%; height: auto; margin: 18px auto; }
.post-body figure { min-width: 0; margin: 18px 0; }
.post-body .figure-compact { max-width: 590px; margin-right: auto; margin-left: auto; }
.post-body figure img { margin: 0 auto; }
.post-body figcaption { margin-top: 6px; color: var(--muted); font: .64rem "DM Mono", monospace; text-align: center; }
.post-body .figure-row { display: grid; gap: 16px; align-items: start; margin: 18px 0 24px; }
.post-body .figure-row figure { margin: 0; }
.post-body .figure-row--samples { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 640px) {
  :root { --width: min(100% - 24px, 560px); }
  body { font-size: 14px; }
  .site-header { padding: 9px 0 6px; }
  .wordmark { font-size: .85rem; }
  .tabs { gap: 13px; }
  .tabs a { font-size: .68rem; }
  .hero { grid-template-columns: 1fr 56px; gap: 10px; padding: 11px 0 14px; }
  .hero h1 { font-size: 1.3rem; }
  .eyebrow, .section-number { font-size: .57rem; }
  .hero .eyebrow { margin-bottom: 4px; font-size: .52rem; line-height: 1.35; }
  .intro { margin: 3px 0 5px; font-size: .71rem; line-height: 1.34; }
  .contact-row { gap: 8px; }
  .contact-row a { font-size: .62rem; }
  .portrait-wrap { width: 56px; align-self: start; }
  .portrait-wrap img { aspect-ratio: 1 / 1; }
  .section-grid { grid-template-columns: 1fr; gap: 2px; padding: 19px 0; }
  .section-grid h2, .section-heading h2 { font-size: 1.04rem; }
  .body-large { margin-top: 5px; font-size: .82rem; }
  .publications { padding: 19px 0; }
  .section-heading { grid-template-columns: 1fr; gap: 2px; margin-bottom: 12px; }
  .section-heading > p:last-child { margin-top: 2px; }
  .paper { grid-template-columns: 34px 1fr 10px; gap: 7px; padding: 8px 2px; }
  .paper a { font-size: .79rem; }
  .paper p { font-size: .62rem; }
  .software-grid { grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
  .software-card { padding: 13px; }
  .software-card h3 { margin-top: 7px; }
  .site-footer { gap: 8px; padding: 18px 0; }
  .subpage { padding: 30px 0 45px; }
  .page-intro { grid-template-columns: 1fr; gap: 8px; padding-bottom: 24px; }
  .page-intro .eyebrow { grid-column: auto; margin-bottom: 0; }
  .page-intro h1 { font-size: 1.4rem; }
  .page-intro > p:last-child { font-size: .82rem; }
  .empty-state { padding: 20px; }
  .blog-entry { padding: 15px 2px 17px; }
  .blog-entry h2 { font-size: .9rem; }
  .rating-row { grid-template-columns: 27px 1fr auto; gap: 7px; min-height: 47px; padding: 6px 2px; }
  .rating-row h2 { font-size: .84rem; }
  .rating-score { min-width: 61px; }
  .rating-score strong { font-size: 1rem; }
  .rating-score span { font-size: .58rem; }
  .post-shell { padding: 24px 0 40px; }
  .post-header { padding-bottom: 17px; }
  .post-header h1 { font-size: 1.55rem; }
  .post-deck { font-size: .83rem; }
  .post-body { font-size: .83rem; line-height: 1.62; }
  .post-body h2 { margin-top: 27px; font-size: 1.08rem; }
  .post-body h3 { font-size: .92rem; }
  .post-body table { font-size: .66rem; }
  .post-body .table-with-note { grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
  .post-body .table-note { font-size: .52rem; }
  .post-body .figure-row { grid-template-columns: 1fr; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
