:root,
body.colorscheme-light {
  --bg: #fafafa;
  --fg: #212121;
  --alt-bg: #e0e0e0;
  --alt-fg: #000000;
  --darker-alt-bg: #cccccc;
  --link: #1565c0;
}

body.colorscheme-dark {
  --bg: #212121;
  --fg: #dadada;
  --alt-bg: #424242;
  --alt-fg: #dadada;
  --darker-alt-bg: #4f4f4f;
  --link: #42a5f5;
}

@media (prefers-color-scheme: dark) {
  body.colorscheme-auto {
    --bg: #212121;
    --fg: #dadada;
    --alt-bg: #424242;
    --alt-fg: #dadada;
    --darker-alt-bg: #4f4f4f;
    --link: #42a5f5;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

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

a:hover {
  text-decoration: underline;
}

.wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.5rem;
}

.nav-title {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--fg);
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}

.lang-switcher {
  list-style: none;
  display: flex;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.content {
  flex: 1;
}

.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0.2rem 0;
}

.hero h2 {
  font-weight: normal;
  color: var(--alt-fg);
  opacity: 0.8;
  margin: 0.2rem 0 1.5rem;
}

.social-list {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  padding: 0;
  margin: 0 0 1.5rem;
  font-size: 1.4rem;
}

.social-list a {
  color: var(--fg);
}

.bio {
  max-width: 560px;
  margin: 1rem auto 1.5rem;
}

.cta-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.85;
  text-decoration: none;
}

.btn-primary {
  background: var(--link);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--darker-alt-bg);
}

.section-heading {
  text-align: center;
  margin: 2.5rem 0 1.5rem;
}

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

.skill-category h3 {
  font-size: 1rem;
  text-align: center;
  margin: 0 0 0.5rem;
}

.pill-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.pill {
  background: var(--alt-bg);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  text-align: left;
}

.project-card {
  background: var(--alt-bg);
  border: 1px solid var(--darker-alt-bg);
  border-radius: 8px;
  padding: 1.25rem;
  transition: transform 0.15s ease;
}

.project-card:hover {
  transform: translateY(-2px);
}

.project-card h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.read-more {
  font-size: 0.85rem;
  font-weight: 600;
}

.view-all {
  text-align: center;
  margin-top: 1.5rem;
}

.project-section {
  margin-bottom: 2.5rem;
}

.blog-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

@media (max-width: 480px) {
  .cta-row {
    flex-direction: column;
    align-items: center;
  }
}

.page h1 {
  border-bottom: 1px solid var(--darker-alt-bg);
  padding-bottom: 0.5rem;
}

.cv-section {
  max-width: 640px;
  margin: 0 auto 2rem;
}

.edu-item,
.exp-item,
.pub-item {
  background: var(--alt-bg);
  border: 1px solid var(--darker-alt-bg);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.edu-header,
.exp-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.edu-years,
.exp-years {
  font-size: 0.85rem;
  opacity: 0.7;
  white-space: nowrap;
}

.edu-focus {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

.exp-location {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.15rem;
}

.exp-bullets {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.exp-bullets li {
  margin-bottom: 0.35rem;
}

.pub-title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.pub-meta {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0;
  word-break: break-word;
}

@media (max-width: 480px) {
  .edu-header,
  .exp-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.site-footer {
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
  padding-top: 2rem;
}

.theme-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--darker-alt-bg);
  background: var(--alt-bg);
  color: var(--fg);
  cursor: pointer;
  font-size: 1.1rem;
  z-index: 10;
}
