/* Wenrui Huang — homepage */

:root {
  --sky: #f5faff;          /* page background: very light blue */
  --page-gradient: linear-gradient(#f3faff 0, #f8fcff 1100px, #ffffff 100%);
  --sky-deep: #dce4ef;     /* rules */
  --card: #f3f4f7;         /* abstract boxes */
  --ink: #1b2432;
  --muted: #5a6779;
  --band: transparent;     /* masthead */
  --on-band: #1b2432;
  --on-band-soft: #5a6779;
  --link: #214a94;
  --link-strong: #132e62;
  --heading: #1f3f73;

  --page: 68rem;
  --measure: 55rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky: #12161d;
    --sky-deep: #262c37;
    --card: #181e28;
    --ink: #e6ebf3;
    --muted: #a3afc2;
    --band: transparent;
    --page-gradient: none;
    --on-band: #e6ebf3;
    --on-band-soft: #a3afc2;
    --link: #9fbcf2;
    --link-strong: #cddcf8;
    --heading: #c9d9ef;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 17px;  /* base for all rem sizes; raise or lower to scale the whole site */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--sky);
  background-image: var(--page-gradient);
  color: var(--ink);
  font-family: "STIX Two Text", "STIX Two Text Local", "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.55;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
}

a:hover {
  color: var(--link-strong);
  text-decoration-color: currentColor;
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

p { margin: 0 0 .85rem; }

/* keep superscripts (e.g. |x|^-α) from stretching the line spacing */
sup, sub { line-height: 0; }

::selection { background: color-mix(in srgb, var(--link) 22%, transparent); }

.skip { position: absolute; left: -9999px; }

.skip:focus {
  left: 1rem;
  top: 1rem;
  padding: .4rem .7rem;
  background: var(--card);
  border: 1px solid var(--sky-deep);
}

/* Masthead: full-width colored band */

.masthead {
  background: var(--band);
  color: var(--on-band);
}

.masthead-inner {
  width: min(var(--page), 100% - 3rem);
  margin: 0 auto;
  padding: 3.25rem 0 1.6rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 2.75rem;
}

/* photo on the left spanning both rows; name block above the menu on the right */
.masthead .portrait { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.masthead-text { grid-column: 2; grid-row: 1; align-self: end; }
.masthead .nav { grid-column: 2; grid-row: 2; align-self: start; }

.masthead a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
}

.masthead a:hover {
  color: var(--link-strong);
  text-decoration-color: currentColor;
}

.name {
  margin: 0 0 .55rem;
  font-size: clamp(2.5rem, 5vw, 3.4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.012em;
}

.role {
  margin: 0;
  font-size: 1.12rem;
  color: var(--on-band);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.4rem;
  margin: .85rem 0 0;
  font-size: 1rem;
}

.email { color: var(--on-band-soft); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.75rem;
  margin-top: 1.5rem;
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 400;
}

.nav a {
  color: var(--link);
  text-decoration: none;
}

.nav a:hover { color: var(--link-strong); }

/* the page you are on is shown in black instead of blue */
.nav a[aria-current="page"] { color: var(--ink); }

.portrait {
  display: block;
  width: 200px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 4px;
}

/* Body */

.page {
  width: min(var(--page), 100% - 3rem);
  margin: 0 auto;
  padding: .6rem 0 3.5rem;
}

.section { padding: 1.9rem 0 .4rem; }

.section > h2 {
  margin: 0 0 1.1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--sky-deep);
  color: var(--heading);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.25;
}

.section-body > :first-child { margin-top: 0; }

.section-body p { max-width: var(--measure); }

.section-body .seeking {
  margin-top: 1.1rem;
  color: var(--heading);
  font-weight: 600;
}

.section-body h3 {
  margin: 1.7rem 0 .2rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
}

.section-body h3:first-child { margin-top: .2rem; }

/* Papers */

.section-body { counter-reset: paper; }

.paper {
  position: relative;
  max-width: var(--measure);
  margin: 0;
  padding: .85rem 0 .95rem 2.3rem;
  border-bottom: 1px solid var(--sky-deep);
  counter-increment: paper;
}

/* paper number, set to line up with the first line of the title */
.paper::before {
  content: counter(paper) ".";
  position: absolute;
  left: 0;
  top: .85rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.38;
  font-variant-numeric: lining-nums;
}

.paper:last-child { border-bottom: 0; }

.paper-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.38;
  text-wrap: pretty;
}

.paper-title a { text-decoration-color: transparent; }
.paper-title a:hover { text-decoration-color: currentColor; }

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.1rem;
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.paper-meta cite {
  color: var(--ink);
  font-style: italic;
  font-weight: 600;
}

.nowrap { white-space: nowrap; }

.paper-abstract { margin-top: .2rem; }

.paper-abstract summary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--link);
  font-size: .9rem;
  cursor: pointer;
  list-style: none;
}

.paper-abstract summary::-webkit-details-marker { display: none; }

.paper-abstract summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: .36em solid currentColor;
  border-top: .24em solid transparent;
  border-bottom: .24em solid transparent;
  transition: transform .15s ease;
}

.paper-abstract[open] summary::before { transform: rotate(90deg); }

.paper-abstract summary:hover { color: var(--link-strong); }

.paper-abstract p {
  margin: .5rem 0 .1rem;
  padding: 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.55;
  hyphens: auto;
}

/* Dated rows */

.rows {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: .5rem 1.25rem;
  align-items: baseline;
  margin: 0 0 .9rem;
}

.rows dt {
  color: var(--muted);
  font-variant-numeric: lining-nums;
}

.rows dd { margin: 0; }

.section-body h3 + .rows { margin-top: .6rem; }

/* Talks: date | title, with the venue underneath */

.talks {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1.35rem 1.25rem;
  align-items: baseline;
  margin: .2rem 0 1rem;
}

.talks dt {
  color: var(--muted);
  font-variant-numeric: lining-nums;
}

.talks dd { margin: 0; }

.talk-title {
  display: block;
  font-size: 1.15rem;
  line-height: 1.4;
}

.talk-venue {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

/* Narrow screens */

@media (max-width: 760px) {
  body { font-size: 18px; }

  .masthead-inner {
    width: min(var(--page), 100% - 2.25rem);
    padding: 2rem 0 1.8rem;
    column-gap: 1.1rem;
  }

  .masthead .portrait { grid-row: 1; align-self: start; }
  .masthead-text { align-self: start; }
  .masthead .nav { grid-column: 1 / -1; }

  .name { font-size: 2.1rem; }

  .role { font-size: 1.02rem; }

  .portrait { width: 104px; }

  .nav { margin-top: 1.1rem; gap: .3rem 1.2rem; font-size: 1.2rem; }

  .page { width: min(var(--page), 100% - 2.25rem); }

  .section { padding-top: 1.5rem; }

  .section > h2 { font-size: 1.35rem; }

  .rows { grid-template-columns: 6.2rem minmax(0, 1fr); gap: .4rem .9rem; }

  .talks { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .talks dt { margin-top: 1.2rem; font-size: .95rem; }
  .talks dt:first-child { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .paper-abstract summary::before { transition: none; }
}
