/* The QZhao Lab — site styles. Colours and fonts are set once in :root. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-display: swap; src: url("../fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }

:root {
  --ink: #15213b;
  --ink-2: #2a3550;
  --ink-3: #4a556c;
  --line: #e3e6ec;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --accent: #7d1a28;
  --accent-dark: #5a111c;
  --gold: #f1c75b;
  --sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --serif: "Source Serif 4", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --max: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.65; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }

.container { max-width: var(--max); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.section { padding-top: 96px; padding-bottom: 96px; }
.section-tight { margin-top: 64px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); text-decoration: none; }
.main-nav { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 15px; font-weight: 500; }
.main-nav a { color: var(--ink); text-decoration: none; padding: 10px 0; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a.active { border-bottom-color: var(--accent); color: var(--ink); }
.main-nav .lang-switch { border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; }
.main-nav .lang-switch:hover { border-color: var(--accent); }

/* Shared type */
.eyebrow { margin: 0 0 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.eyebrow a { color: inherit; text-decoration: none; }
.label { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.page-title { margin: 0 0 24px; font-family: var(--serif); font-size: 52px; line-height: 1.1; font-weight: 600; }
.section-title { margin: 0 0 56px; font-family: var(--serif); font-size: 44px; line-height: 1.15; font-weight: 600; }
.section-title.small { font-size: 30px; margin-bottom: 24px; }
.prose { max-width: 760px; color: var(--ink-2); }
.prose h2 { font-family: var(--serif); font-size: 28px; color: var(--ink); margin: 40px 0 12px; }
.prose li { margin-bottom: 6px; }
.note { font-size: 14px; color: var(--ink-3); }
.more { display: inline-block; font-weight: 600; text-decoration: none; padding: 10px 0; }

/* Hero — full-screen background image (path set by heroImage in data/site.json) with a dark wash for legible text */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; color: #fff;
  background-color: #14283a;
  background-image: linear-gradient(90deg, rgba(12,24,38,0.88) 0%, rgba(12,24,38,0.62) 55%, rgba(12,24,38,0.30) 100%), var(--hero-image, none);
  background-size: cover; background-position: center;
}
.hero-inner { flex-grow: 1; display: flex; flex-wrap: wrap; gap: 48px; align-items: center; padding-top: 140px; padding-bottom: 48px; }
.hero-text { flex: 1 1 560px; max-width: 820px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero .eyebrow { color: var(--gold); }
.hero-title { margin: 0; font-family: var(--serif); font-size: clamp(48px, 7vw, 76px); line-height: 1.02; font-weight: 600; letter-spacing: -0.01em; color: #fff; }
.hero-tagline { margin: 0; font-family: var(--serif); font-size: clamp(24px, 3vw, 32px); line-height: 1.25; color: #e8eef5; }
.rule { height: 2px; width: 72px; background: var(--gold); }
.summary { max-width: 720px; }
.summary .label { color: #fff; }
.summary-text p { margin: 8px 0 0; font-size: 19px; color: #eef2f7; }
.scroll-cue { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 0 28px; font-size: 13px; color: #e8eef5; text-decoration: none; }
.scroll-cue:hover { color: #fff; }

/* On the home page the header floats over the hero (on phones it sits in the hero's flow, see the media query) */
.home .site-header { position: absolute; top: 0; left: 0; right: 0; z-index: 5; background: transparent; border-bottom: none; }
.home main { position: relative; }
.home .brand, .home .main-nav a { color: #fff; }
.home .main-nav a:hover, .home .main-nav a.active { color: #fff; border-bottom-color: var(--gold); }
.home .main-nav .lang-switch { border-color: rgba(255,255,255,0.5); }
.home .main-nav .lang-switch:hover { border-color: #fff; }

/* Research directions: image with a text card floating over its edge */
.feature { display: flex; align-items: center; margin-bottom: 96px; }
.feature:last-child { margin-bottom: 0; }
.feature.reverse { flex-direction: row-reverse; }
.feature-media { flex: 0 0 58%; min-width: 0; }
.feature-img { width: 100%; height: 340px; object-fit: cover; border-radius: 12px; display: block; }
.feature-card { position: relative; z-index: 1; flex: 0 0 48%; margin-left: -6%; background: var(--surface); border-radius: 12px; padding: 36px 40px; box-shadow: 0 18px 48px rgba(21,33,59,0.16), 0 2px 6px rgba(21,33,59,0.06); }
.feature.reverse .feature-card { margin-left: 0; margin-right: -6%; }
.feature-card h2, .feature-card h3 { margin: 0 0 12px; font-family: var(--serif); font-size: 32px; line-height: 1.2; font-weight: 600; }
.feature-card p { margin: 0 0 10px; color: var(--ink-2); }
.feature-card .index { font-size: 14px; font-weight: 600; color: var(--accent); }
.figure-placeholder { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px dashed #9aa3b5; color: var(--ink-3); font-size: 15px; }
.section-flush { padding-bottom: 96px; }

/* Research detail */
.research-layout { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.research-layout .prose { flex: 999 1 560px; min-width: 0; }
.research-figure { flex: 1 1 320px; min-width: 0; }
.figure { width: 100%; height: 300px; object-fit: cover; border-radius: 12px; display: block; }

/* Publications */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { padding: 16px 0; border-bottom: 1px solid var(--line); }
.pub p { margin: 0; }
.pub-title { font-weight: 600; }
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { color: var(--ink-2); font-size: 15px; }
.pub-venue { color: var(--ink-3); font-size: 15px; }
.year-group { margin-top: 48px; }
.year { font-family: var(--serif); font-size: 28px; margin: 0 0 8px; color: var(--accent); }

/* News */
.news-list { list-style: none; margin: 0 0 16px; padding: 0; }
.news-item { display: flex; flex-wrap: wrap; gap: 4px 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.news-item time { flex: 0 0 150px; font-size: 15px; font-weight: 600; color: var(--ink-3); }
.news-body { flex: 1 1 400px; min-width: 0; }
.news-body p { margin: 0; }
.news-images { list-style: none; margin: 12px 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.news-thumb { display: block; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.news-thumb img { width: 168px; height: 112px; object-fit: cover; display: block; transition: transform 0.2s ease; }
.news-thumb:hover img, .news-thumb:focus-visible img { transform: scale(1.04); }
.news-images.compact .news-thumb img { width: 120px; height: 80px; }
.news-thumb.whole { background: #fff; border: 1px solid var(--line); }
.news-thumb.whole img { width: auto; height: auto; max-width: 100%; max-height: 112px; object-fit: contain; }
.news-images.compact .news-thumb.whole img { width: auto; height: auto; max-height: 80px; }
.news-images li { max-width: 100%; }

/* Lab-life album on the Team page */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gallery-thumb { display: block; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.gallery-thumb img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; display: block; transition: transform 0.25s ease; }
.gallery-thumb:hover img, .gallery-thumb:focus-visible img { transform: scale(1.04); }
.gallery-caption { margin: 6px 2px 0; font-size: 14px; color: var(--ink-3); }

/* Picture viewer for news and album images */
.lightbox { padding: 0; border: none; background: transparent; max-width: none; max-height: none; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 16, 28, 0.94); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-width: 90vw; max-height: 82vh; display: block; border-radius: 8px; }
.lightbox figcaption { color: #f3f5f9; font-size: 15px; max-width: 80vw; text-align: center; }
.lightbox-close, .lightbox-nav { position: fixed; width: 48px; height: 48px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-nav[hidden] { display: none; }
.news-preview { padding-top: 0; }

/* Team */
.pi { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.pi-photo { width: 220px; height: 260px; object-fit: cover; border-radius: 12px; }
.pi-text { flex: 1 1 420px; min-width: 0; }
.pi-text h3 { margin: 0; font-family: var(--serif); font-size: 30px; }
.role { margin: 4px 0 16px; color: var(--accent); font-weight: 500; }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 32px 24px; }
.people .avatar { width: 120px; height: 120px; font-size: 40px; }
.person { display: flex; flex-direction: column; gap: 4px; }
.avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--surface-2); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 32px; font-weight: 600; margin-bottom: 8px; }
.pi-photo.avatar { width: 220px; height: 260px; border-radius: 12px; font-size: 72px; }
.person-name { font-weight: 600; }
.person-role, .alumni-now { font-size: 15px; color: var(--ink-3); }
.alumni { list-style: none; margin: 0; padding: 0; }
.alumni li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.alumni-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.alumni-initial { display: flex; align-items: center; justify-content: center; background: var(--surface-2); font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--ink); }

/* Term notes */
.notes { max-width: 760px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; color: var(--ink-3); }
.notes-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.notes ol { margin: 0; padding-left: 20px; }
.notes p { margin: 0; }

/* Contact */
.contact { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 32px; max-width: 760px; margin: 0 0 24px; }
.contact dt { font-weight: 600; }
.contact dd { margin: 0; color: var(--ink-2); }

/* Footer */
.site-footer { background: var(--ink); color: #e6e9ef; margin-top: 64px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; padding-top: 56px; padding-bottom: 56px; font-size: 15px; }
.footer-col { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.footer-brand { font-family: var(--serif); font-size: 22px; font-weight: 600; color: #fff; }
.site-footer a { color: #fff; }

@media (max-width: 640px) {
  .section { padding-top: 64px; padding-bottom: 64px; }
  .page-title { font-size: 38px; }
  .section-title { font-size: 32px; margin-bottom: 36px; }
  .feature, .feature.reverse { flex-direction: column; align-items: stretch; margin-bottom: 64px; }
  .feature-media { flex: none; width: 100%; }
  .feature-img { height: 220px; }
  .feature-card, .feature.reverse .feature-card { flex: none; margin: -48px 16px 0; padding: 24px; }
  .feature-card h2, .feature-card h3 { font-size: 26px; }
  .figure { height: 220px; }
  .contact { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .news-thumb img { width: calc((100vw - 58px) / 2); height: auto; aspect-ratio: 3 / 2; }
  .news-images.compact .news-thumb img { width: 120px; height: 80px; }
  .news-thumb.whole img, .news-images.compact .news-thumb.whole img { width: auto; height: auto; aspect-ratio: auto; max-width: 100%; max-height: 112px; }
  .contact dd { margin-bottom: 12px; }
  .hero { min-height: auto; background-image: linear-gradient(rgba(12,24,38,0.80), rgba(12,24,38,0.80)), var(--hero-image, none); }
  .hero-inner { padding-top: 32px; }
  .home .site-header { position: static; background: #14283a; }
}

/* Portrait outline: photos with a plain white background would otherwise melt into the page. */
.avatar, .pi-photo, .alumni-photo {
  border: 2px solid color-mix(in srgb, var(--ink) 22%, transparent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 14%, transparent);
  box-sizing: border-box;
}

/* Join Us: open-position badge next to a position title */
.position-status { display: inline-block; vertical-align: middle; margin-left: 10px; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-family: var(--sans, inherit); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
