/* ==========================================================================
   Computational Mechanics of Soft Materials Group
   One stylesheet, one definition per rule. Tokens first, then base, then
   layout, then components in the order they appear in the page shell.
   ========================================================================== */

:root {
  /* palette */
  --page-bg:    #ffffff;
  --surface:    #ffffff;
  --soft-bg:    #f4f7f9;
  --text:       #16212b;
  --muted:      #5a6976;
  --line:       #dbe3ea;
  --accent:     #1d5b7a;
  --accent-ink: #14435c;
  --accent-soft:#e6f0f5;
  --shadow:     0 1px 2px rgba(16, 33, 43, .05), 0 8px 24px -18px rgba(16, 33, 43, .28);

  /* type */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* metrics */
  --container: 1080px;
  --radius: 12px;
  --radius-sm: 8px;

  color-scheme: light dark;

}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg:    #10171d;
    --surface:    #161f27;
    --soft-bg:    #131c23;
    --text:       #e8eef3;
    --muted:      #9aacba;
    --line:       #26333d;
    --accent:     #6cb6d6;
    --accent-ink: #9ed2ea;
    --accent-soft:#172934;
    --shadow:     0 1px 2px rgba(0, 0, 0, .4);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ------------------------------- typography ------------------------------ */

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.014em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 1.3rem + 2vw, 2.7rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.7rem); }
h3 { font-size: 1.08rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: .16em;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.eyebrow {
  margin-bottom: .4rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.lead {
  max-width: 62ch;
  font-size: 1.12rem;
  color: var(--muted);
}

.text-link {
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.text-link::after { content: " \2192"; opacity: .55; }
.text-link:hover { text-decoration: underline; }

/* --------------------------------- layout -------------------------------- */

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.page-layout { padding: 2.75rem 0 4rem; }

.page-opening {
  max-width: 70ch;
  margin-bottom: 2.75rem;
}

.content-section { padding: 2.75rem 0; }
.content-section:last-child { padding-bottom: 4rem; }
.content-section.flush { padding-top: 0; }

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}
.section-heading-row h2 { margin: 0; }

/* --------------------------------- header -------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--page-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.brand-name {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.brand-sub {
  font-size: .76rem;
  font-weight: 500;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.site-nav a {
  padding: .4rem .6rem;
  border-radius: 7px;
  color: var(--text);
  font-size: .94rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { background: var(--soft-bg); color: var(--accent); }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: .3rem .6rem;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ---------------------------------- hero --------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 88% -20%, var(--accent-soft) 0%, transparent 58%),
    var(--soft-bg);
}

.hero .container { width: min(100% - 2.5rem, 1340px); }

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 780px);
  gap: 2.25rem;
  align-items: center;
  padding: 3.5rem 0 3.5rem;
}
.hero-text { max-width: 40ch; }
.hero-figure { --band-h: 480px; width: 100%; }

.hero h1 { margin-bottom: .75rem; }

.hero-lead {
  max-width: 54ch;
  margin-bottom: 1rem;
  font-size: 1.14rem;
  color: var(--muted);
}

.hero-affil {
  margin-bottom: 1.75rem;
  font-size: .92rem;
  color: var(--muted);
}
.hero-affil strong { color: var(--text); font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0;
}

/* -------------------------------- carousel ------------------------------- */

.carousel { position: relative; }

.carousel-viewport {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.carousel-track {
  display: grid;          /* every slide shares one cell, so no layout shift */
  margin: 0;
  padding: 0;
  list-style: none;
}

.carousel-slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease;
}
.carousel-slide.is-active { opacity: 1; visibility: visible; }

.carousel-slide figure { margin: 0; }

.carousel-media {
  position: relative;
  height: var(--band-h, 320px);
  background: var(--page-bg);
}

/* Transparent artwork whose embedded dark labels need a light canvas. */
.carousel-media-light { background: #fff; }

.carousel-slide img,
.carousel-slide video {
  position: absolute;
  top: .6rem;
  left: .6rem;
  display: block;
  width: calc(100% - 1.2rem);
  height: calc(100% - 1.2rem);
  object-fit: contain;    /* letterboxed in the frame, never cropped */
  border-radius: 4px;
}

/* A video slide gets a small corner badge so it reads as playable. */
.carousel-slide figure { position: relative; }
.carousel-slide.has-video .carousel-media::after {
  content: "\25B6";
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--accent);
  font-size: .6rem;
  pointer-events: none;
}
.carousel-slide.has-video.is-playing .carousel-media::after { content: none; }

.carousel-slide figcaption {
  padding: .7rem 1.1rem .8rem;
  border-top: 1px solid var(--line);
  font-size: .86rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}
.carousel-slide figcaption a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.carousel-slide figcaption a:hover { text-decoration: underline; }
.carousel-slide figcaption a::after { content: " \2197"; opacity: .6; font-weight: 400; }

.figcaption-meta {
  display: block;
  margin-top: .2rem;
  font-size: .8rem;
  color: var(--muted);
}

.carousel-arrow {
  position: absolute;
  top: calc(50% - 2.2rem);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.carousel-arrow:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.carousel-arrow.prev { left: .55rem; }
.carousel-arrow.next { right: .55rem; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: .4rem;
  margin-top: .75rem;
}
.carousel-dots button {
  width: .5rem;
  height: .5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  transition: background-color .15s, transform .15s;
}
.carousel-dots button[aria-selected="true"] { background: var(--accent); transform: scale(1.25); }

/* A single slide needs no navigation. */
.carousel.is-single .carousel-arrow,
.carousel.is-single .carousel-dots { display: none; }

.btn {
  display: inline-block;
  padding: .55rem .95rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  background: var(--surface);
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--accent-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

/* --------------------------------- cards --------------------------------- */

.card-base {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ------------------------------ research topics -------------------------- */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}

.topic {
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.topic h3 { margin-bottom: .35rem; font-size: 1rem; color: var(--accent); }
.topic p { margin: 0; font-size: .93rem; color: var(--muted); }

/* ------------------------------ news previews ---------------------------- */

.list-preview { display: grid; gap: 0; }

.preview-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.preview-item:first-child { padding-top: 0; }
.preview-item:last-child { border-bottom: 0; }
.preview-item time,
.news-item time {
  display: block;
  margin-bottom: .2rem;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .02em;
  color: var(--muted);
}
.preview-item h3 { margin-bottom: .3rem; }
.preview-item p { margin: 0; color: var(--muted); }

.news-list { display: grid; gap: 1rem; }

.news-item {
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.news-item h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.news-item p { margin: 0; color: var(--muted); }

/* ------------------------------ publications ----------------------------- */

.publication-list { display: grid; gap: 0; }

.pub-year {
  margin: 2rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--accent-soft);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent);
}
.pub-year:first-child { margin-top: 0; }

.publication-item {
  padding: 1rem 0 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  transition: border-color .15s, background-color .15s;
}
.publication-item:last-child { border-bottom: 0; }
.publication-item:hover {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--soft-bg) 60%, transparent);
}
.publication-item h3 { margin-bottom: .3rem; font-size: 1.03rem; line-height: 1.35; }
.publication-item h3 a { text-decoration: none; }
.publication-item h3 a:hover { text-decoration: underline; }

.pub-authors {
  margin: 0 0 .2rem;
  font-size: .92rem;
  color: var(--muted);
}
.pub-authors strong { color: var(--text); font-weight: 600; }

.pub-meta {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
}

.pub-links {
  margin: .35rem 0 0;
  font-size: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
}

.publication-list.compact .publication-item { padding-left: 0; border-left: 0; }
.publication-list.compact .publication-item:hover { background: none; }

/* Type markers, set once each. */
.publication-item.preprint::before,
.publication-item.proceedings::before {
  display: inline-block;
  margin-bottom: .3rem;
  padding: .04rem .45rem;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.publication-item.preprint::before { content: "Preprint"; }
.publication-item.proceedings::before { content: "Proceedings"; }

/* --------------------------------- people -------------------------------- */

.people-grid { display: grid; gap: 1.25rem; }

.person-card {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background-color .18s, border-color .18s, box-shadow .18s;
}

/* Tint the whole card under the cursor. :focus-within covers tabbing to a
   link inside it. The group headings share the class but are not cards. */
.person-card:not(.person-section-card):hover,
.person-card:not(.person-section-card):focus-within {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(16, 33, 43, .06), 0 12px 28px -20px rgba(16, 33, 43, .45);
}

.avatar {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 168px;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
  background: var(--soft-bg);
}

.person-body { padding: 1.4rem 1.6rem; }
.person-body .role {
  margin-bottom: .15rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.person-body h2 { font-size: 1.22rem; margin-bottom: .5rem; }
.person-body p { color: var(--muted); font-size: .96rem; }

/* A row that only carries a group heading. */
.person-section-card {
  display: block;
  margin-top: 1.25rem;
  background: none;
  border: 0;
  border-bottom: 2px solid var(--accent-soft);
  border-radius: 0;
  box-shadow: none;
}
.person-section-card .person-body { padding: 0 0 .5rem; }
.person-section-card h2 {
  margin: 0;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* -------------------------------- projects ------------------------------- */

.project-list { display: grid; gap: 1.25rem; }

.project-card {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.project-image {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--soft-bg);
  border-right: 1px solid var(--line);
}
.project-image > * { max-width: 100%; }

.project-logo,
.msmt-logo,
.edf-logo {
  display: block;
  width: 100%;
  max-height: 116px;
  object-fit: contain;
}

.project-body { padding: 1.4rem 1.6rem; }
.project-body time {
  display: block;
  margin-bottom: .2rem;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
}
.project-body h3 { margin-bottom: .4rem; font-size: 1.18rem; }
.project-body p { color: var(--muted); font-size: .96rem; }

/* -------------------------------- openings ------------------------------- */

.openings-list { display: grid; gap: 1.25rem; }

.opening-card {
  padding: 1.6rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.opening-card h2 { font-size: 1.24rem; margin-bottom: .6rem; }
.opening-card p { color: var(--muted); }
.opening-card p:first-of-type { color: var(--text); font-size: 1.03rem; }

/* ------------------------------ placeholders ----------------------------- */

.placeholder-image {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 1rem;
  background: var(--soft-bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .85rem;
}

/* --------------------------------- footer -------------------------------- */

.site-footer {
  margin-top: 1rem;
  padding: 2.5rem 0 2rem;
  background: var(--soft-bg);
  border-top: 1px solid var(--line);
  font-size: .92rem;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.footer-grid h3 {
  margin-bottom: .5rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text);
}
.footer-grid p { margin-bottom: .35rem; }

.footer-links { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; }

.footer-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: .25rem;
}
.footer-logos img {
  height: 52px;
  width: auto;
  border-radius: 4px;
}
.footer-logos a { display: inline-flex; }

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: .86rem;
}

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 900px) {
  /* Below this the two columns squeeze the text, so the figure goes underneath. */
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 3rem 0 2.75rem;
  }
  .hero-figure { --band-h: 340px; max-width: 300px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute;
    inset: 70px 0 auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem 1.25rem 1rem;
    background: var(--page-bg);
    border-bottom: 1px solid var(--line);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: .6rem .5rem; border-radius: 0; }

  .brand-sub { display: none; }

  .person-card,
  .project-card { grid-template-columns: 1fr; }
  .avatar { aspect-ratio: 16 / 10; min-height: 0; }
  .project-image { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > :first-child { grid-column: auto; }
  .section-heading-row { flex-direction: column; align-items: flex-start; gap: .25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
