/* bsaverio.ethz.ch – one small stylesheet, system fonts, no external resources.
   Colours meet WCAG 2.2 AA contrast in both light and dark mode. */

:root {
  --bg: #ffffff;
  --text: #1d1f23;
  --muted: #545a63;      /* 7.0:1 on --bg */
  --link: #1f57a6;       /* ETH blue, 6.6:1 on --bg */
  --link-visited: #6a3d9a;
  --accent: #1f57a6;
  --rule: #d9dce1;
  --surface: #f2f5f9;    /* light blue-grey tint for cards and footer */
  --surface-strong: #e3eaf3;
  --new: #0b6b35;
  --working: #8a4b00;
  --new-bg: #edf7f0;
  --working-bg: #fcf3e6;
  --focus: #b8860b;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
  --measure: 60rem;
  font-size: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --text: #e7e9ec;
    --muted: #aab1bb;
    --link: #8db5ff;
    --link-visited: #c4a6ff;
    --accent: #6f9ef0;
    --rule: #3a3f46;
    --surface: #1d2229;
    --surface-strong: #27303b;
    --new: #6fd69a;
    --working: #f2b766;
    --new-bg: #17271e;
    --working-bg: #2a2216;
    --focus: #ffd34d;
    --shadow: none;
  }
  img:not(.photo):not(.logo) { filter: brightness(0.92); }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1 0 auto; width: 100%; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1rem; }

a { color: var(--link); text-underline-offset: 0.15em; overflow-wrap: anywhere; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 2.25rem 0 0.75rem; }
h1 { font-size: 2rem; margin-top: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; }
h2::after { content: ""; display: block; width: 2.5rem; height: 3px; margin-top: 0.4rem; background: var(--accent); border-radius: 2px; }
h3 { font-size: 1.15rem; }

img { max-width: 100%; height: auto; }
main img { display: block; margin: 1rem 0; border-radius: 6px; }
main img.medium { max-width: min(100%, 26rem); }
/* two pictures side by side, scaled to the same height */
main p.img-row { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; }
main p.img-row img { margin: 0; min-width: 0; max-height: 13rem; width: auto; max-width: calc(50% - 0.5rem); object-fit: contain; }
/* small thumbnail on the left of a block of text */
.with-thumb { display: flex; gap: 1.25rem; align-items: flex-start; margin: 1.25rem 0; }
.with-thumb > p:first-child { flex: 0 0 6.5rem; margin: 0; }
.with-thumb img.thumb { width: 6.5rem; height: 6.5rem; object-fit: contain; margin: 0.25rem 0 0; padding: 0.3rem; background: #fff; border: 1px solid var(--rule); }
.with-thumb > div { min-width: 0; }
.with-thumb h3 { margin-top: 0; }
@media (max-width: 34rem) {
  .with-thumb > p:first-child { flex-basis: 4.5rem; }
  .with-thumb img.thumb { width: 4.5rem; height: 4.5rem; }
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
blockquote { margin: 1.25rem 0; padding: 0.5rem 1rem; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 6px 6px 0; color: var(--muted); }
blockquote p { margin: 0.4rem 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
pre { background: var(--surface); padding: 0.75rem 1rem; overflow-x: auto; border-radius: 6px; }
table { border-collapse: collapse; }
th, td { border: 1px solid var(--rule); padding: 0.3rem 0.6rem; text-align: left; }

.small, .meta { font-size: 0.9rem; color: var(--muted); }

/* skip link: visible on keyboard focus only */
.skip-link {
  position: absolute; left: 0.5rem; top: -3rem;
  background: var(--bg); color: var(--link); padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* header: name and tagline, navigation */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.8rem; }
.site-name { margin: 0; line-height: 1.2; }
.site-name a { color: var(--text); text-decoration: none; font-size: 1.25rem; font-weight: 700; }
.site-tagline { display: block; color: var(--muted); font-size: 0.85rem; }
.site-header ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.site-header nav a { text-decoration: none; padding: 0.3rem 0.65rem; display: inline-block; border-radius: 999px; }
.site-header nav a:hover { background: var(--surface); text-decoration: underline; }
.site-header nav a[aria-current="page"] { background: var(--surface-strong); color: var(--text); font-weight: 600; }
.site-header nav a:visited { color: var(--link); }
.site-header nav a[aria-current="page"]:visited { color: var(--text); }

main { padding-bottom: 3rem; }
main:focus { outline: none; }

/* footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem; padding: 1.25rem 0 2rem; }
.site-footer p { margin: 0.25rem 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0.25rem 0; display: flex; flex-wrap: wrap; gap: 0 1rem; }

/* logos: always on a white tile so that they stay readable in dark mode */
img.logo { display: inline-block; height: 3.25rem; width: auto; margin: 0; padding: 0.4rem 0.6rem; background: #fff; border-radius: 6px; vertical-align: middle; }
img.logo.logo-ifa { height: 4.25rem; padding-top: 0.2rem; padding-bottom: 0.2rem; margin-left: 0.75rem; }
.logos { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin: 0.75rem 0 1rem; }
.logos p { margin: 0; }

/* a paragraph with a logo on its right (CV) */
.with-logo { display: grid; grid-template-columns: 1fr 11rem; gap: 1.5rem; align-items: center; margin: 1rem 0; }
.with-logo p { margin: 0; }
.with-logo img.logo { justify-self: center; height: auto; max-height: 5.5rem; max-width: 100%; }
@media (max-width: 34rem) {
  .with-logo { grid-template-columns: 1fr 5rem; gap: 1rem; }
}

/* highlighted box with a picture (Golden Owl) */
.award-box { display: flex; align-items: center; gap: 1.25rem; background: var(--surface); border-radius: 10px; padding: 1rem 1.25rem; margin: 1.5rem 0; box-shadow: var(--shadow); }
.award-box p { margin: 0; }
.award-box > p:first-child { flex-shrink: 0; }
.award-box img.logo { height: 5.5rem; width: auto; flex-shrink: 0; padding: 0.3rem; }

/* home: portrait and contact block */
.portrait { float: right; width: 11rem; aspect-ratio: 1; object-fit: cover; margin: 1.75rem 0 1rem 1.5rem; border-radius: 50%; box-shadow: var(--shadow); }
@media (max-width: 34rem) { .portrait { width: 7.5rem; margin-left: 1rem; } }
.contact { margin: 0.5rem 0 1.5rem; }
.contact p { margin: 0.15rem 0; }
.contact img.logo { margin-top: 0.75rem; height: 2.75rem; padding: 0.3rem 0; }
h2 { clear: both; }

/* home: research topics grid */
.topic-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0.9rem; }
.topic-grid a { display: block; height: 100%; text-decoration: none; color: var(--text); background: var(--surface); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.topic-grid a:hover { background: var(--surface-strong); }
.topic-grid a:hover span { text-decoration: underline; }
.topic-grid img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; margin: 0; border-radius: 0; }
.topic-grid span { display: block; padding: 0.45rem 0.65rem 0.6rem; font-size: 0.92rem; font-weight: 600; line-height: 1.3; }

/* news */
.news { list-style: none; padding: 0; }
.news li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.news time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* team */
.team { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 1.25rem; }
.team li { display: flex; flex-direction: column; text-align: center; }
.team img { aspect-ratio: 1; object-fit: cover; width: 100%; max-width: 9rem; margin: 0 auto 0.5rem; border-radius: 50%; box-shadow: var(--shadow); }
.team .role { color: var(--muted); font-size: 0.9rem; }
.easteregg img { margin: 2rem auto 0; opacity: 0.85; }

/* publications */
.toc ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.toc a { display: inline-block; padding: 0.15rem 0.6rem; background: var(--surface); border-radius: 999px; text-decoration: none; font-size: 0.92rem; }
.toc a:hover { background: var(--surface-strong); text-decoration: underline; }
.toc a:visited { color: var(--link); }
.pubs { list-style: none; padding: 0; margin: 0; }
.pub { margin: 0 0 0.9rem; }
.pub .title { font-style: normal; font-weight: 600; }
.pub .me { text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 2px; }
.pub .award { font-weight: 600; }
.pub .links { white-space: nowrap; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid currentColor; border-radius: 999px; padding: 0 0.45rem; margin-right: 0.3rem; vertical-align: 0.1em; }
.pub-new, .pub-working-paper { border-left: 3px solid; border-radius: 0 6px 6px 0; padding: 0.35rem 0.6rem; margin-left: -0.6rem; }
.pub-new { background: var(--new-bg); border-color: var(--new); }
.pub-working-paper { background: var(--working-bg); border-color: var(--working); }
@media (max-width: 38rem) { .pub-new, .pub-working-paper { margin-left: 0; } }
.tag-new { color: var(--new); }
.tag-working-paper { color: var(--working); }
.topic { margin-top: 1rem; }
.topic h3 { margin-top: 2rem; }
.topic-body { display: grid; grid-template-columns: 20rem 1fr; gap: 0 2rem; align-items: start; }
.topic-body.no-image { display: block; }
.topic-image { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; margin: 0.3rem 0 1rem; position: sticky; top: 1rem; border-radius: 8px; box-shadow: var(--shadow); }
@media (max-width: 50rem) {
  .topic-body { grid-template-columns: 14rem 1fr; gap: 0 1.25rem; }
}
@media (max-width: 38rem) {
  .topic-body { display: block; }
  .topic-image { aspect-ratio: 2 / 1; position: static; }
}

/* projects: cards */
.project { background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding: 0.25rem 1.25rem 0.75rem; margin: 1rem 0 1.25rem; box-shadow: var(--shadow); }
.project h3 { margin-top: 1rem; }
.project .logos { margin: 0.5rem 0 0.75rem; }
.project p { margin: 0.6rem 0; }
.project img.logo { height: 3.25rem; }
.project h4 { font-size: 0.95rem; margin: 1rem 0 0.35rem; color: var(--accent); }
.project-list { list-style: none; padding: 0; margin: 0 0 0.5rem; font-size: 0.92rem; }
.project-list li { margin: 0 0 0.4rem; }
.project-list cite { font-style: normal; }
.project-list .meta { color: var(--muted); }
.project-list .links { white-space: nowrap; }
.project-list .kind { display: inline-block; min-width: 7rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.1rem 1rem; margin: 0.5rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* course material */
.files { padding-left: 1.25rem; }
.files li { margin: 0.15rem 0; }

/* grid of thumbnails */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; align-items: center; }
.gallery p { margin: 0; }
.gallery img { margin: 0; background: #fff; padding: 0.25rem; border: 1px solid var(--rule); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header nav, .site-footer, .skip-link { display: none; }
  a { color: inherit; }
  .project, .award-box, .topic-grid a { box-shadow: none; }
}

/* CV: projects and awards, year in a side column */
.timeline ul { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.timeline li { position: relative; padding-left: 3.5rem; margin: 0 0 0.45rem; }
.timeline .year { position: absolute; left: 0; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline .detail { display: block; color: var(--muted); font-size: 0.9rem; }

/* teaching: past theses, grouped by year (year in a side column on wide screens) */
.theses { display: grid; grid-template-columns: 3.5rem 1fr; align-items: baseline; }
.theses h4 { grid-column: 1; font-size: 1rem; color: var(--accent); margin: 0; padding: 0.5rem 0; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.theses ul { grid-column: 2; list-style: none; padding: 0.5rem 0; margin: 0; border-top: 1px solid var(--rule); }
.theses li { margin: 0 0 0.3rem; }
.theses .student { color: var(--muted); font-size: 0.9rem; }
.theses .student::before { content: " — "; }
@media (max-width: 34rem) {
  .theses { display: block; }
  .theses h4 { border-top: 0; padding-bottom: 0; }
}
