:root {
  color-scheme: light;
  --paper: #edf0e8;
  --white: #fff;
  --ink: #14213d;
  --muted: #485875;
  --blue: #244fb4;
  --sky: #dfeeff;
  --line: #d8e2f0;
  --hero-ink: #132631;
  --radius: 1rem;
  --header-offset: 5.25rem;
  --font: "Aptos", "Inter", "Segoe UI", system-ui, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-offset); }
body { margin: 0; font-size: 1rem; line-height: 1.6; }
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
::selection { background: #c4dcff; color: var(--ink); }

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
h2 { font-size: clamp(2.75rem, 5.8vw, 5.35rem); letter-spacing: -.075em; font-weight: 650; }
h3 { letter-spacing: -.035em; }
.wrap { width: min(100% - 2.75rem, 76rem); margin-inline: auto; }
.section { padding-block: clamp(4rem, 8vw, 7.25rem); }

.skip-link {
  position: fixed;
  z-index: 5;
  inset: .5rem auto auto .5rem;
  transform: translateY(-180%);
  padding: .625rem 1rem;
  background: var(--white);
  border-radius: .5rem;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 3;
  top: 0;
  background: rgb(237 240 232 / .95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; min-height: 4.75rem; }
.brand { display: inline-flex; align-items: center; gap: .625rem; flex: none; text-decoration: none; }
.brand span { font-weight: 750; font-size: 1.4rem; letter-spacing: -.07em; }
.brand img { object-fit: contain; }
.header-affiliation { display: flex; align-items: center; gap: clamp(.7rem, 1.4vw, 1.25rem); flex: none; padding-inline-start: clamp(.8rem, 2vw, 1.55rem); border-inline-start: 1px solid var(--line); }
.header-affiliation a { display: grid; align-items: center; min-height: 2.15rem; }
.header-affiliation img { width: 5.4rem; height: 2rem; object-fit: contain; }
.site-nav { display: flex; align-self: stretch; align-items: stretch; gap: clamp(1.35rem, 3vw, 2.7rem); margin-inline-start: auto; }
.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  font-size: .93rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.site-nav a::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--blue); transform: scaleX(0); transition: transform .25s ease; }
.site-nav a:is(:hover, [aria-current]) { color: var(--blue); }
.site-nav a[aria-current]::after { transform: scaleX(1); }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: min(42rem, calc(100svh - 4.75rem));
  background: var(--hero-ink);
  color: #f8faf6;
}
.hero-inner { position: relative; z-index: 1; padding-block: clamp(3.2rem, 7vw, 6rem); }
.hero-copy { max-width: min(63%, 42rem); animation: rise .72s cubic-bezier(.2,.7,.2,1) both; }
.hero h1 {
  max-width: 37rem;
  font-size: clamp(2.8rem, 4.55vw, 4.65rem);
  line-height: 1.02;
  letter-spacing: -.065em;
  font-weight: 680;
  text-wrap: balance;
}
.hero-description { margin-top: 1.35rem; max-width: 34rem; color: #e1e8e5; font-size: clamp(1rem, 1.38vw, 1.125rem); }
.hero-description p + p { margin-top: .8rem; }
.hero-description a, .hero .subtle-link { color: #c5deff; text-decoration-color: #97b7e1; text-underline-offset: .2em; }
.hero :focus-visible { outline-color: #c5deff; }
.hero-actions { margin-top: 1.65rem; display: flex; align-items: center; flex-wrap: wrap; gap: 1.25rem; }
.hero .button { color: var(--hero-ink); background: #dceaf4; border-color: #dceaf4; }
.hero .button:hover { background: #f0f6fb; border-color: #f0f6fb; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .75rem 1.2rem;
  min-height: 3rem;
  border: 1px solid var(--blue);
  border-radius: .55rem;
  background: var(--blue);
  color: var(--white);
  font-size: .94rem;
  font-weight: 650;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.button:hover { background: #183b91; border-color: #183b91; }
.button-outline { color: var(--blue); background: transparent; border-color: #a9bee8; }
.button-outline:hover { color: var(--white); }
.subtle-link { color: var(--blue); font-weight: 650; text-underline-offset: .25em; text-decoration-color: #91a8d9; transition: text-decoration-color .2s ease; }
.subtle-link:hover { text-decoration-color: currentColor; }
.hero-figure {
  position: absolute;
  inset: 0 0 0 33%;
  overflow: hidden;
  animation: photo-fade .9s ease both;
}
.hero-slides { position: absolute; inset: 0; mask-image: linear-gradient(90deg, transparent 2%, #000 7%); }
.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--photo-focus, 28% 52%);
  scale: var(--photo-scale, 1);
  transform-origin: var(--photo-origin, center);
}
.hero-slide.is-entering { animation: hero-slide-in 1.2s ease both; }
.hero-slide.is-leaving { animation: hero-slide-out 1.2s ease both; }
@keyframes hero-slide-in { from { opacity: 0; translate: 2.5% 0; } to { opacity: 1; translate: 0 0; } }
@keyframes hero-slide-out { to { translate: -2.5% 0; } }
.hero-figure::after {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(90deg, var(--hero-ink) 2%, rgb(19 38 49 / .95) 16%, rgb(19 38 49 / .45) 36%, rgb(19 38 49 / .12) 65%, rgb(19 38 49 / .08));
  pointer-events: none;
}
.hero-caption { position: absolute; z-index: 1; right: 1.35rem; bottom: 1rem; max-width: calc(100% - 2.7rem); padding: .23rem .55rem; border-radius: .3rem; background: rgb(13 28 32 / .84); color: #f8faf6; font-size: .8125rem; }
.hero-caption a { text-underline-offset: .17em; }
.research-figure figcaption, .gallery-item figcaption { color: var(--muted); font-size: .875rem; margin-top: .55rem; }
@keyframes photo-fade { from { opacity: 0; } to { opacity: 1; } }

.research, .gallery { background: #f5f6f0; border-block: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 1fr minmax(0, 1fr); align-items: end; gap: 1.25rem; margin-bottom: clamp(2rem, 4vw, 3.4rem); }
.section-heading p { color: var(--muted); max-width: 44rem; font-size: clamp(1rem, 1.4vw, 1.12rem); }
.research .section-heading { grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr); align-items: start; }
.research-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
  gap: clamp(1.65rem, 5vw, 4.5rem);
  padding: clamp(1.4rem, 4vw, 3.75rem);
  background: rgb(255 255 255 / .65);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.research-copy h3 { max-width: 24rem; font-size: clamp(1.55rem, 2.9vw, 2.55rem); margin-bottom: 1rem; }
.research-copy p { color: var(--muted); }
.research-copy p + p { margin-top: .8rem; }
.research .section-heading > p, .research-copy > p { text-align: justify; }
.research .section-heading > p strong, .research-copy > p strong { color: var(--ink); }
.research-figure a { display: block; background: var(--white); padding: .65rem; border: 1px solid var(--line); border-radius: .65rem; }
.research-figure img { width: 100%; aspect-ratio: 1.596; object-fit: contain; }
.publications { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin-top: 1.2rem; padding: 1.25rem clamp(1.4rem, 4vw, 3.75rem); background: #e8eef1; border: 1px solid var(--line); border-radius: var(--radius); }
.publications h3 { font-size: 1.35rem; }
.publications p { color: var(--muted); margin-top: .2rem; }
.publications .button { flex-shrink: 0; }

.people { position: relative; isolation: isolate; }
.people::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("labev-logo.png") 88% center / auto 111% no-repeat;
  opacity: .15;
  pointer-events: none;
}
.people-tabs {
  display: flex;
  gap: .3rem;
  width: fit-content;
  max-width: 100%;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: #eaf0fa;
}
.people-tabs button {
  min-height: 2.65rem;
  padding: .48rem .95rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  background: transparent;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}
.people-tabs button:hover { color: var(--blue); }
.people-tabs button[aria-selected="true"] { color: var(--blue); background: var(--white); border-color: #d7e2f3; }
.people-panel { margin-top: 1.3rem; animation: rise .32s cubic-bezier(.2,.7,.2,1) both; }
.people-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.person-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  height: 100%;
  min-height: 6.2rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  text-align: left;
  color: var(--ink);
  background: rgb(255 255 255 / .72);
}
button.person-card { cursor: pointer; transition: border-color .2s ease, background .2s ease; }
button.person-card:hover { border-color: #9eb6eb; background: #f9fbff; }
.avatar { position: relative; flex: none; display: grid; place-items: center; width: 3.65rem; height: 3.65rem; overflow: hidden; border-radius: .65rem; background: var(--sky); color: var(--blue); font-weight: 700; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.person-info { min-width: 0; }
.person-name { display: block; font-weight: 700; line-height: 1.25; }
.person-role { display: block; color: var(--muted); font-size: .875rem; line-height: 1.35; margin-top: .3rem; }
.join { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(1.15rem, 4vw, 2.75rem); margin-top: 2.1rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.join h3 { font-size: 1.32rem; }
.join p { color: var(--muted); max-width: 50rem; margin-top: .55rem; }
.join-program-logo { display: inline-flex; justify-self: start; padding: .45rem; border-radius: .5rem; background: var(--hero-ink); }
.join-program-logo img { width: clamp(10.5rem, 18vw, 14.5rem); height: auto; border-radius: inherit; }
.profile-access { color: var(--muted); margin-top: 1.4rem; font-size: .875rem; }
.profile-access-trigger { padding: .2rem 0; border: 0; background: transparent; cursor: pointer; }

.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2rem); }
.gallery-photo { display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius); background: var(--sky); }
.gallery-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .55s cubic-bezier(.2,.7,.2,1); }
.gallery-photo:hover img { transform: scale(1.035); }
.gallery-item figcaption, .photo-dialog figcaption { white-space: pre-line; overflow-wrap: anywhere; }
.gallery-credit { margin-top: 1.4rem; color: var(--muted); font-size: .875rem; }

.contact { background: #e7edf0; }
.contact-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 2rem; }
.contact-inner > div:first-child > p { margin-top: .75rem; color: var(--muted); }
.contact-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.45rem; }
.contact-logos a { display: flex; align-items: center; padding: .55rem .7rem; border-radius: .5rem; background: rgb(255 255 255 / .75); }
.contact-logos img { width: auto; height: 2.65rem; max-width: 8.5rem; object-fit: contain; }
.contact-details { display: grid; grid-template-columns: .85fr 1.15fr; gap: 1.5rem; }
.contact-details h3 { margin-bottom: .65rem; font-size: 1.15rem; }
.contact-details a { display: block; width: fit-content; color: var(--blue); text-underline-offset: .2em; }
.contact-details address { font-style: normal; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; padding-block: 1.25rem; color: var(--muted); font-size: .9rem; }
.footer-inner .brand { color: var(--ink); }
.footer-inner > a:last-child { text-underline-offset: .2em; }

dialog { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); max-height: calc(100dvh - 2rem); }
dialog[open] { animation: rise .25s ease both; }
dialog::backdrop { background: rgb(12 23 48 / .76); }
.profile-dialog { width: min(35rem, 100% - 2rem); }
.profile-access-dialog { width: min(29rem, 100% - 2rem); }
.dialog-inner { padding: 1.5rem; }
.dialog-actions { display: flex; justify-content: flex-end; margin-bottom: .35rem; }
.close-button { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-size: 1.65rem; line-height: 1; cursor: pointer; }
.close-button:hover { background: var(--sky); }
.profile-access-dialog h2 { font-size: 1.7rem; letter-spacing: -.045em; }
.profile-access-form { display: grid; gap: .85rem; margin-top: 1rem; }
.profile-access-field { display: grid; gap: .3rem; }
.profile-access-field input { width: 100%; padding: .68rem .75rem; border: 1px solid #8da0b7; border-radius: .45rem; background: var(--white); color: var(--ink); font: inherit; }
.profile-access-form .button { justify-self: start; cursor: pointer; }
.profile-access-error { color: #922c31; font-size: .92rem; }
.profile-heading { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.profile-heading .avatar { width: 5.4rem; height: 5.4rem; font-size: 1.4rem; }
.profile-heading h2 { font-size: clamp(1.65rem, 4.8vw, 2.3rem); letter-spacing: -.055em; }
.profile-heading p, .profile-detail p { color: var(--muted); overflow-wrap: anywhere; }
.profile-detail + .profile-detail { margin-top: .85rem; }
.profile-detail h3 { font-size: 1rem; margin-bottom: .2rem; }
.profile-detail p { white-space: pre-line; }
.profile-links { display: flex; flex-wrap: wrap; gap: .45rem 1rem; padding: 0; list-style: none; margin-bottom: 0; }
.profile-links a { color: var(--blue); overflow-wrap: anywhere; text-underline-offset: .2em; }
.photo-dialog { width: min(65rem, 100% - 2rem); }
.photo-dialog .dialog-inner { padding: .8rem; }
.photo-dialog img { margin-inline: auto; max-height: calc(100dvh - 9rem); border-radius: .5rem; object-fit: contain; }
.photo-dialog figcaption { margin: .55rem .35rem .2rem; }

[data-reveal].reveal-pending { opacity: 0; transform: translateY(16px); }
[data-reveal] { transition: opacity .55s cubic-bezier(.2,.7,.2,1), transform .55s cubic-bezier(.2,.7,.2,1); }
[data-reveal]:focus-within { opacity: 1; transform: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 54rem) {
  .hero-copy { max-width: 68%; }
  .hero-figure { left: 41%; }
  .hero-slide { object-position: var(--photo-focus-compact, var(--photo-focus, 15% 52%)); }
  .hero-figure::after { background: linear-gradient(90deg, var(--hero-ink) 2%, rgb(19 38 49 / .92) 21%, rgb(19 38 49 / .42) 52%, rgb(19 38 49 / .08) 79%); }
  .research-feature { grid-template-columns: minmax(0, 1fr); }
  .research-figure { max-width: 42rem; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-inner { grid-template-columns: 1fr; }
}

@media (max-width: 47rem) {
  :root { --header-offset: 7rem; }
  .header-inner { position: relative; flex-direction: column; align-items: flex-start; justify-content: center; gap: .15rem; padding-top: .55rem; }
  .brand img { width: 2.3rem; height: 2.3rem; }
  .header-affiliation { position: absolute; top: .55rem; right: 0; height: 2.3rem; padding: 0; border: 0; }
  .header-affiliation img { width: 4.4rem; height: 1.8rem; }
  .site-nav { width: 100%; justify-content: space-between; gap: .45rem; }
  .site-nav a { min-height: 2.75rem; font-size: .875rem; }
}

@media (max-width: 43rem) {
  .wrap { width: calc(100% - 2rem); }
  .hero { --hero-photo-height: clamp(12rem, 54vw, 21rem); min-height: auto; }
  .hero-inner { padding-block: 2.6rem calc(var(--hero-photo-height) + .75rem); }
  .hero-copy { max-width: 100%; }
  .hero h1 { font-size: clamp(2.25rem, 8.9vw, 3.8rem); text-wrap: initial; }
  .hero-figure { inset: auto 0 0; height: calc(var(--hero-photo-height) + 2rem); }
  .hero-slides { mask-image: none; }
  .hero-slide { object-position: var(--photo-focus-mobile, center 52%); scale: var(--photo-scale-mobile, var(--photo-scale, 1)); }
  .hero-figure::after { background: linear-gradient(180deg, var(--hero-ink), rgb(19 38 49 / .73) 18%, rgb(19 38 49 / .1) 54%); }
  .section-heading, .research .section-heading { grid-template-columns: 1fr; }
  .research .section-heading > p, .research-copy > p { hyphens: auto; }
  .gallery-grid { grid-template-columns: 1fr; }
  .people::before { background-position: 57% center; }
  .join { grid-template-columns: 1fr; }
}

@media (max-width: 32rem) {
  .people-tabs { width: 100%; }
  .people-tabs button { flex: 1; font-size: .875rem; padding-inline: .35rem; }
  .people-grid { grid-template-columns: 1fr; }
  .person-card { min-height: 5.15rem; }
  .contact-details { grid-template-columns: 1fr; }
  .footer-inner { flex-wrap: wrap; column-gap: .8rem; row-gap: .25rem; }
  .footer-inner p { order: 1; width: 100%; }
  .publications { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 22.5rem) {
  .people-tabs { display: grid; }
  .people-tabs button { padding-inline: .65rem; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .hero-slide.is-entering { animation: photo-fade .6s ease both !important; }
  [data-reveal].reveal-pending { opacity: 1; transform: none; }
}

@media print {
  .site-header { position: static; }
  [data-reveal].reveal-pending { opacity: 1; transform: none; }
}
