/* Alessandro Rudi: site styles.
   One file, no external fonts or scripts, light and dark mode, print-friendly.
   Shared by the home page, the publications page and every program page. */

:root {
  --bg: #ffffff;
  --ink: #15181d;
  --muted: #464e5b;
  --faint: #6b7280;
  --rule: #e5e7eb;
  --card: #fafbfc;
  --card-rule: #e3e6ea;
  --accent: #1d4f91;
  --accent-hover: #123a6e;
  --tag-bg: #edf2f9;
  --tag-ink: #1d4f91;
  --maxw: 52rem;
  --radius: 10px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --ink: #e8eaef;
    --muted: #b6bcc8;
    --faint: #8d95a3;
    --rule: #262b34;
    --card: #141820;
    --card-rule: #262c37;
    --accent: #8fb6ff;
    --accent-hover: #b9d0ff;
    --tag-bg: #1a2335;
    --tag-ink: #a9c6ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.62 var(--sans);
  text-rendering: optimizeLegibility;
}

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

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

/* Top bar */
.topbar { border-bottom: 1px solid var(--rule); }
.topbar .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: 0.9rem; padding-bottom: 0.9rem; flex-wrap: wrap; }
.topbar .home { font-weight: 600; color: var(--ink); letter-spacing: 0.01em; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: var(--ink); }

/* Hero */
.hero { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.75rem; align-items: start; padding: 2.75rem 0 1.5rem; }
.portrait { width: 9.5rem; height: 9.5rem; border-radius: 12px; object-fit: cover; display: block; background: var(--card); }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: 2.35rem; line-height: 1.15; margin: 0 0 0.35rem; letter-spacing: -0.005em; }
.roles { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.98rem; line-height: 1.5; }
.lede { margin: 0 0 1rem; font-size: 1.12rem; line-height: 1.55; }
.links { margin: 0; font-size: 0.95rem; color: var(--faint); }
.links a { white-space: nowrap; }

/* Sections */
section { padding: 1.6rem 0 0.4rem; border-top: 1px solid var(--rule); margin-top: 1.4rem; }
section:first-of-type { border-top: 0; margin-top: 0; }
h2 { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 0 0 1rem; }
h3 { font-size: 1.08rem; font-weight: 650; margin: 1.4rem 0 0.35rem; line-height: 1.35; }
p { margin: 0 0 0.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }

/* Facts strip */
.facts { list-style: none; padding: 0; margin: 0.4rem 0 0.6rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem 1.2rem; }
@media (max-width: 52rem) { .facts { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 30rem) { .facts { grid-template-columns: 1fr; } }
.facts li { padding-left: 0.9rem; border-left: 2px solid var(--rule); color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.facts strong { color: var(--ink); font-weight: 650; }

/* Program cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; margin: 0.4rem 0 0.8rem; }
.card { background: var(--card); border: 1px solid var(--card-rule); border-radius: var(--radius); padding: 1.1rem 1.2rem 1rem; display: flex; flex-direction: column; }
.card .kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.4rem; }
.card h3 { margin: 0 0 0.45rem; font-size: 1.1rem; }
.card p { font-size: 0.97rem; color: var(--muted); margin-bottom: 0.7rem; }
.card .meta { font-size: 0.9rem; color: var(--faint); margin-top: auto; }

/* Research themes */
.theme { margin: 0 0 1.1rem; }
.theme h3 { margin-top: 0.2rem; }
.theme p { color: var(--muted); }
.refs { font-size: 0.93rem; color: var(--faint); margin: -0.35rem 0 0; }

/* Publications */
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { margin: 0 0 1rem; }
.pubs .t { font-weight: 600; display: block; line-height: 1.4; }
.pubs .a { color: var(--muted); font-size: 0.95rem; display: block; }
.pubs .v { font-size: 0.92rem; color: var(--faint); }
.me { color: var(--ink); font-weight: 600; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.08rem 0.45rem; border-radius: 999px; background: var(--tag-bg); color: var(--tag-ink); margin-left: 0.35rem; vertical-align: 0.08em; }
.year { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin: 1.6rem 0 0.7rem; color: var(--ink); }
.filters { font-size: 0.92rem; color: var(--faint); margin: 0 0 1rem; }

/* Lists */
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { margin: 0 0 0.55rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0.2rem 2rem; }
.dl { display: grid; grid-template-columns: 10rem 1fr; gap: 0.35rem 1.2rem; margin: 0; }
.dl dt { color: var(--faint); font-size: 0.93rem; }
.dl dd { margin: 0; }

/* Program page */
.program-hero { padding: 2.6rem 0 1rem; }
.program-hero .kicker { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.6rem; }
.program-hero h1 { font-family: var(--serif); font-weight: 600; font-size: 2.3rem; line-height: 1.15; margin: 0 0 0.6rem; }
.program-hero .lede { max-width: 44rem; }
.status { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; font-size: 0.93rem; color: var(--muted); margin: 0.8rem 0 0; }
.status b { color: var(--ink); font-weight: 650; }
.cta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.2rem 0 0.4rem; }
.button { display: inline-block; padding: 0.5rem 0.95rem; border-radius: 8px; border: 1px solid var(--accent); font-weight: 600; font-size: 0.95rem; }
.button.primary { background: var(--accent); color: var(--bg); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); text-decoration: none; }

/* Footer */
footer { border-top: 1px solid var(--rule); margin-top: 2.2rem; padding: 1.2rem 0 2.4rem; font-size: 0.88rem; color: var(--faint); }
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Small screens */
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .hero { grid-template-columns: 1fr; gap: 1.1rem; padding-top: 1.8rem; }
  .portrait { width: 7rem; height: 7rem; }
  .hero h1 { font-size: 2rem; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 0.5rem; }
}

/* Print */
@media print {
  .topbar nav, .filters, .cta { display: none; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; }
  section { break-inside: avoid-page; }
}

/* Flagship program card spans the full grid width */
.card.wide { grid-column: 1 / -1; }

/* Code blocks (citation on program pages) */
pre { background: var(--card); border: 1px solid var(--card-rule); border-radius: var(--radius); padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.84rem; line-height: 1.5; margin: 0.2rem 0 0.9rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Figures (program pages) */
figure { margin: 0.4rem 0 1.2rem; }
figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--card-rule); background: #fff; }
figcaption { font-size: 0.9rem; line-height: 1.45; color: var(--faint); margin-top: 0.55rem; }
