:root {
  color-scheme: light;
  --bg: #fbfbf8;
  --surface: #ffffff;
  --panel: #f4f4f0;
  --ink: #131715;
  --muted: #666d68;
  --line: #e4e7e1;
  --line-strong: #cfd5ce;
  --accent: #1f5d47;
  --header-bg: rgba(251, 251, 248, 0.94);
  --container: min(1040px, calc(100vw - 2rem));
  --radius: 12px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1412;
  --surface: #161c19;
  --panel: #1b221f;
  --ink: #f4f2ea;
  --muted: #adb6b0;
  --line: #2a332e;
  --line-strong: #435049;
  --accent: #8fd0ad;
  --header-bg: rgba(15, 20, 18, 0.92);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Public Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  transition: background-color 180ms ease, color 180ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.wrap {
  width: var(--container);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo {
  height: 26px;
  width: auto;
}

:root[data-theme="dark"] .brand-logo {
  filter: invert(1) hue-rotate(180deg) brightness(1.06);
}

.brand strong {
  font-family: "Bodoni Moda", serif;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
}

.site-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem 1rem;
}

.theme-toggle {
  appearance: none;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0.48rem 0.8rem;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.theme-toggle::before {
  content: "";
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 auto;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--line-strong);
  outline: none;
}

.theme-toggle:active {
  transform: translateY(1px);
}

.hero {
  padding: 4.75rem 0 1.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: end;
}

.eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Bodoni Moda", serif;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.55rem, 6.3vw, 4.5rem);
  max-width: 9ch;
}

.hero p {
  max-width: 42rem;
  margin: 1.2rem 0 0;
  font-size: 1.08rem;
  color: var(--muted);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin-top: 1.4rem;
  font-size: 0.96rem;
  font-weight: 600;
}

.hero-links a {
  color: var(--accent);
}

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.cta-link::after {
  content: "\2192";
  transition: transform 160ms ease;
}

.cta-link:hover,
.cta-link:focus-visible {
  border-color: var(--accent);
  background: var(--panel);
}

.cta-link:hover::after,
.cta-link:focus-visible::after {
  transform: translateX(0.2rem);
}

section {
  padding: 0;
}

section + section .wrap {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.section-head {
  max-width: 42rem;
  margin-bottom: 1.1rem;
}

.section-head p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.45rem);
}

.about-copy {
  display: grid;
  gap: 1rem;
  max-width: 48rem;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--line);
}

.about-copy p {
  margin: 0;
  color: var(--muted);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.member-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  padding: 0.85rem 0;
  background: transparent;
}

.member-photo {
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: var(--panel);
}

.member-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

.member-photo img.member-photo-top {
  object-position: center top;
}

.member-photo img.member-photo-fabio {
  transform: scale(1.05);
  transform-origin: center 38%;
}

.member-photo img.member-photo-luigi {
  object-position: center 50%;
  transform: scale(1.1);
  transform-origin: center 30%;
}

.member-copy {
  min-width: 0;
}

.member-role {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.member-copy h3 {
  font-size: 1.46rem;
}

.member-copy p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.logo-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2.25rem;
  padding: 0.7rem 0 0.95rem;
}

.logo-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.logo-card img {
  height: 48px;
  width: auto;
  max-width: none;
  opacity: 1;
  transition: filter 180ms ease;
}

.logo-card img.logo-embl-ebi {
  height: 54px;
}

.logo-card img.logo-scilifelab {
  height: 38px;
}

:root[data-theme="dark"] .logo-card img {
  filter: invert(1) hue-rotate(180deg) brightness(1.06);
}

.media-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.media-list li {
  padding: 1rem 0;
}

.media-source {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.media-list a {
  display: inline-block;
  margin-top: 0.28rem;
  font-family: "Bodoni Moda", serif;
  font-size: 1.14rem;
  letter-spacing: -0.02em;
}

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub-item {
  padding: 1rem 0;
}

.pub-title {
  display: inline-block;
  margin-top: 0.28rem;
  font-family: "Bodoni Moda", serif;
  font-size: 1.14rem;
  letter-spacing: -0.02em;
}

.pub-title:hover,
.pub-title:focus-visible {
  color: var(--accent);
}

.pub-authors,
.pub-empty {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.pub-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  transition: border-color 160ms ease, color 160ms ease;
}

.pub-links a:hover,
.pub-links a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.publication {
  max-width: 44rem;
  padding: 3rem 0 1rem;
}

.pub-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.pub-page-title {
  margin: 0.4rem 0 0.8rem;
  max-width: none;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
}

.pub-tldr {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  color: var(--muted);
}

.publication > h2,
.post h2 {
  margin: 2.6rem 0 0.8rem;
  font-size: 1.6rem;
}

.post {
  counter-reset: section;
  font-size: 1.05rem;
}

/* Numbered sections: 01, 02, ... */
.post h2::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  margin-right: 0.7rem;
  color: var(--accent);
  font-family: "Public Sans", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  vertical-align: middle;
}

.post .lead {
  margin: 1.8rem 0;
  font-family: "Bodoni Moda", serif;
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.post .stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 2.2rem 0;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.post .stats strong {
  display: block;
  font-family: "Bodoni Moda", serif;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1;
  color: var(--accent);
}

.post .stats span {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .post .stats {
    grid-template-columns: 1fr;
  }
}

.post h3 {
  margin: 1.8rem 0 0.5rem;
  font-size: 1.25rem;
}

.post a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.post video {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: #000;
}

.post img,
.post figure {
  margin: 1.8rem 0;
  border-radius: 10px;
}

.post figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
}

.post figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.post blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.post table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  font-size: 0.95rem;
}

.post th,
.post td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.post .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

.post pre,
.bibtex pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 10px;
  background: var(--panel);
  font-size: 0.85rem;
  line-height: 1.5;
}

.post :not(pre) > code {
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: var(--panel);
  font-size: 0.9em;
}

.bibtex {
  position: relative;
}

.bibtex button {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
}

.bibtex button::before {
  display: none;
}

.footer {
  padding: 3rem 0 2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .hero-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .site-header-inner {
    align-items: flex-start;
    padding: 0.9rem 0;
  }

  .site-header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    padding: 4rem 0 1.5rem;
  }

  .member-card {
    grid-template-columns: 1fr;
  }

  .member-photo {
    max-width: 9.5rem;
  }
}

/* Highlighter-style emphasis */
.post mark {
  padding: 0.05em 0.3em;
  border-radius: 4px;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Benchmark bar charts */
.post .charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.8rem 0 0.6rem;
}

.post .chart {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.post .chart h4 {
  margin: 0;
  font-family: "Bodoni Moda", serif;
  font-size: 1.15rem;
}

.post .chart p {
  margin: 0.15rem 0 0.9rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.post .bar {
  display: grid;
  grid-template-columns: 6.2rem 1fr 2.6rem;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0;
  font-size: 0.85rem;
}

.post .bar-track {
  height: 0.9rem;
  border-radius: 999px;
  background: var(--panel);
  overflow: hidden;
}

.post .bar-track i {
  display: block;
  width: calc(var(--v) * 1%);
  height: 100%;
  border-radius: 999px;
  background: var(--line-strong);
}

.post .bar.win .bar-track i {
  background: var(--accent);
}

.post .bar.win {
  font-weight: 600;
}

.post .bar b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.post .chart em {
  display: block;
  margin-top: 0.8rem;
  font-style: normal;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.post .source {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .post .charts {
    grid-template-columns: 1fr;
  }
}

/* Link icons: GitHub and arXiv */
.pub-links a[href*="github.com"]::before,
.pub-links a[href*="arxiv.org"]::before,
.post p > a[href*="github.com"]::before,
.post p > a[href*="arxiv.org"]::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.4em;
  vertical-align: -0.14em;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.pub-links a[href*="github.com"]::before,
.post p > a[href*="github.com"]::before {
  --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%200C3.58%200%200%203.58%200%208c0%203.54%202.29%206.53%205.47%207.59.4.07.55-.17.55-.38%200-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01%201.08.58%201.23.82.72%201.21%201.87.87%202.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95%200-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12%200%200%20.67-.21%202.2.82.64-.18%201.32-.27%202-.27.68%200%201.36.09%202%20.27%201.53-1.04%202.2-.82%202.2-.82.44%201.1.16%201.92.08%202.12.51.56.82%201.27.82%202.15%200%203.07-1.87%203.75-3.65%203.95.29.25.54.73.54%201.48%200%201.07-.01%201.93-.01%202.2%200%20.21.15.46.55.38A8.013%208.013%200%200016%208c0-4.42-3.58-8-8-8z%22/%3E%3C/svg%3E");
}

.pub-links a[href*="arxiv.org"]::before,
.post p > a[href*="arxiv.org"]::before {
  --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.5%22%20stroke-linejoin%3D%22round%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M3.5%201.75h6l3%203v9.5h-9z%22/%3E%3Cpath%20d%3D%22M9.5%201.75v3h3M5.5%208h5M5.5%2010.5h5%22/%3E%3C/svg%3E");
}
