/* ============================================================
   Premium Academic Portfolio — Dark/Light Mode
   Deep Indigo + Warm Gold Palette
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

/* ============================================================
   LIGHT THEME (default)
   ============================================================ */
:root {
  /* ── Core palette ── */
  --primary:           #6366f1;
  --primary-hover:     #4f46e5;
  --primary-light:     #eef2ff;
  --primary-deep:      #312e81;

  --accent:            #f59e0b;
  --accent-light:      #fef3c7;

  /* ── Text ── */
  --text-dark:         #1e1b4b;
  --text-body:         #374151;
  --text-muted:        #4b5563;
  --text-light:        #6b7280;

  /* ── Backgrounds ── */
  --bg-body:           #f5f3ff;
  --bg-card:           rgba(255, 255, 255, 0.82);
  --bg-card-solid:     #ffffff;
  --bg-card-hover:     rgba(238, 242, 255, 0.65);
  --bg-subtle:         rgba(238, 242, 255, 0.4);
  --bg-input:          #f8f7ff;

  /* ── Borders ── */
  --border-color:      rgba(139, 92, 246, 0.12);
  --border-strong:     rgba(99, 102, 241, 0.25);

  /* ── Nav ── */
  --nav-bg:            rgba(255, 255, 255, 0.82);
  --nav-link-color:    #4b5563;
  --nav-link-hover-bg: #eef2ff;

  /* ── Shadows ── */
  --shadow-sm:         0 1px 3px rgba(99, 102, 241, 0.06);
  --shadow-md:         0 4px 20px rgba(99, 102, 241, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg:         0 12px 40px rgba(99, 102, 241, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-glow:       0 0 40px rgba(99, 102, 241, 0.15);

  /* ── Radii ── */
  --radius-lg:         20px;
  --radius-md:         14px;
  --radius-sm:         10px;

  /* ── Transitions ── */
  --transition:        all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast:   all 0.18s ease;

  /* ── Gradients ── */
  --gradient-primary:  linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
  --gradient-warm:     linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --gradient-surface:  linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(238, 242, 255, 0.7) 100%);

  /* ── Body background decorations ── */
  --bg-gradient-1:     rgba(99, 102, 241, 0.12);
  --bg-gradient-2:     rgba(139, 92, 246, 0.08);
  --bg-gradient-3:     rgba(245, 158, 11, 0.06);

  /* ── Badges ── */
  --badge-q1-bg:       linear-gradient(135deg, #dbeafe, #c7d2fe);
  --badge-q1-text:     #3730a3;
  --badge-q2-bg:       linear-gradient(135deg, #ffedd5, #fed7aa);
  --badge-q2-text:     #c2410c;
  --badge-sci-bg:      linear-gradient(135deg, #e0e7ff, #c7d2fe);
  --badge-sci-text:    #312e81;
  --badge-scopus-bg:   linear-gradient(135deg, #fae8ff, #f5d0fe);
  --badge-scopus-text: #7e22ce;
  --badge-if-bg:       linear-gradient(135deg, #d1fae5, #a7f3d0);
  --badge-if-text:     #065f46;
  --badge-proc-bg:     linear-gradient(135deg, #f1f5f9, #e2e8f0);
  --badge-proc-text:   #334155;

  /* ── Table ── */
  --table-header-bg:   var(--gradient-primary);
  --table-header-text: #ffffff;
  --table-row-hover:   var(--primary-light);

  /* ── Timeline ── */
  --timeline-dot-border: var(--bg-card-solid);

  /* ── Publication item ── */
  --pub-bg:            rgba(238, 242, 255, 0.35);
  --pub-bg-hover:      rgba(238, 242, 255, 0.65);

  /* ── Toggle button ── */
  --toggle-bg:         #f1f5f9;
  --toggle-hover:      #e2e8f0;
  --toggle-color:      #4b5563;
}

/* ============================================================
   DARK THEME
   ============================================================ */
[data-theme="dark"] {
  /* ── Core palette (slightly brighter for dark bg) ── */
  --primary:           #818cf8;
  --primary-hover:     #a5b4fc;
  --primary-light:     rgba(99, 102, 241, 0.15);
  --primary-deep:      #c7d2fe;

  --accent:            #fbbf24;
  --accent-light:      rgba(251, 191, 36, 0.15);

  /* ── Text — high contrast on dark ── */
  --text-dark:         #f1f5f9;
  --text-body:         #cbd5e1;
  --text-muted:        #94a3b8;
  --text-light:        #64748b;

  /* ── Backgrounds ── */
  --bg-body:           #0f0d1a;
  --bg-card:           rgba(30, 27, 50, 0.85);
  --bg-card-solid:     #1a1730;
  --bg-card-hover:     rgba(49, 46, 80, 0.5);
  --bg-subtle:         rgba(49, 46, 80, 0.35);
  --bg-input:          #1e1b3a;

  /* ── Borders ── */
  --border-color:      rgba(129, 140, 248, 0.12);
  --border-strong:     rgba(129, 140, 248, 0.25);

  /* ── Nav ── */
  --nav-bg:            rgba(15, 13, 26, 0.88);
  --nav-link-color:    #94a3b8;
  --nav-link-hover-bg: rgba(99, 102, 241, 0.12);

  /* ── Shadows ── */
  --shadow-sm:         0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md:         0 4px 20px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-lg:         0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-glow:       0 0 40px rgba(99, 102, 241, 0.2);

  /* ── Gradients ── */
  --gradient-surface:  linear-gradient(145deg, rgba(30, 27, 50, 0.95) 0%, rgba(25, 22, 44, 0.8) 100%);

  /* ── Body background decorations ── */
  --bg-gradient-1:     rgba(99, 102, 241, 0.08);
  --bg-gradient-2:     rgba(139, 92, 246, 0.06);
  --bg-gradient-3:     rgba(245, 158, 11, 0.04);

  /* ── Badges — deeper tones for dark mode ── */
  --badge-q1-bg:       linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
  --badge-q1-text:     #93c5fd;
  --badge-q2-bg:       linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(245, 158, 11, 0.2));
  --badge-q2-text:     #fdba74;
  --badge-sci-bg:      linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(129, 140, 248, 0.18));
  --badge-sci-text:    #a5b4fc;
  --badge-scopus-bg:   linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(192, 132, 252, 0.18));
  --badge-scopus-text: #d8b4fe;
  --badge-if-bg:       linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(52, 211, 153, 0.18));
  --badge-if-text:     #6ee7b7;
  --badge-proc-bg:     linear-gradient(135deg, rgba(71, 85, 105, 0.25), rgba(100, 116, 139, 0.25));
  --badge-proc-text:   #cbd5e1;

  /* ── Table ── */
  --table-row-hover:   rgba(99, 102, 241, 0.08);

  /* ── Timeline ── */
  --timeline-dot-border: #1a1730;

  /* ── Publication item ── */
  --pub-bg:            rgba(49, 46, 80, 0.25);
  --pub-bg-hover:      rgba(49, 46, 80, 0.45);

  /* ── Toggle button ── */
  --toggle-bg:         rgba(99, 102, 241, 0.12);
  --toggle-hover:      rgba(99, 102, 241, 0.22);
  --toggle-color:      #fbbf24;
}

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

html {
  font-size: 14.5px; /* Scales down all rem-based sizes slightly */
}

/* ── Global Body ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-body);
  background: var(--bg-body);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--bg-gradient-1), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--bg-gradient-2), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, var(--bg-gradient-3), transparent);
  background-attachment: fixed;
  line-height: 1.7;
  padding: 48px 24px;
  padding-top: 100px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.top-nav.scrolled {
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.1), 0 1px 4px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .top-nav.scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(99, 102, 241, 0.08);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-inner::-webkit-scrollbar { display: none; }
.nav-inner { -ms-overflow-style: none; scrollbar-width: none; }

.nav-link {
  font-family: 'Outfit', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--nav-link-color);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 10px;
  white-space: nowrap;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--nav-link-hover-bg);
}

.nav-link.active {
  color: #fff;
  font-weight: 600;
  background: var(--gradient-primary);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  cursor: pointer;
  transition: var(--transition);
  margin-left: 8px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--toggle-hover);
  transform: rotate(15deg) scale(1.08);
}

/* Show/hide sun/moon icons */
.icon-moon { display: none; }
.icon-sun  { display: block; }

[data-theme="dark"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: none; }

@media (max-width: 640px) {
  .nav-inner {
    justify-content: flex-start;
    gap: 4px;
    padding: 10px 16px;
  }

  .nav-link {
    font-size: 0.82rem;
    padding: 6px 14px;
  }
}

/* ── Page Wrapper ── */
.portfolio-container {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 36px;
  align-items: start;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--gradient-surface);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.sidebar:hover {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-3px);
}

/* Avatar */
.avatar-container {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
  padding: 4px;
  box-shadow: 0 0 0 4px #d1fae5, var(--shadow-md);
  transition: var(--transition);
}

.avatar-container:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px #d1fae5, var(--shadow-lg);
}

.avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Profile text */
.profile-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
  letter-spacing: -0.025em;
  transition: color 0.3s ease;
}

.profile-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #34d399 0%, #10b981 50%, #059669 100%);
  padding: 5px 18px;
  border-radius: 24px;
  display: inline-block;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.profile-institution {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 25px;
  line-height: 1.5;
  transition: color 0.3s ease;
}

.profile-institution strong {
  color: var(--text-dark);
  transition: color 0.3s ease;
}

.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  margin-bottom: 25px;
}

/* ── Contact & Social ── */
.contact-info {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 25px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.contact-item:hover {
  background-color: var(--primary-light);
}

.contact-item strong {
  color: var(--primary-deep);
  font-weight: 600;
  min-width: 62px;
  transition: color 0.3s ease;
}

.contact-item span {
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.contact-item a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
  transition: var(--transition-fast);
  font-weight: 500;
}

.contact-item a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Social Icons */
.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card-solid);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.social-icon:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.social-icon:hover img {
  filter: brightness(0) invert(1);
}

.social-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  transition: var(--transition-fast);
}

[data-theme="dark"] .social-icon img {
  filter: brightness(0.85) invert(0.15);
}

[data-theme="dark"] .social-icon:hover img {
  filter: brightness(0) invert(1);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Card ── */
.card {
  background: var(--gradient-surface);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 38px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -60px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08), transparent 70%);
  pointer-events: none;
}

[data-theme="dark"] .card::before {
  background: radial-gradient(circle, rgba(129, 140, 248, 0.06), transparent 70%);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* Section Titles */
.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 28px;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.015em;
  border-bottom: none;
  position: relative;
  transition: color 0.3s ease;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.card:hover .section-title::after {
  width: 100px;
}

/* ── Typography ── */
p {
  margin-bottom: 16px;
  line-height: 1.75;
  color: var(--text-body);
  text-align: justify;
  transition: color 0.3s ease;
}

li {
  text-align: justify;
}

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

p strong {
  color: var(--text-dark);
  transition: color 0.3s ease;
}

/* ============================================================
   TIMELINE (Education & Experience)
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  transition: var(--transition-fast);
}

.timeline-item:hover {
  transform: translateX(4px);
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: 3px solid var(--timeline-dot-border);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 2px 6px rgba(99, 102, 241, 0.25);
  transition: var(--transition);
}

.timeline-item:hover .timeline-dot {
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.25), 0 2px 10px rgba(99, 102, 241, 0.35);
  transform: scale(1.2);
}

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

.timeline-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  transition: color 0.3s ease;
}

.timeline-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-primary);
  padding: 3px 14px;
  border-radius: 14px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  letter-spacing: 0.02em;
}

.timeline-institution {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.timeline-institution a {
  color: var(--primary) !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: var(--transition-fast);
}

.timeline-institution a:hover {
  color: var(--primary-hover) !important;
  text-decoration: underline !important;
}

.timeline-details {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.timeline-details strong {
  color: var(--text-dark);
  transition: color 0.3s ease;
}

.timeline-details ul {
  list-style-type: none;
  padding-left: 0;
}

.timeline-details li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
}

.timeline-details li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gradient-primary);
}

/* ============================================================
   PUBLICATIONS
   ============================================================ */
.publications-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.publication-item {
  border-left: 4px solid transparent;
  border-image: var(--gradient-primary) 1;
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--pub-bg);
  transition: var(--transition);
}

.publication-item:hover {
  background: var(--pub-bg-hover);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.publication-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
  line-height: 1.45;
  transition: color 0.3s ease;
}

.publication-title a {
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition-fast);
}

.publication-title a:hover {
  color: var(--primary);
}

.publication-title span {
  color: var(--text-dark);
  transition: color 0.3s ease;
}

.publication-authors {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  transition: color 0.3s ease;
}

.publication-authors strong {
  color: var(--primary-deep);
  font-weight: 600;
  transition: color 0.3s ease;
}

.publication-venue {
  font-size: 0.84rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

/* ── Badges ── */
.badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: var(--transition-fast);
}

.badge:hover {
  transform: translateY(-1px);
}

.badge-q1 {
  background: var(--badge-q1-bg);
  color: var(--badge-q1-text);
}

.badge-q2 {
  background: var(--badge-q2-bg);
  color: var(--badge-q2-text);
}

.badge-sci {
  background: var(--badge-sci-bg);
  color: var(--badge-sci-text);
}

.badge-scopus {
  background: var(--badge-scopus-bg);
  color: var(--badge-scopus-text);
}

.badge-if {
  background: var(--badge-if-bg);
  color: var(--badge-if-text);
}

.badge-proc {
  background: var(--badge-proc-bg);
  color: var(--badge-proc-text);
}

/* ============================================================
   GRID LIST (Awards, Reviewers)
   ============================================================ */
.grid-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Full-width item in 2-col grid (desktop) */
.info-item--full {
  grid-column: span 2;
}

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

  /* Collapse all items to single column on mobile */
  .info-item--full {
    grid-column: span 1;
  }
}

.info-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.info-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.info-item:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.info-item:hover::before {
  opacity: 1;
}

.info-item h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.info-item p {
  color: var(--text-body);
}

.info-item ul {
  padding-left: 18px;
  margin-top: 8px;
}

.info-item li {
  margin-bottom: 4px;
  color: var(--text-body);
}

.info-item li strong {
  color: var(--text-dark);
}

/* ============================================================
   TEACHING TABLE
   ============================================================ */
.teaching-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  text-align: left;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.teaching-table th {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--table-header-text);
  background: var(--table-header-bg);
  padding: 12px 18px;
  border-bottom: none;
}

.teaching-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
  color: var(--text-body);
}

.teaching-table tr:hover td {
  background-color: var(--table-row-hover);
}

.teaching-table tr:last-child td {
  border-bottom: none;
}

/* ── Languages ── */
.languages-container {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.language-pill {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dark);
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  padding: 8px 20px;
  border-radius: 24px;
  transition: var(--transition);
}

.language-pill:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.language-pill:hover strong {
  color: #fff;
}

.language-pill strong {
  color: var(--text-dark);
  transition: color 0.3s ease;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  text-align: center;
  padding: 36px 0 12px 0;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 40px;
  position: relative;
  transition: color 0.3s ease;
}

footer::before {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 4px;
  margin: 0 auto 20px auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Tablet & below (991px) ── */
@media (max-width: 991px) {
  .portfolio-container {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .sidebar {
    position: static;
    width: 100%;
    /* Side-by-side: avatar left, info right on tablets */
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    text-align: left;
    gap: 24px;
    padding: 28px 24px;
  }

  .avatar-container {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }

  .sidebar > *:not(.avatar-container) {
    flex: 1 1 200px;
  }

  .contact-info {
    text-align: left;
  }

  .card {
    padding: 28px 24px;
  }

  .sidebar:hover {
    transform: none; /* Disable lift on touch devices */
  }
}

/* ── Small tablets & large phones (768px) ── */
@media (max-width: 768px) {
  body {
    padding: 16px 14px;
    padding-top: 88px;
  }

  .nav-inner {
    gap: 4px;
    padding: 10px 14px;
    justify-content: flex-start;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 6px 12px;
  }

  .portfolio-container {
    gap: 18px;
  }

  /* Sidebar: avatar + info side-by-side on tablet */
  .sidebar {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    text-align: left;
    padding: 22px 18px;
    gap: 18px;
  }

  .avatar-container {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .sidebar > *:not(.avatar-container) {
    flex: 1;
    min-width: 0;
  }

  .profile-name {
    font-size: 1.3rem;
    margin-bottom: 6px;
    text-align: left;
  }

  .profile-title {
    font-size: 0.78rem;
    padding: 3px 12px;
    display: inline-block;
    margin-bottom: 8px;
  }

  .profile-institution {
    font-size: 0.8rem;
    margin-bottom: 12px;
    text-align: left;
  }

  .divider {
    width: 100%;
    margin-bottom: 14px;
  }

  .contact-info {
    text-align: left;
    width: 100%;
  }

  .social-links {
    justify-content: flex-start;
  }

  .card {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .section-title {
    font-size: 1.3rem;
  }

  /* Tables scroll horizontally */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Timeline adjustments */
  .timeline-item {
    flex-direction: column;
    gap: 6px;
  }

  /* Badge wrapping */
  .badge-group {
    flex-wrap: wrap;
  }
}

/* ── Mobile phones (480px) ── */
@media (max-width: 480px) {
  body {
    padding: 12px 10px;
    padding-top: 80px;
  }

  .nav-link {
    font-size: 0.78rem;
    padding: 5px 10px;
  }

  .card {
    padding: 18px 14px;
    border-radius: 12px;
  }

  /* Sidebar: stack fully on small phones */
  .sidebar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 14px;
    border-radius: 14px;
    gap: 0;
  }

  .avatar-container {
    width: 90px;
    height: 90px;
    margin-bottom: 12px;
  }

  .profile-name {
    font-size: 1.25rem;
    margin-bottom: 6px;
    text-align: center;
  }

  .profile-title {
    font-size: 0.75rem;
    padding: 3px 12px;
    display: inline-block;
    margin-bottom: 10px;
  }

  .profile-institution {
    font-size: 0.78rem;
    text-align: center;
    margin-bottom: 14px;
  }

  .contact-info {
    text-align: left;
    width: 100%;
  }

  .social-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .card {
    padding: 18px 14px;
    border-radius: 12px;
  }

  .section-title {
    font-size: 1.2rem;
    margin-bottom: 16px;
  }

  .social-btn {
    font-size: 0.78rem;
    padding: 7px 14px;
  }

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

  .skill-tag {
    font-size: 0.75rem;
    padding: 4px 10px;
  }

  .languages-container {
    flex-direction: column;
    gap: 8px;
  }

  footer {
    margin-bottom: 10vh !important;
    font-size: 0.78rem;
  }
}

/* ── Smooth entrance animation ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar,
.card {
  animation: fadeInUp 0.6s ease both;
}

.card:nth-child(1) { animation-delay: 0.08s; }
.card:nth-child(2) { animation-delay: 0.16s; }
.card:nth-child(3) { animation-delay: 0.24s; }
.card:nth-child(4) { animation-delay: 0.32s; }
.card:nth-child(5) { animation-delay: 0.40s; }
.card:nth-child(6) { animation-delay: 0.48s; }
.card:nth-child(7) { animation-delay: 0.56s; }
