:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #5c636b;
  --rule: #e2e0da;
  --accent: #8a5a00;
  --accent-soft: #f3ead9;
  --masthead: #23303d;
  --masthead-text: #f4f2ee;
  --masthead-muted: #c3c9cf;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181c;
    --card: #1d2126;
    --text: #e6e3de;
    --muted: #a3a9b0;
    --rule: #30353b;
    --accent: #e0b25c;
    --accent-soft: #2c261b;
    --masthead: #0f1317;
    --masthead-text: #f4f2ee;
    --masthead-muted: #a3a9b0;
  }
}

:root[data-theme="dark"] {
  --bg: #15181c;
  --card: #1d2126;
  --text: #e6e3de;
  --muted: #a3a9b0;
  --rule: #30353b;
  --accent: #e0b25c;
  --accent-soft: #2c261b;
  --masthead: #0f1317;
  --masthead-text: #f4f2ee;
  --masthead-muted: #a3a9b0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
}

h1, h2, h3, .nav, .meta, .links, .year, .footer, .tags {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-underline-offset: 2px; }

.wrap {
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 16px;
}

/* Masthead */
.masthead {
  background: var(--masthead);
  color: var(--masthead-text);
  padding-top: 2.5rem;
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-bottom: 2rem;
}
.headshot {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 3px solid var(--masthead-muted);
}
.masthead h1 { margin: 0 0 .25rem; font-size: 2.2rem; line-height: 1.15; }
.position, .institution { margin: 0; }
.institution { color: var(--masthead-muted); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
  padding-bottom: .9rem;
  font-size: .95rem;
}
.nav a { color: var(--masthead-text); text-decoration: none; opacity: .85; }
.nav a:hover { opacity: 1; text-decoration: underline; }

/* Sections */
main.wrap { padding-top: 2rem; padding-bottom: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  scroll-margin-top: 1rem;
}
.card h2 {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent-soft);
}
.card h3 { font-size: 1rem; margin: 1.5rem 0 .5rem; }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.tags li { background: var(--accent-soft); padding: .2rem .7rem; border-radius: 999px; }

.entries { list-style: none; padding: 0; margin: 0; }
.entries > li + li { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.entries.plain > li + li { margin-top: .75rem; padding-top: 0; border-top: 0; }
.entry { display: grid; grid-template-columns: 3.5rem 1fr; gap: 1rem; }
.year { color: var(--muted); font-weight: 600; padding-top: .1rem; }
.entry-title { font-weight: 600; margin: 0; }
a.entry-title { display: inline-block; }
.meta { color: var(--muted); margin: .2rem 0 0; font-size: .92rem; }
.summary { margin: .5rem 0 0; }
.links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .5rem 0 0; font-size: .92rem; }
.notice {
  margin: .75rem 0 0;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--muted);
  border-left: 3px solid var(--rule);
  padding-left: .75rem;
}

.footer { color: var(--muted); font-size: .85rem; padding-top: .5rem; padding-bottom: 2rem; }

@media (max-width: 560px) {
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .headshot { width: 120px; height: 120px; }
  .masthead h1 { font-size: 1.8rem; }
  .card { padding: 1.25rem 1rem; }
  .entry { grid-template-columns: 1fr; gap: .25rem; }
}

/* "Show all" toggle for long lists */
.more { margin-top: .75rem; }
.more > summary {
  cursor: pointer;
  color: var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: .92rem;
  list-style: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "\25B8\00a0"; }
.more[open] > summary::before { content: "\25BE\00a0"; }
.more > summary:hover { text-decoration: underline; }
.more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.more .when-open, .more[open] .when-closed { display: none; }
.more[open] .when-open { display: inline; }
.more > .entries { margin-top: .75rem; }

/* Publication groups */
#publications h3 { margin: 1.75rem 0 .75rem; font-size: 1.05rem; color: var(--muted); }
#publications h2 + h3 { margin-top: .25rem; }
.more > .entries > li:first-child { margin-top: 0; }
