/* Palette, type and spacing. Edit these first. */
:root {
  --bg: #ffffff;
  --text: #1f1e1c;
  --muted: #6c6862;
  --faint: #9a958e;
  --border: #ebe7e2;
  --surface: #f6f4f1;
  --accent: #ad4f2b;
  --accent-soft: color-mix(in srgb, var(--accent) 40%, transparent);
  --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --page: 880px;
  --label-col: 140px;
  --col-gap: 36px;
}

* { box-sizing: border-box; }

::selection { background: rgba(173, 79, 43, 0.18); }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

main {
  width: min(100%, var(--page));
  margin: 0 auto;
  padding: 88px 28px 72px;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.2;
}

/* Intro: bio on the left, portrait on the right */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  grid-template-areas: "bio photo";
  gap: 56px;
  align-items: start;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}

.intro-bio { grid-area: bio; }
.intro-photo {
  grid-area: photo;
  padding-top: 28px;
}

.name {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.kicker {
  margin: 2px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}

.intro-copy {
  max-width: 600px;
  margin: 18px 0 0;
  color: var(--muted);
}

.intro-copy:first-of-type { margin-top: 22px; }

.portrait {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

.social-links {
  display: flex;
  gap: 4px;
  margin: 22px 0 0 -7px;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  border-radius: 8px;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.social-links a:hover {
  color: var(--accent);
  background: var(--surface);
  transform: translateY(-1px);
}

.social-links svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: currentColor;
}

/* Sections: label column + body */

section {
  display: grid;
  grid-template-columns: var(--label-col) minmax(0, 1fr);
  gap: var(--col-gap);
  padding: 44px 0;
  border-bottom: 1px solid var(--border);
}

h2 {
  padding-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.section-body { min-width: 0; }

.note {
  margin-top: 20px;
  color: var(--faint);
  font-size: 0.8rem;
}

/* Publications */

.pub-list {
  display: grid;
  gap: 22px;
}

.pub {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
}

.pub-year {
  padding-top: 2px;
  color: var(--faint);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.pub-title {
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.pub-title a { text-decoration: none; }

.pub-authors,
.pub-venue {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.pub-authors .me {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.pub-venue { margin-top: 3px; }

.venue-strong {
  color: var(--text);
  font-weight: 500;
}

.pub-link {
  color: var(--accent);
  text-decoration: none;
}

.pub-link::before {
  content: "\00b7";
  margin: 0 8px;
  color: var(--faint);
}

.pub-link:hover { text-decoration: underline; }

/* Footer */

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-top: 28px;
  color: var(--faint);
  font-size: 0.8rem;
}

.site-footer p { margin: 0; }

.doodle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.doodle svg {
  display: block;
  flex: 0 0 auto;
}

/* Back to top */

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--muted);
  background: color-mix(in srgb, #fff 55%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.15s, border-color 0.15s;
}

.to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.to-top:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Tablet: keep photo on the right, just narrower */

@media (max-width: 860px) {
  .intro {
    grid-template-columns: minmax(0, 1fr) 168px;
    gap: 40px;
  }
}

/* Phone: photo on top, sections stack */

@media (max-width: 640px) {
  main { padding: 48px 22px 64px; }

  .intro {
    grid-template-columns: 1fr;
    grid-template-areas: "photo" "bio";
    gap: 24px;
    padding-bottom: 40px;
  }

  .intro-photo { padding-top: 0; }

  .portrait { width: 132px; }

  section {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 36px 0;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .pub-year:empty { display: none; }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
