/* Colours. To restyle the site, this is the block to change. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #211e1a;
  --muted: #625c54;
  --rule: #e4dfd6;
  --accent: #2c6a4f;
  --body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --display: var(--body);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171513;
    --ink: #ece7df;
    --muted: #a69e93;
    --rule: #322e29;
    --accent: #8fd0ad;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171513;
  --ink: #ece7df;
  --muted: #a69e93;
  --rule: #322e29;
  --accent: #8fd0ad;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: .18em;
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

p { margin: 0 0 1em; }
ul, ol { list-style: none; margin: 0; padding: 0; }
strong, b { font-weight: 600; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 1; background: var(--bg); padding: .25rem .5rem; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.topbar-links {
  display: flex;
  justify-content: flex-end;
  gap: 1.75rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: .85rem 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-links::-webkit-scrollbar { display: none; }
.topbar a {
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
}
.topbar a:hover { color: var(--ink); }
.topbar a[aria-current] {
  color: var(--accent);
  font-weight: 600;
}

/* Layout: fixed profile column beside a readable text column. */
.page {
  display: grid;
  grid-template-columns: 15rem minmax(0, 42rem);
  gap: clamp(3rem, 7vw, 6rem);
  justify-content: center;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) 2rem 3rem;
}

/* Profile */
.profile {
  position: sticky;
  top: 5.5rem;
  align-self: start;
}

.portrait {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; }

h1 {
  margin: 0 0 .35rem;
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.contact {
  margin-top: .85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .85rem;
}
.contact a {
  display: flex;
  align-items: center;
  min-height: 1.75rem;
  color: var(--ink);
  text-decoration: none;
}
.contact a:hover { color: var(--accent); }
.contact svg { display: block; width: 1.3rem; height: 1.3rem; }
.contact .cv { font-family: var(--display); font-weight: 600; font-size: 1rem; }

address {
  margin-top: 1rem;
  color: var(--muted);
  font-size: .9rem;
  font-style: normal;
  line-height: 1.4;
}

.theme {
  margin-top: 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.theme:hover { color: var(--ink); }

/* Main column */
section { margin-bottom: 3.5rem; scroll-margin-top: 5rem; }

h2 {
  margin: 0 0 1.25rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.15rem;
  letter-spacing: -.01em;
}

/* News and dated entries share one date column. */
.news li, .entries li {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: .75rem;
}
.news time, .when {
  color: var(--muted);
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: .05em;
}

.news-toggle {
  display: block;
  margin-top: 1.25rem;
  padding: .35rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
}
.news-toggle:hover { border-color: var(--muted); }
.news-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* Publications */
.pub {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  column-gap: 1rem;
  margin-bottom: 1.75rem;
}
.pub:last-child { margin-bottom: 0; }
.pub[hidden] { display: none; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.5rem;
}
.filters button {
  padding: .15rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}
.filters button:hover { color: var(--ink); border-color: var(--muted); }
.filters button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.venue {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.35;
  padding-top: .1em;
}

h3 {
  margin: 0 0 .25rem;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: -.01em;
}

.authors { margin: 0 0 .25rem; color: var(--muted); font-size: 1rem; line-height: 1.45; }
.authors b { color: var(--ink); }

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 .6rem;
  font-size: .95rem;
}
.pub-links summary {
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.pub-links summary::-webkit-details-marker { display: none; }
.pub-links summary:hover { text-decoration: underline; text-underline-offset: .18em; }
.pub > div, .pub-links details { min-width: 0; }
.pub-links details[open] { flex-basis: 100%; }
.pub-links pre {
  max-width: 100%;
  margin: .4rem 0 0;
  padding: .75rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: .78rem;
  line-height: 1.45;
}

footer { color: var(--muted); font-size: .875rem; }

.load-error { color: var(--accent); font-weight: 600; }

/* Narrow screens: the profile becomes a compact header. */
@media (max-width: 820px) {
  .topbar-links {
    justify-content: flex-start;
    gap: 1.25rem;
    padding: .7rem 1rem;
  }
  .page {
    display: block;
    padding: 1.5rem 1rem 2rem;
  }
  .profile {
    position: static;
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    column-gap: 1rem;
    align-items: center;
    margin-bottom: 2.25rem;
  }
  .portrait {
    margin: 0;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: 50% 15%;
    border-radius: 50%;
  }
  h1 { font-size: 1.5rem; }
  .contact, address, .theme { grid-column: 1 / -1; }
  .contact { margin-top: 1rem; }
  address { margin-top: .6rem; }
  .theme { justify-self: start; margin-top: .5rem; }
  section { margin-bottom: 2.75rem; }
  .news li, .entries li { grid-template-columns: 5.75rem minmax(0, 1fr); gap: .6rem; }
  .pub { display: block; }
  .venue { margin-bottom: .15rem; }
}

.blog-page {
  max-width: 42rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) 1rem 3rem;
}
.blog-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(2rem, 6vw, 3.5rem);
}
.blog-header .theme { margin: 0; }
.blog-home { color: var(--ink); font-weight: 600; font-size: 1.1rem; }
.blog-title {
  margin: 0 0 1.25rem;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.blog-empty { color: var(--muted); }
.blog-back { display: inline-block; margin-bottom: 1.5rem; font-size: .95rem; }
.post-link { font-weight: 500; }
.post-summary { margin: .15rem 0 0; color: var(--muted); font-size: .95rem; }
.post > time,
.post-meta { display: block; margin: -.75rem 0 1.75rem; color: var(--muted); font-size: .95rem; }
.post-body { overflow-wrap: break-word; }
.post-body h2 { border: 0; margin: 2rem 0 .75rem; padding: 0; font-size: 1.3rem; }
.post-body h3 { margin: 1.5rem 0 .5rem; font-size: 1.1rem; font-weight: 600; }
.post-body ul, .post-body ol { margin: 0 0 1em; padding-left: 1.4rem; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body a { text-decoration-color: currentColor; }
.post-body img { display: block; max-width: 100%; height: auto; margin: 1.25rem 0; border-radius: 4px; }
.post-body blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}
.post-body code { font-size: .88em; }
.post-body figure { margin: 1.75rem 0; }
.post-body figure img { margin: 0; width: 100%; border-radius: 6px; }
.post-body figcaption { margin-top: .5rem; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.post-body figure.omics-icon { margin: .5rem 0 1.25rem; }
.post-body figure.omics-icon img { max-width: 560px; }
/* Figures are transparent with dark labels; give them a light card in dark mode. */
:root[data-theme="dark"] .post-body figure img { background: #fbfaf7; padding: .5rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .post-body figure img { background: #fbfaf7; padding: .5rem; }
}
.post-body pre {
  max-width: 100%;
  overflow-x: auto;
  padding: .75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: .85rem;
  line-height: 1.45;
}

@media print {
  .topbar, .theme, .skip { display: none; }
  .profile { position: static; }
}
