/* =========================================================
   Yujie Li — homepage v2
   Dark kinetic editorial. Fonts are self-hosted (OFL).
   ========================================================= */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var.woff2") format("woff2-variations"), url("fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #0c0c0b;
  --bg-raise: #151514;
  --fg: #edeae2;
  --fg-dim: #a39f94;
  --fg-faint: #7a766c;
  --line: rgba(237, 234, 226, 0.12);
  --line-strong: rgba(237, 234, 226, 0.28);
  --accent: #a6f0c0;
  --accent-ink: #0c0c0b;

  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 400; }
.accent { color: var(--accent); }
.label { color: var(--fg-faint); display: block; margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.ulink { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: background-size 0.5s var(--ease-out); }
.ulink:hover { background-size: 0 1px; background-position: 100% 100%; }
.inline-logo { display: inline-block; height: 0.95em; width: auto; vertical-align: -0.12em; margin-right: 0.3em; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }

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

/* Static film grain: gives the black depth without moving */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------------- Cursor ---------------- */
.cursor { display: none; }
@media (pointer: fine) {
  .cursor {
    display: block; position: fixed; left: 0; top: 0; z-index: 95; pointer-events: none;
    width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
    background: var(--accent);
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out), margin 0.35s var(--ease-out), opacity 0.2s;
    will-change: transform;
  }
  .cursor.is-hidden { opacity: 0; }
  .cursor.is-active { width: 72px; height: 72px; margin: -36px 0 0 -36px; }
  .cursor__label {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--accent-ink); opacity: 0; transition: opacity 0.2s;
  }
  .cursor.is-active .cursor__label { opacity: 1; }
}

/* Floating paper teaser that trails the cursor on the Work list */
.preview {
  position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none;
  width: clamp(240px, 24vw, 380px); aspect-ratio: 4 / 3;
  opacity: 0; transform: translate3d(-50%, -50%, 0) scale(0.85);
  transition: opacity 0.35s var(--ease-out);
  will-change: transform;
}
.preview.is-visible { opacity: 1; }
.preview__inner {
  width: 100%; height: 100%; border-radius: 6px; overflow: hidden;
  background: #f4f2ec center / contain no-repeat;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

/* ---------------- Nav ---------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  mix-blend-mode: difference; color: #fff;
}
.nav__logo { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; white-space: nowrap; }
.nav__links { display: flex; gap: clamp(14px, 2vw, 30px); font-size: 14px; }
.nav__links a { position: relative; display: inline-flex; gap: 6px; align-items: baseline; opacity: 0.6; transition: opacity 0.3s; }
.nav__links a .mono { font-size: 10px; }
.nav__links a:hover, .nav__links a.is-current { opacity: 1; }
.nav__meta { display: flex; align-items: center; gap: 22px; }
.nav__clock .dot { background: #fff; }
.nav__classic { opacity: 0.6; transition: opacity 0.3s; }
.nav__classic:hover { opacity: 1; }
.nav { transition: transform 0.6s var(--ease-out), background-color 0.4s, border-color 0.4s; border-bottom: 1px solid transparent; }
.nav.is-solid { mix-blend-mode: normal; background: rgba(12, 12, 11, 0.72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom-color: var(--line); }
.nav.is-solid .nav__clock .dot { background: var(--accent); }
.nav.is-hidden { transform: translateY(-100%); }
.nav__menu { display: none; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.menu {
  position: fixed; inset: 0; z-index: 65; background: var(--bg);
  display: flex; flex-direction: column; justify-content: center; gap: 40px; padding: 80px var(--gutter) 40px;
}
.menu[hidden] { display: none; }
.menu nav { display: flex; flex-direction: column; gap: 6px; }
.menu nav a { font-family: var(--display); font-weight: 700; font-stretch: 80%; font-size: clamp(40px, 12vw, 72px); line-height: 1; text-transform: uppercase; display: flex; gap: 14px; align-items: baseline; }
.menu nav a .mono { color: var(--fg-faint); }
.menu__versions { display: flex; flex-wrap: wrap; gap: 10px 24px; color: var(--fg-dim); }
/* The version dropdown must not be colour-inverted by the nav's blend mode */
.nav:has(.vs.is-open) { mix-blend-mode: normal; }
.nav__classic .vs__btn { cursor: pointer; }
.nav__classic.is-open { opacity: 1; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 96px var(--gutter) 28px;
}
.hero__top {
  position: absolute; top: 84px; left: var(--gutter); right: var(--gutter);
  display: flex; justify-content: space-between; color: var(--fg-faint);
  border-top: 1px solid var(--line); padding-top: 12px;
}
.hero__tagline {
  margin: clamp(56px, 10vh, 120px) 0 auto auto; max-width: 15em; text-align: right;
  font-family: var(--serif); font-size: clamp(26px, 3.2vw, 48px); line-height: 1.08; letter-spacing: -0.01em; color: var(--fg-dim);
}
.hero__tagline em { color: var(--fg); }
.hero__name {
  font-family: var(--display); font-weight: 800; font-stretch: 100%;
  font-size: 19vw; line-height: 0.82;
  margin: 0 0 clamp(28px, 4vw, 48px) -0.04em;
  white-space: nowrap; user-select: none;
}
/* letter-spacing lives here so it scales with the font-size the fit script sets on this element */
.hero__line { display: inline-block; overflow: hidden; padding: 0.04em 0.02em 0.02em; vertical-align: top; letter-spacing: -0.035em; }
.hero__line .ch { display: inline-block; font-variation-settings: "wght" 800, "wdth" 100; }
.js .hero__line .ch { transform: translateY(110%); }
.is-loaded .hero__line .ch { transform: none; transition: transform 1.1s var(--ease-out); transition-delay: calc(var(--i) * 55ms); }

.hero__grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px;
  border-top: 1px solid var(--line); padding-top: 18px;
}
.hero__cell p { font-size: 15px; line-height: 1.45; color: var(--fg); max-width: 30ch; }
.hero__cell .label { margin-bottom: 8px; }
.hero__cell--stats .stat { font-family: var(--display); font-weight: 700; font-size: 1.15em; font-variant-numeric: tabular-nums; }
.hero__cell--stats .sep { color: var(--fg-faint); margin: 0 4px; }
.hero__bottom { display: flex; justify-content: space-between; align-items: center; margin-top: clamp(32px, 6vh, 64px); }
.social { display: flex; flex-wrap: wrap; gap: 8px; }
.social a {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 999px;
  transition: background 0.35s var(--ease-out), color 0.35s var(--ease-out), border-color 0.35s;
}
.social a:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.scroll-cue { color: var(--fg-faint); display: inline-flex; gap: 8px; }
.scroll-cue span { display: inline-block; animation: cue 2.4s var(--ease-in-out) 3; }
@keyframes cue { 0%, 100% { transform: none; } 50% { transform: translateY(5px); } }

.js .hero__top, .js .hero__tagline, .js .hero__grid, .js .hero__bottom { opacity: 0; transform: translateY(16px); }
.is-loaded .hero__top, .is-loaded .hero__tagline, .is-loaded .hero__grid, .is-loaded .hero__bottom {
  opacity: 1; transform: none; transition: opacity 1s var(--ease-out) 0.55s, transform 1s var(--ease-out) 0.55s;
}

/* ---------------- Sections ---------------- */
.section { padding: clamp(96px, 14vw, 180px) var(--gutter) 0; }
.section__head {
  display: grid; grid-template-columns: 80px 1fr auto; align-items: baseline;
  border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: clamp(40px, 6vw, 80px);
}
.section__head > .mono { color: var(--fg-faint); }
.section__head h2 {
  font-family: var(--display); font-weight: 700; font-stretch: 75%;
  font-size: clamp(44px, 8vw, 120px); line-height: 0.9; letter-spacing: -0.02em; text-transform: uppercase;
}

/* About statement: words light up as they scroll past */
.statement {
  font-size: clamp(26px, 3.6vw, 54px); line-height: 1.18; letter-spacing: -0.015em; font-weight: 400;
  max-width: 24em; margin-left: 80px;
}
.statement em { font-family: var(--serif); font-style: italic; font-size: 1.08em; letter-spacing: 0; color: var(--accent); }
.statement .w { transition: opacity 0.25s linear; }
.js .statement .w { opacity: 0.16; }
.js .statement .w.is-lit { opacity: 1; }

.interests { margin: clamp(64px, 9vw, 120px) 0 0 80px; border-top: 1px solid var(--line); }
.interest {
  position: relative; display: grid; grid-template-columns: 56px minmax(0, 1.3fr) minmax(0, 1fr) 40px; align-items: center; gap: 16px;
  padding: 26px 0; border-bottom: 1px solid var(--line); overflow: hidden; isolation: isolate;
}
.interest::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fg);
  transform: scaleY(0); transform-origin: 50% 100%; transition: transform 0.55s var(--ease-out);
}
.interest:hover::before { transform: scaleY(1); }
.interest:hover { color: var(--bg); }
.interest__idx { color: var(--fg-faint); padding-left: 4px; transition: color 0.3s; }
.interest:hover .interest__idx { color: var(--bg); }
.interest__title { font-family: var(--display); font-weight: 600; font-stretch: 85%; font-size: clamp(30px, 4.6vw, 68px); line-height: 1; text-transform: uppercase; letter-spacing: -0.01em; transition: transform 0.55s var(--ease-out); }
.interest:hover .interest__title { transform: translateX(14px); }
.interest__tags { color: var(--fg-dim); font-size: 15px; transition: color 0.3s; }
.interest:hover .interest__tags { color: var(--bg); }
.interest__arrow { font-size: 26px; transform: translateX(-12px); opacity: 0; transition: transform 0.55s var(--ease-out), opacity 0.3s; }
.interest:hover .interest__arrow { transform: none; opacity: 1; }

/* Marquee: moves only while the page scrolls */
.marquee { margin-top: clamp(96px, 14vw, 180px); border-block: 1px solid var(--line); overflow: hidden; padding: 18px 0; }
.marquee__track { display: flex; width: max-content; will-change: transform; }
.marquee__track span {
  font-family: var(--display); font-weight: 800; font-stretch: 110%; text-transform: uppercase; white-space: nowrap;
  font-size: clamp(40px, 7vw, 104px); line-height: 1; letter-spacing: -0.02em;
  color: transparent; -webkit-text-stroke: 1px var(--line-strong);
}
.marquee__track i { font-style: normal; color: var(--accent); -webkit-text-stroke: 0; font-size: 0.5em; vertical-align: 0.35em; margin: 0 0.3em; }

/* ---------------- Work ---------------- */
.pubs { border-top: 1px solid var(--line); }
.pub {
  position: relative; display: grid; grid-template-columns: 80px minmax(0, 1fr) 150px; gap: 0 16px;
  padding: 30px 0 28px; border-bottom: 1px solid var(--line);
}
.pub::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.7s var(--ease-out);
}
.pub:hover::after { transform: scaleX(1); }
.pub__idx { color: var(--fg-faint); padding-top: 0.7em; }
.pub__thumb { display: none; }
.pub__title { font-weight: 400; }
.pub__title a { display: block; }
.pub__short {
  display: block; font-family: var(--display); font-weight: 700; font-stretch: 80%;
  font-size: clamp(34px, 5.4vw, 84px); line-height: 0.95; letter-spacing: -0.02em; text-transform: uppercase;
  transition: transform 0.6s var(--ease-out), color 0.3s;
}
.pub__short--long { font-size: clamp(24px, 2.6vw, 40px); line-height: 1.05; text-transform: none; font-stretch: 90%; letter-spacing: -0.01em; max-width: 28ch; }
.pub:hover .pub__short { transform: translateX(16px); color: var(--accent); }
.pub__sub { display: block; margin-top: 12px; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.35; color: var(--fg); max-width: 46ch; }
.pub__authors { margin-top: 12px; font-size: 14px; color: var(--fg-dim); max-width: 70ch; }
.pub__authors strong { color: var(--fg); font-weight: 600; }
.pub__links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; }
.pub__links a { color: var(--fg-dim); transition: color 0.25s; }
.pub__links a:hover { color: var(--accent); }
.pub__cite { color: var(--accent) !important; }
.pub__venue { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 0.7em; }
.pub__badge { border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.pub__year { color: var(--fg-faint); }

/* ---------------- News ---------------- */
.news__list { border-top: 1px solid var(--line); margin-left: 80px; }
.news__item { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.news__item time { color: var(--fg-faint); padding-top: 0.35em; }
.news__item p { font-size: clamp(17px, 1.5vw, 22px); line-height: 1.4; max-width: 52ch; }
.news__item a { color: var(--accent); background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.4s var(--ease-out); }
.news__item a:hover { background-size: 100% 1px; }
.news__item em { font-style: normal; }
.news__item img { display: inline-block; height: 0.95em; width: auto; vertical-align: -0.12em; }
.news__item.is-extra { display: none; }
.news.is-open .news__item.is-extra { display: grid; }
.btn {
  margin: 28px 0 0 80px; padding: 12px 22px; border: 1px solid var(--line-strong); border-radius: 999px;
  transition: background 0.35s var(--ease-out), color 0.35s var(--ease-out);
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn [data-when="open"], .news.is-open .btn [data-when="closed"] { display: none; }
.news.is-open .btn [data-when="open"] { display: inline; }

/* ---------------- Experience ---------------- */
.exp { border-top: 1px solid var(--line); margin-left: 80px; }
.exp__item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 26px 0; border-bottom: 1px solid var(--line); }
.exp__logo { width: 56px; height: 56px; border-radius: 14px; background: #f4f2ec; display: grid; place-items: center; overflow: hidden; }
.exp__logo img { width: 72%; height: 72%; object-fit: contain; }
.exp__body h3 { font-family: var(--display); font-weight: 600; font-stretch: 90%; font-size: clamp(22px, 2.4vw, 34px); line-height: 1.1; letter-spacing: -0.01em; }
.exp__org { margin-top: 6px; color: var(--fg); }
.exp__detail { margin-top: 2px; color: var(--fg-dim); font-size: 15px; }
.exp__period { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; color: var(--fg-dim); text-align: right; }
.now { color: var(--accent); }

/* ---------------- Honors ---------------- */
.honors__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 80px); margin-left: 80px; }
.rows { border-top: 1px solid var(--line); }
.rows li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.rows time { color: var(--fg-faint); padding-top: 0.3em; }
.rows span { font-size: 17px; line-height: 1.35; }
.rows small { display: block; margin-top: 4px; font-size: 14px; color: var(--fg-dim); }

/* ---------------- Contact ---------------- */
.contact { padding: clamp(120px, 18vw, 240px) var(--gutter) 28px; }
.contact__lead { margin-top: 18px; color: var(--fg-dim); font-size: 18px; max-width: 34ch; }
.contact__big { display: block; width: 100%; text-align: left; margin-top: clamp(28px, 4vw, 56px); }
.contact__say {
  display: block; width: max-content; font-family: var(--display); font-weight: 800; font-stretch: 100%;
  font-size: 12vw; white-space: nowrap; line-height: 0.82; letter-spacing: -0.04em; text-transform: uppercase; margin-left: -0.04em;
  transition: color 0.4s, font-stretch 0.8s var(--ease-out);
}
.contact__big:hover .contact__say { color: var(--accent); }
.contact__mail { display: inline-block; margin-top: 22px; font-size: clamp(13px, 1.4vw, 18px); text-transform: none; color: var(--fg-dim); border-bottom: 1px solid var(--line-strong); padding-bottom: 4px; }
.toast { min-height: 1.5em; margin-top: 12px; color: var(--accent); }
.contact__bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  margin-top: clamp(64px, 10vw, 140px); padding-top: 16px; border-top: 1px solid var(--line); color: var(--fg-faint);
}
.contact__bar a { transition: color 0.25s; }
.contact__bar a:hover { color: var(--fg); }

/* ---------------- Reveal ---------------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1080px) {
  .nav__links { display: none; }
  .nav__menu { display: inline-block; }
  .hero__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .hide-sm, .nav__clock { display: none; }
  .nav__classic { display: none; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__bottom { flex-direction: column; align-items: flex-start; gap: 20px; }
  .section__head { grid-template-columns: 36px 1fr auto; }
  .hero__tagline { text-align: left; margin-left: 0; font-size: 30px; }
  .statement, .interests, .news__list, .exp, .honors__grid, .btn { margin-left: 0; }
  .interest { grid-template-columns: 36px minmax(0, 1fr); padding: 20px 0; }
  .interest__tags { grid-column: 2; font-size: 14px; }
  .interest__arrow { display: none; }
  .pub { grid-template-columns: 1fr; }
  .pub__idx { display: none; }
  .pub__venue { flex-direction: row; align-items: center; order: -1; padding: 0 0 14px; }
  .pub__thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #f4f2ec; border-radius: 6px; margin-bottom: 18px; }
  .news__item { grid-template-columns: 1fr; gap: 6px; }
  .exp__item { grid-template-columns: 48px minmax(0, 1fr); gap: 16px; }
  .exp__logo { width: 48px; height: 48px; border-radius: 12px; }
  .exp__period { grid-column: 2; flex-direction: row; align-items: center; gap: 14px; }
  .honors__grid { grid-template-columns: 1fr; }
  .rows li { grid-template-columns: 84px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .js .hero__line .ch, .js .reveal, .js .hero__top, .js .hero__tagline, .js .hero__grid, .js .hero__bottom { transform: none; opacity: 1; }
  .js .statement .w { opacity: 1; }
}
