/* Prof. Boon Chirn Chye - group site. Colours and fonts are set once, in :root. */
:root {
  --substrate: #0b3c3f;      /* deep teal, the dark bands */
  --substrate-2: #135559;
  --substrate-3: #1d6b6f;
  --gold: #e3b63e;           /* bond-wire gold, the single accent */
  --gold-ink: #6b5100;       /* gold-family text on light backgrounds */
  --paper: #f5f7f6;
  --surface: #ffffff;
  --line: #d3dcda;
  --ink: #142629;
  --muted: #4d6266;
  --link: #0b5a5f;
  --radius: 6px;
  --wrap: 1120px;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "IBM Plex Sans Condensed", "IBM Plex Sans", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--font-body); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--substrate); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--ink); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 1em; max-width: 68ch; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { font: 700 1.25rem/1 var(--font-head); color: var(--substrate); text-decoration: none; white-space: nowrap; }
.brand span { display: block; font: 400 .78rem/1.3 var(--font-body); color: var(--muted); margin-top: 3px; }
.nav { display: flex; gap: 2px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; padding: 8px 11px; border-radius: var(--radius); font-size: .97rem; }
.nav a:hover { background: var(--paper); }
.nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--gold); font-weight: 600; }
.nav .nav-cta { background: var(--substrate); color: #fff; margin-left: 6px; }
.nav .nav-cta:hover { background: var(--substrate-2); color: #fff; }
.nav .nav-cta[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--gold); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; font: inherit; color: var(--ink); cursor: pointer; }
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 20px 14px; display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; }
  .nav .nav-cta { margin: 6px 0 0; text-align: center; }
}

/* buttons */
.btn { display: inline-block; font: 600 1rem/1 var(--font-body); padding: 14px 22px; border-radius: var(--radius); text-decoration: none; border: 2px solid transparent; cursor: pointer; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #f0c653; color: var(--ink); }
.btn-line { border-color: currentColor; color: #fff; }
.btn-line:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-dark { background: var(--substrate); color: #fff; }
.btn-dark:hover { background: var(--substrate-2); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* hero with the frequency ruler */
.hero { background: var(--substrate); color: #eaf3f2; padding: 64px 0 56px; }
.hero h1 { color: #fff; max-width: 17ch; margin-bottom: .4em; }
.hero .lead { color: #c5dad8; }
.hero a:not(.btn) { color: var(--gold); }
.ruler { margin-top: 36px; }
.ruler-track { position: relative; height: 40px; margin-top: 44px; border-top: 2px solid var(--gold); }
.ruler-decade { position: absolute; top: 0; height: 100%; border-left: 1px solid rgba(255,255,255,.28); }
.ruler-decade span { position: absolute; top: -30px; left: 6px; font: 400 .78rem/1 var(--font-mono); color: #a9c7c5; white-space: nowrap; }
.ruler-dot { position: absolute; top: -13px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; border: 3px solid var(--gold); background: var(--substrate); cursor: pointer; padding: 0; }
.ruler-dot::after { content: attr(data-label); position: absolute; top: 34px; left: 50%; transform: translateX(-50%); font: 400 .8rem/1 var(--font-mono); color: #d8e8e6; white-space: nowrap; }
.ruler-dot:hover, .ruler-dot[aria-pressed="true"] { background: var(--gold); }
.ruler-dot[aria-pressed="true"]::after { color: var(--gold); font-weight: 500; }
.ruler-axis { display: flex; justify-content: space-between; font: 400 .78rem/1 var(--font-mono); color: #8fb2b0; margin-top: 26px; }
.ruler-detail { margin-top: 18px; min-height: 8.5em; max-width: 64ch; border-left: 3px solid var(--gold); padding-left: 18px; }
.ruler-detail h3 { color: #fff; margin-bottom: .3em; }
.ruler-detail p { margin: 0 0 .5em; color: #d3e4e2; }
.ruler-detail .ref { font: 400 .85rem/1.4 var(--font-mono); color: var(--gold); }
@media (max-width: 640px) { .ruler-decade span { font-size: .7rem; } .ruler-detail { min-height: 11em; } }

/* sections */
.section { padding: 64px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { margin-bottom: 28px; }
.section-head p { color: var(--muted); }
.page-title { background: var(--substrate); color: #fff; padding: 48px 0 40px; }
.page-title h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: .25em; }
.page-title p { color: #c5dad8; margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 48px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 820px) { .split, .split-wide { grid-template-columns: 1fr; gap: 24px; } }
.portrait { border-radius: var(--radius); width: 100%; max-width: 320px; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 12%; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 24px 0 0; padding: 0; list-style: none; }
.stats li { font-size: .95rem; color: var(--muted); }
.stats strong { font: 700 1.6rem/1.1 var(--font-head); color: var(--substrate); margin-right: 6px; }

/* research themes */
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 40px; }
.theme { border-top: 3px solid var(--substrate); padding: 18px 0 28px; }
.theme h3 { margin-bottom: .3em; }
.theme p { color: var(--muted); margin-bottom: .6em; }
.theme ul { margin: 0; padding-left: 1.1em; font-size: .95rem; }
.theme li { margin-bottom: .3em; }

/* lists of items: news, recent papers */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.feed .date { font: 400 .85rem/1.7 var(--font-mono); color: var(--muted); }
.feed p { margin: 0; }
@media (max-width: 560px) { .feed li { grid-template-columns: 1fr; gap: 2px; } }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.recent li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.recent .where { font: 500 .82rem/1.4 var(--font-mono); color: var(--gold-ink); }
.recent .ttl { display: block; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chip { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 13px; font-size: .9rem; color: var(--ink); }
button.chip { cursor: pointer; font-family: inherit; }
button.chip:hover { border-color: var(--substrate-3); }
button.chip[aria-pressed="true"] { background: var(--substrate); border-color: var(--substrate); color: #fff; }
.chips-dark .chip { background: transparent; border-color: rgba(255,255,255,.35); color: #eaf3f2; }

/* join page */
.callout { background: var(--substrate); color: #eaf3f2; border-radius: var(--radius); padding: 28px 30px; }
.callout h2, .callout h3 { color: #fff; }
.callout p { color: #d3e4e2; }
.callout a:not(.btn) { color: var(--gold); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px 32px; margin: 0; padding: 0; list-style: none; }
.facts li { border-left: 3px solid var(--gold); padding-left: 16px; }
.facts strong { display: block; font: 600 1.1rem/1.3 var(--font-head); color: var(--substrate); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 22px 52px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--substrate); color: #fff; font: 600 1rem/34px var(--font-head); text-align: center; }
.steps li::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps strong { display: block; }
.funding { display: grid; gap: 0; }
.fund { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr) minmax(0, 1fr); gap: 8px 28px; padding: 20px 0; border-top: 1px solid var(--line); }
.fund h3 { font-size: 1.1rem; margin: 0; }
.fund p { margin: 0; font-size: .95rem; }
.fund .when { font: 500 .85rem/1.5 var(--font-mono); color: var(--gold-ink); }
@media (max-width: 820px) { .fund { grid-template-columns: 1fr; } }
details.faq { border-top: 1px solid var(--line); padding: 14px 0; }
details.faq:last-of-type { border-bottom: 1px solid var(--line); }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details.faq summary::after { content: "+"; font: 400 1.3rem/1 var(--font-mono); color: var(--substrate-3); }
details.faq[open] summary::after { content: "\2212"; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq p { margin: 10px 0 0; color: var(--muted); }
.figure { margin: 0; }
.figure img { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.figure figcaption { font-size: .88rem; color: var(--muted); margin-top: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }

/* publications */
.toolbar { display: grid; gap: 14px; margin-bottom: 24px; position: sticky; top: 64px; background: var(--paper); padding: 12px 0; z-index: 10; border-bottom: 1px solid var(--line); }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field { font: inherit; padding: 10px 12px; border: 1px solid #aebdbb; border-radius: var(--radius); background: #fff; color: var(--ink); min-width: 0; }
.field-search { flex: 1 1 260px; }
.count { color: var(--muted); font-size: .92rem; margin-left: auto; }
.yearhead { font: 700 1.6rem/1 var(--font-head); color: var(--substrate); margin: 32px 0 6px; padding-top: 6px; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 6px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .97rem; }
.pub .pid { font: 500 .82rem/1.9 var(--font-mono); color: var(--muted); }
.pub .body { max-width: 86ch; min-width: 0; overflow-wrap: anywhere; }
.pub .links { display: flex; gap: 12px; margin-top: 4px; font-size: .88rem; font-weight: 500; }
.pub .badge { display: inline-block; font: 500 .75rem/1 var(--font-mono); padding: 3px 7px; border-radius: 3px; background: #e5eeed; color: var(--substrate); margin-left: 6px; vertical-align: 1px; }
.empty { padding: 32px 0; color: var(--muted); }

/* people, grants tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .96rem; min-width: 640px; }
table.data th { text-align: left; font: 600 .9rem/1.3 var(--font-head); color: var(--muted); padding: 10px 14px 10px 0; border-bottom: 2px solid var(--substrate); }
table.data td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td.nm { font-weight: 600; white-space: nowrap; }
.tag { display: inline-block; font: 500 .75rem/1 var(--font-mono); padding: 4px 8px; border-radius: 3px; }
.tag-active { background: var(--gold); color: var(--ink); }
.tag-done { background: #e5eeed; color: var(--muted); }
.awards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.award { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.award .yr { font: 700 1.15rem/1.4 var(--font-head); color: var(--substrate); }
.award p { margin: 0; }
.award img { margin-top: 10px; max-width: 220px; border-radius: var(--radius); border: 1px solid var(--line); }

/* teaching */
.pillars { margin: 0; padding: 0; list-style: none; counter-reset: p; display: grid; gap: 14px; }
.pillars li { counter-increment: p; padding-left: 46px; position: relative; }
.pillars li::before { content: counter(p); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--ink); font: 700 1rem/32px var(--font-head); text-align: center; }

/* footer */
.site-footer { background: var(--substrate); color: #c5dad8; padding: 40px 0 32px; font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px 40px; }
.site-footer h2 { font-size: 1.05rem; color: #fff; }
.site-footer p { margin: 0 0 .4em; }
.site-footer .fine { margin-top: 28px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.2); font-size: .85rem; color: #9cbdbb; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
@media print { .site-header, .nav-toggle, .toolbar, .btn-row { display: none !important; } body { background: #fff; } .hero, .page-title, .site-footer, .callout { background: #fff; color: #000; } }

/* publication thumbnails (chip photos and key results) */
.pub.has-thumb { grid-template-columns: 54px minmax(0, 1fr) 150px; }
.pub .pthumb { display: block; align-self: start; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #fff; }
.pub .pthumb img { display: block; width: 100%; height: 100px; object-fit: cover; object-position: center; }
@media (max-width: 640px) {
  .pub.has-thumb { grid-template-columns: 44px minmax(0, 1fr); }
  .pub .pthumb { grid-column: 2; width: 180px; }
}

/* member photos */
td.nm { white-space: normal; padding-right: 18px; min-width: 14em; }
td.nm .nmt { display: inline-block; vertical-align: middle; white-space: normal; max-width: 9em; }
td.nm .avatar { display: inline-block; vertical-align: middle; width: 40px; height: 50px; margin-right: 12px; border-radius: 4px; object-fit: cover; background: #e5eeed; }
td.nm .avatar-none { display: inline-flex; align-items: center; justify-content: center; font: 600 .8rem/1 var(--font-mono); color: var(--substrate); letter-spacing: .02em; }
@media (max-width: 640px) { td.nm { white-space: normal; } td.nm { min-width: 11em; } td.nm .nmt { max-width: 6.2em; } td.nm .avatar { width: 32px; height: 40px; margin-right: 8px; } }

/* group photos by year */
.years { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px 20px; margin-top: 20px; align-items: start; }
.years figure { margin: 0; }
.years img { display: block; width: 100%; height: auto; border-radius: 4px; }
.years figcaption { margin-top: 6px; font: 500 .9rem/1.3 var(--font-mono); color: var(--muted); }
.years-main { grid-row: span 2; }
@media (max-width: 720px) { .years { grid-template-columns: minmax(0, 1fr); } .years-main { grid-row: auto; } }
