:root {
  --content-width: 980px;
  --content-gutter: 2rem;
  --bg: #f5f2ec;
  --surface: #edeae2;
  --ink: #1a1916;
  --ink-mute: #6b6760;
  --accent: #2d4a3e;
  --accent2: #8b3a2a;
  --rule: #c9c5bb;
  --nav-bg: rgba(245, 242, 236, 0.9);
  --bg-glow-1: rgba(45, 74, 62, 0.08);
  --bg-glow-2: rgba(139, 58, 42, 0.06);
  --dot: rgba(131, 123, 110, 0.24);
  --serif: "DM Mono", monospace;
  --mono: "DM Mono", monospace;
  --sans: "DM Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #121411;
  --surface: #1a1f1b;
  --ink: #ece7dd;
  --ink-mute: #b8b2a6;
  --accent: #9fc8b2;
  --accent2: #d6a089;
  --rule: #343a34;
  --nav-bg: rgba(18, 20, 17, 0.88);
  --bg-glow-1: rgba(159, 200, 178, 0.09);
  --bg-glow-2: rgba(214, 160, 137, 0.07);
  --dot: rgba(190, 184, 171, 0.15);
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.8;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(circle, var(--dot) 0.9px, transparent 0.9px);
  background-size: 24px 24px;
}

main {
  flex: 1 0 auto;
}

body::before {
  content: "";
  position: fixed;
  inset: -20vh -20vw;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40rem 40rem at calc(20% + var(--mx, 0px)) calc(15% + var(--sy, 0px)), var(--bg-glow-1), transparent 72%),
    radial-gradient(36rem 36rem at calc(85% - var(--mx, 0px)) calc(72% - var(--sy, 0px)), var(--bg-glow-2), transparent 72%);
}

.site-wrapper {
  width: min(var(--content-width), calc(100% - (2 * var(--content-gutter))));
  margin: 0 auto;
  padding: 0;
}
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  background-image: radial-gradient(circle, var(--dot) 0.9px, transparent 0.9px);
  background-size: 24px 24px;
}
.nav-inner {
  width: min(var(--content-width), calc(100% - (2 * var(--content-gutter))));
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 54px;
}
.nav-logo {
  color: var(--ink-mute);
  text-decoration: none;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}
.nav-logo svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-logo:hover { color: var(--accent); }
.nav-links { display: flex; gap: 1.25rem; list-style: none; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.nav-links a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

.theme-toggle {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-mute);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 14px;
  padding: 0;
  cursor: pointer;
}

.theme-toggle-label {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.theme-toggle-label svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms ease, opacity 180ms ease;
}

.theme-toggle.is-animating .theme-toggle-label svg {
  transform: rotate(20deg) scale(0.94);
  opacity: 0.9;
}

#hero { padding: 5rem 0 3.2rem; display: grid; grid-template-columns: 1fr auto; gap: 2.4rem; align-items: start; }
#hero.hero-no-tagline { padding-bottom: 0.5rem; }
.hero-eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem; }
.hero-name { font-family: var(--serif); font-size: clamp(3rem, 6vw, 5rem); font-weight: 300; line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 1.2rem; }
#hero.hero-no-tagline .hero-name { margin-bottom: 0; }
.hero-name em { font-style: italic; color: var(--accent2); }
.hero-tagline { font-size: 15px; color: var(--ink-mute); max-width: 680px; line-height: 1.75; margin-bottom: 0.4rem; }
.hero-links { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.hero-photo { width: 160px; height: 160px; border-radius: 50%; border: 1px solid var(--rule); object-fit: cover; object-position: center; background: var(--surface); }

.btn { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; padding: 0.5rem 1rem; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1e3329; }
.btn-ghost { border: 1px solid var(--rule); color: var(--ink-mute); }
.btn-ghost:hover { border-color: var(--ink-mute); color: var(--ink); }

section, .page-header { padding: 2.4rem 0; border-top: none; }
.page-header { padding-bottom: 0.35rem; }
.page-header + section { padding-top: 0.15rem; }
.section-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.page-header .section-header::before { content: ""; width: 2.6rem; flex: 0 0 2.6rem; }
.section-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.section-title { font-family: var(--serif); font-size: 2rem; font-weight: 300; line-height: 1.1; }
.section-rule { flex: 1; height: 1px; background: var(--rule); }
.section-subtitle { color: var(--ink-mute); }

.about-body {
  display: grid;
  grid-template-columns: 1fr minmax(160px, max-content);
  gap: 3rem;
  align-items: start;
}
.about-text p { margin-bottom: 1rem; color: var(--ink-mute); }
.about-sidebar {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 1.2rem 1.4rem;
  width: fit-content;
  justify-self: end;
}
.sidebar-heading {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.8rem;
}
.sidebar-list { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.sidebar-list li { font-size: 13px; color: var(--ink-mute); }

.card-grid { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.card { background: var(--bg); padding: 1.25rem 1.4rem; }
.card:hover { background: var(--surface); }
.card-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 0.35rem; }
.card-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 400; margin-bottom: 0.35rem; }
.card-desc { font-size: 13.5px; color: var(--ink-mute); }

.list-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 0.9rem; align-items: start; border-bottom: none; padding-bottom: 0.85rem; position: relative; }
.list-item--group-start:first-child { padding-top: 0; }
.list-item--group-start:not(:first-child) { border-top: 1px solid var(--rule); padding-top: 0.85rem; }
.list-item--group-cont::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(72px + 0.9rem);
  right: 0;
  height: 1px;
  background: var(--rule);
}
.list-item--group-cont .list-body,
.list-item--group-cont .list-actions { padding-top: 0.85rem; }
.list-year { font-family: var(--mono); font-size: 11px; color: var(--accent); line-height: 1.35; padding-top: 0.15rem; }
.list-title { font-family: var(--serif); font-size: 1.08rem; margin-bottom: 0.15rem; line-height: 1.25; }
.list-meta { font-size: 13px; color: var(--ink-mute); }
.list-meta strong.pub-author-highlight {
  font-weight: 400;
  color: var(--ink);
}
.list-links { display: flex; gap: 0.6rem; margin-top: 0.45rem; flex-wrap: wrap; }
.list-actions {
  display: grid;
  grid-auto-rows: 24px;
  row-gap: 8px;
  align-content: center;
  justify-items: end;
  min-width: 92px;
  align-self: start;
}
.list-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 24px;
  padding: 0 0.5rem;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent2);
  text-decoration: none;
  background: var(--surface);
}
.list-link:hover { border-color: var(--accent2); }
.section-actions { margin-top: 1.1rem; }

.cv-download {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  margin-bottom: 1.1rem;
}

.cv-download p {
  color: var(--ink-mute);
  font-size: 13px;
  margin: 0;
}

.cv-download .list-links {
  margin-top: 0;
}

.cv-group-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 1rem 0 0.2rem;
}

/* Homepage selected lists: denser than full lists */
.list-block-compact .list-item {
  padding-bottom: 0.68rem;
}
.list-block-compact .list-item--group-start:not(:first-child) {
  padding-top: 0.68rem;
}
.list-block-compact .list-item--group-cont .list-body,
.list-block-compact .list-item--group-cont .list-actions { padding-top: 0.68rem; }

.list-block-compact .list-title {
  font-size: 1.02rem;
}

.list-block-compact .list-meta {
  font-size: 12.5px;
}

.list-block-compact .list-links {
  margin-top: 0.35rem;
}

footer { border-top: 1px solid var(--rule); padding: 1.2rem 0 1.8rem; margin-top: 0.6rem; }
.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem 1rem;
}
.footer-copy { justify-self: start; text-align: left; }
.footer-links {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
.footer-updated { justify-self: end; text-align: right; }
.footer-copy, .footer-updated, .footer-links a { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 720px) {
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .footer-copy,
  .footer-updated {
    justify-self: center;
    text-align: center;
  }
}

@media (max-width: 760px) {
  .nav-inner { flex-wrap: wrap; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .nav-links { width: 100%; order: 3; }
}
@media (max-width: 640px) {
  #hero { grid-template-columns: 1fr; gap: 1.2rem; }
  .hero-photo { display: none; }
  .about-body { grid-template-columns: 1fr; }
  .list-item { grid-template-columns: 1fr; gap: 0.2rem; }
  .list-actions { justify-items: start; padding-top: 0; }
  :root { --content-gutter: 1.1rem; }
}
