/* Enrico Casella: site styles. Colours and sizes are set once, here. */
:root {
  --ink: #14181a;
  --muted: #4d585c;
  --line: #d9dfe0;
  --paper: #ffffff;
  --soft: #f3f6f6;
  --accent: #0b5c63;
  --accent-dark: #083f44;
  --dark: #0d1517;
  --on-dark: #e8eeee;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 70rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; font: 1.0625rem/1.6 var(--font); color: var(--ink); background: var(--paper); }
img, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.7rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p, ul, ol { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999rem; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 20; }
.skip:focus { left: 0; }
[hidden] { display: none !important; }

/* Header and menu */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1.5rem; padding-block: .7rem; }
.brand { color: var(--ink); text-decoration: none; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-sub { color: var(--muted); font-size: .85rem; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: .1rem .25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: .45rem .6rem; color: var(--ink); text-decoration: none; font-size: .95rem; border-radius: var(--radius); }
.site-nav a:hover { background: var(--soft); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.nav-toggle { font: inherit; font-size: .95rem; padding: .45rem .8rem; background: none; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); cursor: pointer; }
@media (max-width: 52rem) {
  .brand-sub { display: block; }
  .js .site-nav { display: none; width: 100%; }
  .js .site-nav.open { display: block; }
  .js .site-nav ul { flex-direction: column; padding-bottom: .5rem; }
  .js .site-nav a { padding: .7rem .25rem; border-top: 1px solid var(--line); border-radius: 0; }
}
@media (min-width: 52.01rem) { .nav-toggle { display: none; } }

/* Shared pieces */
.page-head { padding-block: 3rem 1.5rem; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .6rem; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 46rem; }
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2em; }
.section { padding-block: 2.5rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.more { font-weight: 600; text-decoration: none; }
.more::after { content: " \2192"; }
.more:hover { text-decoration: underline; }
.button { display: inline-block; padding: .7rem 1.2rem; background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; border: 1px solid var(--accent); border-radius: var(--radius); cursor: pointer; }
.button:hover { background: var(--accent-dark); color: #fff; }
.button-quiet { background: none; color: var(--accent); border-color: var(--line); }
.button-quiet:hover { background: var(--soft); color: var(--accent-dark); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.tag, .status { display: inline-block; font-size: .75rem; font-weight: 600; line-height: 1; padding: .3rem .5rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.tag { background: var(--soft); color: var(--muted); }
.status-published { background: #dff0ea; color: #0c4a36; }
.status-preliminary { background: #fbeccb; color: #6b4300; }
.status-ongoing { background: #e1e8f8; color: #233e85; }
.plain, .legend, .news-brief, .pubs, .people { list-style: none; padding: 0; }

/* Footer */
.site-footer { margin-top: 4rem; padding-block: 2.5rem 1.5rem; background: var(--dark); color: var(--on-dark); font-size: .95rem; }
.site-footer a { color: #fff; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem 3rem; }
.footer-name { font-weight: 700; font-size: 1.1rem; margin-bottom: .25rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; max-width: 30rem; }
.small-print { color: #a9b6b8; font-size: .85rem; margin: 2rem 0 0; }

/* Home */
.hero { padding-block: clamp(3rem, 9vw, 6rem) 2.5rem; text-align: center; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5.5rem); letter-spacing: -.035em; line-height: 1.03; max-width: 24ch; margin-inline: auto; }
.hero .lede { font-size: clamp(1.15rem, 2.2vw, 1.45rem); margin: 1.5rem auto 0; }
.hero .actions { justify-content: center; }
.hero .button { border-radius: 999px; padding-inline: 1.5rem; }
.hero-panel { max-width: 84rem; margin: 0 auto 3.5rem; padding-inline: clamp(.75rem, 2vw, 1.5rem); }
.hero-panel video, .hero-panel img { width: 100%; aspect-ratio: 16 / 9; max-height: 78vh; object-fit: cover; background: #000; border-radius: 1.75rem; }
.dots { display: flex; justify-content: center; align-items: center; gap: .1rem; margin-top: .75rem; }
.dot { display: grid; place-items: center; min-width: 1.75rem; height: 1.75rem; padding: 0 .3rem; background: none; border: 0; cursor: pointer; }
.dot span { display: block; width: .6rem; height: .6rem; overflow: hidden; background: #7c898c; border-radius: 999px; transition: width .3s ease; }
.dot:hover span { background: var(--ink); }
.dot[aria-current="true"] span { width: 3.25rem; background: #c3cbce; }
.dot i { display: block; width: 0; height: 100%; background: var(--ink); border-radius: 999px; transition: width .25s linear; }
.dot[aria-current="true"] i { min-width: .6rem; }
.band { padding-block: clamp(3rem, 7vw, 5rem); }
.band-grey { background: #f5f5f7; }
.band h2 { font-size: clamp(1.9rem, 4.5vw, 3.2rem); letter-spacing: -.025em; }
.band .section-head { margin-bottom: 1.5rem; }
.rail { list-style: none; margin: 0; display: flex; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: .5rem max(1.25rem, calc((100vw - var(--wrap)) / 2 + 1.25rem)) 1.5rem; scroll-padding-inline: max(1.25rem, calc((100vw - var(--wrap)) / 2 + 1.25rem)); }
.rail::-webkit-scrollbar { display: none; }
.rail > li { flex: 0 0 auto; scroll-snap-align: start; }
.feature { display: flex; flex-direction: column; width: clamp(17rem, 80vw, 27rem); overflow: hidden; background: var(--dark); color: #fff; border-radius: 1.75rem; }
.feature-text { padding: 1.5rem 1.5rem 1.25rem; min-height: 9.5rem; }
.feature-label { font-size: .85rem; font-weight: 600; color: #9fdfe3; margin: 0 0 .4rem; }
.feature h3 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); line-height: 1.15; margin: 0; }
.feature video, .feature img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; margin-top: auto; }
.feature-light { background: #fff; color: var(--ink); }
.feature-light .feature-label { color: var(--accent); }
.feature-light img { object-fit: contain; background: #fff; }
.thumb { width: clamp(9rem, 42vw, 15rem); }
.thumb video, .thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; border-radius: 1.25rem; }
.rail-numbered { flex-wrap: wrap; overflow: visible; counter-reset: tile; }
.rail-numbered > .thumb { position: relative; counter-increment: tile; }
.rail-numbered > .thumb::after { content: counter(tile); position: absolute; left: .5rem; top: .5rem; min-width: 2rem; padding: .15rem .5rem; font-weight: 700; text-align: center; color: #fff; background: rgba(13, 21, 23, .92); border-radius: 999px; }
.rail-wrap:has(.rail-numbered) .rail-buttons { display: none; }
.rail-buttons { display: flex; justify-content: flex-end; gap: .6rem; }
.rail-buttons button { width: 2.6rem; height: 2.6rem; font-size: 1.5rem; line-height: 1; color: var(--ink); background: #dfe3e6; border: 0; border-radius: 50%; cursor: pointer; }
.rail-buttons button:hover { background: #cfd5d9; }
.rail-buttons button:disabled { opacity: .35; cursor: default; }
.home-doors .door { background: #fff; border-top: 0; border-radius: 1.5rem; padding: 1.75rem; }
.home-doors .doors-grid { padding-block: 0; }
.reveal-on .rail .reveal { transform: translateY(1.5rem); }
.reveal-on .rail .reveal.in { transform: none; }
.motion-toggle { position: fixed; right: 1rem; bottom: 1rem; z-index: 9; font: inherit; font-size: .85rem; font-weight: 600; padding: .5rem .85rem; color: #fff; background: rgba(13, 21, 23, .92); border: 1px solid rgba(255, 255, 255, .6); border-radius: 999px; cursor: pointer; }
.reveal-on .reveal { opacity: 0; transform: translateY(1.5rem) scale(.97); transition: opacity .6s ease, transform .6s ease; }
.reveal-on .reveal.in { opacity: 1; transform: none; }
.gallery figcaption { font-size: .88rem; color: var(--muted); margin-top: .5rem; }
.doors-grid { display: grid; gap: 1rem; padding-block: 1rem 1.5rem; }
@media (min-width: 48rem) { .doors-grid { grid-template-columns: repeat(3, 1fr); } }
.door { padding: 1.4rem; background: var(--soft); border-top: 3px solid var(--accent); border-radius: 0 0 var(--radius) var(--radius); }
.door h2 { font-size: 1.15rem; }
.door p:last-child { margin-bottom: 0; }
.two-col { display: grid; gap: 2.5rem; }
@media (min-width: 60rem) { .two-col { grid-template-columns: 1fr 1.4fr; gap: 4rem; } }
.news-brief li { padding: .8rem 0; border-top: 1px solid var(--line); }
.news-brief time, .post time { display: block; font-size: .85rem; color: var(--muted); }
.news-brief a { font-weight: 600; text-decoration: none; }
.news-brief a:hover { text-decoration: underline; }
.about { display: grid; gap: 2rem; align-items: start; border-top: 1px solid var(--line); }
@media (min-width: 48rem) { .about { grid-template-columns: 16rem 1fr; gap: 3rem; } }
.portrait { width: 16rem; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; border-radius: var(--radius); }

/* Research */
.cards { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.card:hover { border-color: var(--accent); }
.card:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.card-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--soft); }
.card-body { padding: 1rem 1.1rem 1.2rem; font-size: .97rem; }
.card-meta { margin-bottom: .5rem; }
.card-title { font-size: 1.1rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-title a:focus-visible { outline: none; }
.card-body p:last-child { margin-bottom: 0; }
.card-result { font-weight: 600; color: var(--accent-dark); }
.theme { padding-block: 2rem; }
.theme-blurb { color: var(--muted); max-width: 46rem; margin-bottom: 1.5rem; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-size: .9rem; color: var(--muted); margin-top: 1.5rem; }
.support { padding-block: 2rem; border-top: 1px solid var(--line); }
.support p { max-width: 46rem; }
.crumb { font-size: .9rem; color: var(--muted); }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.band-dark { background: var(--dark); padding-block: 2rem; margin-bottom: 2rem; }
.band-figure { margin-block: 0; }
.band-figure video { width: 100%; max-height: 75vh; background: #000; border-radius: var(--radius); }
.band-figure figcaption { font-size: .88rem; color: var(--on-dark); margin-top: .5rem; }
.result { margin: 0 0 2rem; padding: 1.1rem 1.3rem; background: var(--soft); border-left: 4px solid var(--accent); }
.result p { font-size: 1.2rem; font-weight: 600; margin: 0; }
.result-source { display: block; font-size: .88rem; color: var(--muted); margin-top: .4rem; }
.gallery { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); margin-block: 1.5rem 2rem; align-items: start; }
.gallery-single { grid-template-columns: 1fr; }
.gallery figure { margin: 0; }
.gallery img, .gallery video { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.zoom { display: block; cursor: zoom-in; }
.next-step { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.lightbox { border: 0; padding: 1rem; max-width: min(96vw, 80rem); background: var(--paper); border-radius: var(--radius); }
.lightbox::backdrop { background: rgba(13, 21, 23, .85); }
.lightbox img { max-height: 78vh; width: auto; margin: .75rem auto; }
.lightbox p { margin: 0; font-size: .9rem; color: var(--muted); }


/* Publications */
.pub { padding: 1rem 0; border-top: 1px solid var(--line); }
.pub p { margin: 0; }
.pub-media { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; align-items: start; }
@media (min-width: 36rem) { .pub-media { grid-template-columns: 10rem 1fr; gap: 1.25rem; } }
.pub-thumb video, .pub-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; border-radius: var(--radius); }
.pub-title { font-weight: 600; }
.pub-title a { color: var(--ink); text-decoration-color: #8a9699; }
.pub-title a:hover { color: var(--accent); }
.pub-authors, .pub-venue { font-size: .93rem; color: var(--muted); }
.pub-authors strong { color: var(--ink); }
.pub-note { font-style: italic; }
.pub-links { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .3rem 1rem; margin-top: .4rem; font-size: .9rem; }
.bibtex summary { color: var(--accent); cursor: pointer; }
.bibtex[open] { flex-basis: 100%; }
.bibtex pre { font: .82rem/1.5 var(--mono); background: var(--soft); padding: .8rem; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; margin: .5rem 0 0; }
.pub-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; padding: 1rem; background: var(--soft); border-radius: var(--radius); margin-bottom: 1rem; }
.pub-filter label { display: grid; gap: .25rem; font-size: .85rem; font-weight: 600; }
.pub-filter select { font: inherit; font-size: .95rem; padding: .45rem .5rem; border: 1px solid #6f7b7e; border-radius: var(--radius); background: #fff; color: var(--ink); max-width: 100%; }
.pub-count { font-size: .9rem; color: var(--muted); }
.pub-year { margin-top: 2rem; }
.pub-year h2 { color: var(--accent); }

/* Teaching, Lab, News, Contact */
.course, .post { padding-block: 1.75rem; border-top: 1px solid var(--line); }
.course-code { font-weight: 700; color: var(--accent); margin-bottom: .3rem; }
.course-meta { font-size: .9rem; color: var(--muted); }
.post h2 { margin-top: .2rem; }
.wide-photo { margin-block: 0 2.5rem; }
.wide-photo img { width: 100%; max-height: 32rem; object-fit: cover; border-radius: var(--radius); }
.people { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); margin-block: 1.5rem 2.5rem; }
.person { display: grid; grid-template-columns: 6rem 1fr; gap: 1rem; align-items: start; }
.avatar { width: 6rem; height: 6rem; border-radius: 50%; object-fit: cover; object-position: top; }
.avatar-blank { display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--accent); font-weight: 700; font-size: 1.4rem; }
.person h3 { margin-bottom: .1rem; }
.person-role { color: var(--accent); font-weight: 600; font-size: .92rem; margin-bottom: .4rem; }
.person p { font-size: .95rem; }
.alumni li { margin-bottom: .5rem; }
.contact-grid { display: grid; gap: 2rem; padding-block: 2rem; }
@media (min-width: 48rem) { .contact-grid { grid-template-columns: 1fr 1fr; } }
.email { font-size: 1.25rem; font-weight: 600; }
address { font-style: normal; }
.plain li { margin-bottom: .4rem; }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media print {
  .site-header, .site-footer, .pub-filter, .video-toggle, video, .actions { display: none !important; }
  body { font-size: 11pt; }
  a { color: inherit; }
}

