:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #555555;
  --link: #1772d0;
  --link-hover: #f09228;
  --rule: #e2e2e2;
  --placeholder: #f2f4f6;
  --award: #c0392b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181b;
    --text: #e6e6e6;
    --muted: #a0a4a8;
    --link: #6aaaf0;
    --link-hover: #f5a85a;
    --rule: #2c3035;
    --placeholder: #22262b;
    --award: #f07b6e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Lato", Verdana, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--link); text-decoration: none; }
a:hover, a:focus { color: var(--link-hover); }

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---------- Header ---------- */
.header {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 32px;
  align-items: center;
  padding: 16px 0 8px;
}
.header h1 {
  font-size: 32px;
  font-weight: 400;
  margin: 0 0 6px;
}
.header .role { margin: 0 0 12px; }
.header .address { color: var(--muted); margin: 0 0 14px; }
.header .photo {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
}

.links { font-weight: 700; }
.service { margin: 14px 0 0; font-size: 14px; }
.links a { white-space: nowrap; }
.links .sep { color: var(--muted); padding: 0 6px; font-weight: 400; }

/* ---------- Sections ---------- */
h2 {
  font-size: 22px;
  font-weight: 400;
  margin: 40px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
.intro { margin: 0 0 12px; }
.full-list { color: var(--muted); }

/* ---------- Publications ---------- */
.pub {
  display: grid;
  grid-template-columns: 35% 1fr;
  gap: 24px;
  align-items: center;
  padding: 18px 0;
}
.pub + .pub { border-top: 1px solid var(--rule); }
.header > *, .pub > * { min-width: 0; }
/* Every row takes the height of the tallest publication */
.pubs {
  display: grid;
  grid-auto-rows: 1fr;
}
.pub .thumb {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pub .thumb img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 4px;
}
.award {
  margin: 0 0 4px;
  color: var(--award);
  font-weight: 700;
}
.pub .thumb .placeholder {
  aspect-ratio: 4 / 3;
  background: var(--placeholder);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}
.pub h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}
.pub .authors { margin: 0; }
.pub .authors strong { font-weight: 700; }
.pub .venue { margin: 0 0 4px; }
.pub .venue em { font-style: italic; }
.pub .pub-links { margin: 0 0 8px; }
.pub .desc { margin: 0; color: var(--muted); }

.earlier { padding-left: 20px; margin: 8px 0 0; }
.earlier li { margin-bottom: 8px; }

.footer {
  margin-top: 48px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  .header {
    grid-template-columns: 1fr;
    gap: 16px;
    text-align: center;
  }
  .header .photo { order: -1; margin: 0 auto; width: 140px; height: 140px; }
  .pubs { grid-auto-rows: auto; }
  .pub { grid-template-columns: 1fr; gap: 12px; }
}
