/* ---------- design tokens ---------- */
:root {
  --bg: #fdfdfc;
  --bg-alt: #f4f3f1;
  --text: #1c1c1a;
  --text-muted: #63625c;
  --accent: #c8951c;
  --accent-2: #2e7d4f;
  --border: #e4e2dd;
  --radius: 10px;
  --max-width: 46rem;
  --max-width-wide: 64rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --bg-alt: #1f1e24;
    --text: #ebe9e4;
    --text-muted: #a6a4a0;
    --accent: #f0c048;
    --accent-2: #5fcb8c;
    --border: #34333a;
  }
}

/* manual theme toggle overrides system preference in either direction */
:root[data-theme="light"] {
  --bg: #fdfdfc;
  --bg-alt: #f4f3f1;
  --text: #1c1c1a;
  --text-muted: #63625c;
  --accent: #c8951c;
  --accent-2: #2e7d4f;
  --border: #e4e2dd;
}
:root[data-theme="dark"] {
  --bg: #16151a;
  --bg-alt: #1f1e24;
  --text: #ebe9e4;
  --text-muted: #a6a4a0;
  --accent: #f0c048;
  --accent-2: #5fcb8c;
  --border: #34333a;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.65;
}

img { max-width: 100%; display: block; }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand {
  font-weight: 600;
  color: var(--text);
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.4rem;
}

.nav-toggle,
.nav-toggle-label { display: none; }

/* ---------- main / footer ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

main:has(.project-grid),
main:has(.pub-list) {
  max-width: var(--max-width-wide);
}

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 1.5rem;
}

/* ---------- typography ---------- */
h1 { font-size: 1.9rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 2.5rem 0 1rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; margin: 0 0 0.25rem; }

.prose p { margin: 1rem 0; }
.page-intro { color: var(--text-muted); margin-top: 0.25rem; }

/* ---------- hero (home) ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.hero-avatar {
  flex: 0 0 auto;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.hero h1 { font-size: 2.1rem; }
.hero .role { color: var(--accent); font-weight: 600; margin: 0.25rem 0; }
.hero .tagline { color: var(--text-muted); max-width: 38rem; }
.pull-quote {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
  opacity: 0.75;
  margin: 0.6rem 0 0;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin: 1.25rem 0 0.5rem;
}
.social-links a { color: var(--text-muted); display: inline-flex; }
.social-links a:hover { color: var(--accent); }

.home-intro { margin-top: 2.5rem; }
.home-pubs { margin-top: 2.5rem; }
.home-news { margin-top: 2.5rem; }

.more-link { display: inline-block; margin-top: 0.75rem; font-size: 0.9rem; }

.build-note {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- news / blog list ---------- */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news-list li {
  display: flex;
  gap: 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.news-list li:last-child { border-bottom: none; }

.news-date {
  flex: 0 0 5.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-top: 0.15rem;
}

.news-body p { margin: 0.15rem 0 0; }
.news-title { font-weight: 600; color: var(--text); }
.news-title:hover { color: var(--accent); }

.news-list-full .news-body p { color: var(--text-muted); }

/* ---------- bio ---------- */
.bio-section { margin-top: 2rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.timeline > li:last-child { border-bottom: none; }

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.timeline-dates { color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; }
.timeline-org { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.15rem; }
.timeline-bullets {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.95rem;
}
.timeline-bullets li { margin: 0.3rem 0; }

.skills-list { list-style: none; margin: 0; padding: 0; }
.skills-list li { padding: 0.4rem 0; font-size: 0.95rem; }

/* ---------- projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.project-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  background: var(--bg-alt);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.project-card-image { aspect-ratio: 16 / 10; overflow: hidden; background: var(--border); }
.project-card-image img { width: 100%; height: 100%; object-fit: cover; }

.project-card-body { padding: 1rem 1.1rem 1.2rem; }
.project-card-body h3 { margin-bottom: 0.35rem; }
.project-card-body p { margin: 0.25rem 0; color: var(--text-muted); font-size: 0.92rem; }
.project-card-meta { font-size: 0.82rem !important; }

.project-single-image { border-radius: var(--radius); margin: 1.25rem 0; }
.project-single-meta { color: var(--text-muted); margin: 0.25rem 0 0.75rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.tag {
  font-size: 0.75rem;
  color: var(--accent-2);
  background: var(--bg);
  border: 1px solid var(--accent-2);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.back-link { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; }

/* ---------- blog (long-form) ---------- */
.article-list { list-style: none; margin: 2rem 0 0; padding: 0; }
.article-item {
  display: flex;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.article-item:last-child { border-bottom: none; }
.article-title { font-weight: 600; font-size: 1.1rem; color: var(--text); }
.article-title:hover { color: var(--accent); }
.article-excerpt { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- publications ---------- */
.pub-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}
.pub-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }

.pub-preview {
  flex: 0 0 140px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
}
.pub-preview img { width: 100%; height: 100%; object-fit: cover; }

.pub-title { font-size: 1.05rem; }
.pub-authors { margin: 0.3rem 0; font-size: 0.92rem; }
.pub-venue { margin: 0.2rem 0; color: var(--text-muted); font-size: 0.88rem; }
.pub-abbr {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.pub-note { font-style: italic; }
.pub-links { margin: 0.4rem 0 0; display: flex; gap: 1rem; font-size: 0.88rem; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: stretch; gap: 1rem; }
  .hero > div { min-width: 0; }
  .hero-avatar { width: 120px; height: 120px; }

  .nav-right { flex-wrap: wrap; }

  .nav-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
  }
  .nav-toggle-label span {
    width: 22px;
    height: 2px;
    background: var(--text);
    display: block;
  }

  .nav-links {
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }
  .nav-toggle:checked ~ .nav-links {
    max-height: 20rem;
    margin-top: 0.75rem;
  }
  .nav-links li { border-top: 1px solid var(--border); }
  .nav-links a { display: block; padding: 0.75rem 0.25rem; }

  main { padding: 1.75rem 1.25rem 3rem; }

  .pub-item { flex-direction: column; }
  .pub-preview { flex-basis: auto; width: 100%; aspect-ratio: 16 / 9; }

  .timeline-header { flex-direction: column; gap: 0.15rem; }
}
