/* ---------- Tokens ---------- */
:root {
  --bg: #F4F1EA;
  --bg-alt: #EDE8DD;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --ink-mute: #8A857B;
  --rule: #C9C2B2;
  --accent: #D9C36B;
  --accent-soft: #F2E9B8;
  --cream: #F4F1EA;
  --dark: #141311;
  --dark-soft: #262420;
  --sage: #D8DDC8;
  --sage-deep: #B9C1A2;
  --butter: #E8E0B8;
  --butter-deep: #D4C78A;
  --pink: #EFD9CF;
  --max: 960px;
  --pad: clamp(24px, 6vw, 96px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); transition: border-color .2s, color .2s; }
a:hover { border-color: var(--ink); }

p { margin: 0 0 1em; }
em { font-style: italic; color: var(--ink-soft); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 22px var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(1.2);
}
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark .name {
  font-size: 26px; font-weight: 600; letter-spacing: -0.01em; line-height: 1;
}
.wordmark .est {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--ink-mute); letter-spacing: 0.08em;
  text-transform: uppercase; padding-bottom: 2px;
}
.nav { display: flex; gap: 28px; }
.nav a {
  border-bottom: none;
  font-size: 13px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-soft);
  position: relative; padding-bottom: 2px;
}
.nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left;
  transition: transform .3s ease;
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); }

/* ---------- Sections ---------- */
main { width: 100%; }

.section {
  padding: 96px var(--pad) 112px;
  border-bottom: 1px solid var(--rule);
  min-height: 100vh;
  scroll-margin-top: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.section:last-of-type { border-bottom: none; }
.section > .section-head { width: 100%; }
.section > .section-body { width: 100%; }
.section > .section-head,
.section > .section-body {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}

/* Tone variants — Williams-style full-width color blocks */
.tone-cream { background: var(--cream); color: var(--ink); }
.tone-sage { background: var(--sage); color: var(--ink); }
.tone-butter { background: var(--butter); color: var(--ink); }

.tone-dark {
  background: var(--dark);
  color: #EDE7D9;
  border-bottom-color: #2A2824;
}
.tone-dark .section-head .label { color: #EDE7D9; }
.tone-dark .section-head,
.tone-dark .subhead { color: #9E9787; border-color: #3A3631; }
.tone-dark .lede { color: #F4EEDE; }
.tone-dark a { color: #EDE7D9; border-color: #4A453D; }
.tone-dark a:hover { border-color: #EDE7D9; }
.tone-dark .meta-row { border-color: #3A3631; color: #C9C2B2; }
.tone-dark .meta-row span:first-child { color: #807970; }
.tone-dark .meta-row span:last-child { color: #EDE7D9; }
.tone-dark .pub { border-color: #3A3631; }
.tone-dark .pub:last-child { border-color: #3A3631; }
.tone-dark .pub-meta { color: #BDB5A6; }
.tone-dark .pub-meta strong { color: #F4EEDE; }
.tone-dark .pub-links a { color: #9E9787; }
.tone-dark .pub-links a:hover { color: #EDE7D9; }
.tone-dark .pub-status { background: var(--butter); color: var(--dark); }
.tone-dark .talks li, .tone-dark .timeline li { border-color: #3A3631; }
.tone-dark em, .tone-dark .note, .tone-dark .soft { color: #BDB5A6; }
.tone-dark .tags li { background: #262420; border-color: #3A3631; color: #C9C2B2; }
.tone-dark .yr { color: #9E9787; }

.tone-sage .pub-status { background: #F4F1EA; }
.tone-sage .meta-row, .tone-sage .pub, .tone-sage .talks li, .tone-sage .timeline li, .tone-sage .subhead {
  border-color: #A9B293;
}
.tone-sage .btn { background: var(--dark); color: var(--sage); }

.tone-butter .pub-status { background: #F4F1EA; }
.tone-butter .meta-row, .tone-butter .subhead {
  border-color: #D4C06A;
}

.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 56px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute);
}
.section-head .label { color: var(--ink); }

.section-body { max-width: 100%; }

.two-col {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; gap: 32px; }
}

/* ---------- Portrait ---------- */
.about-grid { grid-template-columns: 320px 1fr; }
@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }
.portrait-col { display: flex; flex-direction: column; gap: 24px; }
.portrait {
  margin: 0;
  overflow: hidden;
  background: var(--bg-alt);
  aspect-ratio: 3 / 4;
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.95);
  transition: transform .6s ease;
}
.portrait:hover img { transform: scale(1.03); }
.portrait { position: relative; }
.portrait-mark {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--butter);
  color: var(--dark);
  font-size: 18px;
  border-radius: 2px;
  box-shadow: 0 4px 18px rgba(0,0,0,.15);
}

/* ---------- Contact block ---------- */
.contact-block {
  display: block;
}
#contact { padding-top: 120px; padding-bottom: 140px; }
#contact .section-head { margin-bottom: 72px; }
.contact-card {
  position: relative;
  background: transparent;
  color: var(--ink);
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
@media (max-width: 720px) {
  .contact-card { grid-template-columns: 1fr; gap: 32px; }
}
.contact-intro { display: flex; flex-direction: column; gap: 10px; }
.card-asterisk {
  position: absolute;
  top: 24px; right: 28px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--butter);
  color: var(--dark);
  font-size: 22px;
  border-radius: 2px;
}
.contact-lede {
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.contact-sub {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 420px;
  line-height: 1.55;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  padding-left: clamp(24px, 4vw, 48px);
  border-left: 1px solid var(--rule);
}
@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; padding-left: 0; border-left: none; padding-top: 24px; border-top: 1px solid var(--rule); }
}
@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; gap: 24px; }
}
.contact-grid > div { display: flex; flex-direction: column; gap: 8px; }
.contact-k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute);
}
.contact-v { font-size: 17px; color: var(--ink); line-height: 1.5; }
.contact-grid a {
  font-size: 17px; color: var(--ink);
  border-bottom: 1px solid var(--rule);
  width: fit-content;
}
.contact-grid a:hover { border-color: var(--ink); }
.contact-links { display: flex; flex-wrap: nowrap; gap: 18px; }
.contact-links a { font-size: 16px; }


/* ---------- Meta list ---------- */
.meta { display: flex; flex-direction: column; gap: 14px; }
.meta-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
}
.meta-row span:first-child { color: var(--ink-mute); }
.meta-row span:last-child { color: var(--ink); text-align: right; }

/* ---------- Intro ---------- */
.intro { max-width: 680px; }
.lede {
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 28px;
}

.subhead {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute);
  margin: 48px 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

/* ---------- Tags ---------- */
.tags { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: 12px; letter-spacing: 0.02em;
  padding: 6px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-soft);
}

/* ---------- Publications ---------- */
.pub-group { margin-bottom: 32px; }
.pub-status {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink);
  background: var(--accent-soft);
  padding: 3px 10px;
  margin-bottom: 14px;
}
.pub {
  padding: 18px 0;
  border-top: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 1px solid var(--rule); }
.pub-title {
  font-size: 16px; font-weight: 500; line-height: 1.4;
  margin: 0 0 6px;
}
.pub-meta {
  font-size: 13px; color: var(--ink-soft); margin: 0 0 4px;
}
.pub-meta strong { color: var(--ink); font-weight: 600; }
.pub-links { margin: 6px 0 0; font-size: 12px; }
.pub-links a {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-right: 12px; border-bottom: none; color: var(--ink-mute);
}
.pub-links a:hover { color: var(--ink); }
.note { color: var(--ink-mute); font-size: 12px; }

/* ---------- Talks / Timeline ---------- */
.talks, .timeline {
  list-style: none; padding: 0; margin: 0;
}
.talks li, .timeline li {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  font-size: 14px;
}
.talks li:last-child, .timeline li:last-child { border-bottom: 1px solid var(--rule); }
.yr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-mute); padding-top: 2px;
}

/* ---------- CV center ---------- */
#cv .intro { margin: 0 auto; }

/* ---------- PDF embed ---------- */
.pdf-frame {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 860px;
  border: 1px solid var(--rule);
  background: #fff;
  overflow: hidden;
  margin: 20px 0 8px;
}
.pdf-frame iframe {
  width: 100%; height: 100%;
  border: 0; display: block;
}
@media (max-width: 720px) {
  .pdf-frame { aspect-ratio: 2 / 3; }
}

/* ---------- CV button ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background .2s;
}
.btn:hover { background: var(--ink-soft); color: var(--bg); }
.soft { color: var(--ink-soft); }

/* ---------- Contact links ---------- */
.links-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 24px; }
.links-row a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.links-row a:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max); margin: 0 auto;
  display: flex; justify-content: space-between;
  padding: 32px var(--pad);
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------- Section reveal animation ---------- */
.section-head, .section-body {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s ease, transform .9s ease;
}
.section.in-view .section-head,
.section.in-view .section-body {
  opacity: 1;
  transform: translateY(0);
}
.section.in-view .section-body { transition-delay: .15s; }

@media (prefers-reduced-motion: reduce) {
  .section-head, .section-body { opacity: 1; transform: none; transition: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .nav { gap: 18px; flex-wrap: wrap; }
  .section { padding: 60px 0 72px; min-height: auto; }
  .talks li, .timeline li { grid-template-columns: 60px 1fr; gap: 12px; }
}
