:root {
  --bg: #f8fafc;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --card-bg: #ffffff;
  --card-hover: #f1f5f9;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --btn-primary-bg: #0f172a;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #1e293b;
  --badge-bg: #f1f5f9;
  --badge-text: #334155;
  --badge-accent-bg: #eff6ff;
  --badge-accent-text: #1d4ed8;
  --avatar-border: #f8fafc;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b0f17;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --border: #1e293b;
  --border-strong: #334155;
  --card-bg: #131b2e;
  --card-hover: #1b253b;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-light: #0c2340;
  --btn-primary-bg: #f8fafc;
  --btn-primary-text: #0f172a;
  --btn-primary-hover: #e2e8f0;
  --badge-bg: #1e293b;
  --badge-text: #cbd5e1;
  --badge-accent-bg: #0e2a47;
  --badge-accent-text: #38bdf8;
  --avatar-border: #0b0f17;
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.68;
  letter-spacing: -0.011em;
  transition: background-color 0.2s ease, color 0.2s ease;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  padding-bottom: 4rem;
}

.site-wrapper {
  max-width: 740px;
  margin: 0 auto;
}

/* Banner */
.banner-container {
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  position: relative;
  background: #0f172a;
}

@media (min-width: 640px) {
  .banner-container {
    height: 220px;
    border-radius: 0 0 16px 16px;
  }
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Theme Switch */
.theme-switch-wrapper {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
}

#theme-toggle {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}

#theme-toggle:hover {
  transform: scale(1.08);
}

.theme-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* Main Container */
.container {
  padding: 0 1.5rem;
  margin-top: -3.5rem;
  position: relative;
}

/* Profile Header */
.profile-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 1.25rem;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 50%;
  border: 4px solid var(--avatar-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: block;
  background-color: var(--card-bg);
}

.name {
  font-size: 2.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.02rem;
  font-weight: 450;
  margin-bottom: 1.25rem;
}

/* Links & Buttons */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--card-hover);
  border-color: var(--border-strong);
  color: var(--accent);
  transform: translateY(-1px);
}

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

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

.btn .icon {
  flex-shrink: 0;
}

/* Sections */
.section {
  margin-bottom: 3rem;
}

.section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
  color: var(--text);
}

.bio-text p {
  color: var(--text);
  margin-bottom: 1.2rem;
  font-size: 1.04rem;
  line-height: 1.72;
}

.bio-text p:last-child {
  margin-bottom: 0;
}

.section a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.section a:hover {
  border-bottom-color: var(--accent);
}

/* Publications */
.section-header-inline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.section-header-inline h2 {
  margin-bottom: 0;
}

.more-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.pub-item {
  padding: 1.15rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.pub-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.pub-title {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.pub-title a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pub-title a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.pub-citation {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.pub-citation strong {
  color: var(--text);
  font-weight: 600;
}

.pub-citation em {
  font-style: italic;
  color: var(--text);
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-subtle);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer-links a {
  color: var(--text-subtle);
  text-decoration: none;
}

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