/* =============================================================
   Personal Academic Website — Main Stylesheet
   ============================================================= */

/* ── Custom properties ──────────────────────────────────────── */
:root {
  --primary:        #1e3a5f;
  --primary-light:  #2d5282;
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --teal:           #0891b2;
  --bg:             #ffffff;
  --bg-alt:         #f8fafc;
  --bg-card:        #ffffff;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;
  --border:         #e2e8f0;
  --nav-height:     64px;
  --max-w:          1100px;
  --radius:         8px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow:         0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);
  --transition:     all 0.22s ease;
}

/* Dark mode */
[data-theme="dark"] {
  --primary:        #2d5282;
  --primary-light:  #3b6cb0;
  --accent:         #60a5fa;
  --accent-hover:   #93c5fd;
  --teal:           #22d3ee;
  --bg:             #0f172a;
  --bg-alt:         #1e293b;
  --bg-card:        #1e293b;
  --text:           #e2e8f0;
  --text-muted:     #94a3b8;
  --text-light:     #64748b;
  --border:         #334155;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow:         0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.5);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

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

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

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

ul, ol { padding-left: 1.5rem; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main { flex: 1; }

.section {
  padding: 4rem 0;
}
.section + .section {
  border-top: 1px solid var(--border);
}
.section-alt {
  background: var(--bg-alt);
}
.section-title {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 0.4rem;
  position: relative;
  display: inline-block;
  padding-bottom: 0.5rem;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 3rem; height: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}

/* ── Navigation ─────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--primary);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-brand {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
  text-decoration: none;
}
.nav-brand:hover { color: #fff; text-decoration: none; opacity: .85; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.15rem;
  padding: 0;
}

.nav-links a {
  color: rgba(255,255,255,.80);
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  font-size: 0.92rem;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,.15);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.80);
  padding: 0.4rem;
  border-radius: 5px;
  display: flex;
  align-items: center;
  font-size: 1rem;
  transition: var(--transition);
}
.btn-icon:hover { color: #fff; background: rgba(255,255,255,.15); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  text-decoration: none !important;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}
.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

/* ── Hero Section ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1a4a80 60%, #0f3460 100%);
  color: #fff;
  padding: 5rem 0 4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}

.hero-name {
  font-size: 2.8rem;
  color: #fff;
  margin-bottom: 0.3rem;
  letter-spacing: -1px;
}

.hero-title {
  font-size: 1.15rem;
  color: rgba(255,255,255,.85);
  margin-bottom: 0.2rem;
  font-weight: 400;
}

.hero-institution {
  font-size: 1.05rem;
  color: rgba(255,255,255,.70);
  margin-bottom: 1.5rem;
}

.hero-bio {
  color: rgba(255,255,255,.85);
  font-size: 1.02rem;
  max-width: 620px;
  margin-bottom: 2rem;
}

.hero-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  transition: var(--transition);
  text-decoration: none !important;
}
.social-btn:hover {
  background: rgba(255,255,255,.22);
  color: #fff;
  border-color: rgba(255,255,255,.45);
}

.hero-photo {
  position: relative;
}

.hero-photo img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.3);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  background: rgba(255,255,255,.1);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
  transform: translateY(-2px);
}

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

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

/* ── Publications ────────────────────────────────────────────── */
.pub-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }

.pub-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }

.pub-authors {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.pub-authors em { color: var(--text); font-style: normal; font-weight: 600; }

.pub-venue {
  font-size: 0.88rem;
  color: var(--teal);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag-cite {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
[data-theme="dark"] .tag-cite {
  background: #1e3a5f;
  color: #93c5fd;
  border-color: #1d4ed8;
}

/* ── Scholar Stats ───────────────────────────────────────────── */
.scholar-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-box {
  text-align: center;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}
[data-theme="dark"] .stat-value { color: var(--accent); }
.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── News ────────────────────────────────────────────────────── */
.news-list { list-style: none; padding: 0; }
.news-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.news-item:last-child { border-bottom: none; }
.news-date {
  min-width: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 2px;
}
.news-content { flex: 1; }
.news-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 50px;
  font-size: 0.76rem;
  font-weight: 700;
  margin-right: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-paper   { background: #d1fae5; color: #065f46; }
.badge-talk    { background: #dbeafe; color: #1e40af; }
.badge-award   { background: #fef3c7; color: #92400e; }
.badge-misc    { background: #f3e8ff; color: #6b21a8; }
.badge-news    { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge-paper  { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-talk   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-award  { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-misc   { background: #4c1d95; color: #c4b5fd; }
[data-theme="dark"] .badge-news   { background: #7f1d1d; color: #fca5a5; }

/* ── Timeline (CV) ───────────────────────────────────────────── */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 14px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  padding: 0 0 2rem 2.5rem;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.timeline-period {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.timeline-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
}
.timeline-place {
  color: var(--teal);
  font-style: italic;
  margin-bottom: 0.4rem;
}
.timeline-desc { color: var(--text-muted); font-size: 0.93rem; }

/* ── Blog ────────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}
.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.blog-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.blog-card-body {
  padding: 1.5rem;
}
.blog-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.blog-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}
.blog-card-title a { color: inherit; }
.blog-card-title a:hover { color: var(--accent); text-decoration: none; }
.blog-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.blog-category {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-alt);
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ── Blog Post Article ───────────────────────────────────────── */
.post-header {
  background: linear-gradient(135deg, var(--primary) 0%, #1a4a80 100%);
  color: #fff;
  padding: 4rem 0 3rem;
}
.post-header h1 {
  color: #fff;
  font-size: 2.2rem;
  margin-bottom: 1rem;
}
.post-meta {
  font-size: 0.9rem;
  color: rgba(255,255,255,.75);
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.post-body {
  padding: 3rem 0;
  max-width: 780px;
}
.post-body p { font-size: 1.02rem; margin-bottom: 1.3rem; }
.post-body h2 { margin: 2rem 0 0.75rem; font-size: 1.5rem; }
.post-body h3 { margin: 1.5rem 0 0.5rem; font-size: 1.2rem; }
.post-body ul, .post-body ol { margin-bottom: 1.2rem; }
.post-body li { margin-bottom: 0.4rem; }
.post-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-body code {
  background: var(--bg-alt);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--teal);
}
.post-body pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.post-body pre code {
  background: none;
  padding: 0;
}

/* ── Hobbies ─────────────────────────────────────────────────── */
.hobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.hobby-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.hobby-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: var(--accent);
}
.hobby-emoji { font-size: 2.5rem; margin-bottom: 0.75rem; }
.hobby-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.hobby-desc { font-size: 0.9rem; color: var(--text-muted); }

/* ── CV Page ─────────────────────────────────────────────────── */
.cv-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  align-items: start;
}
.cv-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}
.cv-section-header h2 {
  font-size: 1.3rem;
  color: var(--primary);
}
.cv-section-header .icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 0.9rem;
}
.skill-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.skill-item { font-size: 0.92rem; }
.skill-name {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  color: var(--text);
  font-weight: 600;
}
.skill-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.skill-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  border-radius: 3px;
  transition: width 1s ease;
}
.award-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.award-icon { font-size: 1.3rem; margin-top: 1px; }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  background: var(--primary);
  color: rgba(255,255,255,.75);
  padding: 2.5rem 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-name { color: #fff; font-weight: 700; font-size: 1rem; }
.footer-links {
  display: flex;
  gap: 1rem;
  list-style: none;
}
.footer-links a {
  color: rgba(255,255,255,.65);
  font-size: 0.88rem;
  transition: var(--transition);
}
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-social {
  display: flex;
  gap: 0.6rem;
}
.footer-social a {
  color: rgba(255,255,255,.65);
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}
.footer-social a:hover {
  color: #fff;
  border-color: rgba(255,255,255,.6);
  background: rgba(255,255,255,.1);
}
.footer-copy {
  font-size: 0.82rem;
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.45);
}

/* ── Utilities ───────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
[data-theme="dark"] .alert-info {
  background: #1e3a5f;
  border-color: #1d4ed8;
  color: #93c5fd;
}

/* ── Mobile Nav ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--primary);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-links a { font-size: 1rem; padding: 0.65rem 1rem; display: block; }
  h1 { font-size: 1.8rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-photo { display: flex; justify-content: center; order: -1; }
  .hero-name { font-size: 2rem; }
  .hero-bio { font-size: 0.97rem; }
  .cv-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ── Print styles (CV page) ──────────────────────────────────── */
@media print {
  .navbar, footer, .btn-print, .hamburger { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding: 1.5rem 0; }
  a { color: #000; }
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.5s ease both; }
.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

/* ── Loading skeleton ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-alt) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 1em;
  margin-bottom: 0.5em;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Accessibility ───────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
