:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --accent: #2563eb;
  --text: #111827;
  --muted: #4b5563;
  --border: #e5e7eb;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --max-width: 1080px;
  --radius: 14px;
  --sans: "Inter", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --btn-bg: #f9fafb;
  --btn-hover: #eef2ff;
  --logo-bg: #f5f6fa;
  --tab-active-bg: linear-gradient(90deg, #1fb6ff, #2563eb);
}

/* Dark theme variables */
[data-theme='dark'] {
  --bg: #0f172a;
  --card: #1e293b;
  --accent: #38bdf8;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  --btn-bg: #334155;
  --btn-hover: #475569;
  --logo-bg: #334155;
  --tab-active-bg: linear-gradient(90deg, #0ea5e9, #2563eb);
}

/* Fallback to system preference if no manual theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f172a;
    --card: #1e293b;
    --accent: #38bdf8;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    --btn-bg: #334155;
    --btn-hover: #475569;
    --logo-bg: #334155;
    --tab-active-bg: linear-gradient(90deg, #0ea5e9, #2563eb);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.hero, .pub-card, .btn, .tab-btn, .logo-img, .logo-img-small, .logo-badge {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

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

a:hover {
  text-decoration: underline;
}

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

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 100;
  width: 40px;
  height: 40px;
}

.theme-toggle:hover {
  background: var(--btn-hover);
  transform: scale(1.1);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

[data-theme='dark'] .sun-icon {
  display: block;
}
[data-theme='dark'] .moon-icon {
  display: none;
}
:root:not([data-theme='dark']) .sun-icon {
  display: none;
}
:root:not([data-theme='dark']) .moon-icon {
  display: block;
}

/* Adjust for system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .sun-icon {
    display: block;
  }
  :root:not([data-theme='light']) .moon-icon {
    display: none;
  }
}

.hero {
  background: var(--card);
  padding: 28px 0 10px;
  position: relative;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 700;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
}

.hero-text p {
  margin: 0 0 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 600;
}

.btn:hover {
  background: var(--btn-hover);
}

.portrait {
  justify-self: end;
}

.profile-pic {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section {
  padding: 26px 0;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.divider {
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

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

.news-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.news-date {
  font-weight: 700;
  margin-right: 8px;
}

.pub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.pub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  color: #ffffff;
  background: var(--tab-active-bg);
  border-color: transparent;
  box-shadow: var(--shadow);
}

.pub-panel {
  display: none;
}

.pub-panel.active {
  display: block;
}

.pub-card {
  display: grid;
  /* grid-template-columns: 160px 1fr; */
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pub-thumb {
  width: 160px;
  height: 100px;
  background: var(--btn-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  object-fit: cover;
}

.pub-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 17px;
}

.pub-authors, .pub-meta, .pub-desc {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.exp-table, .edu-table {
  width: 100%;
  border-collapse: collapse;
}

.exp-row, .edu-row {
  border-bottom: 1px solid var(--border);
}

.exp-cell, .edu-cell {
  padding: 14px 0;
  vertical-align: top;
  font-size: 18px;
  line-height: 1.7;
}

.logo-cell {
  width: 110px;
  text-align: right;
  padding-left: 14px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--btn-hover);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
}

.logo-img {
  width: 220px;
  height: 144px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--logo-bg);
  box-shadow: var(--shadow);
  object-fit: contain;
}

.logo-img-small {
  width: 220px;
  height: 144px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--logo-bg);
  box-shadow: var(--shadow);
  object-fit: contain;
}

.logo-badge small {
  display: block;
  font-size: 10px;
  color: #4b5563;
}

.text-red {
  color: #dc2626;
}

[data-theme='dark'] .text-red {
  color: #f87171;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .text-red {
    color: #f87171;
  }
}

.footer {
  padding: 24px 0 32px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero-grid, .pub-grid {
    grid-template-columns: 1fr;
  }

  .portrait {
    justify-self: start;
  }

  .profile-pic {
    width: 160px;
    height: 160px;
  }
}

