/* =========================================
   Academic Portfolio — Modern Minimal Design
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:          #ffffff;
  --bg-subtle:   #f7f7f8;
  --bg-chip:     #f3f4f6;

  --border:      #e4e4e7;
  --border-mid:  #d1d5db;

  --text-heading: #09090b;
  --text-body:    #3f3f46;
  --text-muted:   #71717a;
  --text-faint:   #a1a1aa;

  --accent:       #2563eb;       /* blue — links & active states */
  --accent-light: #eff6ff;
  --accent-hover: #1d4ed8;

  --navbar-bg:   rgba(255, 255, 255, 0.9);
  --toast-bg:    #09090b;
  --toast-color: #ffffff;

  --btn-primary-bg:           var(--accent);
  --btn-primary-text:         #ffffff;
  --btn-primary-border:       var(--accent);
  --btn-primary-hover-bg:     var(--accent-hover);
  --btn-primary-hover-border: var(--accent-hover);

  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --max-w: 920px;
  --ease:  cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg:          #1a1c20;       /* soft grayish charcoal instead of pitch black */
  --bg-subtle:   #212429;
  --bg-chip:     #2b2e35;

  --border:      #2b2e35;
  --border-mid:  #414652;

  --text-heading: #fafafa;
  --text-body:    #d4d4d8;
  --text-muted:   #a1a1aa;
  --text-faint:   #71717a;

  --accent:       #3b82f6;       /* slightly brighter blue for accessibility */
  --accent-light: rgba(59, 130, 246, 0.1);
  --accent-hover: #60a5fa;

  --navbar-bg:   rgba(26, 28, 32, 0.9);
  --toast-bg:    #fafafa;
  --toast-color: #1a1c20;

  --btn-primary-bg:           var(--accent);
  --btn-primary-text:         #ffffff;
  --btn-primary-border:       var(--accent);
  --btn-primary-hover-bg:     var(--accent-hover);
  --btn-primary-hover-border: var(--accent-hover);
}

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

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-body);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Baseline links ───────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

/* ── Layout ───────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}

/* ── Nav ────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 15px 28px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Theme Toggle ───────────────────── */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.15s var(--ease);
}
.theme-toggle:hover {
  background: var(--bg-subtle);
  color: var(--accent);
  transform: scale(1.05);
}
.theme-toggle:active {
  transform: scale(0.95);
}

/* Hide sun/moon depending on data-theme */
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
.sun-icon { display: none; }
.moon-icon { display: block; }

.logo {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.2px;
}
.logo span { color: var(--accent); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 6px;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav-link:hover {
  color: var(--text-heading);
  background: var(--bg-subtle);
}
.nav-link.active {
  color: var(--text-heading);
  font-weight: 600;
  background: var(--bg-chip);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-heading);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.mobile-toggle:hover { background: var(--bg-subtle); }

/* ── Hero ───────────────────────────── */
.hero {
  padding: 72px 0 56px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: flex-start;
  gap: 40px;
}

.hero-text-col { flex: 1; min-width: 0; }

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  color: var(--text-heading);
  margin-bottom: 12px;
}

.hero-affiliation {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-body);
  margin-bottom: 6px;
}

.hero-location {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.hero-bio {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-body);
  margin-bottom: 28px;
  max-width: 560px;
}
.hero-bio strong {
  color: var(--text-heading);
  font-weight: 600;
}
.hero-bio a {
  color: var(--text-heading);
  text-decoration: underline;
  text-decoration-color: var(--border-mid);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.hero-bio a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Social link chips with icons */
.hero-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-chip);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.18s var(--ease),
              background 0.18s var(--ease),
              border-color 0.18s var(--ease),
              transform 0.15s var(--ease),
              box-shadow 0.18s var(--ease);
}
.hero-social-link svg {
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.hero-social-link:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-color: #bfdbfe;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,0.12);
}
.hero-social-link:hover svg { opacity: 1; }
.hero-social-link:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ── Buttons ────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  background-image: none !important;
  text-decoration: none !important;
  transition: all 0.2s var(--ease);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-border);
}
.btn-primary:hover {
  background: var(--btn-primary-hover-bg);
  border-color: var(--btn-primary-hover-border);
  color: var(--btn-primary-text);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow: none;
}
.btn-secondary {
  background: var(--bg-chip);
  border-color: var(--border);
  color: var(--text-body);
}
.btn-secondary:hover {
  background: var(--border);
  color: var(--text-heading);
  border-color: var(--border-mid);
  transform: translateY(-1px);
}
.btn-secondary:active {
  transform: translateY(1px);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* Portrait */
.hero-image-wrapper { flex-shrink: 0; }

.profile-img {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--border), 0 4px 12px rgba(0,0,0,0.1);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.profile-img:hover {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--accent), 0 8px 24px rgba(37, 99, 235, 0.2);
}

/* ── Sections ───────────────────────── */
.section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-heading);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 13px;
  background-color: var(--accent);
  border-radius: 99px;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.65;
}

/* ── Bio prose ──────────────────────── */
.bio-content {
  max-width: 700px;
}
.bio-content p {
  font-size: 1rem;
  line-height: 1.78;
  color: var(--text-body);
  margin-bottom: 16px;
}
.bio-content p:last-child { margin-bottom: 0; }
.bio-content strong { color: var(--text-heading); font-weight: 600; }

.bio-content a {
  color: var(--text-heading);
  text-decoration: underline;
  text-decoration-color: var(--border-mid);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.bio-content a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ── Publications ───────────────────── */
.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-item {
  padding: 20px 16px;
  margin: 0 -16px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.pub-item:first-child { padding-top: 20px; }
.pub-item:last-child { border-bottom: none; }
.pub-item:hover {
  background: var(--bg-subtle);
  border-color: transparent;
  transform: translateX(4px);
}

.pub-item-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-heading);
}
.pub-item-title a {
  color: var(--text-heading);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: color 0.18s var(--ease), background-size 0.25s var(--ease);
}
.pub-item-title a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

.pub-item-authors {
  font-size: 0.95rem;
  color: var(--text-muted);
}
.pub-item-authors strong { color: var(--text-body); font-weight: 600; }

.pub-item-venue {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-faint);
}

.pub-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-chip);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 4px;
}

.pub-link {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  transition: text-decoration 0.12s;
}
.pub-link:hover { text-decoration: underline; }

/* ── Projects ───────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  padding: 20px 16px;
  margin: 0 -16px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.project-item:first-child { padding-top: 20px; }
.project-item:last-child { border-bottom: none; }
.project-item:hover {
  background: var(--bg-subtle);
  border-color: transparent;
  transform: translateX(4px);
}

.project-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.project-item-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.2px;
}
.project-item-title a {
  color: var(--text-heading);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1.5px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: color 0.18s var(--ease), background-size 0.25s var(--ease);
}
.project-item-title a:hover {
  color: var(--accent);
  background-size: 100% 1.5px;
}

.project-item-meta {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
  white-space: nowrap;
}

.project-item-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.68;
}

.project-item-sub {
  font-size: 0.875rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-item-sub a {
  color: var(--accent);
  font-weight: 500;
  transition: text-decoration 0.12s;
}
.project-item-sub a:hover { text-decoration: underline; }

/* ── CV entries ─────────────────────── */
.cv-section { margin-bottom: 40px; }
.cv-section:last-child { margin-bottom: 0; }

.cv-section-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.cv-entry {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 20px;
  padding: 20px 16px;
  margin: 0 -16px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.cv-entry:last-child { border-bottom: none; }
.cv-entry:hover {
  background: var(--bg-subtle);
  border-color: transparent;
  transform: translateX(4px);
}

.cv-date {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
  padding-top: 2px;
  line-height: 1.5;
}

.cv-details h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.cv-institution {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.cv-desc {
  font-size: 1rem;
  color: var(--text-body);
  line-height: 1.65;
}
.cv-desc a {
  color: var(--accent);
  text-decoration: none;
}
.cv-desc a:hover { text-decoration: underline; }

.cv-cert-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  margin: 0 -16px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  gap: 16px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.cv-cert-item:last-child { border-bottom: none; }
.cv-cert-item:hover {
  background: var(--bg-subtle);
  border-color: transparent;
  transform: translateX(4px);
}

.cv-cert-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
}
.cv-cert-issuer {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.cv-cert-score {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ── Contact ─────────────────────────── */
.contact-block { display: flex; flex-direction: column; }

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}
.contact-row:first-child { padding-top: 0; }
.contact-row:last-child { border-bottom: none; }

.contact-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  flex-shrink: 0;
  width: 120px;
}

.contact-val {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--text-body);
}
.contact-val a {
  color: var(--text-heading);
  text-decoration: none;
  transition: color 0.15s;
}
.contact-val a:hover { color: var(--accent); }

.copy-text-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-chip);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}
.copy-text-btn:hover {
  color: var(--text-heading);
  border-color: var(--border-mid);
  background: var(--border-mid);
}
.copy-text-btn:active {
  transform: scale(0.95);
}

/* ── Toast ───────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--toast-bg);
  color: var(--toast-color);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Footer ──────────────────────────── */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
  font-size: 0.825rem;
  color: var(--text-faint);
}

.footer-nav {
  display: flex;
  gap: 18px;
}
.footer-nav a {
  color: var(--text-faint);
  transition: color 0.15s;
}
.footer-nav a:hover { color: var(--text-heading); }

/* ── Responsive ──────────────────────── */
@media (max-width: 640px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-title { font-size: 2.1rem; }
  .cv-entry {
    grid-template-columns: 1fr;
    gap: 4px;
    margin: 0;
    padding: 16px 0;
  }
  .cv-entry:hover, .pub-item:hover, .project-item:hover, .cv-cert-item:hover {
    transform: none;
    background: transparent;
  }
  .pub-item, .project-item, .cv-cert-item {
    margin: 0;
    padding: 16px 0;
  }
  .contact-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .contact-label { width: auto; }
  .mobile-toggle { display: block; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    gap: 4px;
  }
  .nav-menu.open { display: flex; }
  .nav-link { width: 100%; padding: 8px 10px; }
}

/* ── Print ───────────────────────────── */
@media print {
  body { color: #000; }
  .navbar, footer, .copy-text-btn, .toast { display: none !important; }
  .container, .footer-container { max-width: 100% !important; padding: 0 !important; }
}
