:root {
  --font: "EB Garamond", Garamond, "Adobe Garamond Pro", Georgia, serif;

  --ink: #16181d;
  --ink-soft: #4b515c;
  --ink-faint: #858b96;
  --accent: #1f3a5f;
  --accent-hover: #2f5688;
  --accent-tint: #e6ecf4;
  --paper: #f8fafc;
  --panel: #eaeef4;
  --sidebar-bg: #e6ecf4;
  --rule: #dfe4ec;
  --rule-strong: #c4ccd8;

  --sidebar-width: 300px;
  --content-max: 720px;
  --topbar-h: 54px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

:target { scroll-margin-top: calc(var(--topbar-h) + 1rem); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { color: var(--accent-hover); border-bottom-color: currentColor; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--topbar-h);
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule-strong);
}
.topbar__home {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
  border: none;
}
.topbar__links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  font-size: 1.05rem;
}
.topbar__links a { color: var(--ink-soft); border: none; }
.topbar__links a:hover { color: var(--accent); }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--rule-strong);
  padding: 2.5rem 1.75rem;
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
}

.portrait {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 14%;
  border: 3px solid var(--paper);
  outline: 1px solid var(--rule);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.10);
  margin: 0 auto 1.25rem;
}

.name {
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  margin: 0 0 0.35rem;
}

.email {
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 1.75rem;
  word-break: break-word;
}

.sidebar-block { margin-bottom: 1.6rem; }
.sidebar-block p { margin: 0 0 0.35rem; font-size: 1.02rem; line-height: 1.45; }

.sidebar-block.position { margin-bottom: 1.75rem; }
.sidebar-block.position p { margin: 0; line-height: 1.3; }

.sidebar-heading {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

.entry { margin-bottom: 0.7rem; }
.entry:last-child { margin-bottom: 0; }

.entry .entry-title { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.entry .entry-year { margin: 0; font-size: 0.9rem; line-height: 1.3; color: var(--ink-faint); }

.keywords {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.keywords li {
  font-size: 0.92rem;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 0.12rem 0.7rem;
}

.muted { color: var(--ink-faint); font-style: italic; }

.bio p { font-size: 1rem; line-height: 1.5; color: var(--ink-soft); margin: 0; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }

.cv-link { margin: 0.25rem 0 0; font-size: 1.05rem; font-weight: 600; }

.content {
  padding: 2.75rem clamp(1.5rem, 5vw, 4rem) 3rem;
  max-width: calc(var(--content-max) + 14rem);
  margin: 0 auto;
}

.section { margin-bottom: 4.5rem; }
.section:first-child { margin-top: 0.5rem; }

.section-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  margin: 0 0 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  letter-spacing: -0.01em;
}

.cards-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.card-thumb {
  display: block;
  width: 100%;
  max-width: 170px;
  height: auto;
  margin: 0 auto 0.8rem;
  background: #fff;
  padding: 4px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  filter: saturate(0.9);
}
.card-thumb--wide { max-width: 200px; }

.card {
  background: #f3f6fb;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
}

.card > :last-child { margin-top: auto; }

.card .paper-abstract summary { font-size: 1.2rem; }
.card-kicker {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.card-title { font-size: 1.4rem; font-weight: 600; margin: 0 0 0.6rem; line-height: 1.2; }
.card-body { margin: 0 0 0.6rem; color: var(--ink-soft); text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.card-body--small { font-size: 0.85rem; }
.card-note { margin: 0 0 0.6rem; font-size: 1.02rem; }
.card-links { margin: 0; }

.topic { margin-bottom: 3rem; }
.topic:last-child { margin-bottom: 0; }

.topic-title {
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 1.5rem;
  padding: 0.4rem 0.9rem;
  background: var(--accent-tint);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  line-height: 1.2;
}

.topic-papers {}

.paper {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 0 0 1.35rem 0.85rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px dotted var(--rule-strong);
}
.paper:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.paper-main { flex: 1 1 auto; min-width: 0; }
.paper-figure { flex: 0 0 170px; width: 170px; margin-top: 0.2rem; }
.paper-thumb {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  padding: 5px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(22, 24, 29, 0.06);

  filter: saturate(0.9);
  transition: filter 0.2s ease;
}

.paper-thumb:hover { filter: none; }

.figure-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--rule-strong);
  border-radius: 6px;
  background: #f3f6fb;
  color: var(--ink-faint);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
}

.paper-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}
.paper-title { font-size: 1.22rem; font-weight: 600; margin: 0; line-height: 1.25; }
.paper-meta { color: var(--ink-soft); font-style: italic; margin: 0.3rem 0 0.5rem; line-height: 1.25; }
.paper-meta.meta-plain { font-style: normal; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule-strong);
}

.tag-jmp, .tag-pub, .tag-review, .tag-wip {
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule-strong);
}

.paper-abstract { margin: 0.5rem 0 0.6rem; }
.paper-abstract summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 1rem;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
}
.paper-abstract summary::-webkit-details-marker { display: none; }
.paper-abstract summary::before { content: "▸"; font-size: 0.8rem; transition: transform 0.15s ease; }
.paper-abstract[open] summary::before { transform: rotate(90deg); }
.paper-abstract summary:hover { color: var(--accent-hover); }
.paper-abstract p {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  font-size: 1.08rem;
  padding-left: 1.15rem;
  border-left: 2px solid var(--rule);
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.paper-links { margin: 0.4rem 0 0; font-size: 1.05rem; }
.paper-links a { margin-right: 1rem; }

.paper-coverage { margin: 0.35rem 0 0; font-size: 0.98rem; color: var(--ink-faint); }
.paper-coverage a { margin: 0 0.15rem; }

.courses { display: grid; gap: 1.5rem; }
.course {
  padding-left: 0.85rem;
  border-left: 4px solid var(--rule-strong);
}
.course-title { font-size: 1.22rem; font-weight: 600; margin: 0 0 0.2rem; }
.course-meta { color: var(--ink-soft); font-style: italic; margin: 0 0 0.35rem; }
.course-links { margin: 0; font-size: 1.05rem; }

.footer {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-strong);
}
.profiles { margin: 0 0 0.6rem; display: flex; flex-wrap: wrap; gap: 1.25rem; }
.profiles a { font-size: 1.08rem; }
.copyright { margin: 0; color: var(--ink-faint); font-size: 1rem; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--rule-strong);
  }
  .cards-2 { grid-template-columns: 1fr; }
  .paper { flex-direction: column; }
  .paper-figure { flex-basis: auto; width: 100%; max-width: 260px; order: -1; }
}
