:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #eaeef4;
  --text: #1a1d24;
  --muted: #5c6370;
  --accent: #2563eb;
  --accent-soft: #3b82f6;
  --border: #dde2e9;
  --shadow: 0 8px 24px rgba(26, 29, 36, 0.06);
}

/* Dark theme */
html.dark {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-soft: #22262e;
  --text: #e6e9ef;
  --muted: #9ca3b4;
  --accent: #5b8def;
  --accent-soft: #7ba3f7;
  --border: #2d333b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

html.dark body {
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  backdrop-filter: blur(8px);
  background: rgba(247, 250, 255, 0.9);
  border-bottom: 1px solid var(--border);
}

html.dark .topbar {
  background: rgba(15, 17, 21, 0.9);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.brand {
  text-decoration: none;
  font-weight: 700;
  color: var(--text);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  padding: 0.4rem 0.6rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  margin-right: 0.5rem;
  font-size: 1.2rem;
  line-height: 1;
}

.theme-toggle::before {
  content: "☀";
}

html.dark .theme-toggle::before {
  content: "☾";
}

.hero {
  padding: 3rem 0 2rem;
}

.hero-content {
  animation: heroFade 0.6s ease-out;
}

@keyframes heroFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}

.hero-profile-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.hero-profile-links.hero-icon-row {
  gap: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.hero-profile-links a {
  color: var(--accent);
  text-decoration: none;
}

.hero-profile-links a:hover {
  text-decoration: underline;
}

.hero-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.hero-icon-link:hover {
  text-decoration: none;
  opacity: 0.85;
}

.hero-icon {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.hero-profile-links span[aria-hidden="true"] {
  color: var(--muted);
  user-select: none;
}

.hero-profile-links img,
.hero-profile-links .icon-wos,
.hero-profile-links .icon-github {
  vertical-align: middle;
  margin-inline-end: 0.25em;
}

.icon-wos {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-start: 0.25em;
  vertical-align: middle;
}

.profile-link .icon-wos {
  margin-inline-start: 0.25em;
}

.hero-profile-links em {
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  align-items: center;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.9rem, 2.8vw, 2.8rem);
  margin: 0.5rem 0;
}

.lead {
  color: var(--muted);
  line-height: 1.65;
}

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

.lead a:hover {
  text-decoration: underline;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.2rem;
}

.btn {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  align-self: center;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.profile-pic {
  width: 170px;
  height: 170px;
  border-radius: 14px;
  object-fit: cover;
  border: 4px solid var(--surface-soft);
}

.profile-card h2 {
  margin: 0.9rem 0 0.1rem;
  font-size: 1.1rem;
}

.profile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-card p + p {
  margin-top: 0.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card p {
  color: var(--muted);
  line-height: 1.6;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.highlights-grid article {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 1rem;
}

.section-heading p {
  margin-top: -0.25rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}

.tab-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-panels {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.tab-panel {
  display: none;
}

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

.tab-panel ul,
.tab-panel ol {
  color: var(--muted);
  line-height: 1.7;
  padding-left: 1.2rem;
}

/* Experience timeline */
.section-intro {
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-item {
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}

.timeline-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.timeline-company-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--surface-soft);
}

.timeline-meta-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.timeline-meta-text strong {
  color: var(--text);
}

.timeline-meta-text span {
  font-size: 0.9rem;
  color: var(--muted);
}

.timeline-item p,
.timeline-item .timeline-focus {
  margin: 0 0 0.5rem;
}

.timeline-focus {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
}

.timeline-achievements {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
}

.timeline-scale {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0.35rem 0 0.5rem !important;
}

.timeline-source {
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.5rem !important;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 1.1rem;
}

.project-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.project-card p {
  margin: 0;
  font-size: 0.95rem;
}

.project-impact p {
  margin-bottom: 0.75rem;
}

.project-impact p:last-of-type {
  margin-bottom: 0;
}

.project-tech {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.profile-group-title {
  margin: 1rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

#recognition .profile-group-title:first-of-type {
  margin-top: 0.5rem;
}

.profile-list {
  margin: 0 0 0.5rem;
}

.profile-list li {
  margin-bottom: 0.35rem;
}

/* Expertise grid */
.expertise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.expertise-group {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 1rem;
}

.expertise-group h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--text);
}

.expertise-group ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* Publications & Research */
.publications-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.research-areas h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.research-areas ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.7;
}

/* Recognition */
.recognition-grid ul {
  margin: 0 0 1rem;
  padding-left: 2.5rem;
  color: var(--muted);
  line-height: 1.7;
}

.recognition-grid ul li::marker {
  color: var(--muted);
}

#recognition h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
}

#recognition h3:first-of-type {
  margin-top: 0;
}

/* Speaking */
.speaking-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.8;
}

/* Contact CTA */
.contact-cta p {
  margin: 0.4rem 0;
}

.contact-location {
  margin-top: 0.75rem !important;
  font-size: 0.95rem;
}

/* Blog index & post pages */
.page-content {
  padding: 2rem 0 3rem;
}

.blog-page .section-intro {
  margin-bottom: 1.5rem;
}

.blog-index-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.blog-index-item {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.blog-index-item:last-child {
  border-bottom: none;
}

.blog-index-item .blog-date {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.blog-index-item h2 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.blog-index-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.blog-index-item h2 a:hover {
  color: var(--accent);
}

.blog-index-item p {
  margin: 0;
  font-size: 0.95rem;
}

.blog-back {
  margin: 0 0 0.75rem !important;
  font-size: 0.9rem;
}

.blog-post .blog-date {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.blog-post .blog-subtitle {
  margin: -0.5rem 0 1rem;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.5;
}

.blog-post h1 {
  margin: 0 0 1rem;
  font-size: 1.75rem;
}

.blog-post h2 {
  margin: 1.5rem 0 0.6rem;
  font-size: 1.2rem;
  color: var(--text);
}

.blog-post h2:first-of-type {
  margin-top: 1rem;
}

.blog-post p {
  margin: 0 0 1rem;
}

.blog-post p:last-child {
  margin-bottom: 0;
}

.blog-post ul {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  color: var(--muted);
  line-height: 1.65;
}

.blog-post ul li {
  margin-bottom: 0.35rem;
}

.blog-post ul li:last-child {
  margin-bottom: 0;
}

.blog-citation {
  padding: 0.75rem 1rem;
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.citation-placeholder {
  font-style: italic;
}

.blog-index-item .blog-links {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}

.blog-index-item .blog-links a {
  color: var(--accent);
  text-decoration: none;
}

.blog-index-item .blog-links a:hover {
  text-decoration: underline;
}

/* Blog */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.blog-entry {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.blog-entry:last-of-type {
  border-bottom: none;
}

.blog-date {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.blog-entry h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.blog-entry h3 a {
  color: var(--text);
  text-decoration: none;
}

.blog-entry h3 a:hover {
  color: var(--accent);
}

.blog-entry-placeholder {
  padding: 1rem;
  background: var(--surface-soft);
  border-radius: 10px;
}

.blog-placeholder {
  margin: 0;
  font-style: italic;
  color: var(--muted);
}

.contact a,
.card a {
  color: var(--accent);
  text-decoration: none;
}

.card a.btn {
  color: #fff;
}

.card a.btn:hover {
  text-decoration: none;
}

.contact a:hover,
.card a:hover {
  text-decoration: underline;
}

.profile-link {
  text-decoration: underline;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  padding: 1.2rem;
}

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

  .nav-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
  }

  .topbar-inner {
    position: relative;
    flex-wrap: wrap;
  }

  .brand {
    margin-right: auto;
  }

  .main-nav {
    order: 3;
    width: 100%;
  }

  .profile-card {
    max-width: 320px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.4rem;
  }
}
