/* =========================================================
   Li Tang — personal website
   Modern minimal · light + dark theme
   Design tokens live in :root (light) and [data-theme="dark"].
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1e23;
  --text-muted: #5b636e;
  --heading: #0d0f12;
  --accent: #1e40af;
  --accent-hover: #1e3a8a;
  --accent-soft: rgba(30, 64, 175, 0.10);
  --border: #e6e8ec;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.05);
  --radius: 12px;
  --maxw: 1040px;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --bg-alt: #14171c;
  --surface: #161a20;
  --text: #e4e7eb;
  --text-muted: #9aa3ad;
  --heading: #f4f6f8;
  --accent: #7ea3f0;
  --accent-hover: #9cbcf7;
  --accent-soft: rgba(126, 163, 240, 0.16);
  --border: #262b33;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ----------------------- Base ----------------------- */
* { box-sizing: border-box; }

html {
  font-size: 14.5px;        /* root size — shrinks the whole rem-based type scale */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

h1, h2, h3 { color: var(--heading); line-height: 1.25; letter-spacing: -0.01em; }

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

em { font-style: italic; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ----------------------- Navbar ----------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--heading);
  letter-spacing: -0.02em;
}
.nav-brand:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  gap: 26px;
  margin-left: auto;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover,
.nav-links a.active { color: var(--accent); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* ----------------------- Hero ----------------------- */
.hero {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 34px 24px 24px;
}
.hero-text { flex: 1; min-width: 0; }
.hero h1 {
  font-size: 1.05rem;
  margin: 0 0 4px;
  font-weight: 700;
}
.hero-role {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 2px;
}
.hero-affil {
  font-size: 1.02rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.hero-email {
  font-size: 0.95rem;
  margin: 0 0 22px;
}
.hero-email strong { color: var(--heading); font-weight: 600; }
.hero-email a { color: #c0392b; text-decoration: none; }
.hero-email a:hover { color: #a93226; text-decoration: underline; }
[data-theme="dark"] .hero-email a { color: #ff7b72; }
[data-theme="dark"] .hero-email a:hover { color: #ff9d96; }
.hero-fields {
  font-size: 0.95rem;
  color: #c0392b;
  font-weight: 600;
  margin: 0 0 22px;
  line-height: 1.5;
}
.hero-fields strong { color: var(--accent); font-weight: 700; }
[data-theme="dark"] .hero-fields { color: #ff7b72; }
.hero-chips {
  margin: 0 0 30px;
  gap: 9px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; }

.hero-aside { flex-shrink: 0; }
.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #13306e);
  box-shadow: var(--shadow);
  border: 4px solid var(--surface);
  user-select: none;
}

/* ----------------------- Buttons ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 17px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, transform 0.12s ease;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* ----------------------- Sections ----------------------- */
.section { padding: 29px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  font-size: 1.4rem;
  margin: 0 0 16px;
  padding-bottom: 9px;
  position: relative;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.subhead {
  font-size: 1.1rem;
  margin: 20px 0 8px;
  color: var(--heading);
}
.subhead:first-of-type { margin-top: 4px; }

.prose p { color: var(--text); margin: 0 0 14px; max-width: 68ch; }
.prose strong { font-weight: 600; }

/* ----------------------- Chips ----------------------- */
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.chips li {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 999px;
}

/* ----------------------- Publications ----------------------- */
.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pub {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }
.pub-main { min-width: 0; }
.pub-title {
  font-weight: 600;
  color: var(--heading);
  margin: 0 0 3px;
  line-height: 1.4;
}
.pub-authors {
  color: var(--text-muted);
  font-size: 0.93rem;
  margin: 0 0 3px;
}
.pub-authors a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.pub-authors a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
.pub-venue {
  font-size: 0.93rem;
  color: var(--text);
  margin: 0;
}
.pub-venue em { color: var(--accent); font-style: italic; }
.pub-year {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  margin-top: 2px;
}
.section-alt .pub-year { background: var(--surface); }

.pub-links {
  display: inline;
}
.pub-links a {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 6px;
  text-decoration: none;
  position: relative;
  top: -1px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.pub-links a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ----------------------- Contact ----------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 22px;
}
.contact-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 4px;
}
.contact-grid p { margin: 0 0 4px; }

/* ----------------------- Footer ----------------------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }

/* ----------------------- Responsive ----------------------- */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .hero {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 22px;
    padding: 28px 24px 24px;
  }
  .hero h1 { font-size: 2.1rem; }
  .avatar { width: 112px; height: 112px; font-size: 2.4rem; }
  .section { padding: 28px 0; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
