/* ------------------------------------------------------------------ tokens */
:root {
  --bg:        #fbfbfa;
  --surface:   #ffffff;
  --text:      #17181a;
  --muted:     #6b6f76;
  --faint:     #9aa0a6;
  --rule:      #e6e5e1;
  --accent:    #2f5d50;
  --accent-bg: #eef3f1;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --measure: 62rem;
  --gutter: 1.5rem;
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0e0f11;
    --surface:   #16181b;
    --text:      #e9e8e4;
    --muted:     #9ba0a7;
    --faint:     #6e747c;
    --rule:      #26292e;
    --accent:    #7fc0ac;
    --accent-bg: #16211e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:        #0e0f11;
  --surface:   #16181b;
  --text:      #e9e8e4;
  --muted:     #9ba0a7;
  --faint:     #6e747c;
  --rule:      #26292e;
  --accent:    #7fc0ac;
  --accent-bg: #16211e;
  color-scheme: dark;
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "cv05", "ss01";
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color .15s ease, color .15s ease;
}
a:hover { color: var(--accent); border-bottom-color: var(--accent); }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 { font-weight: 500; letter-spacing: -0.015em; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: .75rem;
  z-index: 10;
  background: var(--surface);
  padding: .5rem .75rem;
  border: 1px solid var(--rule);
}

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
}

.mark {
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: .08em;
  border: 0;
  color: var(--text);
}

.topbar nav {
  display: flex;
  gap: 1.1rem;
  margin-left: auto;
  font-size: .85rem;
  color: var(--muted);
}
.topbar nav a { border: 0; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }

#theme-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
#theme-toggle:hover { color: var(--text); border-color: var(--faint); }
#theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#theme-toggle .moon { display: none; }
:root[data-theme="dark"] #theme-toggle .sun { display: none; }
:root[data-theme="dark"] #theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) #theme-toggle .moon { display: block; }
}

/* ------------------------------------------------------------------ layout */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem var(--gutter) 4rem;
}

section + section {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--rule);
}

section > h2 {
  margin: 0 0 1.25rem;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

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

/* -------------------------------------------------------------------- hero */
.hero {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  padding-top: 1.5rem;
}
.hero-text { flex: 1 1 auto; min-width: 0; }

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  line-height: 1.1;
  margin: 0 0 .5rem;
  letter-spacing: -0.02em;
}

.role {
  margin: 0 0 1.25rem;
  font-size: .92rem;
  color: var(--muted);
}

.lede {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.links a { display: inline-flex; padding: .2rem; color: var(--muted); border: 0; }
.links a:hover { color: var(--accent); }
.links svg { width: 20px; height: 20px; fill: currentColor; }
.links svg.stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.portrait {
  flex: 0 0 auto;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-bg);
  border: 1px solid var(--rule);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait.empty { display: none; }

/* ------------------------------------------------------------------ topics */
.topics {
  display: grid;
  gap: 1.75rem;
}
.topics h3 {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .35rem;
  font-size: .98rem;
  font-weight: 600;
}
.topic-icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topics p {
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
}
.topics .topic-link { margin-top: .5rem; font-size: .88rem; }
.topics .topic-link a { color: var(--accent); border-bottom-color: transparent; }
.topics .topic-link a:hover { border-bottom-color: var(--accent); }

/* ------------------------------------------------------------ publications */
.pub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.pub-head h2 { margin-bottom: .5rem; }

.filters { display: flex; gap: .35rem; }
.filters button {
  font: inherit;
  font-size: .78rem;
  padding: .18rem .6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.filters button:hover { color: var(--text); border-color: var(--faint); }
.filters button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-bg);
}

.note {
  font-size: .82rem;
  color: var(--faint);
  margin-bottom: 1.75rem;
}
.note a { border-bottom-color: var(--rule); }

.year-group { margin-bottom: 2.25rem; }
.year-group:last-child { margin-bottom: 0; }

.year-label {
  font-family: var(--serif);
  font-size: .85rem;
  color: var(--faint);
  letter-spacing: .06em;
  margin: 0 0 .9rem;
}

.pub {
  margin-bottom: 1.4rem;
  animation: rise .25s ease both;
}
.pub:last-child { margin-bottom: 0; }

.pub-title {
  margin: 0 0 .2rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
}
.pub-authors {
  margin: 0;
  font-size: .87rem;
  color: var(--muted);
  line-height: 1.5;
}
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-meta {
  margin: .2rem 0 0;
  font-size: .85rem;
  color: var(--faint);
}
.pub-meta em { font-style: italic; }
.pub-meta .sep { margin: 0 .5rem; opacity: .5; }
.pub-meta a {
  color: var(--accent);
  border-bottom-color: transparent;
}
.pub-meta a:hover { border-bottom-color: var(--accent); }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ footer */
footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 3rem;
  font-size: .8rem;
  color: var(--faint);
  border-top: 1px solid var(--rule);
}

/* ------------------------------------------------------------------ mobile */
@media (max-width: 600px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; gap: 1.25rem; }
  .portrait { width: 84px; height: 84px; }
  .topbar nav { gap: .85rem; font-size: .8rem; }
  .pub-head { flex-direction: column; align-items: flex-start; gap: .25rem; }
}
