/* Theme variables */
:root {
  --bg: #f7f7f5;
  --bg-card: #fff;
  --text: #333;
  --text-heading: #111;
  --text-secondary: #444;
  --text-muted: #666;
  --text-muted-2: #777;
  --text-muted-3: #888;
  --text-muted-4: #999;
  --border: #eee;
  --border-2: #ddd;
  --accent: #0066cc;
  --accent-hover: #0055aa;
  --accent-bg: #e8f0fe;
  --accent-shadow: rgba(0, 102, 204, 0.12);
  --tag-bg: #f5f8ff;
  --tag-border: #e0e8f5;
  --tag-hover-bg: #eaf1ff;
  --code-bg: #f5f5f5;
  --toc-bg: #f9f9f9;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-hover: rgba(0, 0, 0, 0.1);
  --research-bg: #f9fbff;
  --pub-card-bg: #fcfcfc;
  --scholar-bg: #f0f0f0;
  --scholar-hover: #e0e0e0;
  --medium-icon: #111;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-card: #242424;
  --text: #d4d4d4;
  --text-heading: #f0f0f0;
  --text-secondary: #bbb;
  --text-muted: #aaa;
  --text-muted-2: #999;
  --text-muted-3: #888;
  --text-muted-4: #777;
  --border: #333;
  --border-2: #444;
  --accent: #4d9fff;
  --accent-hover: #3a8aee;
  --accent-bg: #1e2a3a;
  --accent-shadow: rgba(77, 159, 255, 0.15);
  --tag-bg: #1e2a3a;
  --tag-border: #2a3a4a;
  --tag-hover-bg: #253545;
  --code-bg: #2a2a2a;
  --toc-bg: #242424;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.4);
  --research-bg: #1e2430;
  --pub-card-bg: #242424;
  --scholar-bg: #333;
  --scholar-hover: #444;
  --medium-icon: #f0f0f0;
}

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

/* Base */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  padding: 2rem 1rem;
  transition:
    background 0.3s,
    color 0.3s;
}

/* Layout */
.container {
  max-width: 900px;
  margin: 0 auto;
}

/* Typography */
h1 {
  font-size: 2em;
  font-weight: 700;
  margin-bottom: 0.3em;
  color: var(--text-heading);
}

h2 {
  font-size: 1.4em;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5em;
  color: var(--text-heading);
}

h3 {
  font-size: 1.15em;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.4em;
  color: var(--text-heading);
}

p {
  margin-bottom: 1em;
}

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

a:hover {
  text-decoration: underline;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border-2);
  margin: 2rem 0;
}

hr::before {
  content: none;
}

/* Theme toggle switch */
.theme-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 100;
  width: 52px;
  height: 28px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: var(--border-2);
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  transition:
    background 0.3s,
    border-color 0.3s;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s;
}

.theme-toggle .toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7em;
  transition: opacity 0.2s;
  line-height: 1;
}

.theme-toggle .fa-moon {
  right: 7px;
  color: var(--text-muted-4);
  opacity: 1;
}

.theme-toggle .fa-sun {
  left: 7px;
  color: #f5c842;
  opacity: 0;
}

[data-theme="dark"] .theme-toggle {
  background: var(--accent);
  border-color: var(--accent);
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateX(24px);
}

[data-theme="dark"] .theme-toggle .fa-moon {
  opacity: 0;
}

[data-theme="dark"] .theme-toggle .fa-sun {
  opacity: 1;
}

/* Header */
.header {
  margin-bottom: 0.5em;
  text-align: center;
}

.header h1 {
  margin-bottom: 0.1em;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.8em;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.05em;
  margin-bottom: 0.6em;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4em 1.2em;
  font-size: 0.95em;
}

/* Medium card */
.medium-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: 1.2em 1.5em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition:
    box-shadow 0.2s,
    transform 0.2s,
    border-color 0.2s;
}

.medium-card:hover {
  box-shadow: 0 4px 20px var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--text-heading);
  text-decoration: none;
}

.medium-card:hover .medium-arrow {
  transform: translateX(4px);
}

.medium-card-left {
  display: flex;
  align-items: center;
  gap: 1em;
}

.medium-card-icon {
  font-size: 2em;
  color: var(--medium-icon);
}

.medium-card-title {
  font-weight: 600;
  font-size: 1em;
  color: var(--text-heading);
  margin-bottom: 0.15em;
}

.medium-card-desc {
  font-size: 0.85em;
  color: var(--text-muted-2);
}

.medium-card-cta {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.medium-arrow {
  font-size: 0.8em;
  transition: transform 0.2s;
}

.content-cards {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

/* Education quip */
.edu-quip {
  font-size: 0.85em;
  color: var(--text-muted-4);
  font-style: italic;
  margin-top: 0.4em;
}

.edu-quip i {
  margin-right: 0.3em;
  font-size: 0.9em;
}

/* YouTube card */
.yt-icon {
  color: #ff0000;
}

.yt-card:hover {
  border-color: #ff0000;
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.1);
}

.yt-cta {
  color: #ff0000;
}

@media (max-width: 600px) {
  .medium-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8em;
  }
}

/* Experience timeline */
.timeline {
  position: relative;
  padding-left: 28px;
  margin-left: 6px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-2);
}

.exp-entry {
  position: relative;
  margin-bottom: 1.8em;
}

.exp-entry:last-child {
  margin-bottom: 0;
}

.exp-entry::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border-2);
}

.exp-entry .exp-date {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-muted-4);
  margin-bottom: 0.15em;
}

.exp-entry .exp-role {
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.2em;
}

.exp-entry p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

/* Lists */
ul {
  padding-left: 1.3em;
  margin-bottom: 1em;
}

li {
  margin-bottom: 0.3em;
}

/* About stats bar */
.about-stats {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  margin-bottom: 1.5em;
  padding: 0;
}

.stat {
  text-align: center;
  flex: 1;
  padding: 1.2em 0.8em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow);
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

.stat:hover {
  box-shadow: 0 4px 16px var(--accent-shadow);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78em;
  color: var(--text-muted-3);
  margin-top: 0.2em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Skills grid with tags */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2em;
}

.skill-group {
  padding: 1em;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

.skill-group:hover {
  box-shadow: 0 4px 16px var(--accent-shadow);
  transform: translateY(-2px);
}

.skill-group-title {
  font-weight: 600;
  font-size: 0.88em;
  color: var(--text-muted);
  margin-bottom: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skill-group-title i {
  color: var(--accent);
  margin-right: 0.4em;
  width: 16px;
  text-align: center;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--text);
  font-size: 0.82em;
  padding: 0.35em 0.75em;
  border-radius: 4px;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}

.skill-tag i {
  font-size: 0.9em;
  color: var(--accent);
  width: 14px;
  text-align: center;
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tag-hover-bg);
}

@media (max-width: 600px) {
  .about-stats {
    flex-wrap: wrap;
    gap: 0.5em;
  }
  .stat {
    flex: 1 1 40%;
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

/* Skills grid */
.skills-list {
  list-style: none;
  padding-left: 0;
}

.skills-list li {
  margin-bottom: 0.5em;
}

.skills-list li strong {
  color: var(--text-heading);
}

/* Blog list */
.post-list {
  list-style: none;
  padding-left: 0;
}

.post-list li {
  margin-bottom: 0.6em;
}

.post-date {
  color: var(--text-muted-4);
  font-size: 0.9em;
  margin-right: 0.5em;
}

/* Code / Pre blocks */
code {
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1em;
  overflow-x: auto;
  border-radius: 4px;
  margin-bottom: 1em;
  line-height: 1.4;
  font-size: 0.85em;
}

pre code {
  background: none;
  padding: 0;
}

/* Table of Contents */
.toc {
  background: var(--toc-bg);
  padding: 1em 1.5em;
  border-radius: 4px;
  margin-bottom: 2em;
}

.toc h2 {
  margin-bottom: 0.4em;
  font-size: 1.15em;
}

.toc ul {
  margin-bottom: 0;
}

.toc li {
  margin-bottom: 0.2em;
}

/* Paper entry */
.paper {
  margin-bottom: 2em;
  padding-bottom: 1em;
  border-bottom: 1px solid var(--border);
}

.paper:last-child {
  border-bottom: none;
}

.paper h3 {
  margin-bottom: 0.2em;
}

.paper .arxiv {
  font-size: 0.85em;
  color: var(--text-muted-3);
  margin-bottom: 0.5em;
  display: block;
}

/* Resources table-like */
.resource {
  margin-bottom: 0.8em;
}

.resource a {
  font-weight: 500;
}

.stars {
  color: var(--text-muted-4);
  font-size: 0.85em;
}

/* Publication card */
.pub-card {
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 2em;
  background: var(--pub-card-bg);
  margin-bottom: 1.5em;
}

.pub-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.78em;
  font-weight: 600;
  padding: 0.3em 0.9em;
  border-radius: 20px;
  margin-bottom: 1em;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pub-title {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.5em;
  line-height: 1.35;
}

.pub-authors {
  color: var(--text-muted);
  font-size: 0.95em;
  margin-bottom: 1em;
  line-height: 1.5;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  font-size: 0.88em;
  color: var(--text-muted-2);
  margin-bottom: 1.5em;
  padding-bottom: 1.2em;
  border-bottom: 1px solid var(--border);
}

.pub-meta i {
  margin-right: 0.4em;
  color: var(--accent);
}

.pub-abstract {
  margin-bottom: 1.5em;
}

.pub-abstract h3 {
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-4);
  margin-bottom: 0.7em;
}

.pub-abstract p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.pub-highlights {
  margin-bottom: 1.5em;
}

.pub-highlights h3 {
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-4);
  margin-bottom: 0.8em;
}

.highlight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8em;
  padding: 0.8em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.highlight-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 8px;
  font-size: 0.95em;
}

.highlight-text {
  display: flex;
  flex-direction: column;
}

.highlight-text strong {
  font-size: 0.92em;
  color: var(--text-heading);
}

.highlight-text span {
  font-size: 0.82em;
  color: var(--text-muted-2);
  line-height: 1.4;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
  margin-top: 1.5em;
  padding-top: 1.2em;
  border-top: 1px solid var(--border);
}

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.6em 1.3em;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.pub-link:hover {
  text-decoration: none;
}

.pub-link.springer {
  background: var(--accent);
  color: #fff;
}

.pub-link.springer:hover {
  background: var(--accent-hover);
}

.pub-link.scholar {
  background: var(--scholar-bg);
  color: var(--text);
}

.pub-link.scholar:hover {
  background: var(--scholar-hover);
}

@media (max-width: 600px) {
  .pub-card {
    padding: 1.2em;
  }
  .highlight-grid {
    grid-template-columns: 1fr;
  }
  .pub-title {
    font-size: 1.25em;
  }
}

/* Footer */
.footer {
  margin-top: 1em;
  color: var(--text-muted-4);
  font-size: 0.85em;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1.2rem 0.8rem;
  }

  h1 {
    font-size: 1.6em;
  }

  h2 {
    font-size: 1.25em;
  }

  .avatar {
    width: 140px;
    height: 140px;
  }

  pre {
    font-size: 0.75em;
    padding: 0.7em;
  }
}
