/* ============================================================
   Xuyang Chen — Portfolio
   Single static stylesheet, no build step.
   ============================================================ */

:root {
  --bg: #fbfbfd;
  --bg-soft: #f1f2f6;
  --surface: #ffffff;
  --text: #1a1c20;
  --text-soft: #565b66;
  --border: #e6e7ec;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-2: #0ea5a4;
  --shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 8px 24px rgba(20, 22, 30, .06);
  --radius: 16px;
  --maxw: 1080px;
}

[data-theme="dark"] {
  --bg: #0c0d12;
  --bg-soft: #14161d;
  --surface: #15171f;
  --text: #f0f1f5;
  --text-soft: #9aa0ad;
  --border: #262934;
  --accent: #7c83ff;
  --accent-soft: #1c1e2e;
  --accent-2: #2dd4bf;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

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

a { color: inherit; text-decoration: none; }

/* ---------------- NAV ---------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
}
.nav__brand {
  font-weight: 800; font-size: 1.1rem; letter-spacing: .04em;
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; background: var(--accent); color: #fff;
}
.nav__links { display: flex; gap: 22px; margin-left: 8px; }
.nav__links a {
  font-size: .9rem; color: var(--text-soft); font-weight: 500;
  position: relative; transition: color .2s ease;
}
.nav__links a:hover { color: var(--text); }
.nav__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; color: var(--text);
  transition: background .2s ease, transform .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.theme-icon { width: 16px; height: 16px; display: block; }
.theme-icon::before { content: "🌙"; font-size: 15px; }
[data-theme="dark"] .theme-icon::before { content: "☀️"; }

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { box-shadow: var(--shadow); border-color: var(--accent); }
.btn--sm { padding: 8px 16px; font-size: .85rem; }

/* ---------------- HERO ---------------- */
.hero { position: relative; padding: 88px 0 56px; overflow: hidden; }
.hero__bg {
  position: absolute; inset: -40% 0 auto 0; height: 560px; z-index: 0;
  background:
    radial-gradient(600px 300px at 20% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(500px 280px at 85% 0%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%);
  filter: blur(8px); pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; max-width: 800px; }
.hero__avatar {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); background: var(--surface);
  box-shadow: 0 8px 28px rgba(20,22,30,.16); margin-bottom: 22px; display: block;
}
.hero__eyebrow {
  display: inline-block; font-size: .82rem; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 5px 14px; border-radius: 999px; margin-bottom: 20px;
}
.hero__name { font-size: clamp(2.8rem, 7vw, 4.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.02; }
.hero__name-cn { font-size: .5em; font-weight: 700; color: var(--text-soft); letter-spacing: .06em; margin-left: 6px; }
.hero__role { font-size: clamp(1.1rem, 2.6vw, 1.5rem); font-weight: 600; color: var(--text-soft); margin-top: 8px; }
.hero__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.hero__tags span {
  font-size: .8rem; font-weight: 500; font-family: "JetBrains Mono", monospace;
  color: var(--text-soft); border: 1px solid var(--border); background: var(--surface);
  padding: 5px 12px; border-radius: 8px;
}
.hero__lede { font-size: 1.08rem; color: var(--text-soft); max-width: 620px; margin-top: 8px; }
.hero__lede strong { color: var(--text); }
.hero__motto {
  margin-top: 22px; padding: 12px 20px; max-width: 620px;
  border-left: 3px solid var(--accent);
  font-size: 1.02rem; font-weight: 600; color: var(--text); line-height: 1.5;
}
.hero__motto span {
  display: block; margin-top: 4px;
  font-size: .86rem; font-weight: 400; font-style: italic; color: var(--text-soft);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* ---------------- STATS ---------------- */
.stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
  max-width: 480px; margin: 8px 0 24px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-align: center; box-shadow: var(--shadow);
}
.stat__num { display: block; font-size: 1.9rem; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.stat__label { font-size: .82rem; color: var(--text-soft); }

/* ---------------- SECTIONS ---------------- */
.section { padding: 56px 24px; }
.section__title {
  font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 28px;
  display: flex; align-items: baseline; gap: 12px;
}
.section__idx { font-family: "JetBrains Mono", monospace; font-size: .9rem; color: var(--accent); font-weight: 500; }

/* ---------------- ABOUT ---------------- */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.about__card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.about__card--full { grid-column: 1 / -1; }
.about__card h3 { font-size: 1.05rem; margin-bottom: 10px; }
.about__card p { color: var(--text-soft); }
.about__card p + p { margin-top: 10px; }
.about__card .edu { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.edu { list-style: none; display: grid; gap: 10px; }
.edu li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--text-soft); }
.edu__logo {
  flex: none; width: 32px; height: 32px; object-fit: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px; margin-right: 4px;
}
.edu li strong { color: var(--text); }
.edu li span { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: .8rem; color: var(--text-soft); }

/* ---------------- TIMELINE ---------------- */
.timeline { display: grid; gap: 16px; }
.tl {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); position: relative;
  border-left: 3px solid var(--accent);
}
.tl__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tl__head h3 { font-size: 1.15rem; }
.tl__date { font-family: "JetBrains Mono", monospace; font-size: .82rem; color: var(--text-soft); white-space: nowrap; }
.tl__org { color: var(--accent); font-weight: 600; font-size: .92rem; margin: 4px 0 12px; }
.tl__org a { text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s ease; }
.tl__org a:hover { border-bottom-color: currentColor; }
.tl__points { list-style: none; display: grid; gap: 8px; }
.tl__points li { color: var(--text-soft); padding-left: 18px; position: relative; }
.tl__points li::before { content: "›"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.tl__points li strong { color: var(--text); }

/* ---------------- GRID / CARDS ---------------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 36px rgba(20,22,30,.10); }
.card--accent { border-top: 3px solid var(--accent-2); }
.card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card__top h3 { font-size: 1.06rem; line-height: 1.3; }
.card__year { font-family: "JetBrains Mono", monospace; font-size: .76rem; color: var(--text-soft); white-space: nowrap; }
.card__sub { font-size: .86rem; font-weight: 600; color: var(--accent); }
.card p { color: var(--text-soft); font-size: .94rem; }
.card p strong { color: var(--text); }

/* ---------------- CHIPS ---------------- */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 6px; }
.chips li, .chips span {
  font-size: .76rem; font-family: "JetBrains Mono", monospace; color: var(--text-soft);
  background: var(--bg-soft); border: 1px solid var(--border); padding: 4px 10px; border-radius: 7px;
}
.chips--lg span { font-size: .82rem; padding: 6px 12px; }

/* ---------------- SKILLS ---------------- */
.skillset {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.skillset h3 { font-size: 1rem; margin-bottom: 14px; color: var(--accent); }

/* ---------------- PUBLICATIONS ---------------- */
.pub__meta { color: var(--text-soft); font-size: .9rem; margin-bottom: 20px; }
.pubs { list-style: none; display: grid; gap: 10px; }
.pubs li {
  display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow);
  transition: border-color .2s ease;
}
.pubs li:hover { border-color: var(--accent); }
.pub__venue {
  font-family: "JetBrains Mono", monospace; font-size: .78rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); padding: 5px 8px; border-radius: 7px;
  text-align: center; white-space: nowrap;
}
.pub__venue--review { color: var(--text-soft); background: var(--bg-soft); }
.pub__body { display: flex; flex-direction: column; gap: 8px; }
.pubs p { font-size: .92rem; }
.pubs em { color: var(--text-soft); font-style: normal; }
.pub__links { display: flex; flex-wrap: wrap; gap: 8px; }
.pub__links a {
  font-size: .76rem; font-weight: 600; font-family: "JetBrains Mono", monospace;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: 3px 10px; border-radius: 7px; transition: background .15s ease, transform .15s ease;
}
.pub__links a:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }

/* ---------------- OTHERS ---------------- */
.others { list-style: none; display: grid; gap: 10px; }
.others li {
  display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow); transition: border-color .2s ease;
}
.others li:hover { border-color: var(--accent); }
.others__tag {
  font-family: "JetBrains Mono", monospace; font-size: .78rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); padding: 5px 8px; border-radius: 7px;
  text-align: center; white-space: nowrap;
}
.others p { font-size: .92rem; }
.others p strong { color: var(--text); }
.others a {
  font-size: .76rem; font-weight: 600; font-family: "JetBrains Mono", monospace;
  color: var(--accent); white-space: nowrap;
}
.others a:hover { text-decoration: underline; }

/* ---------------- CONTACT ---------------- */
.contact {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  border-radius: 24px; padding: 56px 40px; text-align: center; color: #fff;
}
.contact h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; }
.contact p { margin: 12px auto 28px; max-width: 540px; opacity: .92; }
.contact__links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.contact .btn { background: #fff; color: var(--accent); border-color: #fff; }
.contact .btn--ghost { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.4); }
.contact .btn:hover { box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------------- FOOTER ---------------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; margin-top: 24px; }
.footer__inner { display: flex; justify-content: space-between; color: var(--text-soft); font-size: .86rem; }

/* ---------------- REVEAL ANIMATION ---------------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .nav__links { display: none; }
  .grid, .grid--2, .about { grid-template-columns: 1fr; }
  .about__card--full { grid-column: auto; }
  .pubs li, .others li { grid-template-columns: 1fr; gap: 8px; }
  .pub__venue, .others__tag { justify-self: start; }
  .section { padding: 44px 20px; }
}
