@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap');

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

/* ── Design tokens ────────────────────────────────── */
:root {
  --bg:           #f9f9f7;
  --surface:      #ffffff;
  --surface-sub:  #f3f4f0;
  --text:         #1c1c1e;
  --text-muted:   #6b7280;
  --text-faint:   #9ca3af;
  --accent:       #1e40af;
  --accent-dim:   #dbeafe;
  --border:       #e2e8f0;
  --border-med:   #cbd5e1;

  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  --max-w:  860px;
  --gap:    1.5rem;
  --radius: 4px;
}

[data-theme="dark"] {
  --bg:           #111110;
  --surface:      #1c1c1a;
  --surface-sub:  #252523;
  --text:         #e8e8e6;
  --text-muted:   #9ca3af;
  --text-faint:   #6b7280;
  --accent:       #60a5fa;
  --accent-dim:   #1e3a5f;
  --border:       #2d2d2b;
  --border-med:   #3d3d3b;
}

/* ── Base ─────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }

h1, h2, h3, h4, h5 {
  font-family: var(--mono);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  font-family: var(--mono);
  font-size: 0.875rem;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }

/* ── Layout ───────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
}

main { min-height: calc(100vh - 120px); }

/* ── Header ───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.site-name {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-name:hover { color: var(--accent); text-decoration: none; }

.site-nav {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.1rem;
  margin-bottom: 0;
}

.site-nav li {
  display: flex;
  align-items: center;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.775rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  transition: color 0.12s, background 0.12s;
  display: flex;
  align-items: center;
  line-height: 1;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
  text-decoration: none;
}
.site-nav a.ext::after {
  content: ' ↗';
  font-size: 0.65rem;
  opacity: 0.55;
}

.nav-icon-sep {
  width: 1px;
  height: 16px;
  background: var(--border-med);
  margin: 0 0.25rem;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 0.3rem;
  border-radius: var(--radius);
  transition: color 0.12s, background 0.12s;
}
.nav-icon-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
  text-decoration: none;
}
.nav-icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Hero ─────────────────────────────────────────── */
.hero {
  padding: 5rem 0 4.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 4rem;
  align-items: center;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.hero-name {
  font-family: var(--mono);
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 0.65rem;
}

.hero-title {
  font-family: var(--mono);
  font-size: 0.825rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1.75rem;
}

.hero-bio {
  font-size: 0.975rem;
  color: var(--text);
  max-width: 52ch;
  line-height: 1.8;
  margin-bottom: 2rem;
}

.hero-collab-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-link {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.hero-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  text-decoration: none;
}
.hero-link-ext::after {
  content: ' ↗';
  font-size: 0.65rem;
  opacity: 0.55;
}

.hero-photo-wrap { display: flex; justify-content: center; }

.hero-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.hero-photo-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--surface-sub);
  border: 2px dashed var(--border-med);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  text-align: center;
  padding: 1rem;
  line-height: 1.4;
}

/* ── Section shared ───────────────────────────────── */
.section {
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }

.section-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.35rem;
}
.section-label::before { content: '// '; }

.section-title {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.section-subtitle {
  font-size: 0.925rem;
  color: var(--text-muted);
  /*max-width: 60ch;*/
  margin-bottom: 2rem;
}

.section-more {
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

/* ── Cards ────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: var(--border-med);
  box-shadow: 0 2px 10px rgba(0,0,0,0.055);
}

.card-tag {
  font-family: var(--mono);
  font-size: 0.67rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.45rem;
}

.card-title {
  font-family: var(--mono);
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--accent); }

.card-full-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  font-style: italic;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Blog list ────────────────────────────────────── */
.post-list { list-style: none; padding: 0; margin: 0; }

.post-item {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { border-top: none; }

.post-item:last-child { border-bottom: none; }

.post-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.post-title {
  font-size: 0.975rem;
  font-weight: 500;
  color: var(--text);
}
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { color: var(--accent); }

/* ── Page header (inner pages) ────────────────────── */
.page-header {
  padding: 3.5rem 0 2.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.page-header .section-label { margin-bottom: 0.35rem; }

.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

.page-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  /*max-width: 60ch;*/
  line-height: 1.7;
}

.page-content { padding-bottom: 0; }

/* ── Single post ──────────────────────────────────── */
.post-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.post-meta {
  font-family: var(--mono);
  font-size: 0.775rem;
  color: var(--text-faint);
}

.post-body {
  font-size: 0.95rem;
  padding-bottom: 4rem;
}
.post-body h2 { font-size: 1.3rem; margin: 2.25rem 0 0.75rem; }
.post-body h3 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }
.post-body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}
.post-body blockquote {
  border-left: 3px solid var(--border-med);
  padding-left: 1.1rem;
  color: var(--text-muted);
  margin: 1.5rem 0;
  font-style: italic;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1.5rem 0;
}
.post-body th, .post-body td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}
.post-body th {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--surface-sub);
  font-weight: 600;
}

/* ── Footer ───────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-name {
  font-family: var(--mono);
  font-size: 0.775rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}
.footer-links a {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }

.footer-top {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-decoration: none;
}
.footer-top:hover { color: var(--accent); text-decoration: none; }

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}
.theme-toggle:hover {
  color: var(--accent);
  background: var(--accent-dim);
}
.theme-toggle svg { width: 15px; height: 15px; }

/* show moon in light mode, sun in dark mode */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* ── Home: research topic tags ────────────────────── */
.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.topic-tag {
  font-family: var(--mono);
  font-size: 0.775rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 99px;
}

/* ── Home: software tease list ────────────────────── */
.software-tease {
  list-style: none;
  padding: 0;
  margin: 0 0 0.25rem;
}

.software-tease li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.software-tease li:first-child { border-top: 1px solid var(--border); }

.software-tease-name {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  font-size: 0.825rem;
}

.software-tease-desc {
  color: var(--text-muted);
}

/* ── Research page: full entries ──────────────────── */
.research-entry {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
}
.research-entry:last-child { border-bottom: none; }

.research-entry-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.research-entry h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.research-entry-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 2.5rem;
  align-items: start;
}
.research-entry-body.no-image {
  grid-template-columns: 1fr;
}

.research-entry-desc {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.research-pubs {
  margin-top: 0.25rem;
}

.research-pubs-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.research-pubs ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.research-pubs li {
  font-size: 0.825rem;
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.research-pubs a {
  color: var(--text-muted);
  text-decoration: none;
}
.research-pubs a:hover { color: var(--accent); text-decoration: underline; }

.research-pub-ref {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-left: 0.35rem;
}

.research-entry-img-wrap {
  position: sticky;
  top: 70px;
}

.research-entry-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

.research-img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-sub);
  border: 1px dashed var(--border-med);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  text-align: center;
  padding: 1rem;
  line-height: 1.5;
}

/* ── Software page: full rows ─────────────────────── */
.software-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.software-entry {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
}
.software-entry:last-child { border-bottom: none; }

.software-entry-meta {
  padding-top: 0.1rem;
}

.software-entry-name {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.software-entry-name a { color: inherit; text-decoration: none; }
.software-entry-name a:hover { color: var(--accent); }

.software-entry-role {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.software-entry-fullname {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-style: italic;
  line-height: 1.4;
}

.software-entry-desc {
  font-size: 0.925rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.software-entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.software-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.12s, border-color 0.12s;
}
.software-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}
.software-link.primary {
  background: var(--accent-dim);
  border-color: transparent;
  color: var(--accent);
}
.software-link.primary:hover { border-color: var(--accent); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 640px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hero-photo-wrap { order: -1; }
  .hero-photo, .hero-photo-placeholder { width: 120px; height: 120px; }
  .hero-name { font-size: 2rem; }

  .site-nav a { padding: 0.3rem 0.45rem; font-size: 0.72rem; }

  .site-footer .container { flex-direction: column; gap: 0.75rem; text-align: center; }
  .footer-right { justify-content: center; }

  .post-item { grid-template-columns: 1fr; gap: 0.2rem; }
  .post-date { font-size: 0.7rem; }

  .research-entry-body { grid-template-columns: 1fr; }

  .software-entry {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .software-tease li { grid-template-columns: 6rem 1fr; }
}
