:root {
  --paper: #f6f7f9;
  --ink: #18212b;
  --muted: #5a6573;
  --rule: #d9dee4;
  --accent: #24527a;
  --code-bg: #eceff3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171d;
    --ink: #e6eaef;
    --muted: #9aa5b1;
    --rule: #2a323c;
    --accent: #8bb6dd;
    --code-bg: #1b222a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }
main.wrap { padding-top: 3rem; padding-bottom: 3rem; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, .pub-title, .year-num { font-family: "Spectral", Georgia, "Times New Roman", serif; }
h1 { font-size: 2.6rem; line-height: 1.15; font-weight: 500; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; font-weight: 500; margin: 2.5rem 0 1rem; }

/* Header and navigation */
.site-header { border-bottom: 1px solid var(--rule); }
.nav { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 1rem; padding-bottom: 1rem; }
.nav-home { font-family: "Spectral", Georgia, serif; font-size: 1.15rem; font-weight: 500; color: var(--ink); text-decoration: none; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; list-style: none; margin: 0; padding: 0; font-size: 0.95rem; font-weight: 500; }
.nav-links a { color: var(--muted); text-decoration: none; padding-bottom: 0.2rem; }
.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--accent); }

/* Placeholder text: still to be filled in */
.ph { color: var(--muted); font-style: italic; background: var(--code-bg); border-radius: 3px; padding: 0 0.3em; }
p.ph { padding: 0.35rem 0.6rem; }

/* Home */
.intro { display: flex; gap: 2rem; align-items: center; justify-content: space-between; padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }
.portrait { flex: none; width: 8.5rem; height: 8.5rem; border-radius: 50%; object-fit: cover; }
.portrait-ph { display: grid; place-items: center; background: var(--code-bg); border: 1px dashed var(--rule); color: var(--muted); font-size: 0.85rem; }
.news { list-style: none; margin: 0; padding: 0; }
.news li { margin-bottom: 0.6rem; }
.news-date { display: inline-block; min-width: 6.5rem; color: var(--muted); font-size: 0.95rem; }
.more { margin: 1.25rem 0 0; font-weight: 500; }

/* Two-column pages (home, publications): content left, sidebar right */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; grid-template-areas: "main side"; gap: 1rem 3.5rem; align-items: start; margin-top: 1.5rem; }
.page-main { grid-area: main; }
.page-side { grid-area: side; display: grid; gap: 2.25rem; }
.side-box h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.page-main > section:first-child > h2 { margin-top: 0; }
.intro + .page-grid { margin-top: 2.5rem; }
.page-side .news li { margin-bottom: 0.9rem; font-size: 0.95rem; line-height: 1.5; }
.page-side .news-date { display: block; min-width: 0; font-size: 0.85rem; margin-bottom: 0.1rem; }

/* Publications page */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.profile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.profile { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
a.profile:hover { border-color: var(--accent); color: var(--accent); }
.profile-empty { color: var(--muted); border-style: dashed; cursor: help; }
/* Brand logos (Simple Icons) in brand colours */
.profile-icon { flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; }
.profile-logo { width: 100%; height: 100%; }
.profile-orcid { color: #a6ce39; }
.profile-scholar { color: #4285f4; }
.profile-semantic_scholar { color: #1857b6; }
.profile-dblp { color: #004f9f; }
@media (prefers-color-scheme: dark) {
  .profile-semantic_scholar { color: #6f9be0; }
  .profile-dblp { color: #5b8fd0; }
}
.profile-empty .profile-icon { opacity: 0.55; }

.pub-filter { width: 100%; max-width: 22rem; padding: 0.6rem 0.8rem; font: inherit; font-size: 0.95rem; color: var(--ink); background: transparent; border: 1px solid var(--muted); border-radius: 6px; }
.pub-filter:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.filter-empty { color: var(--muted); margin: 1.5rem 0 0; }
.pub-year { border-top: 1px solid var(--rule); margin-top: 1.75rem; }
.pub-year-num { margin: 0.5rem 0 0.75rem; text-align: right; font-size: 2rem; font-weight: 400; color: var(--muted); font-variant-numeric: oldstyle-nums; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.75rem; }
.pub-badge-col { padding-top: 0.2rem; }
.pub-badge { display: block; text-align: center; padding: 0.15rem 0.4rem; border-radius: 3px; background: var(--accent); color: var(--paper); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.pub-body { display: flex; flex-direction: column; gap: 0.15rem; }
.pub-body .pub-authors { font-size: 0.95rem; }
.pub-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.pub-btn { font: inherit; font-size: 0.78rem; font-weight: 500; line-height: 1; padding: 0.4rem 0.7rem; border: 1px solid var(--muted); border-radius: 3px; background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; }
.pub-btn:hover, .pub-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.pub-panel { margin-top: 0.75rem; }
.pub-panel p { margin: 0; font-size: 0.95rem; line-height: 1.6; }
.pub-panel .bibtex { margin: 0; }

/* CV and teaching */
.cv-item { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; margin-bottom: 1rem; }
.cv-item p { margin: 0; }
.cv-when { color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; align-self: start; }
.cv-what { font-weight: 500; }
.cv-detail { color: var(--muted); font-size: 0.95rem; }
.lede { color: var(--muted); max-width: 36rem; margin: 0 0 1rem; }
.profiles { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin: 0; font-weight: 500; }

.year {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
.year:first-of-type { border-top: 0; }
.year-num {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: oldstyle-nums;
}
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 1.5rem; }
.pubs li:last-child { margin-bottom: 0; }
.pub-title { font-size: 1.2rem; line-height: 1.35; font-weight: 500; color: var(--ink); text-decoration: none; }
.pub-title:hover { color: var(--accent); text-decoration: underline; }
.pub-authors, .pub-venue { color: var(--muted); font-size: 0.95rem; }
.pub-venue { font-style: italic; }
.pub-links { display: flex; gap: 1rem; font-size: 0.9rem; font-weight: 500; margin-top: 0.2rem; }
.me { color: var(--ink); font-weight: 600; }

/* Paper page: compact, so the whole abstract is visible without scrolling
   (Google Scholar inclusion guideline). */
main.layout-paper { padding-top: 1.75rem; }
.back { margin: 0 0 1.25rem; font-size: 0.95rem; }
.paper h1 { font-size: 1.9rem; }
.paper h2 { margin: 1.5rem 0 0.5rem; }
.authors { margin: 0; }
.venue { margin: 0.25rem 0 1rem; color: var(--muted); font-style: italic; }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-weight: 500; margin: 0; }
.abstract { font-family: "Spectral", Georgia, serif; font-size: 1.05rem; line-height: 1.6; margin: 0; }
.bibtex {
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.notice { margin-top: 3rem; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }

.footer { padding-bottom: 3rem; color: var(--muted); font-size: 0.875rem; }
.footer p { border-top: 1px solid var(--rule); padding-top: 1.25rem; margin: 0; }

@media (max-width: 52rem) {
  .page-grid { grid-template-columns: 1fr; grid-template-areas: "main" "side"; gap: 2.5rem; }
  .profile-list { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
}

@media (max-width: 34rem) {
  main.wrap { padding-top: 2.5rem; }
  h1 { font-size: 2.1rem; }
  .paper h1 { font-size: 1.7rem; }
  .year { grid-template-columns: 1fr; gap: 0.75rem; }
  .intro { flex-direction: column-reverse; align-items: flex-start; gap: 1.25rem; }
  .portrait { width: 6rem; height: 6rem; }
  .cv-item { grid-template-columns: 1fr; gap: 0.1rem; }
  .pub { grid-template-columns: 1fr; gap: 0.4rem; }
  .pub-badge { display: inline-block; }
}
