/* ---------------------------------------------------------------------------
   Design system — editorial v1
   Type: Fraunces (display/prose) · Inter (UI) · JetBrains Mono (code)
   ---------------------------------------------------------------------------*/

:root {
  /* Palette — warm paper + ink */
  --bg: #f7f3ec;
  --surface: #fffdf8;
  --ink: #1a1a1a;
  --ink-soft: #2e2e2e;
  --muted: #6e6a62;
  --muted-2: #8f8b83;
  --rule: #d9d3c6;
  --rule-soft: #e8e2d4;
  --accent: #a1381a;
  --accent-hover: #7c2910;
  --code-bg: #efe9dc;

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale — major-second (1.125) from 17px base */
  --fs-xs:   0.8125rem;
  --fs-sm:   0.9375rem;
  --fs-base: 1.0625rem;
  --fs-md:   1.1875rem;
  --fs-lg:   1.375rem;
  --fs-xl:   1.75rem;
  --fs-2xl:  2.25rem;
  --fs-3xl:  3rem;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  /* Layout */
  --max: 680px;
  --max-wide: 920px;
  --radius: 4px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur: 140ms;

  color-scheme: light;
}

/* Dark — cooler ink on deep graphite */
html[data-theme="dark"] {
  --bg: #14130f;
  --surface: #1a1915;
  --ink: #eae4d3;
  --ink-soft: #cfc9b8;
  --muted: #a09b8d;
  --muted-2: #7d7a70;
  --rule: #2b2924;
  --rule-soft: #232119;
  --accent: #e78a5f;
  --accent-hover: #f6a378;
  --code-bg: #1f1d17;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #14130f;
    --surface: #1a1915;
    --ink: #eae4d3;
    --ink-soft: #cfc9b8;
    --muted: #a09b8d;
    --muted-2: #7d7a70;
    --rule: #2b2924;
    --rule-soft: #232119;
    --accent: #e78a5f;
    --accent-hover: #f6a378;
    --code-bg: #1f1d17;
    color-scheme: dark;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: var(--fs-base);
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--surface); }

/* ---------- Layout ---------- */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
body.wide .container { max-width: var(--max-wide); }
.site-header .container,
.site-footer .container { max-width: var(--max-wide); }

main.container { padding-top: var(--s-6); padding-bottom: var(--s-8); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.018em;
  color: var(--ink);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  text-wrap: balance;
}
h1 {
  font-size: var(--fs-2xl);
  margin: 0 0 var(--s-3);
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144, "SOFT" 40;
}
h2 {
  font-size: var(--fs-lg);
  margin: var(--s-7) 0 var(--s-3);
  letter-spacing: -0.015em;
}
h3 {
  font-size: var(--fs-md);
  margin: var(--s-5) 0 var(--s-2);
  font-weight: 500;
}

p { margin: 0 0 1em; text-wrap: pretty; }

.subtitle {
  color: var(--muted);
  font-size: var(--fs-md);
  font-style: italic;
  font-weight: 400;
  margin-top: 0;
  margin-bottom: var(--s-5);
}

.muted { color: var(--muted); }

/* Small-caps section labels */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size var(--dur) var(--ease), color var(--dur) var(--ease);
}
a:hover {
  color: var(--accent);
  background-size: 100% 2px;
}

.prose a { color: var(--accent); }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}
pre {
  background: var(--code-bg);
  padding: var(--s-4);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.55;
}
pre code { background: transparent; padding: 0; font-size: inherit; }

blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-2) var(--s-5);
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s-7) 0;
}

/* ---------- Header ---------- */
.site-header {
  padding: var(--s-4) 0;
  margin-bottom: var(--s-7);
  border-bottom: 1px solid var(--rule);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}
.brand {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: var(--fs-base);
  letter-spacing: -0.01em;
  color: var(--ink);
  background-image: none;
}
.brand:hover { color: var(--accent); }

nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  flex-wrap: wrap;
  font-family: var(--font-sans);
}
nav a {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 400;
  background-image: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

#theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1;
  font-family: var(--font-sans);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: var(--s-9);
  padding: var(--s-5) 0 var(--s-7);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.site-footer a { color: var(--muted); background-image: none; border-bottom: 1px solid transparent; }
.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Home ---------- */
.home-header {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: var(--s-6);
  align-items: center;
  margin-bottom: var(--s-6);
}
.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 6px 24px rgba(0,0,0,0.06);
}
.home-header h1 {
  margin-bottom: var(--s-1);
  font-size: var(--fs-2xl);
}
.home-header .links {
  margin: var(--s-3) 0 0;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
}

@media (max-width: 560px) {
  .home-header { grid-template-columns: 1fr; gap: var(--s-3); }
  .avatar { width: 104px; height: 104px; }
}

.prose {
  font-size: var(--fs-base);
  line-height: 1.7;
}
.prose p { margin-bottom: 1em; }

.home-news { margin-top: var(--s-8); }

/* ---------- Callout ---------- */
.callout {
  margin: var(--s-6) 0 0;
  padding: var(--s-4) var(--s-5);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
}
.callout strong { color: var(--accent); font-weight: 600; }
.callout code { background: transparent; padding: 0; font-weight: 600; }

/* ---------- MCP page ---------- */
.mcp-info h1 {
  font-size: var(--fs-3xl);
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144, "SOFT" 60, "wght" 400;
  margin-bottom: var(--s-3);
}
.mcp-info .lede {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 36em;
}
.mcp-info .mcp-endpoint {
  margin: var(--s-6) 0 var(--s-2);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  text-align: center;
  word-break: break-all;
}
.mcp-info .mcp-endpoint code {
  background: transparent;
  padding: 0;
  font-size: var(--fs-base);
  color: var(--accent);
  font-weight: 500;
}
.mcp-info pre { font-size: var(--fs-xs); line-height: 1.55; }
.mcp-info h2 { margin-top: var(--s-8); font-size: var(--fs-lg); }
.mcp-info h3 {
  font-family: var(--font-sans);
  color: var(--muted);
  font-weight: 500;
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: var(--s-5);
  margin-bottom: var(--s-2);
}

.mcp-prompts {
  list-style: none;
  padding: 0;
  margin: var(--s-4) 0 0;
}
.mcp-prompts li {
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-2);
  border-left: 2px solid var(--rule);
  background: var(--surface);
  border-radius: 2px;
  font-style: italic;
  color: var(--ink-soft);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.mcp-prompts li:hover {
  border-left-color: var(--accent);
  transform: translateX(2px);
}

.mcp-footnote {
  margin-top: var(--s-8);
  font-size: var(--fs-xs);
  text-align: center;
  font-family: var(--font-sans);
}

/* ---------- News list ---------- */
.news-list {
  list-style: none;
  padding: 0;
  margin: var(--s-4) 0 0;
}
.news-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.news-item:last-child { border-bottom: none; }
.news-item time {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  padding-top: 4px;
}
.news-body p { margin: 0; }

@media (max-width: 560px) {
  .news-item { grid-template-columns: 1fr; gap: var(--s-1); }
  .news-item time { padding-top: 0; }
}

/* ---------- CV ---------- */
.cv-header { margin-bottom: var(--s-6); }
.cv-header .links { font-size: var(--fs-sm); }
.cv-section { margin-top: var(--s-7); }

.cv-list { list-style: none; padding: 0; margin: 0; }
.cv-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.cv-item:last-child { border-bottom: none; }
.cv-date {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  padding-top: 4px;
}
.cv-title { font-weight: 500; font-size: var(--fs-md); }
.cv-title .muted { font-weight: 400; font-style: italic; }

.cv-bullets {
  margin: var(--s-2) 0 var(--s-1);
  padding-left: 1.2rem;
  color: var(--ink-soft);
}
.cv-bullets li {
  margin: var(--s-1) 0;
  line-height: 1.55;
  font-size: var(--fs-sm);
}

@media (max-width: 560px) {
  .cv-item { grid-template-columns: 1fr; gap: var(--s-1); }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-2); }
.chip {
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--muted);
  padding: 2px 10px;
  border-radius: 99px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
}

/* ---------- Publications ---------- */
.pub-year h2 {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--s-2);
  margin-top: var(--s-7);
}
.pub-list { list-style: none; padding: 0; margin: 0 0 var(--s-6); }
.pub {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.pub:last-child { border-bottom: none; }
.pub-abbr {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fffdf8;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 8px;
  vertical-align: middle;
}
.pub-title { font-weight: 500; display: inline; font-size: var(--fs-md); }
.pub-meta { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--s-1); font-style: italic; }
.pub-links { font-family: var(--font-sans); font-size: var(--fs-xs); margin-top: var(--s-1); }

/* ---------- Entry lists ---------- */
.entry-list { list-style: none; padding: 0; margin: 0; }
.entry {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.entry:last-child { border-bottom: none; }
.entry a { background-image: none; }
.entry-title { font-weight: 500; font-size: var(--fs-md); color: var(--ink); }
.entry a:hover .entry-title { color: var(--accent); }
.entry time {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

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