/* =========
   Design System
   ========= */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --sidebar-w: 280px;
}

/* =========
   Base
   ========= */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

a:hover {
  text-decoration: underline;
}

/* =========
   Layout — Sidebar + Main
   ========= */
.page-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 48px;
}

/* =========
   Sidebar Elements
   ========= */
.avatar {
  width: 150px;
  height: 150px;
  min-width: 150px;
  max-width: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
  margin-bottom: 12px;
}

.sidebar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.badge-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  letter-spacing: 0.02em;
  position: relative;
  top: -1px;
}

.badge-open::before {
  content: "";
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, .4); }
  50% { opacity: .7; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.contact-info {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.icon-location { color: #ef4444; fill: #ef4444; }

.contact-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

a.contact-item:hover {
  opacity: 0.7;
  text-decoration: none;
}

.contact-item[aria-label="Email"] svg    { color: #0a66c2; fill: #0a66c2; }
.contact-item[aria-label="Resume"] svg   { color: #0a66c2; fill: #0a66c2; }
.contact-item[aria-label="GitHub"] svg   { color: #0a66c2; fill: #0a66c2; }
.contact-item[aria-label="LinkedIn"] svg { color: #0a66c2; fill: #0a66c2; }
.contact-item[aria-label="Scholar"] svg  { color: #0a66c2; fill: #0a66c2; }

/* =========
   Navigation Pills
   ========= */
.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.nav-pills a {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 20px;
  transition: background .2s, color .2s;
}

.nav-pills a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* =========
   Cards / Sections
   ========= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.35rem;
  font-weight: 600;
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

/* =========
   Entry (Experience / Education / Publications)
   ========= */
.entry {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.entry:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.entry-header .muted {
  white-space: nowrap;
}

.entry p {
  margin: 4px 0 0;
}

.entry ul {
  margin-top: 10px;
  margin-bottom: 0;
}

.exp-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.exp-row > div {
  flex: 1;
  min-width: 0;
}

.exp-logo {
  width: 50px;
  min-width: 50px;
  display: block;
  margin-top: 4px;
  border-radius: 4px;
}

.exp-logo-siue {
  margin-top: 14px;
}

.edu-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.edu-row > div {
  flex: 1;
  min-width: 0;
}

.edu-logo {
  width: 50px;
  min-width: 50px;
  display: block;
  margin-top: 6px;
}

.edu-logo-siue {
  margin-top: 12px;
}

.pub-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}

.pub-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(79, 70, 229, .08);
  text-decoration: none;
}

.pub-item strong {
  font-size: 1.05rem;
  font-weight: 600;
  display: block;
}

.pub-item p {
  margin: 6px 0 0;
}

.pub-img {
  width: 480px;
  min-width: 480px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.pub-links {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.pub-btn {
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 20px;
  transition: background .2s, color .2s;
}

.pub-btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* =========
   Skills
   ========= */
.skill-group {
  margin-bottom: 16px;
}

.skill-group:last-child {
  margin-bottom: 0;
}

.skill-group h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-block;
  padding: 4px 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* =========
   Projects Grid
   ========= */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.project-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.project-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(79, 70, 229, .08);
  text-decoration: none;
}

.project-item strong {
  font-size: 0.95rem;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.project-item .tag {
  align-self: flex-start;
  font-size: 0.78rem;
  padding: 2px 10px;
}

/* =========
   Text Utilities
   ========= */
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* =========
   Lists
   ========= */
ul {
  padding-left: 20px;
}

li {
  margin-bottom: 8px;
}

li:last-child {
  margin-bottom: 0;
}

/* =========
   Back to Top
   ========= */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  transform: translateY(10px);
  z-index: 200;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #3730a3;
}

/* =========
   Footer
   ========= */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* =========
   Responsive — Mobile: stack sidebar on top
   ========= */
@media (max-width: 768px) {
  .page-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 24px 20px;
  }

  .contact-line {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 16px;
  }

  .main-content {
    padding: 24px 20px;
  }

  .card {
    padding: 20px;
  }

  .entry-header {
    flex-direction: column;
    gap: 2px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .pub-item {
    flex-direction: column;
  }

  .pub-img {
    width: 100%;
    min-width: 0;
  }
}
