/* ==========================================================================
   Huiyi Chen — Swiss minimal
   One grotesque typeface · strict left grid · black + one red · hairlines
   ========================================================================== */

:root {
  /* colour */
  --bg:      #ffffff;
  --ink:     #101010;
  --body:    #2c2c2c;
  --mut:     #6e6e6e;
  --faint:   #9a9a9a;
  --rule:    #e6e6e6;
  --acc:     #c8102e;

  /* type */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
          "Segoe UI", Arial, sans-serif;

  /* metrics */
  --measure: 1080px;
  --gutter:  56px;
}

/* suppresses animation while the header is being measured */
.no-anim, .no-anim * { transition: none !important; }

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------- base */

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  font-feature-settings: "kern" 1, "liga" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 1px;
}

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  z-index: 50;
}
.skip:focus { left: 8px; top: 8px; }

/* ----------------------------------------------------------------- header */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.masthead .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding-block: 56px 26px;
  text-align: center;
  transition: gap .26s ease, padding .26s ease;
}

/* shrinks once the page is scrolled, so the bar stays out of the way */
.masthead.compact .wrap { gap: 13px; padding-block: 18px 12px; }
.masthead.compact .mark { font-size: clamp(17px, 2vw, 22px); letter-spacing: .2em; margin-right: -.2em; }
.masthead.compact .nav a { font-size: 11.5px; }

/* the name — set large, on the page axis */
.mark {
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 700;
  letter-spacing: .26em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.05;
  /* tracking adds space after the last letter; pull it back to stay centred */
  margin-right: -.26em;
  transition: font-size .26s ease, letter-spacing .26s ease;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 52px;
}

.nav a {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mut);
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--acc); }

/* ------------------------------------------------------------------- main */

main { padding-block: 76px 96px; transition: padding-top .26s ease; }

/* section label — the horizontal rule with a tracked caption beneath it */
.label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  padding-top: 14px;
  margin-bottom: 42px;
}

.group + .group { margin-top: 78px; }

/* ------------------------------------------------------------------- bio */

/* centred column: portrait above, bio beneath, both on the page axis */
.bio {
  max-width: 840px;
  margin-inline: auto;
  text-align: center;
}

.portrait {
  width: 260px;
  margin: 0 auto 50px;
}
.portrait img { border-radius: 50%; }

.lede {
  font-size: 22px;
  line-height: 1.52;
  letter-spacing: -.01em;
  font-weight: 500;
  margin-bottom: 26px;
}

.prose p {
  font-size: 17px;
  line-height: 1.74;
  color: var(--body);
}
.prose p + p { margin-top: 18px; }

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 18px;
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mut);
}
.contact a {
  color: var(--ink);
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
  text-decoration-color: var(--acc);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* profile links sitting beside the email */
.social {
  display: inline-flex;
  align-items: center;
  gap: 15px;
}
.social::before {
  content: "";
  width: 1px;
  height: 14px;
  background: var(--rule);
  margin-right: 3px;
}
.social a {
  display: inline-flex;
  color: var(--mut);
  transition: color .18s ease;
}
.social a:hover { color: var(--acc); }
.social svg { width: 19px; height: 19px; display: block; }

/* -------------------------------------------------------------- research */

.entry + .entry { margin-top: 64px; }

.entry h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -.015em;
  font-weight: 600;
  margin-bottom: 8px;
}
.entry h2 a {
  text-decoration: underline;
  text-decoration-color: var(--acc);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  transition: color .18s ease;
}
.entry h2 a:hover { color: var(--acc); }

.byline {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--mut);
}
.byline a {
  color: var(--mut);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.byline a:hover { color: var(--ink); text-decoration-color: var(--acc); }

.venue {
  font-size: 13.5px;
  color: var(--mut);
  margin-bottom: 26px;
}
.venue a {
  color: var(--acc);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-body {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 44px;
  align-items: start;
}

.entry figure {
  border: 1px solid var(--rule);
  padding: 10px;
}
.entry figure img { width: 100%; }
.entry figure img + img { margin-top: 10px; }

.abstract p {
  font-size: 14.5px;
  line-height: 1.74;
  color: var(--body);
}

.note {
  margin-top: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--mut);
}
.note a {
  color: var(--acc);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* -------------------------------------------------------------- teaching */

.roster { border-top: 1px solid var(--rule); }

.roster li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 32px;
  align-items: baseline;
  padding: 15px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.5;
}

.roster .when {
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------- cv */

.doc {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--acc);
  padding: 26px 34px 26px 30px;
  text-decoration: none;
  transition: border-color .18s ease, transform .18s ease;
}
.doc:hover { border-color: var(--ink); border-left-color: var(--acc); }

.doc .title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.doc .kind {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mut);
}
.doc svg { flex: none; color: var(--acc); }

/* ---------------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--rule);
  padding-block: 26px 40px;
}
.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}
.foot a { color: var(--mut); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ----------------------------------------------------------- breakpoints */

@media (max-width: 900px) {
  :root { --gutter: 40px; }

  .portrait { width: 210px; margin-bottom: 38px; }

  .entry-body { grid-template-columns: 1fr; gap: 28px; }
  .entry-body .abstract { order: 1; }
  .entry-body figure  { order: 2; }

  main { padding-block: 56px 72px; }
}

@media (max-width: 620px) {
  :root { --gutter: 22px; }

  body { font-size: 15.5px; }

  .masthead .wrap {
    gap: 22px;
    padding-block: 38px 20px;
  }
  .mark { letter-spacing: .2em; margin-right: -.2em; }
  .nav { gap: 12px 26px; }
  .nav a { font-size: 11.5px; letter-spacing: .12em; }

  .portrait { width: 180px; }
  .lede { font-size: 18.5px; }
  .label { font-size: 13.5px; letter-spacing: .12em; }
  .entry h2 { font-size: 19px; }
  .byline { font-size: 15px; }

  .roster li { grid-template-columns: 1fr; gap: 4px; }
  .roster .when { white-space: normal; }

  .doc { width: 100%; padding: 22px 24px; }
}

/* -------------------------------------------------------------- printing */

@media print {
  .masthead, .foot, .skip { display: none; }
  body { font-size: 11pt; }
  main { padding: 0; }
  .entry-body { grid-template-columns: 1fr; }
  a { text-decoration: none; color: #000; }
}
