/* ============================
   Wenkai Yang's Homepage
   ============================ */

/* ---- Theme Variables ---- */
:root {
  --color-bg: #fdfdfd;
  --color-surface: #f5f6f8;
  --color-border: #eaedf0;
  --color-text: #1d1d1f;
  --color-text-secondary: #4a4a4f;
  --color-text-muted: #8e8e93;
  --color-accent: #4a9ede;
  --color-accent-light: #e8f4fd;
  --color-accent-hover: #2d7fb8;
  --color-green: #059669;
  --color-orange: #d97706;
  --color-red: #dc2626;
  --color-card-bg: #ffffff;
  --color-card-border: #eaedf0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark {
  --color-bg: #0f0f14;
  --color-surface: #1a1a24;
  --color-border: #2a2a3a;
  --color-text: #f0f0f5;
  --color-text-secondary: #b0b0c0;
  --color-text-muted: #6a6a7a;
  --color-accent: #58a6ff;
  --color-accent-light: #0d1d33;
  --color-accent-hover: #79c0ff;
  --color-green: #34d399;
  --color-orange: #fbbf24;
  --color-red: #f87171;
  --color-card-bg: #1a1a24;
  --color-card-border: #2a2a3a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

html.light {
  --color-bg: #fdfdfd;
  --color-surface: #f5f6f8;
  --color-border: #eaedf0;
  --color-text: #1d1d1f;
  --color-text-secondary: #4a4a4f;
  --color-text-muted: #8e8e93;
  --color-accent: #4a9ede;
  --color-accent-light: #e8f4fd;
  --color-accent-hover: #2d7fb8;
  --color-green: #059669;
  --color-orange: #d97706;
  --color-red: #dc2626;
  --color-card-bg: #ffffff;
  --color-card-border: #eaedf0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--color-bg);
  font: 15px/1.7 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text-secondary);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

::selection {
  background: var(--color-accent);
  color: #fff;
}

/* ---- Layout ---- */
.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 40px;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 1fr auto;
  gap: 0 70px;
}

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: 50px;
  align-self: start;
}

.sidebar .avatar {
  width: 100%;
  max-width: 220px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
}

.sidebar .avatar:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.sidebar h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-text);
  margin-top: 20px;
  letter-spacing: -0.5px;
}

.sidebar .subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.sidebar .contact {
  list-style: none;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar .contact li {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .contact li i {
  width: 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar .contact li a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.sidebar .contact li a:hover {
  color: var(--color-accent);
}

/* Theme Toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-top: 28px;
  font-size: 13px;
  color: var(--color-text-muted);
  border: none;
  background: none;
  font-family: inherit;
  padding: 0;
  transition: color var(--transition);
}

.theme-toggle:hover { color: var(--color-accent); }

.switch-track {
  position: relative;
  width: 38px;
  height: 20px;
  background: var(--color-border);
  border-radius: 10px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left var(--transition), background var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

html.dark .switch-track { background: var(--color-accent); }
html.dark .switch-thumb { left: 20px; background: var(--color-bg); }

/* ---- Main Content ---- */
main {
  min-width: 0;
  padding-bottom: 40px;
}

/* ---- Typography ---- */
h1, h2, h3 {
  color: var(--color-text);
  font-weight: 700;
}

h2 {
  font-size: 18px;
  margin: 48px 0 16px;
  padding-bottom: 10px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

h2 .section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 13px;
  flex-shrink: 0;
}

main > h2:first-of-type {
  margin-top: 8px;
}

h3 {
  font-size: 15px;
  margin: 28px 0 12px;
  color: var(--color-text-secondary);
  font-weight: 600;
  padding-left: 12px;
  border-left: 3px solid var(--color-accent);
}

p { margin: 0 0 14px; }

.note {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

/* ---- Links ---- */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

a.adv {
  color: var(--color-text);
  font-weight: 600;
  border-bottom: 1.5px solid var(--color-accent-light);
  transition: border-color var(--transition), color var(--transition);
}
a.adv:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

a.ppl { color: var(--color-text-secondary); }
a.ppl:hover { color: var(--color-accent); }

/* Code-style Links (Paper/Code buttons) */
a.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-green);
  text-decoration: none;
  transition: all var(--transition);
  margin-right: 4px;
}

a.btn:hover {
  background: var(--color-green);
  color: #fff;
  border-color: var(--color-green);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

/* ---- Bio Section ---- */
.bio {
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--color-text-secondary);
}

/* ---- News ---- */
ul.news {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

ul.news li {
  font-size: 14px;
  line-height: 1.7;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

ul.news li:hover {
  background: var(--color-surface);
}

ul.news li .date {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  margin-right: 8px;
  letter-spacing: 0.3px;
}

/* ---- Education & Experience ---- */
ul.exp {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

ul.exp li {
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
}

ul.exp li:hover {
  background: var(--color-surface);
  border-color: var(--color-border);
}

ul.exp li .role {
  font-weight: 700;
  color: var(--color-text);
}

ul.exp li .org {
  font-weight: 600;
  color: var(--color-accent);
}

ul.exp li .period {
  color: var(--color-text-muted);
  font-size: 12.5px;
}

ul.exp li .mentor {
  font-size: 12.5px;
  color: var(--color-text-muted);
  display: block;
  margin-top: 3px;
  padding-left: 2px;
}

/* ---- Publications ---- */
ul.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

ul.pub-list > li {
  padding: 16px 18px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

ul.pub-list > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background var(--transition);
  border-radius: 3px 0 0 3px;
}

ul.pub-list > li:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

ul.pub-list > li:hover::before {
  background: var(--color-accent);
}

.pub-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--color-text);
  line-height: 1.4;
  transition: color var(--transition);
}

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

.pub-authors {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 5px;
  line-height: 1.5;
}

.pub-venue {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.pub-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---- Awards ---- */
ul.awards {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

ul.awards li {
  font-size: 14px;
  line-height: 1.6;
}

/* ---- Footer ---- */
footer {
  grid-column: 2;
  padding-top: 30px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---- Visitor Map ---- */
.visitor-map {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-height: 200px;
}

/* ---- Back to Top ---- */
.back-top {
  margin-top: 36px;
  text-align: center;
  font-size: 13px;
}

.back-top a {
  color: var(--color-text-muted);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}

.back-top a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  text-decoration: none;
}

/* ---- Responsive ---- */
@media screen and (max-width: 960px) {
  .wrapper {
    display: block;
    padding: 30px 24px;
  }

  .sidebar {
    position: static;
    text-align: center;
    margin-bottom: 40px;
  }

  .sidebar .avatar {
    max-width: 160px;
    margin: 0 auto;
    display: block;
  }

  .sidebar .contact {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
  }

  main { padding-bottom: 20px; }

  footer {
    grid-column: 1;
  }
}

@media screen and (max-width: 600px) {
  .wrapper { padding: 20px 16px; }

  h2 { font-size: 16px; margin-top: 36px; }

  ul.pub-list > li { padding: 12px 14px; }

  .sidebar .avatar { max-width: 130px; }
}

/* ---- Print ---- */
@media print {
  body { padding: 0; font-size: 11pt; color: #333; background: #fff; }
  .wrapper { display: block; padding: 0; }
  .sidebar { position: static; text-align: center; }
  .sidebar .avatar { max-width: 100px; }
  main { margin: 0; }
  a.btn { display: none; }
  footer { display: none; }
  .theme-toggle { display: none; }
}
