:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #141414;
  --mute: #6b6b6b;
  --faint: #a3a3a3;
  --rule: #e7e7e5;
  --accent: #141414;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(20px, 4vw, 56px);
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.06), 0 18px 40px -14px rgba(20, 20, 20, 0.28);
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: rgba(20, 20, 20, 0.35); }
a:hover { text-decoration-color: currentColor; }

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

/* ---------- Navigation ---------- */

.nav {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px var(--gutter);
  font-size: 14px;
}
.nav a { display: inline-block; padding: 12px 0; text-decoration: none; }
.nav a:hover { color: var(--mute); }
.nav__name { font-weight: 500; }
.nav__links { display: flex; gap: clamp(16px, 2.4vw, 28px); color: var(--mute); }
.nav__links a:hover { color: var(--ink); }

/* ---------- Hero: a short introduction ---------- */

.hero { max-width: 980px; margin: 0 auto; padding: clamp(104px, 15vh, 150px) var(--gutter) 0; }
.hero__title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 4.4vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.012em;
}
.hero p { max-width: 720px; margin: 0 0 14px; font-size: clamp(16.5px, 1.3vw, 18px); line-height: 1.7; color: #3a3a3a; }

/* ---------- Sections: compact rows ---------- */

.section { max-width: 980px; margin: 0 auto; padding: clamp(64px, 10vh, 112px) var(--gutter) 0; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.section__head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 3.6vw, 48px); line-height: 1.05; letter-spacing: -0.01em; }
.section__head p { margin: 0; font-size: 13px; color: var(--faint); }

.row {
  display: grid;
  grid-template-columns: 56px 150px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
}
.row:last-child { border-bottom: 1px solid var(--rule); }
.row__badge { display: block; width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 1px 2px rgba(20, 20, 20, 0.06), 0 8px 18px -8px rgba(20, 20, 20, 0.28); }
.row__when { margin: 0; padding-top: 5px; font-size: 14px; color: var(--mute); font-variant-numeric: tabular-nums; }
.row__what h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; }
.row__what p { margin: 6px 0 0; max-width: 580px; color: var(--mute); }
.row__what a { color: var(--ink); }
.row__project { color: var(--ink); font-style: italic; }
.row__what strong { color: var(--ink); font-weight: 500; }
.row__links { font-size: 14px; }

/* Two study tracks at HKU, drawn as lines on a 2022–2026 axis. */
.tracks { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 10px 18px; max-width: 440px; margin: 16px 0 0; }
.track__name { font-size: 13.5px; color: var(--mute); white-space: nowrap; }
.track__name--cs { color: var(--ink); }
.track__line { position: relative; height: 2px; background: var(--rule); }
.track__line i { position: absolute; top: 0; bottom: 0; left: var(--from); width: var(--span); background: #c9c9c6; }
.track__line i::before,
.track__line i::after { content: ""; position: absolute; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: inherit; }
.track__line i::before { left: -4px; }
.track__line i::after { right: -4px; }
.track__line--cs i { background: var(--accent); }
.track__years { position: relative; height: 18px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.track__years span { position: absolute; left: var(--at); transform: translateX(-50%); }

/* ---------- Contact ---------- */

.contact { display: flex; flex-direction: column; align-items: center; text-align: center; padding: clamp(96px, 14vh, 160px) var(--gutter) 88px; }
.contact__badge { width: 76px; height: 76px; border-radius: 50%; box-shadow: var(--shadow); }
.contact__kicker { margin: 22px 0 8px; font-size: 13px; color: var(--mute); }
.contact h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5.4vw, 72px); line-height: 1.05; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.contact h2 a { text-decoration: none; }
.contact h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.contact__links { display: flex; justify-content: center; gap: 28px; margin: 18px 0 0; font-size: 14px; color: var(--mute); }
.contact__links a { display: inline-block; padding: 10px 0; text-decoration: none; }
.contact__links a:hover { color: var(--ink); }

.credits { max-width: 980px; margin: 0 auto; padding: 22px var(--gutter) 44px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--faint); }
.credits p { margin: 0 0 4px; }

/* Rows settle in once as they are reached. */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Phones ---------- */

@media (max-width: 760px) {
  .hero { padding-top: 88px; }
  .nav .nav__name { display: none; }
  .nav { justify-content: flex-end; }

  .row { grid-template-columns: 44px minmax(0, 1fr); gap: 4px 18px; padding: 20px 0; }
  .row__badge { width: 44px; height: 44px; grid-row: 1 / span 2; }
  .row__when { grid-column: 2; padding-top: 0; font-size: 13px; }
  .row__what { grid-column: 2; }
  .row__what h3 { font-size: 25px; }
  .row__what p { font-size: 15px; }
  .track__minor { display: none; }
  .tracks { padding-right: 12px; }
}
