/* ==========================================================================
   DUTH-FET — stylesheet
   Colours come from the group logo (#3E73C8). Light and dark themes follow
   the visitor's system setting.
   ========================================================================== */

@font-face {
  font-family: "Chakra Petch";
  src: url("../fonts/chakra-petch-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("../fonts/chakra-petch-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #f5f7fa;
  --ink: #1a2233;
  --muted: #5b6577;
  --line: #e1e5ec;
  --brand: #3e73c8;
  --brand-strong: #2a5bae;
  --brand-deep: #1f4c96;
  --brand-wash: #eaf1fb;
  --cell-off: #e4eaf3;
  --mark: #ffe08a;
  --on-brand: #ffffff;

  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --text: "Source Serif 4", Georgia, "Times New Roman", serif;

  --wrap: 72rem;
  --gutter: clamp(1.1rem, 4vw, 2rem);
  --radius: 4px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-strong); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
mark { background: var(--mark); color: inherit; padding: 0 0.08em; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--brand); color: var(--on-brand); padding: .5rem 1rem; z-index: 20; font-family: var(--display); }
.skip-link:focus { top: .75rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand img { width: 2.3rem; height: 2.3rem; }
.brand span { font-family: var(--display); font-weight: 600; font-size: 1.3rem; letter-spacing: 0.03em; }

.site-nav ul { list-style: none; display: flex; gap: clamp(.9rem, 2.5vw, 2rem); margin: 0; padding: 0; }
.site-nav a {
  font-family: var(--display); font-weight: 500; font-size: 1rem;
  color: var(--ink); text-decoration: none; padding: .35rem 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--brand); }
@media (max-width: 34rem) {
  .site-header .wrap { flex-wrap: wrap; padding-top: .5rem; padding-bottom: .4rem; min-height: 0; }
  .brand span { font-size: 1.15rem; }
  .site-nav { width: 100%; }
  .site-nav ul { justify-content: space-between; gap: .5rem; }
  .site-nav a { font-size: .9rem; }
  html { scroll-padding-top: 7rem; }
}

/* ---------- Buttons & small controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-weight: 500; font-size: 1rem; line-height: 1;
  padding: .8rem 1.15rem; border-radius: var(--radius);
  border: 1.5px solid var(--brand); text-decoration: none; cursor: pointer;
  background: var(--brand); color: var(--on-brand);
}
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-quiet { background: transparent; color: var(--brand-strong); }
.btn-quiet:hover { background: var(--brand-wash); color: var(--brand-strong); border-color: var(--brand); }
.btn-small { font-size: .875rem; padding: .5rem .75rem; }

.tag {
  display: inline-block; font-family: var(--display); font-weight: 500; font-size: .8rem; line-height: 1.2;
  padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink); text-decoration: none; background: var(--surface);
}
a.tag:hover { border-color: var(--brand); color: var(--brand-strong); }

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2rem); }
.section-head p { margin: .5rem 0 0; color: var(--muted); max-width: 38rem; }

.page-head { padding: clamp(2.5rem, 6vw, 3.75rem) 0 clamp(2rem, 5vw, 3rem); background: var(--brand-strong); color: var(--on-brand); }
.page-head + .wrap { margin-top: clamp(1.75rem, 4vw, 2.75rem); }
#people-root > .people-section:first-child { border-top: 0; }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 3rem); margin-bottom: .6rem; }
.page-head p { color: rgba(255, 255, 255, .88); max-width: 42rem; margin: 0; font-size: 1.125rem; }
.page-head a { color: #fff; }
.page-head .jump-links .tag { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: #fff; }
.page-head .jump-links .tag:hover { background: rgba(255, 255, 255, .22); border-color: #fff; color: #fff; }

/* ---------- Home: hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(3rem, 7vw, 5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.06; letter-spacing: -0.015em; margin-bottom: 1.4rem; max-width: 16ch; }
.hero .lead { font-size: 1.2rem; line-height: 1.6; max-width: 36rem; margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.chip-demo { justify-self: center; width: min(100%, 25rem); margin: 0; }
.chip-demo button {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px;
}
.chip-demo canvas { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.chip-demo p { margin: .75rem 0 0; text-align: center; font-family: var(--display); font-size: .875rem; color: var(--muted); }

@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: 1fr; }
  .chip-demo { width: min(100%, 17rem); justify-self: start; margin: 0; }
}

/* ---------- Home: research ---------- */
.research-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.25rem 3.5rem; }
.research-list li { position: relative; padding-left: 1.6rem; }
.research-list li::before {
  content: ""; position: absolute; left: 0; top: .42rem; width: .62rem; height: .62rem; background: var(--brand); border-radius: 1px;
}
.research-list h3 { font-size: 1.2rem; margin-bottom: .45rem; }
.research-list p { margin-bottom: .55rem; max-width: 34rem; }
.research-list a { font-family: var(--display); font-weight: 500; font-size: .95rem; }
@media (max-width: 46rem) { .research-list { grid-template-columns: 1fr; } }

/* ---------- Home: news ---------- */
.news-list { list-style: none; margin: 0; padding: 0; max-width: 52rem; }
.news-list li { display: grid; grid-template-columns: 9rem 1fr; gap: 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.news-list li:first-child { padding-top: 0; }
.news-list time { font-family: var(--display); font-weight: 500; color: var(--muted); font-size: .95rem; padding-top: .1rem; }
.news-list p { margin: 0; }
@media (max-width: 34rem) { .news-list li { grid-template-columns: 1fr; gap: .25rem; } }

.news-more { margin: 1.25rem 0 0; font-family: var(--display); font-weight: 500; }

/* ---------- News page ---------- */
.news-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; max-width: 52rem; }
.news-post { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.4rem 1.6rem 1.5rem; }
.news-post.is-paper { border-left: 5px solid var(--brand); }
.news-post time { font-family: var(--display); font-weight: 500; color: var(--muted); font-size: .95rem; }
.news-post h2 { font-size: 1.3rem; line-height: 1.3; margin: .35rem 0 .5rem; }
.news-meta { display: flex; align-items: center; gap: .75rem; }
.news-authors { margin: 0 0 .2rem; font-size: .98rem; }
.news-authors a { font-weight: 600; text-decoration: none; }
.news-venue { margin: 0 0 .8rem; color: var(--muted); }
.news-text { max-width: 46rem; }
.news-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1rem 0 .4rem; }
.news-figures figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .5rem; }
.news-figures img { width: 100%; height: auto; max-height: 22rem; object-fit: contain; }
.news-figures figcaption { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.news-credit { font-size: .85rem; color: var(--muted); margin: 0 0 .8rem; }
.news-links { margin: .6rem 0 0; }
@media (max-width: 34rem) { .news-post { padding: 1.1rem; } }

/* ---------- Home: contact ---------- */
.contact-grid { max-width: 36rem; }
.contact-grid h3 { font-size: 1.15rem; margin-bottom: .75rem; }
.contact-grid address { font-style: normal; }
.contact-grid dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 1rem 0 0; }
.contact-grid dt { font-family: var(--display); font-weight: 500; color: var(--muted); }
.contact-grid dd { margin: 0; }
@media (max-width: 46rem) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- Home: group leader ---------- */
.lead-card { background: var(--brand-wash); border-top-color: transparent; }
.lead-card .avatar { border-color: #c9d7ef; }
.lead-card .person.is-lead { max-width: 58rem; grid-template-columns: 13rem minmax(0, 1fr); }
@media (max-width: 34rem) { .lead-card { background: var(--brand-wash); border-top-color: transparent; }
.lead-card .avatar { border-color: #c9d7ef; }
.lead-card .person.is-lead { grid-template-columns: 7rem minmax(0, 1fr); } }

/* ---------- Projects ---------- */
.project-group + .project-group { margin-top: 3.5rem; }
.project-group > h2 { font-size: clamp(1.5rem, 3vw, 1.85rem); margin-bottom: 1.25rem; }
.project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.project-list.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 52rem) { .project-list.is-grid { grid-template-columns: 1fr; } }
.project {
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand);
  border-radius: 6px; padding: 1.4rem 1.6rem 1.5rem;
}
.project.is-completed { border-left-color: var(--line); }
.project-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin-bottom: .35rem; }
.project-head h3 { font-size: clamp(1.45rem, 3vw, 1.8rem); color: var(--brand-strong); letter-spacing: .01em; }
.project.is-completed .project-head h3 { font-size: 1.35rem; }
.project-period { font-family: var(--display); font-weight: 600; color: var(--muted); font-size: 1rem; }
.project-title { font-weight: 600; font-size: 1.06rem; line-height: 1.45; margin-bottom: .7rem; }
.project-text { max-width: 46rem; margin-bottom: .9rem; }
.project.is-completed .project-text { font-size: .97rem; }
.project-meta { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .3rem 1rem; margin: 0 0 .8rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .95rem; }
.project-meta dt { font-family: var(--display); font-weight: 500; color: var(--muted); }
.project-meta dd { margin: 0; }
.project-link { margin: 0; font-family: var(--display); font-weight: 500; }
@media (max-width: 34rem) { .project { padding: 1.1rem 1.1rem 1.2rem; } .project-meta { grid-template-columns: 1fr; gap: 0; } .project-meta dd { margin-bottom: .45rem; } }

/* ---------- People ---------- */
.jump-links { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.5rem 0 0; }

.people-section { padding: clamp(2.5rem, 6vw, 3.75rem) 0; border-top: 1px solid var(--line); }
.people-section > .wrap > h2 { font-size: clamp(1.5rem, 3vw, 1.85rem); margin-bottom: 2rem; }

.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem 3.5rem; }
@media (max-width: 64rem) { .people-grid { grid-template-columns: 1fr; } }

.person { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.person.is-lead { grid-template-columns: 16rem minmax(0, 1fr); gap: 2.5rem; max-width: 62rem; }
@media (max-width: 34rem) {
  .person, .person.is-lead { grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; }
}
.person:target { scroll-margin-top: 6rem; }
.person:target .person-name { text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: .2em; }

.avatar {
  width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 25%; border-radius: 6px;
  border: 1px solid var(--line); background: var(--brand-wash);
}
.avatar-initials {
  display: grid; place-items: center; font-family: var(--display); font-weight: 600;
  color: var(--brand-strong); font-size: 1.6rem; letter-spacing: .04em;
}
.is-lead .avatar-initials { font-size: 3rem; }

.person-name { font-size: 1.25rem; margin-bottom: .2rem; }
.is-lead .person-name { font-size: 1.7rem; }
.person-position { font-family: var(--display); font-weight: 500; color: var(--muted); margin: 0 0 .8rem; font-size: .95rem; }
.person-bio { margin-bottom: .9rem; max-width: 40rem; }
.person-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; padding: 0; list-style: none; }
.person-tags .tag { background: var(--brand-wash); border-color: transparent; color: var(--brand-strong); }
.person-links { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; font-family: var(--display); font-size: .92rem; }
.person-links a { font-weight: 500; }

.alumni-block + .alumni-block { margin-top: 2.5rem; }
.alumni-block h3 { font-size: 1.15rem; margin-bottom: 1rem; }
.alumni-list { list-style: none; margin: 0; padding: 0; columns: 3 15rem; column-gap: 2.5rem; }
.alumni-list li { break-inside: avoid; padding: .25rem 0; }
.alumni-list small { color: var(--muted); font-size: .85rem; margin-left: .35rem; }

/* ---------- Publications ---------- */
.pub-controls {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: clamp(1rem, 3vw, 1.5rem); display: grid; gap: 1.1rem; margin-bottom: 1.5rem;
}
.field label, .field-label { display: block; font-family: var(--display); font-weight: 500; font-size: .9rem; color: var(--muted); margin-bottom: .35rem; }
.pub-controls input[type="search"], .pub-controls select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .75rem;
}
.pub-controls input[type="search"] { font-size: 1.125rem; padding: .8rem .9rem; }
.pub-controls input:focus-visible, .pub-controls select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.control-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: end; }
@media (max-width: 40rem) { .control-row { grid-template-columns: 1fr 1fr; } .control-row .field-member { grid-column: 1 / -1; } }

.type-filter { border: 0; padding: 0; margin: 0; min-width: 0; }
.type-filter legend { padding: 0; }
.type-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.type-options label { position: relative; cursor: pointer; }
.type-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.type-options span {
  display: inline-flex; align-items: center; gap: .4rem; font-family: var(--display); font-weight: 500; font-size: .9rem;
  padding: .45rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.type-options span b { font-weight: 500; color: var(--muted); }
.type-options input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.type-options input:checked + span b { color: inherit; opacity: .8; }
.type-options input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.type-options input:disabled + span { opacity: .45; cursor: default; }

.pub-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: 0 0 1.5rem; }
.pub-status p { margin: 0; font-family: var(--display); font-weight: 500; }
.pub-status .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.active-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: -0.5rem 0 1.5rem; }
.active-filters button {
  font-family: var(--display); font-weight: 500; font-size: .875rem; cursor: pointer;
  border: 1px solid var(--brand); color: var(--brand-strong); background: var(--brand-wash);
  border-radius: var(--radius); padding: .35rem .6rem;
}
.active-filters button::after { content: "\00d7"; margin-left: .45rem; font-size: 1.05em; }
.member-banner { margin: 0 0 1.5rem; padding: 1rem 1.2rem; border-left: 3px solid var(--brand); background: var(--surface); }
.member-banner p { margin: 0; }

.year-group { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.5rem; padding: 1.75rem 0; border-top: 1px solid var(--line); }
.year-group h2 { font-size: 1.5rem; color: var(--brand-strong); position: sticky; top: 5.25rem; align-self: start; }
@media (max-width: 40rem) { .year-group { grid-template-columns: 1fr; gap: .75rem; } .year-group h2 { position: static; } }
.pub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.4rem; }
.pub-title { font-weight: 600; font-size: 1.06rem; line-height: 1.4; margin: 0 0 .25rem; }
.pub-title a { color: var(--ink); text-decoration-color: var(--line); }
.pub-title a:hover { color: var(--brand-strong); text-decoration-color: currentColor; }
.pub-authors { margin: 0 0 .2rem; font-size: .98rem; }
.pub-authors a { font-weight: 600; color: var(--brand-strong); text-decoration: none; }
.pub-authors a:hover { text-decoration: underline; }
.pub-venue { margin: 0; color: var(--muted); font-size: .95rem; }
.pub-venue em { color: var(--ink); }
.pub-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; margin-top: .4rem; font-family: var(--display); font-size: .85rem; }
.pub-meta .tag { font-size: .75rem; padding: .2rem .45rem; color: var(--muted); }

.empty-state { padding: 2.5rem 0; max-width: 40rem; }
.empty-state h2 { font-size: 1.4rem; margin-bottom: .6rem; }
.empty-state code { font-size: .9em; background: var(--surface); border: 1px solid var(--line); padding: .1rem .35rem; border-radius: 3px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-deep); color: rgba(255, 255, 255, .82); padding: 2.75rem 0 3rem; font-size: .95rem; margin-top: clamp(2.5rem, 6vw, 4rem); }
.site-footer .wrap { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1.5rem 3rem; }
.site-footer strong { font-family: var(--display); font-weight: 600; color: #fff; font-size: 1.05rem; }
.site-footer p { margin: 0 0 .3rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .3rem; }
.site-footer a { color: #fff; }
.site-footer :focus-visible { outline-color: #fff; }
@media (max-width: 46rem) { .site-footer .wrap { grid-template-columns: 1fr; } }

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

@media print {
  .site-header, .site-footer, .pub-controls, .pub-status .actions, .active-filters, .chip-demo { display: none !important; }
  body { background: #fff; color: #000; }
}
