/* ===== Design tokens ===== */
:root {
  --c-navy: #1a2a55;
  --c-red: #cc0033;
  --c-gray: #6b6b6b;
  --c-ink: #1a1a1a;
  --c-muted: #555;
  --c-line: #e5e5e5;
  --c-bg: #ffffff;
  --c-bg-alt: #f7f7f8;
  --c-link: #1a2a55;
  --c-link-hover: #c8242a;

  --f-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --f-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;

  --maxw: 1100px;
  --gutter: 1.25rem;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
}

/* ===== Reset ===== */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-sans);
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.6;
  font-size: 17px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-link); text-decoration: none; }
a:hover { color: var(--c-link-hover); text-decoration: underline; }
h1, h2, h3, h4 {
  font-family: var(--f-serif);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.75rem, 2.4vw + 1rem, 2.6rem); }
h2 { font-size: clamp(1.4rem, 1.4vw + 1rem, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 2.5rem 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; background: var(--c-bg-alt); padding: 1px 5px; border-radius: 4px; }

/* ===== Layout ===== */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: 3rem 0; }
section + section { border-top: 1px solid var(--c-line); }

/* ===== Header / nav ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.nav { display: flex; align-items: center; justify-content: space-between; padding: .75rem 0; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 600; color: var(--c-ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; object-fit: contain; border: 1px solid #000; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text .t1 { font-family: var(--f-serif); font-size: 1.05rem; font-weight: 600; }
.brand-text .t2 { font-size: .72rem; color: var(--c-muted); letter-spacing: .04em; text-transform: uppercase; }
.nav-links { display: flex; gap: 1.25rem; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-size: .92rem; color: var(--c-ink); padding: .4rem 0; position: relative;
}
.nav-links a:hover { text-decoration: none; color: var(--c-red); }
.nav-links a.active { color: var(--c-red); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--c-red);
}
.nav-toggle {
  display: none; background: none; border: 1px solid var(--c-line); border-radius: var(--radius);
  width: 40px; height: 40px; cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--c-ink); position: relative;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--c-line);
    flex-direction: column; align-items: stretch; gap: 0; padding: .5rem var(--gutter) 1rem;
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
  }
  .nav.open .nav-links { max-height: 80vh; overflow: auto; }
  .nav-links a { padding: .75rem 0; border-bottom: 1px solid var(--c-line); }
  .nav-links a:last-child { border-bottom: 0; }
}

/* ===== Hero ===== */
.hero {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,.82) 55%, rgba(255,255,255,.98) 100%),
    url("../img/homepage.jpg") center/cover no-repeat #f4f4f6;
  padding: 5rem 0 4rem;
  text-align: center;
  border-bottom: 1px solid var(--c-line);
}
.hero-logo { width: 120px; height: 120px; margin: 0 auto 1.25rem; border: 2px solid #000; }
.hero h1 { margin-bottom: .25em; }
.hero .tagline {
  font-family: var(--f-serif); font-style: italic;
  color: var(--c-ink); font-size: 1.2rem; font-weight: 500;
  max-width: 640px; margin: 0 auto 1.5rem;
}
.hero-meta { color: var(--c-ink); font-size: .95rem; font-weight: 500; opacity: .85; }
.hero-meta a { color: var(--c-navy); font-weight: 600; }
.hero-actions { margin-top: 1.5rem; display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: var(--radius);
  font-size: .92rem; font-weight: 500; border: 1px solid var(--c-navy);
  color: var(--c-navy); background: #fff; transition: all .15s ease;
}
.btn:hover { background: var(--c-navy); color: #fff; text-decoration: none; }
.btn-primary { background: var(--c-navy); color: #fff; }
.btn-primary:hover { background: var(--c-red); border-color: var(--c-red); }
.btn-ghost { border-color: var(--c-line); color: var(--c-ink); }
.btn-ghost:hover { background: var(--c-bg-alt); color: var(--c-ink); }

/* ===== Section headings ===== */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.section-head .more { font-size: .9rem; }
.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--c-red); font-weight: 600; }

/* ===== Cards / grids ===== */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius);
  overflow: hidden; transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.card-img { aspect-ratio: 16/10; background: var(--c-bg-alt); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-date { font-size: .78rem; color: var(--c-muted); letter-spacing: .04em; text-transform: uppercase; }
.card-title { font-family: var(--f-serif); font-size: 1.1rem; margin: 0; color: var(--c-ink); }
.card-text { color: var(--c-muted); font-size: .94rem; margin: 0; }

/* ===== News (full list) ===== */
.news-list { display: flex; flex-direction: column; gap: 1.25rem; }
.news-item {
  display: grid; grid-template-columns: 180px 1fr; gap: 1.25rem;
  padding: 1rem; border: 1px solid var(--c-line); border-radius: var(--radius);
  background: #fff;
}
.news-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; background: var(--c-bg-alt); }
.news-item .news-date { font-size: .82rem; color: var(--c-red); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.news-item h3 { margin: .25rem 0 .35rem; font-family: var(--f-serif); }
.news-item p { color: var(--c-muted); font-size: .94rem; margin: 0; }
@media (max-width: 600px) {
  .news-item { grid-template-columns: 1fr; }
  .news-item img { aspect-ratio: 16/9; }
}

/* ===== Publications ===== */
.pub-tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--c-line); margin-bottom: 1.5rem; }
.pub-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: .55rem .95rem; margin-bottom: -1px; font-family: inherit; font-size: 1rem;
  font-weight: 600; color: var(--c-muted); cursor: pointer;
}
.pub-tab:hover { color: var(--c-ink); }
.pub-tab.is-active { color: var(--c-red); border-bottom-color: var(--c-red); }
.pub-panel[hidden] { display: none; }
.pubs-controls { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.5rem; }
.pubs-controls input[type="search"] {
  flex: 1; min-width: 220px; padding: .55rem .8rem; border: 1px solid var(--c-line);
  border-radius: var(--radius); font-size: .95rem; font-family: inherit;
}
.pubs-controls select {
  padding: .55rem .8rem; border: 1px solid var(--c-line); border-radius: var(--radius);
  background: #fff; font-size: .95rem; font-family: inherit;
}
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub-year { font-family: var(--f-serif); font-size: 1.4rem; margin: 1.5rem 0 .75rem; color: var(--c-navy); border-bottom: 2px solid var(--c-red); padding-bottom: .35rem; display: inline-block; }
.pub-item { padding: 1rem 0; border-bottom: 1px solid var(--c-line); }
.pub-item:last-child { border-bottom: 0; }
.pub-title { font-weight: 600; color: var(--c-ink); font-size: 1.02rem; }
.pub-authors { color: var(--c-muted); font-size: .94rem; margin: .25rem 0; }
.pub-authors .me { color: var(--c-navy); font-weight: 600; }
.pub-venue { font-style: italic; color: var(--c-ink); font-size: .94rem; }
.pub-links { margin-top: .4rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.pub-links a {
  font-size: .82rem; padding: .15rem .55rem; border: 1px solid var(--c-line); border-radius: 999px;
  color: var(--c-navy); background: #fff;
}
.pub-links a:hover { background: var(--c-navy); color: #fff; text-decoration: none; }
.pub-empty { color: var(--c-muted); font-style: italic; padding: 2rem 0; text-align: center; }

/* ===== Group members ===== */
.member { display: grid; grid-template-columns: 160px 1fr; gap: 1.25rem; padding: 1.25rem 0; border-bottom: 1px solid var(--c-line); align-items: start; }
.member:last-child { border-bottom: 0; }
.member-photo { width: 160px; aspect-ratio: 1; background: var(--c-bg-alt); border-radius: var(--radius); overflow: hidden; }
.member-photo img { width: 100%; height: 100%; object-fit: cover; }
.member h3 { margin: 0 0 .15rem; }
.member-period { font-size: .85rem; color: var(--c-muted); margin: 0 0 .5rem; }
.member-bio { color: var(--c-muted); font-size: .95rem; }
@media (max-width: 600px) {
  .member { grid-template-columns: 1fr; }
  .member-photo { width: 140px; }
}

/* ===== Software ===== */
.sw-card {
  border: 1px solid var(--c-line); border-radius: var(--radius); padding: 1.25rem;
  background: #fff; display: flex; flex-direction: column; gap: .5rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sw-card:hover { border-color: var(--c-navy); box-shadow: var(--shadow-sm); }
.sw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.sw-card h3 { margin: 0; font-family: var(--f-serif); }
.sw-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-red); font-weight: 600; }
.sw-desc { color: var(--c-muted); font-size: .95rem; margin: 0; }
.sw-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.sw-links a {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem; border: 1px solid var(--c-line); border-radius: var(--radius);
  font-size: .85rem; color: var(--c-navy); background: #fff;
}
.sw-links a:hover { background: var(--c-navy); color: #fff; text-decoration: none; border-color: var(--c-navy); }
.sw-links svg { width: 14px; height: 14px; }

/* ===== Page banner ===== */
.page-banner {
  position: relative;
  background:
    linear-gradient(180deg, rgba(26,42,85,.7) 0%, rgba(26,42,85,.85) 100%),
    url("../img/background.png") center/cover no-repeat;
  color: #fff; padding: 3rem 0 2.25rem; text-align: left;
}
.page-banner h1 { color: #fff; margin: 0; }
.page-banner p { color: rgba(255,255,255,.85); margin: .5rem 0 0; max-width: 720px; }
.page-banner .pub-profile-links a { color: #fff; text-decoration: underline; }
.page-banner .pub-profile-links a:hover { color: rgba(255,255,255,.85); }

/* ===== Footer ===== */
.site-footer {
  margin-top: 3rem; background: var(--c-bg-alt); border-top: 1px solid var(--c-line);
  padding: 2rem 0; color: var(--c-muted); font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-grid h4 { font-family: var(--f-sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-ink); margin-bottom: .5rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: .35rem; }
.footer-bottom { border-top: 1px solid var(--c-line); margin-top: 1.5rem; padding-top: 1rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ===== Research theme blocks ===== */
.theme-block { margin-bottom: 3rem; scroll-margin-top: 80px; }
.theme-block + .theme-block { padding-top: 2rem; border-top: 1px solid var(--c-line); }
.theme-head { margin-bottom: 1.25rem; }
.theme-head h2 {
  display: inline-block; margin: 0 0 .35rem;
  padding-bottom: .35rem; border-bottom: 3px solid var(--c-red);
}
.theme-head .muted { max-width: 760px; margin: 0; font-size: .95rem; }
/* Research grid: exactly 2 columns on desktop, 1 column on small screens */
.research-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (max-width: 780px) {
  .research-grid { grid-template-columns: 1fr; }
}

/* Project card: horizontal — graphical abstract on left, text on right */
.project-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.project-thumb {
  background:
    repeating-linear-gradient(45deg, #f3f4f8 0 8px, #e9eaf0 8px 16px);
  border-right: 1px solid var(--c-line);
  display: flex; align-items: center; justify-content: center;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-thumb-placeholder {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-muted); padding: .5rem; text-align: center; line-height: 1.3;
}

.project-card .card-body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .4rem; }
.project-card .card-title { font-size: 1.02rem; margin: 0; }
.project-card .card-text { font-size: .9rem; margin: 0; color: var(--c-muted); }
.cross-themes { font-size: .8rem; margin: .1rem 0 .25rem; }
.cross-themes a { color: var(--c-navy); }

@media (max-width: 540px) {
  .project-card { grid-template-columns: 1fr; }
  .project-thumb { aspect-ratio: 16/9; border-right: 0; border-bottom: 1px solid var(--c-line); }
}

/* ===== Sub-navigation (e.g. inside Teaching) ===== */
.subnav {
  display: flex; gap: .25rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--c-line);
  margin: -1rem 0 1.75rem;
}
.subnav a {
  padding: .65rem 1rem; font-size: .92rem; color: var(--c-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subnav a:hover { color: var(--c-ink); text-decoration: none; }
.subnav a.active { color: var(--c-red); border-bottom-color: var(--c-red); font-weight: 600; }

/* ===== Course cards (Teaching) ===== */
.course-card {
  display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem;
  padding: 1.25rem; border: 1px solid var(--c-line); border-radius: var(--radius);
  background: #fff; margin-bottom: 1.25rem; align-items: start;
}
.course-card:hover { box-shadow: var(--shadow-sm); }
.course-figure {
  width: 100%; aspect-ratio: 4/3; background: var(--c-bg-alt);
  border-radius: 4px; overflow: hidden;
}
.course-figure img { width: 100%; height: 100%; object-fit: cover; }
.course-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin: .15rem 0 .5rem; }
.course-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .8rem;
               color: var(--c-navy); background: var(--c-bg-alt); padding: .1rem .55rem; border-radius: 4px; }
.course-level { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--c-red); font-weight: 600; padding-top: .15rem; }
.course-term { font-size: .85rem; color: var(--c-muted); padding-top: .12rem; }
.course-card h3 { margin: 0 0 .35rem; font-family: var(--f-serif); }
.course-card p { margin: 0 0 .75rem; color: var(--c-muted); font-size: .95rem; }
.course-links { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 700px) {
  .course-card { grid-template-columns: 1fr; }
  .course-figure { aspect-ratio: 16/9; }
}

/* ===== Reading list ===== */
.reading-section { margin-bottom: 2rem; }
.reading-section h2 { font-size: 1.3rem; margin-bottom: .5rem; padding-bottom: .35rem; border-bottom: 2px solid var(--c-red); display: inline-block; }
.reading-list { list-style: none; padding: 0; margin: 0; }
.reading-list li { padding: .55rem 0; border-bottom: 1px solid var(--c-line); }
.reading-list li:last-child { border-bottom: 0; }
.reading-list .ref-title { font-weight: 600; color: var(--c-ink); }
.reading-list .ref-note { display: block; color: var(--c-muted); font-size: .9rem; margin-top: .15rem; }

/* ===== Utility ===== */
.text-center { text-align: center; }
.muted { color: var(--c-muted); }
.tag-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.tag { font-size: .75rem; padding: .15rem .55rem; background: var(--c-bg-alt); border-radius: 999px; color: var(--c-muted); }
