/* Yuduo (Allen) Zheng — personal site.
   Sky panel, white page, one typeface. Citations are set in Times New Roman.
   Colour carries meaning in the figures only: blue = numbers, yellow = letters. */

:root {
  --ink: #10233d;
  --slate: #3d4f69;
  --muted: #5c6d86;
  --line: rgba(16, 35, 61, .1);
  --sky: #cbe3fb;
  --sky-mid: #dcebfc;
  --mist: #edf5fe;
  --blue: #2f7fdc;
  --link: #1f6fd0;
  --yellow: #f4c44e;
  --yellow-deep: #d99a00;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --serif: "Times New Roman", Times, serif;
  --edge: clamp(1.5rem, 4vw, 3.5rem);
  --label: 8.5rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --lift: 0 1px 0 rgba(16, 35, 61, .14);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--slate);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--sky); color: var(--ink); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  padding: .5rem 1rem; background: #fff; color: var(--link); font-weight: 600;
  border-radius: .5rem; box-shadow: var(--lift); transition: top .15s;
}
.skip:focus { top: 1rem; }

/* ---------- sky panel ---------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: var(--edge);
  background: var(--sky);
  color: var(--ink);
}
.panel :focus-visible { outline-color: var(--ink); }

h1 {
  font-size: clamp(2.25rem, 3.5vw, 3rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.02em;
}
h1 span { display: block; }

.role { margin-top: 1rem; line-height: 1.45; }

.contact { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin-top: 1rem; font-size: 1rem; }
.contact a {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 2rem;
  color: var(--ink);
  text-decoration-color: rgba(16, 35, 61, .35);
}
.contact a:hover { text-decoration-color: var(--ink); }
.contact svg { width: .7rem; height: .7rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.nav { display: grid; justify-items: start; gap: .125rem; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.25rem;
  color: var(--slate);
  font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.nav a::before {
  content: "";
  width: .5625rem;
  height: .5625rem;
  border: 1.5px solid currentColor;
  border-radius: .1875rem;
  transition: background-color .15s;
}
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
.nav a[aria-current]::before { background: var(--ink); }

/* the mark: number tiles and letter tiles */
.tiles { display: flex; gap: .375rem; margin-top: auto; padding-bottom: .25rem; }
.tile {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .5rem;
  background: #fff;
  color: var(--link);
  font-weight: 600;
  line-height: 1;
  box-shadow: var(--lift);
}
.tile--letter { background: var(--yellow); color: var(--ink); translate: 0 .25rem; }

/* ---------- content ---------- */

main { container-type: inline-size; max-width: 58rem; padding: var(--edge) clamp(1.5rem, 5vw, 4.5rem) 3rem; }

section { scroll-margin-top: 2rem; }
section + section { margin-top: clamp(3.5rem, 7vw, 5rem); }

h2 {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* research */
.lead {
  max-width: 24em;
  font-size: clamp(1.5rem, 2.3vw, 2rem);
  font-weight: 500;
  line-height: 1.27;
  letter-spacing: -.015em;
  color: var(--ink);
  text-wrap: balance;
}
.lead-note { max-width: 38em; margin-top: 1rem; text-wrap: pretty; }

.questions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.5rem; margin-top: 2.5rem; }
.question h3 { margin-top: 1rem; font-size: 1.125rem; font-weight: 600; line-height: 1.3; color: var(--ink); text-wrap: balance; }
.question p { margin-top: .5rem; font-size: 1rem; line-height: 1.5; }

.figure, .thumb { display: block; width: 100%; height: auto; border-radius: .75rem; background: var(--mist); }
.figure text { font-family: var(--sans); text-anchor: middle; }
.axis { fill: none; stroke: rgba(16, 35, 61, .24); stroke-width: 1.5; stroke-linecap: round; }
.curve { fill: none; stroke-width: 3; stroke-linecap: round; }
.curve--math { stroke: var(--blue); }
.curve--read { stroke: var(--yellow-deep); }
.dot { stroke: var(--mist); stroke-width: 2; }
.dot--math { fill: var(--blue); }
.dot--read { fill: var(--yellow-deep); }
.dot--root { fill: var(--ink); }
.tile-n { fill: var(--blue); }
.tile-l { fill: var(--yellow); }
.tile-n-t { fill: #fff; font-size: 16px; font-weight: 600; }
.tile-l-t { fill: var(--ink); font-size: 16px; font-weight: 600; }
.tile-n-big { fill: #fff; font-size: 32px; font-weight: 600; }
.bubble { fill: #fff; stroke: rgba(16, 35, 61, .16); }
.bubble-t { fill: var(--ink); font-size: 14px; font-weight: 500; }
.link { fill: none; stroke: rgba(16, 35, 61, .42); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.bell-a { fill: var(--sky); }
.bell-b { fill: var(--blue); opacity: .6; }

/* the current topic, with a task you can try */
.now {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem 2.5rem;
  margin-top: 2.5rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background: var(--sky-mid);
  color: var(--ink);
}
.now-label { font-size: .9375rem; font-weight: 500; color: var(--slate); }
.now h3 { margin-top: .25rem; font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.now-text > p:last-child { max-width: 22em; margin-top: .5rem; font-size: 1rem; line-height: 1.5; color: var(--slate); }

.task { --t: min(2.75rem, calc((100cqw - 5.5rem) / 6)); }
.task-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; font-size: .9375rem; font-weight: 500; }
.task-count { font-weight: 400; color: var(--slate); font-variant-numeric: tabular-nums; }
.task-row, .task-choices { display: flex; gap: .5rem; }
.task-pick { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.task-hint { min-width: 5.75rem; font-size: .9375rem; font-weight: 500; }
.t {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--t);
  height: var(--t);
  padding: 0;
  border: 0;
  border-radius: .625rem;
  background: #fff;
  box-shadow: var(--lift);
  color: var(--ink);
  font: 600 1.125rem/1 var(--sans);
}
.t svg { display: block; width: 64%; height: 64%; }
.sh-c, .sh-b { fill: var(--blue); }
.sh-s { fill: var(--yellow); }
.sh-t { fill: var(--ink); }
.t--slot { background: none; box-shadow: none; border: 1.5px dashed var(--blue); color: var(--link); }
.t--slot.filled { background: #fff; border: 2px solid var(--blue); }
/* the three answers are buttons, and look like it */
button.t { cursor: pointer; box-shadow: var(--lift), inset 0 0 0 1.5px var(--blue); transition: box-shadow .15s, background-color .15s, transform .1s, opacity .15s; }
button.t:hover { background: var(--mist); box-shadow: var(--lift), inset 0 0 0 2.5px var(--blue); }
button.t:active { transform: scale(.95); }
button.t[aria-disabled="true"] { cursor: default; opacity: .35; background: #fff; box-shadow: var(--lift); transform: none; }
button.t.right { opacity: 1; background: var(--mist); box-shadow: inset 0 0 0 2.5px var(--blue); }

/* label column + content column, shared by Publications, Projects and CV */
.rows { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 2rem 1.5rem; }
.rows > h3, .rows > .label { padding-top: .125rem; font-size: .9375rem; font-weight: 500; line-height: 1.5; color: var(--ink); }
.count { margin-left: .25rem; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

/* citations: the academic part, in Times New Roman with a hanging indent */
.refs {
  display: grid;
  gap: .75rem;
  list-style: none;
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.38;
  color: #14171f;
}
.refs li { padding-left: 1.6em; text-indent: -1.6em; }
.refs a { overflow-wrap: anywhere; }

.tag {
  display: inline-block;
  padding: .125rem .625rem;
  border-radius: 99px;
  background: var(--mist);
  color: var(--link);
  font-size: .8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.project { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); align-items: center; gap: 1.25rem; }
.thumb { border-radius: .625rem; }

.entry + .entry { margin-top: 1.25rem; }
.entry-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .125rem 1.25rem; }
.entry-title { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; color: var(--ink); }
.when { font-size: .9375rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry > p { margin-top: .125rem; }
.more { margin-top: 1.5rem; padding-left: calc(var(--label) + 1.5rem); font-weight: 500; }

footer {
  margin-top: clamp(3.5rem, 7vw, 5rem);
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: .875rem;
  color: var(--muted);
}

/* ---------- when the content column gets narrow ---------- */

@container (max-width: 42rem) {
  .now { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 30rem) {
  .now { padding: 1rem; }
  .task { --t: min(2.75rem, calc((100cqw - 3.875rem) / 6)); }
  .task-row, .task-choices { gap: .375rem; }
  .questions { grid-template-columns: minmax(0, 1fr); }
  .rows { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .rows > h3:not(:first-child), .rows > .label:not(:first-child) { margin-top: 1.5rem; }
  .entry-head { grid-template-columns: minmax(0, 1fr); }
  .project { grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; }
  .more { padding-left: 0; }
  .refs { font-size: 1.12rem; }
}

/* ---------- wide screens: panel stays put, content scrolls ---------- */

@media (min-width: 960px) {
  body { display: grid; grid-template-columns: minmax(21rem, min(36%, 31rem)) minmax(0, 1fr); align-items: start; }
  .panel { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
  .nav { margin-top: .5rem; }
}
@media (min-width: 960px) and (max-height: 640px) {
  .panel { gap: 1.25rem; padding-block: 1.75rem; }
  .role, .contact { margin-top: .75rem; }
}

/* ---------- small screens: panel becomes the page header ---------- */

@media (max-width: 959px) {
  .panel { gap: 1.5rem; }
  .nav { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
  .nav a, .contact a { min-height: 2.75rem; }
  .tiles { margin-top: 0; padding-bottom: .5rem; }
}

/* ---------- motion: tiles are laid out in turn; a wrong pick shakes its head ---------- */

@media (prefers-reduced-motion: no-preference) {
  .task.go .t { animation: lay .3s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
  .task button.t.wrong { animation: nope .25s; }
}
@keyframes lay { from { opacity: 0; transform: translateY(.375rem) scale(.9); } }
@keyframes nope { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

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

@media print {
  body { display: block; font-size: 11pt; }
  .panel { position: static; height: auto; background: none; padding: 0 0 1rem; }
  .nav, .tiles, .task, .skip { display: none; }
  main { max-width: none; padding: 0; }
}
