/* ==========================================================================
   Zhiqi Li — homepage
   Modern-minimalist editorial. Light. Graphite-neutral accent. Inter + mono.
   Standalone stylesheet, independent of the minimal-mistakes theme.
   ========================================================================== */

:root {
  --paper:      #fcfcfb;
  --ink:        #17171a;
  --ink-soft:   #5b5b61;
  --ink-faint:  #8a8a90;
  --line:       rgba(20, 20, 26, 0.10);
  --line-soft:  rgba(20, 20, 26, 0.06);
  --graphite:   #3a3a40;
  --wash:       #f3f2ef;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 720px;
  --gutter:  24px;
}

/* --- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "ss01", "cv05", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: none; }

/* offset for sticky nav when jumping to anchors */
section[id] { scroll-margin-top: 84px; }

/* --- layout shell --------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- top nav -------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav__brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__links a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color .2s ease;
}
.nav__links a:hover { color: var(--ink); }
.nav__links a.is-active { color: var(--graphite); }
.nav__sep { width: 1px; height: 14px; background: var(--line); }
.nav__social { display: flex; gap: 14px; }
.nav__social a { color: var(--ink-faint); font-size: 0.95rem; line-height: 1; transition: color .2s ease; }
.nav__social a:hover { color: var(--ink); }
@media (max-width: 640px) {
  .nav__links .nav__link { display: none; }
}

/* --- ambient background canvas -------------------------------------------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 17%, rgba(0,0,0,0.18) 35%, rgba(0,0,0,0.18) 65%, #000 83%, #000 100%);
          mask-image: linear-gradient(to right, #000 0%, #000 17%, rgba(0,0,0,0.18) 35%, rgba(0,0,0,0.18) 65%, #000 83%, #000 100%);
}
/* robot cursor (fine pointers only) */
@media (pointer: fine) {
  body { cursor: url('/images/cursor-robot.svg') 14 12, auto; }
  a, button, summary, [role="button"] { cursor: url('/images/cursor-robot-link.svg') 14 12, pointer; }
  body:active, a:active { cursor: url('/images/cursor-robot-active.svg') 14 12, auto; }
}

/* interactive perception layer — above content, below the nav */
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
}
/* keep all content above the ambient canvas */
.hero, main, .footer { position: relative; z-index: 1; }

/* --- hero ----------------------------------------------------------------- */
.hero { padding: 84px 0 56px; }
/* name decode effect */
.hero__name .char { display: inline-block; }
.hero__name .char.is-scrambling { color: var(--ink-faint); }
.hero__name .sp { display: inline-block; width: 0.28em; }
.hero__avatar {
  width: 76px; height: 76px; border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  margin-bottom: 28px;
  filter: grayscale(8%);
}
.hero__name {
  font-size: clamp(3rem, 9vw, 5.2rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 0.98;
  margin: 0;
}
.hero__role {
  margin: 18px 0 0;
  font-size: 1.18rem;
  font-weight: 450;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.hero__role .sep { color: var(--ink-faint); margin: 0 .5em; font-weight: 300; }
.hero__role .place { color: var(--ink-soft); }
.hero__tagline {
  margin: 14px 0 0;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}
/* earned metadata — the dossier header line */
.hero__meta {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.hero__meta b { color: var(--ink); font-weight: 600; }
.hero__meta .dot { color: var(--ink-faint); }
.hero__social { display: inline-flex; gap: 18px; align-items: center; }
.hero__social a {
  color: var(--ink-faint);
  font-size: 1.02rem;
  line-height: 1;
  transition: color .2s ease, transform .12s ease;
  will-change: transform;
}
.hero__social a:hover { color: var(--ink); }

/* --- section scaffolding -------------------------------------------------- */
.section {
  padding: 52px 0;
  border-top: 1px solid var(--line);
}
main { counter-reset: section; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 28px;
  counter-increment: section;
}
.eyebrow::before {
  content: counter(section, decimal-leading-zero);
  margin-right: 14px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
  color: var(--graphite);
}
.section > p:not(.eyebrow) { margin: 0 0 1.1em; }
.lede a, .entry a, .callout__text a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(20, 20, 26, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .2s ease, color .2s ease, background-color .2s ease;
}
.lede a:hover, .entry a:hover, .callout__text a:hover {
  color: var(--graphite);
  text-decoration-color: var(--graphite);
}
.section strong { font-weight: 600; }

/* About prose runs a touch larger */
#about .lede { font-size: 1.08rem; }
#about .lede:first-of-type { margin-top: 0; }

/* --- hiring callout ------------------------------------------------------- */
.callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 30px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wash);
}
.callout__dot {
  flex: none;
  width: 9px; height: 9px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--graphite);
  position: relative;
}
.callout__dot::after {
  content: "";
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--graphite);
  opacity: 0;
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { opacity: 0; }
}
.callout__text { margin: 0; font-size: 0.97rem; color: var(--ink); }
.callout__text .label { font-weight: 600; }
.callout__text a { white-space: nowrap; }

/* --- timeline (news / honors / education) --------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 22px;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
}
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 50%;
  width: 2px;
  height: 0;
  background: var(--graphite);
  transform: translateY(-50%);
  transition: height .28s cubic-bezier(.2,.7,.2,1);
}
.timeline li:hover::before { height: 62%; }
.timeline time {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
  padding-top: 0.18em;
  white-space: nowrap;
  transition: color .2s ease;
}
.timeline li:hover time { color: var(--ink); }
.timeline .entry { margin: 0; color: var(--ink); }
.timeline .entry .award { font-weight: 600; }
@media (max-width: 540px) {
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .timeline time { padding-top: 0; }
}

/* --- publications --------------------------------------------------------- */
.pubs { display: grid; gap: 16px; }
.pub {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.pub:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px -22px rgba(20, 20, 26, 0.30);
  border-color: rgba(20, 20, 26, 0.16);
}
.pub__media {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: var(--wash);
  align-self: start;
  border: 1px solid var(--line-soft);
  aspect-ratio: 3 / 2;
}
.pub__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(23, 23, 26, 0.12), transparent 42%);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.pub:hover .pub__media::after { animation: scan 1.05s ease-in-out; }
@keyframes scan {
  0%   { transform: translateY(-100%); opacity: 0; }
  18%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateY(230%); opacity: 0; }
}
.pub__title {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.pub__title a { transition: color .2s ease; }
.pub__title a:hover { color: var(--graphite); }
.pub__authors {
  margin: 8px 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.pub__authors .me { color: var(--ink); font-weight: 600; }
.pub__venue {
  margin: 9px 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pub__links {
  margin-top: 11px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.pub__link {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.pub__link:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (max-width: 540px) {
  .pub { grid-template-columns: 1fr; }
  .pub__media { max-width: 240px; }
}

/* --- footer --------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 36px 0 64px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: space-between;
}
.footer a { color: var(--ink-soft); transition: color .2s ease; }
.footer a:hover { color: var(--ink); }

/* --- entrance animation --------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }
/* staggered hero pieces on load */
.hero .reveal:nth-child(1) { transition-delay: .02s; }
.hero .reveal:nth-child(2) { transition-delay: .08s; }
.hero .reveal:nth-child(3) { transition-delay: .14s; }
.hero .reveal:nth-child(4) { transition-delay: .20s; }
.hero .reveal:nth-child(5) { transition-delay: .26s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .callout__dot::after { animation: none; }
  .pub:hover .pub__media::after { animation: none; }
  .timeline li::before { transition: none; }
}
