/*
 * HKU Philosophy: public site styles.
 * HKU Green #024638 (Pantone 3308C) leads; Pantone 2925 blue (darkened for text contrast)
 * for links and focus; HKU gold only for small highlights. Light and dark themes as tokens;
 * light is the default for everyone, dark only when the visitor picks it (data-theme="dark").
 */

:root {
  --green: #024638;
  --green-deep: #01352a;
  --green-tint: #e7f0ec;
  --blue: #0067a0;
  --blue-bright: #009cde;
  --gold: #b5975b;
  --gold-text: #7a5f22;

  --bg: #ffffff;
  --bg-alt: #f6f4ef;
  --surface: #ffffff;
  --border: #e2ded4;
  --text: #2b2a27;
  --text-muted: #5f5c55;
  --heading: #1d2a26;
  --link: var(--blue);
  --focus: var(--blue-bright);
  --chip-bg: var(--green-tint);
  --chip-text: var(--green);
  --shadow: 0 1px 2px rgba(20, 30, 26, .06), 0 4px 16px rgba(20, 30, 26, .06);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang HK", "Microsoft JhengHei", sans-serif;
  --font-head: "Source Serif 4", Georgia, "Times New Roman", "Songti TC", serif;
  --radius: 10px;
  --wrap: 1180px;
  --gutter: 16px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121a17;
  --bg-alt: #18221f;
  --surface: #1b2622;
  --border: #2d3a35;
  --text: #e6e3dc;
  --text-muted: #a8a49b;
  --heading: #f3f1ea;
  --link: #5cc0f0;
  --focus: #5cc0f0;
  --chip-bg: #213a32;
  --chip-text: #b9e4d6;
  --gold-text: #d9c48f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--font-body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 1.2rem + .8vw, 1.75rem); margin: 1.8em 0 .5em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 .4em; }
code { font-size: .9em; background: var(--bg-alt); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
address { font-style: normal; }
main { overflow-x: hidden; overflow-x: clip; min-height: 50vh; } /* clip: no sideways scroll, without cutting off dropdowns */
main:focus { outline: none; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow { max-width: 860px; }
.muted { color: var(--text-muted); }
.plain { list-style: none; padding: 0; margin: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--link); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; gap: .4em;
  background: var(--green); color: #fff; border: 2px solid var(--green);
  padding: .6em 1.15em; border-radius: 999px; font: 600 .95rem/1.2 var(--font-body);
  text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--green-deep); border-color: var(--green-deep); }
.button-ghost { background: transparent; color: var(--green); }
.button-ghost:hover { background: var(--green-tint); color: var(--green); }
.button-light { background: #fff; color: var(--green); border-color: #fff; }
.button-light:hover { background: #e5ddc8; border-color: #e5ddc8; color: var(--green); }
:root[data-theme="dark"] .button-ghost { color: #b9e4d6; border-color: #b9e4d6; }
:root[data-theme="dark"] .button-ghost:hover { background: #213a32; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5em; }

/* ── Prototype banner, header, navigation ────────────────────────────── */
.prototype-banner { background: #f3e9cf; color: #3d3220; font-size: .85rem; padding: 6px 0; border-bottom: 1px solid #e0d2a8; }
.prototype-banner a { color: #3d3220; }

.site-header { background: var(--green); color: #fff; position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; min-width: 0; }
.brand a { color: #fff; text-decoration: none; }
/* Official HKU logo: unmodified, white on green, with clear space around it. */
.brand-hku { display: block; padding: 4px 0; }
.brand-hku img { height: 46px; width: auto; }
.brand-dept { display: flex; align-items: center; gap: 10px; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.35); }
.brand-dept:hover .brand-name { text-decoration: underline; text-underline-offset: .2em; }
.brand-mark {
  flex: none; width: 26px; height: 35px; background: currentColor;
  -webkit-mask: url("../img/zhe.png") center / contain no-repeat;
  mask: url("../img/zhe.png") center / contain no-repeat;
}
.brand-name { font: 600 1.3rem/1.15 var(--font-head); }
@media (max-width: 599px) {
  .brand { flex-direction: column; align-items: flex-start; gap: 6px; }
  .brand-hku img { height: 32px; }
  .brand-dept { padding-left: 0; border-left: 0; }
  .brand-mark { width: 20px; height: 27px; }
  .brand-name { font-size: 1.12rem; }
}
.header-tools { display: flex; gap: 6px; }
.icon-button {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.icon-button:hover { background: rgba(255,255,255,.12); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

.site-nav { background: var(--green-deep); }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: #fff; text-decoration: none; display: block; font-weight: 500; }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--gold); }

/* Drop-downs: the label is a link to the section; the arrow button beside it opens the list (site.js). */
.has-menu { display: flex; flex-wrap: wrap; align-items: stretch; }
.has-menu > .nav-top { flex: 1 1 auto; }
.nav-menu-button {
  color: #fff; background: none; border: 0; font: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0 10px; min-width: 44px;
}
.nav-menu-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.has-menu.open > .nav-menu-button svg { transform: rotate(180deg); }
.nav-menu { display: none; flex-basis: 100%; }
.has-menu.open > .nav-menu { display: block; }

@media (max-width: 899px) {
  .site-nav { display: none; }
  .site-nav.open { display: block; }
  .site-nav .wrap > ul { padding: 6px 0 12px; }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .site-nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--gold); padding-left: 12px; }
  .nav-menu-button { border-bottom: 1px solid rgba(255,255,255,.1); }
  .site-nav .nav-menu { padding: 0 0 0 16px; }
  .site-nav .nav-menu a { font-weight: 400; }
}
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav ul { display: flex; gap: 4px; }
  .site-nav a { padding: 12px 14px; }
  .site-nav a:hover, .nav-menu-button:hover { background: rgba(255,255,255,.08); }
  .has-menu { position: relative; flex-wrap: nowrap; }
  .site-nav .has-menu > .nav-top { padding-right: 2px; }
  .nav-menu-button { padding: 0 10px 0 4px; min-width: 0; }
  .nav-menu-button[data-current] { box-shadow: inset 0 -3px 0 var(--gold); }
  .site-nav .nav-menu {
    display: none; position: absolute; top: 100%; left: 0; z-index: 30; min-width: 230px; padding: 6px 0;
    background: var(--green-deep); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); flex-direction: column; gap: 0;
  }
  .site-nav .has-menu.open > .nav-menu { display: flex; }
  .site-nav .nav-menu a { padding: 10px 16px; font-weight: 400; white-space: nowrap; }
  .site-nav .nav-menu a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold); }
}
@media (min-width: 900px) and (hover: hover) {
  .site-nav .has-menu:hover > .nav-menu { display: flex; }
}

/* ── Hero areas ──────────────────────────────────────────────────────── */
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--gold-text); margin: 0 0 .8em; }
.lede { font-size: 1.15rem; color: var(--text-muted); max-width: 46em; margin: 0; }

.home-hero { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.home-hero-inner { display: grid; gap: 28px; padding-top: 40px; padding-bottom: 40px; align-items: center; }
.home-hero h1 { font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.6rem); max-width: 14em; }
.home-hero-figure { margin: 0; }
.home-hero-figure img { border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
@media (min-width: 900px) {
  .home-hero-inner { grid-template-columns: 1.15fr 1fr; padding-top: 72px; padding-bottom: 72px; gap: 56px; }
}

.page-hero { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.page-hero-inner { padding-top: 36px; padding-bottom: 32px; display: grid; gap: 24px; align-items: center; }
.page-hero h1 { margin-bottom: .25em; }
.page-hero-image { border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; width: 100%; max-height: 280px; }
@media (min-width: 900px) {
  .page-hero.has-image .page-hero-inner { grid-template-columns: 1.4fr 1fr; padding-top: 48px; padding-bottom: 44px; }
}

/* ── Bands and cards ─────────────────────────────────────────────────── */
.band { padding: 48px 0; }
.band-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.band-green { background: var(--green); color: #fff; }
.band-green .band-title, .band-green a:not(.button) { color: #fff; }
.band-title { margin: 0 0 .8em; }
.band-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.more { font-weight: 600; font-size: .92rem; }
.more::after { content: " →"; }
.two-col { display: grid; gap: 40px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; gap: 56px; } }

.card-grid { display: grid; gap: 18px; }
@media (min-width: 700px) { .card-grid.two, .card-grid.three { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card h2, .card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.link-card { text-decoration: none; color: var(--text); display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.link-card:hover { box-shadow: var(--shadow); border-color: var(--green); }
.link-card p { flex: 1; }
.link-card .more { color: var(--link); }

.contact-band { display: grid; gap: 24px; }
@media (min-width: 700px) { .contact-band { grid-template-columns: 1fr 1fr; align-items: end; } }

/* Research area tiles */
.area-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 600px) { .area-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .area-grid { grid-template-columns: repeat(3, 1fr); } }
.area-tile {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px 20px; text-decoration: none; color: var(--text);
  border-radius: var(--radius); border: 1px solid var(--border); border-left: 4px solid var(--green); background: var(--surface);
}
.area-tile:hover { box-shadow: var(--shadow); }
.area-tile strong { font: 600 1.1rem/1.3 var(--font-head); color: var(--heading); }
.area-count { color: var(--text-muted); font-size: .85rem; margin-top: auto; }

/* ── Events and news lists ───────────────────────────────────────────── */
.event-list, .news-list { list-style: none; padding: 0; margin: 0; }
.event-item { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.event-item h3 { margin: 0 0 .2em; font-size: 1.1rem; }
.event-item h3 a { color: var(--heading); text-decoration: none; }
.event-item h3 a:hover { text-decoration: underline; }
.event-item p { margin: 0; }
.event-series { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-text); font-weight: 600; }
.date-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--chip-bg); color: var(--chip-text); border-radius: 8px; border-top: 3px solid var(--gold); height: 64px; line-height: 1.1;
}
.date-chip span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.date-chip strong { font: 600 1.5rem/1 var(--font-head); }
.event-list.past .date-chip { opacity: .75; }
.date-chip.range strong { font-size: 1.1rem; }
.past-year { border-bottom: 1px solid var(--border); }
.past-year > summary { cursor: pointer; padding: 12px 0; font: 600 1.15rem/1.3 var(--font-head); color: var(--heading); }
.past-year > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.date-chip.range span { font-size: .66rem; }

.news-item { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.news-item h2, .news-item h3 { margin: .15em 0 .3em; }
.news-item h2 a, .news-item h3 a { color: var(--heading); text-decoration: none; }
.news-item h2 a:hover, .news-item h3 a:hover { text-decoration: underline; }
.news-item p { margin: 0; }
.news-list.compact .news-item { padding: 12px 0; }
.news-list.compact h3 { font-size: 1.05rem; }

.subscribe { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-top: 28px; font-size: .95rem; }

.event-detail, .news-article { padding-bottom: 48px; }
.event-detail.has-image { display: grid; gap: 28px; }
@media (min-width: 800px) { .event-detail.has-image { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.event-poster { border-radius: var(--radius); box-shadow: var(--shadow); }
.news-article figure { margin: 0 0 1.5em; }
.news-article figure img { border-radius: var(--radius); width: 100%; }
.news-article .gallery { list-style: none; padding: 0; margin: 1.5em 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.news-article .gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.news-article .gallery a:focus-visible img { outline: 3px solid var(--focus, var(--link)); outline-offset: 2px; }
.video { position: relative; aspect-ratio: 16 / 9; margin: 1.5em 0; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── Section layout and prose ────────────────────────────────────────── */
.with-sidebar { display: grid; gap: 24px; padding-top: 28px; padding-bottom: 56px; }
@media (min-width: 900px) { .with-sidebar { grid-template-columns: 230px minmax(0, 1fr); gap: 48px; padding-top: 40px; } }
.prose-wrap { padding-top: 28px; padding-bottom: 56px; }
.section-nav { font-size: .95rem; }
.section-nav-title { font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--text-muted); margin: 0 0 .5em; }
.section-nav ul { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.section-nav a { display: block; padding: 6px 12px; color: var(--text); text-decoration: none; margin-left: -2px; border-left: 2px solid transparent; }
.section-nav a:hover { color: var(--link); }
.section-nav a[aria-current="page"] { border-left-color: var(--green); color: var(--heading); font-weight: 600; }
:root[data-theme="dark"] .section-nav a[aria-current="page"] { border-left-color: #b9e4d6; }
@media (max-width: 899px) {
  .section-nav ul { display: flex; flex-wrap: wrap; gap: 6px; border: 0; }
  .section-nav a { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; margin: 0; font-size: .88rem; }
  .section-nav a[aria-current="page"] { background: var(--chip-bg); border-color: var(--chip-bg); color: var(--chip-text); }
}

.prose { max-width: 46em; }
.prose > :first-child { margin-top: 0; }
.prose li { margin: .35em 0; }
.prose ul ul, .prose ul ol { margin: .4em 0; }
.prose h2 { padding-top: .2em; }
.callout { background: var(--chip-bg); color: var(--text); border-radius: var(--radius); padding: 14px 18px; margin-top: 2em; }
.section-title { margin-top: 2em; }
.breadcrumb { padding: 22px 0 6px; font-size: .9rem; color: var(--text-muted); }

/* ── People ──────────────────────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; padding: 24px 0 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.grow { flex: 1 1 280px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
input[type="search"], input[type="text"], input[type="password"], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .55em .75em; min-height: 44px; max-width: 100%;
}
input:focus-visible, select:focus-visible { outline-offset: 0; }
.filter-status { margin: 4px 0 0; color: var(--text-muted); }
/* Research-area chips: one click turns an area on; clicking the selected chip turns it off. */
.chip-filter { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; padding: 4px 0 6px; }
.chip-label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li[hidden] { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .9rem; line-height: 1.2;
}
.chip:hover { border-color: var(--green); color: var(--heading); }
.chip-count { font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.chip.on .chip-count { color: rgba(255,255,255,.8); }
.chip.on:hover { background: var(--green-deep); color: #fff; }
.chip-x { font-size: 1.15rem; line-height: 1; margin-left: 2px; }
:root[data-theme="dark"] .chip.on { background: #b9e4d6; border-color: #b9e4d6; color: #10231d; }
:root[data-theme="dark"] .chip.on .chip-count { color: #2b4a40; }

/* Shown whenever the directory is filtered: how many, by what, and how to undo it. */
.active-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 4px;
  padding: 12px 16px; border-radius: var(--radius); background: var(--chip-bg); border-left: 4px solid var(--green);
}
.active-filters[hidden] { display: none; }
.active-filters p { margin: 0; }
.active-filters strong { font-size: 1.1rem; }
.clear-all { font-weight: 600; font-size: .92rem; margin-left: auto; }
@media (max-width: 599px) {
  .hide-on-phone { display: none; }
  /* one swipeable row of area chips instead of a tall stack */
  .chip-filter .chips { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + var(--gutter)); padding: 2px var(--gutter) 6px 0; scrollbar-width: none; }
  .chip-filter .chips::-webkit-scrollbar { display: none; }
  .chip-filter .chip { white-space: nowrap; }
}
:root[data-theme="dark"] .active-filters { border-left-color: #b9e4d6; }
.jump-links { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 0 0; font-size: .92rem; }

.people-group { padding-top: 12px; scroll-margin-top: 12px; }
.people-group h2 { margin: 1.4em 0 .8em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.people-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .people-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .people-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .people-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.people-grid.small { gap: 16px 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 640px) { .people-grid.small { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .people-grid.small { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .people-grid.small { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.people-grid.small .photo { max-width: 140px; margin-bottom: 8px; }
.people-grid.small .photo-initials { font-size: 1.6rem; }
.people-grid.small .person-name { font-size: .95rem; }
.people-grid.small .person-title { font-size: .84rem; }
.person-card a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); height: 100%; }
.person-card .photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); margin-bottom: 10px; background: var(--bg-alt); transition: filter .15s; }
.person-card a:hover .photo { filter: brightness(1.05) saturate(1.05); }
.person-card a:hover .person-name { text-decoration: underline; }
.photo-initials { display: grid; place-items: center; font: 600 2.2rem/1 var(--font-head); color: var(--chip-text); background: var(--chip-bg) !important; }
.person-name { font: 600 1.05rem/1.3 var(--font-head); color: var(--heading); }
.person-title { font-size: .9rem; color: var(--text-muted); }
.person-role { font-size: .82rem; font-weight: 600; color: var(--gold-text); }
.person-areas { font-size: .82rem; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.people-grid.office .person-card a { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.person-card[hidden], .people-group[hidden] { display: none; }
#directory { padding-bottom: 56px; }

.profile { padding-bottom: 56px; }
.profile-head { display: grid; gap: 24px; padding: 12px 0 28px; border-bottom: 1px solid var(--border); }
.profile-photo { width: 200px; height: 200px; border-radius: 12px; object-fit: cover; }
.profile-photo.photo-initials { font-size: 3.4rem; }
@media (min-width: 700px) { .profile-head { grid-template-columns: 240px 1fr; gap: 36px; align-items: start; } .profile-photo { width: 240px; height: 240px; } }
.profile h1 { margin: 0 0 .1em; }
.profile-title { font-size: 1.15rem; color: var(--text-muted); margin: 0 0 .6em; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 .8em; }
.badge { background: var(--chip-bg); color: var(--chip-text); font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.appointments { margin: 0 0 1em; color: var(--text); }
.appointments li { padding: 2px 0; }
.contact-list { margin: 0; display: grid; gap: 4px; }
.contact-list div { display: grid; grid-template-columns: 80px 1fr; gap: 10px; }
.contact-list dt { color: var(--text-muted); font-size: .9rem; padding-top: .1em; }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }
.profile-body { display: grid; gap: 32px; padding-top: 12px; }
@media (min-width: 900px) { .profile-body { grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; } }
.profile-side h2 { font-size: 1.05rem; margin: 1.8em 0 .6em; font-family: var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags a { display: inline-block; padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px; font-size: .88rem; text-decoration: none; color: var(--text); background: var(--surface); }
.tags a:hover { border-color: var(--green); color: var(--link); }
.pub-list ul { padding-left: 0; list-style: none; }
.pub-list li { padding-left: 1.2em; text-indent: -1.2em; margin: .6em 0; }
.course-mini { padding-left: 0; list-style: none; }
.code { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--heading); letter-spacing: .01em; }

/* Research */
.area-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.area-list li { border-bottom: 1px solid var(--border); padding: 4px 0 16px; }
.area-list h3 { margin: .8em 0 .2em; }
.area-list p { margin: .3em 0; }
.faces { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.face.photo-initials { font-size: .9rem; }
.pub-person h2 { font-size: 1.3rem; }
.pub-person h2 a { color: var(--heading); text-decoration: none; }
.pub-person h2 a:hover { text-decoration: underline; }

/* Courses */
.course-block h2 { margin-top: 1.4em; }
.course-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.course-list li { display: grid; gap: 2px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
@media (min-width: 700px) { .course-list li { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 220px); align-items: baseline; } }
.course-who { color: var(--text-muted); font-size: .92rem; }
.tag-inline { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 4px; background: var(--chip-bg); color: var(--chip-text); margin-left: 6px; vertical-align: 2px; }

/* Contact */
.contact-cards { padding-top: 32px; }
.contact-cards h2 { font-size: 1.15rem; }
.ask-grid { margin-bottom: 56px; }
.ask-card h3 { margin-bottom: .2em; font-size: 1.2rem; }
.ask-card > .muted { margin-top: 0; font-size: .93rem; }
.ask-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--gold-text); margin: 1.1em 0 .3em; }
.ask-people { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .95rem; }
.ask-people a[href^="mailto"] { overflow-wrap: anywhere; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer { background: var(--green-deep); color: #dfe8e4; font-size: .93rem; padding: 40px 0 20px; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 28px; }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; } }
.footer-title { font: 600 1.05rem/1.3 var(--font-head); color: #fff; margin: 0 0 .6em; }
.footer-hku { display: inline-block; margin-bottom: 18px; }
.footer-hku img { height: 44px; width: auto; }
.footer-grid li { margin: .25em 0; }
.footer-note { border-top: 1px solid rgba(255,255,255,.15); margin-top: 28px; padding-top: 16px; font-size: .82rem; color: #c3d2cc; }

/* ── Demo gate ───────────────────────────────────────────────────────── */
.gate-body { background: var(--green); min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate-screen { width: 100%; max-width: 420px; }
/* The card stays light in both themes: the full-colour HKU logo needs a light ground. */
.gate-box { background: #fff; color: #2b2a27; border-radius: 14px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.25); display: grid; gap: 14px; color-scheme: light; }
.gate-logo { height: 48px; width: auto; margin-bottom: 8px; }
.gate-box h1 { font-size: 1.6rem; margin: 0; color: #1d2a26; }
.gate-box p { margin: 0; color: #5f5c55; }
.gate-box input { background: #fff; color: #2b2a27; border-color: #e2ded4; }
.gate-box .button { justify-content: center; }
.gate-error { color: #b3261e !important; font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .prototype-banner, .site-nav, .header-tools, .site-footer, .section-nav, .filter-bar { display: none !important; }
  .site-header { background: none; color: #000; }
}

/* ── Calendar menus (Subscribe / Add to calendar) ─────────────────────── */
.events-tools { display: flex; justify-content: flex-end; margin-top: 24px; }
.cal-menu { position: relative; display: inline-block; }
.cal-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.cal-menu summary::-webkit-details-marker { display: none; }
.cal-add { margin-top: 6px; font-size: .88rem; font-weight: 600; color: var(--link); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; background: var(--surface, var(--bg)); }
.cal-add:hover, .cal-menu[open] .cal-add { border-color: var(--link); }
.cal-drop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 240px; max-width: min(340px, calc(100vw - 32px));
  background: var(--surface, var(--bg)); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid; }
.cal-subscribe .cal-drop { left: auto; right: 0; }
.cal-drop a { padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .93rem; }
.cal-drop a:hover, .cal-drop a:focus-visible { background: var(--bg-alt); color: var(--heading); }
.cal-note { margin: 4px 10px 6px; font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.cal-note code { font-size: .78rem; }
.event-cal { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 1.2em 0; }
.event-cal .cal-add { margin-top: 0; font-size: .95rem; padding: 6px 14px; }
.cal-subscribe.quiet summary { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; font-weight: 400; min-height: 0; }
.cal-subscribe.quiet .cal-drop { left: 0; right: auto; }

/* ── Labs (home and Research) ────────────────────────────────────────── */
.lab-list { display: grid; gap: 18px; }
.lab-card { border-top: 3px solid var(--green); }
.lab-card h3 { font-size: 1.3rem; }
.lab-list .lab-card p { margin: .4em 0; }

/* ── Publications, grants, talks and media (includes/outputs.php) ────── */
.output-list { list-style: none; margin: 0 0 8px; padding: 0; }
.output-item { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.output-item.has-image { grid-template-columns: 72px 1fr; }
.output-image { width: 72px; height: auto; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-alt); }
.output-image.cover { box-shadow: var(--shadow); }
.output-body { min-width: 0; overflow-wrap: anywhere; }
.output-line { margin: 0; }
.output-line cite { font-style: italic; }
.output-abstract { margin-top: 6px; font-size: .95rem; color: var(--text-muted); }
.output-abstract > summary { cursor: pointer; color: var(--link); font-weight: 500; font-size: .9rem; }
.output-abstract > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.output-abstract p { margin: .5em 0 0; }
.output-list .video { margin-top: 10px; }
.year-head { font-size: 1.05rem; margin: 22px 0 2px; color: var(--text-muted); }
.output-list.books .output-item.has-image { grid-template-columns: 96px 1fr; }
.output-list.books .output-image { width: 96px; }
@media (min-width: 900px) {
  .home-research { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; }
}
.prose .output-list { padding-left: 0; }
.prose .output-list li { margin: 0; }

.podcast-list { display: grid; gap: 18px; }
.podcast { display: flex; gap: 18px; align-items: flex-start; align-self: start; }
.podcast-art { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; }
.podcast h3 { margin: 0 0 .3em; }
.podcast .eyebrow { margin: 0 0 .3em; }
.podcast-latest { margin: .6em 0; }
.podcast audio { width: 100%; max-width: 420px; margin-top: 6px; }
@media (max-width: 599px) { .podcast { flex-direction: column; } }

.edit-own { margin: 6px 0 10px; }
.add-own { font: 500 .85rem var(--font-body); margin-left: 8px; }
.button.button-small { padding: .35em .9em; font-size: .85rem; }
@media (min-width: 700px) {
  .output-list.media-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  .output-list.media .video { margin-bottom: 0; }
}

/* ── News & Events: events (wider) beside news; stacked on phones ─────── */
.ne-cols { display: grid; gap: 40px; padding: 32px 0 8px; }
@media (min-width: 900px) { .ne-cols { grid-template-columns: 3fr 2fr; gap: 56px; } }
.ne-cols .band-head { align-items: center; flex-wrap: wrap; gap: 10px; }
.ne-past { padding-bottom: 40px; max-width: 860px; }
@media (min-width: 900px) and (hover: hover) {
  .site-nav .has-menu:hover > .nav-top, .site-nav .has-menu:hover > .nav-menu-button { background: rgba(255,255,255,.08); }
}

/* Links to other sites: the ↗ icon (added by site.js) */
.ext-icon { display: inline-block; width: .8em; height: .8em; margin-left: .22em; vertical-align: -.05em;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.more.ext::after { content: none; }   /* "Website ↗", not "Website → ↗" */
.with-sidebar > * { min-width: 0; }               /* a long web address must not widen the column */
.prose a { overflow-wrap: anywhere; }
.band-head { margin-bottom: 16px; }
