/* ==========================================================================
   Xian Liu — personal homepage
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --surface: #ffffff;
  --text: #15171c;
  --text-2: #464c58;
  --text-3: #7b818d;
  --border: #e8e9ee;
  --border-strong: #d4d7de;
  --accent: #2f5bea;
  --accent-soft: rgba(47, 91, 234, 0.08);
  --hl: #c2410c;
  --hl-soft: rgba(194, 65, 12, 0.08);
  --glow: rgba(47, 91, 234, 0.10);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 18px 40px -18px rgba(16, 24, 40, 0.28);
  --radius: 16px;
  --maxw: 1080px;
  --nav-h: 60px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e12;
  --bg-soft: #14171d;
  --surface: #13161c;
  --text: #e9ebef;
  --text-2: #b3b8c3;
  --text-3: #858b97;
  --border: #23272f;
  --border-strong: #323743;
  --accent: #7ea4ff;
  --accent-soft: rgba(126, 164, 255, 0.12);
  --hl: #ff9a5c;
  --hl-soft: rgba(255, 154, 92, 0.12);
  --glow: rgba(126, 164, 255, 0.10);
  --shadow: none;
  --shadow-lg: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}

*,
*::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;
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.icon {
  width: 1em;
  height: 1em;
  flex: none;
}

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

.skip-link:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  margin-right: auto;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2px;
}

.nav-links a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-soft);
  text-decoration: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 17px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.theme-toggle .i-sun,
[data-theme="dark"] .theme-toggle .i-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .i-sun {
  display: block;
}

.menu-toggle {
  display: none;
}

@media (max-width: 920px) {
  .menu-toggle {
    display: inline-grid;
  }

  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .nav.open .nav-links {
    display: flex;
  }

  .nav-links a {
    padding: 10px 12px;
    font-size: 15px;
  }
}

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

.hero-wrap {
  background: radial-gradient(900px 420px at 85% -12%, var(--glow), transparent 70%);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 56px;
  align-items: start;
  padding-top: 64px;
  padding-bottom: 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(38px, 5.2vw, 54px);
  font-weight: 750;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 22px;
  color: var(--text-3);
  font-size: 15px;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bio p {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 16.5px;
  line-height: 1.72;
}

.bio a {
  color: var(--text);
  font-weight: 550;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.bio a:hover {
  text-decoration-color: var(--accent);
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn .icon {
  font-size: 16px;
  color: var(--text-2);
}

.btn.primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.btn.primary .icon {
  color: var(--bg);
}

.hero-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-lg);
}

@media (max-width: 780px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 36px;
  }

  .hero-photo {
    order: -1;
    width: 132px;
  }

  .hero-photo img {
    border-radius: 50%;
  }
}

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

.section {
  padding-top: 56px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-head .sub {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

.sub-head {
  margin: 28px 0 12px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sub-head:first-of-type {
  margin-top: 4px;
}

.em {
  color: var(--hl);
  font-weight: 600;
}

/* ---------- News ---------- */

.news {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news li {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}

.news li:last-child {
  border-bottom: 0;
}

.news time {
  padding-top: 1px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.news .txt {
  color: var(--text-2);
}

.news .hl time {
  color: var(--accent);
}

.news .hl .txt {
  color: var(--text);
  font-weight: 520;
}

.news.collapsed li:nth-child(n + 9) {
  display: none;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-text:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  .news li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ---------- Badges & link chips ---------- */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--hl-soft);
  color: var(--hl);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
}

a.badge:hover {
  text-decoration: none;
  filter: saturate(1.3);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
  text-decoration: none;
}

.chip .stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 3px;
  padding-left: 7px;
  border-left: 1px solid var(--border);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.chip .stars .icon {
  color: #e3a008;
  font-size: 11px;
}

/* ---------- Foundation models ---------- */

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

.feature {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.feature:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.feature-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b0c0f;
}

.feature-media img,
.feature-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feature-media.contain {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.feature-media.contain img {
  object-fit: contain;
  padding: 14px;
}

.feature-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  padding: 18px 20px 20px;
}

.feature-org {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.feature-org img {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  box-shadow: 0 0 0 1px var(--border);
}

.feature h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.feature p {
  margin: 0;
  color: var(--text-2);
  font-size: 14.5px;
}

.feature .role b {
  color: var(--text);
  font-weight: 620;
}

.feature .links {
  margin-top: auto;
  padding-top: 6px;
}

.feature-wide {
  grid-column: 1 / -1;
  flex-direction: row;
}

.feature-wide .feature-media {
  flex: 0 0 46%;
  aspect-ratio: auto;
  min-height: 280px;
}

.feature-wide .feature-body {
  justify-content: center;
  padding: 28px 32px;
  gap: 12px;
}

.feature-wide h3 {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.feature-wide .links {
  margin-top: 4px;
}

@media (max-width: 780px) {
  .features {
    grid-template-columns: 1fr;
  }

  .feature-wide {
    flex-direction: column;
  }

  .feature-wide .feature-media {
    flex: none;
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .feature-wide .feature-body {
    padding: 18px 20px 20px;
  }

  .feature-wide h3 {
    font-size: 20px;
  }
}

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

.pubs {
  display: flex;
  flex-direction: column;
}

.pub {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

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

.pub-media {
  position: relative;
  display: block;
  align-self: start;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.pub-media img,
.pub-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.35s ease;
}

.pub:hover .pub-media img,
.pub:hover .pub-media video {
  transform: scale(1.03);
}

.pub-media.cover img,
.pub-media.cover video {
  object-fit: cover;
}

.pub-media.dark {
  background: #000;
}

.venue-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(17, 20, 28, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.pub-title {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 650;
  line-height: 1.42;
  letter-spacing: -0.005em;
}

.pub-title a {
  color: var(--text);
}

.pub-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.pub-authors {
  margin: 0 0 5px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.pub-authors a {
  color: inherit;
}

.pub-authors a:hover {
  color: var(--accent);
}

.pub-authors .me {
  color: var(--text);
  font-weight: 700;
}

.pub-venue {
  margin: 0 0 12px;
  color: var(--text-3);
  font-size: 14px;
}

.pub-venue i {
  font-style: italic;
}

.pub-venue .badge {
  margin-left: 8px;
  vertical-align: 1px;
}

.pub-extra {
  margin: -6px 0 12px;
  color: var(--text-3);
  font-size: 13.5px;
}

.pub-extra a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

@media (max-width: 680px) {
  .pub {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .pub-media {
    max-width: 440px;
  }
}

/* ---------- Experience ---------- */

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

.exp {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.logo {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
}

.exp-main {
  min-width: 0;
  flex: 1;
}

.exp-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 12px;
}

.exp-role {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.exp-date {
  color: var(--text-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.exp-org {
  color: var(--text-2);
  font-size: 14px;
}

.exp-note {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 13.5px;
}

.exp-note a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

.exp-note a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (max-width: 780px) {
  .exp-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Lists: talks, honors, service, teaching ---------- */

.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.list li:last-child {
  border-bottom: 0;
}

.list .what {
  color: var(--text-2);
}

.list .what b {
  color: var(--text);
  font-weight: 620;
}

.list .what a {
  color: var(--text);
}

.list .what a:hover {
  color: var(--accent);
}

.list .when {
  color: var(--text-3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.talk-title {
  display: block;
  color: var(--text);
  font-weight: 560;
}

.talk-venue {
  color: var(--text-3);
  font-size: 14px;
}

.honors {
  columns: 2;
  column-gap: 48px;
}

.honors li {
  break-inside: avoid;
}

.honors li:last-child {
  border-bottom: 1px dashed var(--border);
}

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

.service dt {
  margin-top: 10px;
  color: var(--text);
  font-weight: 620;
}

.service dt:first-child {
  margin-top: 0;
}

.service dd {
  margin: 2px 0 0;
  color: var(--text-2);
}

@media (max-width: 780px) {
  .honors {
    columns: 1;
  }

  .honors li:last-child {
    border-bottom: 0;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ---------- Lightbox ---------- */

a[data-lightbox] {
  cursor: zoom-in;
}

.lightbox {
  width: min(1100px, 94vw);
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  cursor: zoom-out;
}

.lightbox::backdrop {
  background: rgba(8, 10, 14, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lightbox img {
  width: 100%;
  height: auto;
}

.lightbox-caption {
  margin: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13.5px;
}

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

.footer {
  margin-top: 80px;
  padding: 28px 0 44px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13.5px;
}

.footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.footer a {
  color: var(--text-2);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
