:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #1b1f2a;
  --ink-2: #4a5160;
  --muted: #6b7280;
  --line: #e4e1da;
  --accent: #b45309;        /* solar amber, text-safe */
  --accent-strong: #e8890c; /* decorative */
  --accent-soft: #fdf1e1;
  --blue: #1e3a8a;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 4px 16px rgba(20, 20, 30, .06);
  --radius: 12px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #161a22;
    --surface-2: #1c212b;
    --ink: #e8eaef;
    --ink-2: #c3c8d2;
    --muted: #9aa1ae;
    --line: #2a303c;
    --accent: #f5a524;
    --accent-strong: #f5a524;
    --accent-soft: #2a2114;
    --blue: #93b4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2rem); margin-bottom: 1rem; }
.h-small {
  font-family: var(--sans); font-size: .8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin: 2rem 0 .75rem;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.lead { font-size: 1.075rem; color: var(--ink-2); max-width: 70ch; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: .92rem; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 56px 0 24px; }
.hero::before {
  content: ""; position: absolute; right: -220px; top: -160px; width: 720px; height: 720px;
  background: url("../img/sun.jpg") center / contain no-repeat;
  opacity: .5; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle, #000 45%, transparent 70%);
          mask-image: radial-gradient(circle, #000 45%, transparent 70%);
}
@media (prefers-color-scheme: dark) { .hero::before { opacity: .08; filter: invert(1) hue-rotate(180deg); } }
.hero-inner { position: relative; display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }
.portrait { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 640 / 896; object-fit: cover; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 .5rem; }
.hero h1 { font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.1rem); }
.role { color: var(--ink-2); font-size: 1.08rem; margin: .5rem 0 1.25rem; }
.hero-text p { max-width: 68ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.5rem; }
.interests {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px;
}
.interests li {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px 12px 30px; font-size: .94rem; color: var(--ink-2);
}
.interests li::before {
  content: ""; position: absolute; left: 13px; top: 20px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-strong);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .93rem;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #1a1206; } }
.btn-primary:hover { filter: brightness(1.08); }
.btn-small { min-height: 34px; padding: 5px 12px; font-size: .88rem; }

/* Sections */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* People */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 1.5rem 0; }
.person {
  display: flex; gap: 14px; align-items: flex-start; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.avatar {
  flex: 0 0 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .95rem;
}
.person-name { font-weight: 600; }
.person-role { font-size: .85rem; color: var(--muted); }
.person-topic { font-size: .92rem; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.callout {
  margin-top: 1.25rem; padding: 16px 18px; border-radius: var(--radius);
  background: var(--accent-soft); border-left: 4px solid var(--accent-strong); color: var(--ink-2);
}

/* Lists with a year column */
.projects, .pubs, .timeline { list-style: none; margin: 0; padding: 0; }
.project, .pub, .timeline li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.timeline li { grid-template-columns: 84px 1fr; padding: 12px 0; font-size: .95rem; }
.years { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; padding-top: 2px; }
.project-title, .pub-title { font-weight: 500; line-height: 1.45; }
.project-title a, .pub-title a, .item-title a { color: var(--ink); text-decoration-color: var(--line); }
.project-title a:hover, .pub-title a:hover, .item-title a:hover { color: var(--accent); text-decoration-color: currentColor; }
.project-meta, .pub-meta, .item-meta { font-size: .9rem; color: var(--muted); margin-top: 3px; }
.project-meta .proj-role { color: var(--ink-2); font-weight: 500; }
.pub-meta strong { color: var(--ink-2); font-weight: 600; }
.badge, .tag {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: 1px 8px; border-radius: 999px; vertical-align: 1px;
}
.badge { background: var(--accent-soft); color: var(--accent); }
.tag { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

details.more { margin-top: 1.25rem; }
details.more summary {
  cursor: pointer; font-weight: 500; color: var(--accent); padding: 8px 0; list-style: none;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "▸ "; display: inline-block; transition: transform .15s; }
details.more[open] summary::before { transform: rotate(90deg); }

.two-col { display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; }
.two-col .h-small { margin-top: .5rem; }

/* Teaching */
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.course { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.course-code { font-size: .82rem; font-weight: 600; color: var(--accent); letter-spacing: .03em; }
.level { color: var(--muted); font-weight: 500; margin-left: 6px; }
.course-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin: 4px 0 6px; }
.course-terms { font-size: .9rem; color: var(--ink-2); }
.course-note { font-size: .82rem; color: var(--muted); margin-top: 4px; font-style: italic; }
.notes { margin: 1.5rem 0 0; padding-left: 1.2rem; color: var(--ink-2); }
.notes li { margin: .35rem 0; }

/* Link cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 600; }
.card-desc { font-size: .88rem; color: var(--muted); margin-top: 2px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: .9rem; color: var(--ink-2); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-end; }

/* Responsive */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { gap: 12px; }
  .brand { display: none; }
  .nav { margin-left: -6px; }
  .hero { padding-top: 32px; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .portrait { width: 180px; }
  .hero::before { width: 480px; height: 480px; right: -200px; top: -120px; }
  .section { padding: 40px 0; }
  .project, .pub { grid-template-columns: 1fr; gap: 2px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .people, .courses { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn { transition: none; }
}
