/* ==========================================================================
   Jinsong Zhou — homepage
   Apple-inspired design language: system type, generous whitespace,
   frosted navigation, soft rounded surfaces, light + dark themes.
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;

  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);
  --link: #0066cc;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --on-accent: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-bg-strong: rgba(255, 255, 255, 0.88);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.06), 0 20px 48px rgba(0, 0, 0, 0.10);
  --pill-bg: rgba(0, 0, 0, 0.05);
  --live: #34c759;
  --radius: 20px;
  --radius-sm: 12px;
  --nav-h: 48px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #101012;
    --surface: #1d1d1f;
    --surface-hover: #232326;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --hairline: rgba(255, 255, 255, 0.10);
    --hairline-strong: rgba(255, 255, 255, 0.18);
    --link: #2997ff;
    --accent: #0071e3;
    --accent-hover: #0a84ff;
    --nav-bg: rgba(29, 29, 31, 0.72);
    --nav-bg-strong: rgba(29, 29, 31, 0.88);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.30), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.35), 0 20px 48px rgba(0, 0, 0, 0.45);
    --pill-bg: rgba(255, 255, 255, 0.10);
    --live: #30d158;
  }
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll { overflow: hidden; }

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 600; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  flex: none;
}
.icon--chevron { width: 0.8em; height: 0.8em; margin-left: 0.15em; }

/* ---------- Navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
}
/* Frosted background lives on a pseudo-element so backdrop-filter does not
   turn .nav into the containing block for the fixed mobile menu. */
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.nav--scrolled::before {
  background: var(--nav-bg-strong);
  border-bottom-color: var(--hairline);
}

.nav__inner {
  position: relative;
  max-width: 1024px;
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.nav__brand:hover { text-decoration: none; opacity: 0.7; }

.nav__menu {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav__menu a {
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--text);
  opacity: 0.8;
  transition: opacity 0.2s var(--ease);
}
.nav__menu a:hover,
.nav__menu a.is-active { opacity: 1; text-decoration: none; }
.nav__menu a.is-active { font-weight: 600; }

.nav__toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.nav__toggle-bar {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}
.nav__toggle-bar:nth-child(1) { top: 16px; }
.nav__toggle-bar:nth-child(2) { top: 23px; }
.nav--open .nav__toggle-bar:nth-child(1) { top: 19.5px; transform: rotate(45deg); }
.nav--open .nav__toggle-bar:nth-child(2) { top: 19.5px; transform: rotate(-45deg); }

@media (max-width: 833px) {
  .nav__toggle { display: block; }
  .nav__menu {
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 22px 40px;
    background: var(--nav-bg-strong);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s 0.3s;
    overflow-y: auto;
  }
  .nav--open .nav__menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }
  .nav__menu li { border-bottom: 1px solid var(--hairline); }
  .nav__menu a {
    display: block;
    padding: 16px 0;
    font-size: 17px;
    opacity: 1;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: 96px 22px 88px;
  text-align: center;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(0, 113, 227, 0.08), transparent 70%),
    var(--bg);
}
.hero__inner { max-width: 720px; margin: 0 auto; }

.hero__avatar {
  width: 160px;
  height: 160px;
  margin: 0 auto 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow);
}

.hero__title {
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.028em;
  font-weight: 700;
}
.hero__title-zh {
  display: block;
  margin-top: 6px;
  font-size: 0.42em;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.hero__tagline {
  margin-top: 18px;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--text);
}
.hero__subline {
  margin-top: 8px;
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.3;
  color: var(--text-2);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 32px;
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 112px;
  padding: 11px 22px;
  border-radius: 980px;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.02em;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
  justify-content: center;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--secondary {
  color: var(--link);
  box-shadow: inset 0 0 0 1px var(--link);
}
.btn--secondary:hover {
  background: var(--link);
  color: #fff;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 15px;
  font-weight: 400;
  color: var(--link);
}
.link .icon--chevron { transition: transform 0.2s var(--ease); }
.link:hover .icon--chevron { transform: translateX(2px); }

/* ---------- Sections ---------- */

.section { padding: 96px 22px; }
.section--alt { background: var(--bg-alt); }
.section__inner { max-width: 980px; margin: 0 auto; }

.section__header {
  max-width: 720px;
  margin-bottom: 48px;
}

.section__title {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.024em;
  font-weight: 700;
}
.section__title--sm {
  font-size: clamp(24px, 3.4vw, 32px);
  margin-bottom: 24px;
}
.section__lead {
  margin-top: 12px;
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-2);
}

@media (max-width: 733px) {
  .section { padding: 64px 16px; }
  .hero { padding: 64px 16px 56px; }
  .section__header { margin-bottom: 32px; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.about__body {
  margin-top: 24px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--text);
}
.about__body p + p { margin-top: 1em; }

.about__facts {
  margin: 0;
  padding: 8px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.about__fact {
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}
.about__fact:last-child { border-bottom: 0; }
.about__fact dt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}
.about__fact dd {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

@media (max-width: 833px) {
  .about { grid-template-columns: 1fr; gap: 32px; }
}

/* ---------- Cards ---------- */

.card {
  display: block;
  padding: 28px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.card--link:hover {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.card__title {
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.card__title a { color: inherit; }
.card__title--mono {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: -0.01em;
}
.card__subtitle {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-2);
}
.card__text {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
}
.card__icon {
  width: 40px;
  height: 40px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--pill-bg);
  font-size: 22px;
}
.card__list { margin-top: 4px; }
.card__list li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
}
.card__list li + li { margin-top: 8px; }
.card__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
}
.card .link { margin-top: 16px; }

/* Publication rows */
.stack { display: grid; gap: 16px; }
.card--row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 24px;
  align-items: start;
}
.card__authors {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-2);
}
.card__authors strong { color: var(--text); }
.card__note {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
}

.venue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--hairline);
  text-align: center;
}
.venue__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.venue__year {
  font-size: 13px;
  color: var(--text-2);
}

@media (max-width: 733px) {
  .card { padding: 22px; }
  .card--row { grid-template-columns: 1fr; gap: 14px; }
  .venue { flex-direction: row; gap: 6px; align-self: start; width: max-content; padding: 6px 12px; }
  .card__head { flex-direction: column; gap: 10px; }
}

/* ---------- Timeline ---------- */

.timeline {
  position: relative;
  display: grid;
  gap: 24px;
  padding-left: 32px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--hairline-strong);
}
.timeline__item { position: relative; }
.timeline__marker {
  position: absolute;
  left: -32px;
  top: 30px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.section--alt .timeline__marker { background: var(--bg-alt); box-shadow: 0 0 0 4px var(--bg-alt); }

@media (max-width: 733px) {
  .timeline { padding-left: 24px; }
  .timeline::before { left: 5px; }
  .timeline__marker { left: -24px; width: 12px; height: 12px; top: 26px; border-width: 2.5px; }
}

/* ---------- Pills & chips ---------- */

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 980px;
  background: var(--pill-bg);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-2);
  white-space: nowrap;
}
.pill--live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 8px 14px;
  border-radius: 980px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hairline);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.section:not(.section--alt) .chip { background: var(--bg-alt); box-shadow: none; }

/* ---------- Grouped lists (Education / Honors) ---------- */

.list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 24px;
}
.list__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.list__row:last-child { border-bottom: 0; }
.list__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.list__title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.list__sub { font-size: 15px; color: var(--text-2); }
.list__meta {
  flex: none;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .list__row { flex-direction: column; gap: 6px; }
}

/* ---------- Grids ---------- */

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--loose { gap: 48px; }

@media (max-width: 833px) {
  .grid--2 { grid-template-columns: 1fr; }
  .grid--loose { gap: 40px; }
}

/* ---------- Skills ---------- */

.skills {
  display: grid;
  gap: 28px;
}
.skills__group {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}
.skills__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  padding-top: 8px;
}
@media (max-width: 600px) {
  .skills__group { grid-template-columns: 1fr; gap: 10px; }
  .skills__name { padding-top: 0; }
}

/* ---------- Publications ---------- */

.page-hero {
  padding: 72px 22px 56px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(0, 113, 227, 0.08), transparent 70%),
    var(--bg);
}
.eyebrow {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.section__header--row {
  max-width: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.section__header--row > div { max-width: 720px; }
.section__header--row .btn { flex: none; margin-bottom: 4px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}
.stats__item {
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.stats__item dt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stats__item dd {
  margin: 4px 0 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stats__source {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
}
.stats__source .link { margin-left: 6px; font-size: 13px; }

.year-group + .year-group { margin-top: 48px; }
.year-group__title {
  margin-bottom: 16px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-2);
}

.pub__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 14px;
}
.pub__actions .link { margin-top: 0; }
.link--muted { color: var(--text-2); }
.pub__cites { padding: 3px 10px; font-size: 12px; }

@media (max-width: 733px) {
  .page-hero { padding: 48px 16px 40px; }
  .section__header--row { flex-direction: column; align-items: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats__item dd { font-size: 26px; }
}

/* ---------- Visitor map ---------- */

.visitors {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}
.visitors__map {
  overflow: hidden;
  border-radius: var(--radius);
  background: #f5f5f7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  min-height: 200px;
}
.visitors__map img,
.visitors__map a,
.visitors__map > div {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
.visitors__note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-3);
}
.visitors__note a { color: var(--text-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .visitors__map {
    opacity: 0.92;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] .visitors__map {
  opacity: 0.92;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---------- Footer ---------- */

.footer {
  padding: 32px 22px 48px;
  background: var(--bg-alt);
  border-top: 1px solid var(--hairline);
}
.footer__inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  font-size: 12px;
  color: var(--text-2);
}
.footer__links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer__links a { color: var(--text); }
.footer__copy { margin: 0; }

/* ---------- Reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.timeline__item.reveal:nth-child(2) { transition-delay: 0.08s; }
.timeline__item.reveal:nth-child(3) { transition-delay: 0.16s; }
.grid .reveal:nth-child(2) { transition-delay: 0.1s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .btn, .link .icon--chevron, .nav__menu { transition: none; }
}

/* ---------- Print ---------- */

@media print {
  .nav, .footer__links, .hero__actions { display: none; }
  .section, .hero { padding: 24px 0; }
  .card, .list, .about__facts { box-shadow: none; border: 1px solid #ccc; }
  .reveal { opacity: 1; transform: none; }
}
