:root {
  --bg: #efeae0;
  --surface: #f7f3eb;
  --paper: #fffdf8;
  --ink: #1c1915;
  --muted: #6a645b;
  --faint: #8b847a;
  --line: #ddd4c6;
  --chip: #ece6da;
  --accent: #2a4548;
  --accent-fg: #f3efe6;
  --cover-fade: #1a1712;
  --code: #161410;
  --code-fg: #f3efe6;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --shadow: 0 0 0 1px rgba(28, 25, 21, 0.06), 0 1px 2px -1px rgba(28, 25, 21, 0.06),
    0 8px 24px -12px rgba(28, 25, 21, 0.12);
  --shadow-hover: 0 0 0 1px rgba(28, 25, 21, 0.1), 0 14px 32px -14px rgba(28, 25, 21, 0.18);
  --motion-quick: 150ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark {
  color-scheme: dark;
  --bg: #141210;
  --surface: #1b1815;
  --paper: #1f1c18;
  --ink: #f0ebe3;
  --muted: #a39c91;
  --faint: #7d766c;
  --line: #3a342c;
  --chip: #2a2621;
  --accent: #e6dfd2;
  --accent-fg: #1c1915;
  --cover-fade: #0e0c0a;
  --code: #0c0b09;
  --code-fg: #e9e3d8;
  --shadow: 0 0 0 1px rgba(240, 235, 227, 0.08);
  --shadow-hover: 0 0 0 1px rgba(240, 235, 227, 0.14);
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--ink);
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  transition: background-color var(--motion-quick) var(--ease), color var(--motion-quick) var(--ease);
}

button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }

h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 500; letter-spacing: -0.02em; }
p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: color-mix(in oklab, var(--accent) 22%, transparent); }

.wrap { width: min(1024px, calc(100% - 32px)); margin-inline: auto; }
@media (min-width: 640px) { .wrap { width: min(1024px, calc(100% - 48px)); } }

.site-header {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
.header-inner {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-family: var(--font-serif); font-size: 1rem; }
.mono {
  height: 28px; min-width: 28px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 6px; background: var(--ink); color: var(--accent-fg);
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
}
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav { display: flex; align-items: center; gap: 4px; }
nav a, .theme-btn {
  height: 40px; padding: 0 12px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 500; color: var(--muted);
  border: 0; background: transparent;
  transition: background-color var(--motion-quick) var(--ease), color var(--motion-quick) var(--ease);
}
nav a:hover, .theme-btn:hover { background: var(--chip); color: var(--ink); }
nav a[aria-current="page"] { background: var(--chip); color: var(--ink); }
.theme-btn { width: 40px; padding: 0; }

.card {
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  font-family: var(--font-serif); font-size: 1.25rem;
}
.section-title .left { display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 16px; height: 16px; color: var(--accent); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px;
  border-radius: 999px; background: var(--chip); font-size: 12px; font-weight: 500;
}

.cover { position: relative; height: 144px; background: var(--cover-fade); overflow: hidden; }
@media (min-width: 640px) { .cover { height: 192px; } }
@media (min-width: 768px) { .cover { height: 224px; } }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
.cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, color-mix(in oklab, var(--cover-fade) 35%, transparent), transparent);
  pointer-events: none;
}

.profile-body { position: relative; padding: 0 16px 28px; }
@media (min-width: 640px) { .profile-body { padding: 0 28px 28px; } }
.avatar-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: -48px; }
@media (min-width: 640px) { .avatar-row { margin-top: -56px; } }
.avatar {
  width: 96px; height: 96px; border-radius: 999px; object-fit: cover; object-position: top;
  border: 4px solid var(--paper); box-shadow: var(--shadow);
}
@media (min-width: 640px) { .avatar { width: 112px; height: 112px; } }
@media (min-width: 768px) { .avatar { width: 128px; height: 128px; } }
.profile-actions { display: none; gap: 8px; margin-bottom: 4px; }
@media (min-width: 640px) { .profile-actions { display: flex; } }
.profile-actions-mobile { display: flex; gap: 8px; margin-top: 16px; }
@media (min-width: 640px) { .profile-actions-mobile { display: none; } }

.btn {
  height: 40px; padding: 0 16px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 0.875rem; font-weight: 500; border: 0;
  transition: opacity var(--motion-quick) var(--ease), background-color var(--motion-quick) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: 0.92; }
.btn-ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--chip); }
.btn-wide { flex: 1; height: 44px; }

h1.display { font-family: var(--font-serif); font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem); margin-top: 16px; }
.headline { margin: 8px 0 0; max-width: 40rem; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem); line-height: 1.55; color: color-mix(in oklab, var(--ink) 85%, transparent); }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; font-size: 0.875rem; color: var(--muted); }
.meta-row svg { width: 14px; height: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.layout { display: grid; gap: 20px; margin-top: 20px; padding-bottom: 16px; }
@media (min-width: 1024px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pad { padding: 20px 22px; }

.about p { margin: 0 0 12px; font-size: 1.02rem; line-height: 1.75; color: color-mix(in oklab, var(--ink) 90%, transparent); }
.about p:last-child { margin-bottom: 0; }

.post-list { list-style: none; margin: 16px 0 0; padding: 0; }
.post-list li { border-top: 1px solid var(--line); }
.post-list li:first-child { border-top: 0; }
.post-row { display: flex; gap: 16px; padding: 16px 0; }
.post-row:first-child { padding-top: 4px; }
.post-thumb { width: 96px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
@media (min-width: 640px) { .post-thumb { width: 112px; height: 72px; } }
.post-row h3 { font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.3; }
.post-row:hover h3 { text-decoration: underline; }
.post-row p { margin: 4px 0 0; font-size: 0.875rem; color: var(--muted); }

.more-notes { list-style: none; margin: 12px 0 0; padding: 0; }
.more-notes li { border-top: 1px solid var(--line); }
.more-notes a { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-weight: 500; }
.more-notes a:hover span:first-child { text-decoration: underline; }

.job { display: flex; gap: 16px; position: relative; padding-bottom: 24px; }
.job:last-child { padding-bottom: 0; }
.job + .job::before {
  content: ""; position: absolute; left: 15px; top: 0; bottom: 24px; width: 1px; background: var(--line);
}
.job-dot {
  width: 32px; height: 32px; border-radius: 999px; background: var(--chip); color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0; position: relative; z-index: 1; margin-top: 4px;
}
.job-dot svg { width: 14px; height: 14px; }
.job h3 { font-family: var(--font-serif); font-size: 1.125rem; }
.job .org { margin: 2px 0 0; font-size: 0.875rem; color: var(--muted); }
.job .sum { margin: 8px 0 0; line-height: 1.7; color: color-mix(in oklab, var(--ink) 85%, transparent); }

.interest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.skill-group { margin-top: 14px; }
.skill-group h3 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; font-family: var(--font-sans); }
.skill-group .chips { margin-top: 8px; }

.page { padding: 32px 0 16px; }
.page h1 { font-family: var(--font-serif); font-size: clamp(1.75rem, 1.3rem + 2vw, 2.25rem); margin-top: 8px; }
.kicker { font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.blog-grid { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 20px; }
.blog-card {
  display: grid; overflow: hidden; background: var(--paper); border-radius: var(--radius-xl); box-shadow: var(--shadow);
  transition: box-shadow var(--motion-quick) var(--ease);
}
.blog-card:hover { box-shadow: var(--shadow-hover); }
@media (min-width: 640px) { .blog-card { grid-template-columns: 220px minmax(0, 1fr); } }
.blog-card img { width: 100%; height: 176px; object-fit: cover; }
@media (min-width: 640px) { .blog-card img { height: 100%; min-height: 160px; } }
.blog-card .body { padding: 20px 22px; display: flex; flex-direction: column; justify-content: center; }
.blog-card h2 { font-family: var(--font-serif); font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem); margin-top: 6px; }
.blog-card:hover h2 { text-decoration: underline; }
.blog-card .sum { margin: 8px 0 0; color: var(--muted); font-size: 0.95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { height: 24px; padding: 0 8px; border-radius: 999px; background: var(--chip); font-size: 11px; font-weight: 500; display: inline-flex; align-items: center; }

.article { padding: 32px 0 16px; }
.back { display: inline-flex; align-items: center; gap: 6px; height: 36px; font-size: 0.875rem; font-weight: 500; color: var(--muted); }
.back:hover { color: var(--ink); }
.article-head { max-width: 40rem; margin: 24px auto 0; }
.article-head h1 { font-family: var(--font-serif); font-size: clamp(1.8rem, 1.4rem + 2vw, 2.35rem); line-height: 1.15; margin-top: 12px; }
.article-head .lede { margin: 16px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 20px; font-size: 0.875rem; }
.byline img { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; object-position: top; }
.hero-fig { margin: 32px 0 0; overflow: hidden; border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.hero-fig img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }

.prose { max-width: 40rem; margin: 40px auto 0; }
.prose p, .prose li { font-size: 1.0625rem; line-height: 1.75; color: color-mix(in oklab, var(--ink) 90%, transparent); }
.prose p { margin: 0 0 1.15em; }
.prose h2 { font-family: var(--font-serif); font-size: 1.35rem; margin: 1.6em 0 0.6em; }
.prose ul { margin: 0 0 1.15em; padding: 0; list-style: none; }
.prose li { position: relative; padding-left: 18px; margin: 0 0 8px; }
.prose li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.prose blockquote {
  margin: 0 0 1.15em; padding: 0 0 0 16px; border-left: 2px solid var(--accent);
  font-family: var(--font-serif); font-size: 1.15rem; font-style: italic; line-height: 1.4;
}
.prose pre {
  margin: 0 0 1.15em; padding: 16px; overflow-x: auto;
  background: var(--code); color: var(--code-fg); border-radius: var(--radius-md); box-shadow: var(--shadow);
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6;
}
.prose code { font-family: var(--font-mono); }
.prose p code, .prose li code {
  background: var(--chip); padding: 1px 5px; border-radius: 4px; font-size: 0.9em;
}

.more { border-top: 1px solid var(--line); padding: 40px 0; margin-top: 16px; }
.more h2 { font-family: var(--font-serif); font-size: 1.25rem; }
.more-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 640px) { .more-grid { grid-template-columns: repeat(3, 1fr); } }
.more-card { display: block; overflow: hidden; background: var(--paper); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.more-card img { width: 100%; height: 112px; object-fit: cover; }
.more-card div { padding: 14px; }
.more-card h3 { font-family: var(--font-serif); font-size: 1rem; line-height: 1.3; margin-top: 4px; }
.more-card:hover h3 { text-decoration: underline; }

.site-footer { padding: 40px 0 48px; }
.footer-inner {
  display: flex; flex-direction: column; gap: 12px;
  border-top: 1px solid var(--line); padding-top: 24px; font-size: 0.875rem; color: var(--muted);
}
@media (min-width: 640px) {
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .footer-inner p:last-child { text-align: right; max-width: 28rem; }
}

.empty { min-height: 50vh; display: grid; place-items: center; text-align: center; padding: 64px 0; }
.empty h1 { font-family: var(--font-serif); font-size: 1.5rem; }

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