/* ===== CSS Variables ===== */
:root {
  --bg-color: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-color: #212529;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --theme-color: #2563eb;
  --theme-color-hover: #1d4ed8;
  --card-bg: #ffffff;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.14);
  --navbar-bg: rgba(255,255,255,0.95);
  --footer-bg: #1e293b;
  --footer-text: #cbd5e1;
  --code-bg: #f1f5f9;
  --tag-bg: #eff6ff;
  --tag-color: #2563eb;
}

[data-theme="dark"] {
  --bg-color: #0f172a;
  --bg-secondary: #1e293b;
  --text-color: #e2e8f0;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --theme-color: #60a5fa;
  --theme-color-hover: #93c5fd;
  --card-bg: #1e293b;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.5);
  --navbar-bg: rgba(15,23,42,0.95);
  --footer-bg: #020617;
  --footer-text: #94a3b8;
  --code-bg: #1e293b;
  --tag-bg: #1e3a5f;
  --tag-color: #93c5fd;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  transition: background-color 0.3s, color 0.3s;
}

a { color: var(--theme-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--theme-color-hover); }

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

/* ===== Scroll Progress Bar ===== */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 3px;
  background: var(--theme-color); width: 0%;
  z-index: 9999; transition: width 0.1s;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 3px; left: 0; right: 0; z-index: 1000;
  background: var(--navbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  transition: background 0.3s, border-color 0.3s;
}

.navbar-brand {
  font-weight: 700; font-size: 1.1rem;
  color: var(--text-color); letter-spacing: -0.02em;
}
.navbar-brand span { color: var(--theme-color); }

.navbar-nav {
  display: flex; align-items: center; gap: 0.25rem;
  list-style: none;
}

.navbar-nav a {
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  padding: 0.375rem 0.75rem; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.navbar-nav a:hover, .navbar-nav a.active {
  color: var(--theme-color); background: var(--tag-bg);
}

.navbar-controls { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle {
  background: none; border: 1px solid var(--border-color);
  border-radius: 6px; padding: 0.375rem 0.5rem;
  cursor: pointer; color: var(--text-muted);
  font-size: 1rem; transition: all 0.2s;
  display: flex; align-items: center;
}
.theme-toggle:hover { border-color: var(--theme-color); color: var(--theme-color); }

.hamburger {
  display: none; background: none; border: none;
  cursor: pointer; color: var(--text-color); font-size: 1.25rem; padding: 0.25rem;
}

.mobile-menu {
  display: none; position: fixed; top: 63px; left: 0; right: 0;
  background: var(--navbar-bg); border-bottom: 1px solid var(--border-color);
  padding: 1rem; z-index: 999;
  backdrop-filter: blur(10px);
}
.mobile-menu.open { display: block; }
.mobile-menu ul { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.mobile-menu a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 6px;
  color: var(--text-muted); font-weight: 500;
}
.mobile-menu a:hover { color: var(--theme-color); background: var(--tag-bg); }

/* ===== Page Layout ===== */
main { padding-top: 80px; min-height: calc(100vh - 200px); }

.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

section { padding: 3rem 0; }
section + section { border-top: 1px solid var(--border-color); }

/* ===== Hero / About ===== */
.hero { padding: 3.5rem 0 3rem; }

.hero-inner {
  display: grid; grid-template-columns: 1fr 260px;
  gap: 3rem; align-items: start;
}

.hero-text h1 {
  font-size: 2.25rem; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.2; margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.05rem; color: var(--theme-color);
  font-weight: 600; margin-bottom: 1.25rem;
}

.hero-text p { color: var(--text-muted); margin-bottom: 0.875rem; font-size: 0.975rem; }

.hero-badges {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem;
}

.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--tag-bg); color: var(--tag-color);
  font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.7rem;
  border-radius: 999px; border: 1px solid transparent;
}

.hero-image-col { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

.hero-avatar {
  width: 220px; height: 220px; border-radius: 16px;
  object-fit: cover; box-shadow: var(--card-shadow);
  border: 3px solid var(--border-color);
}

.hero-location {
  font-size: 0.8rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; display: flex; align-items: center; gap: 0.35rem;
}

.hero-social {
  display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center;
}
.hero-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border-color); color: var(--text-muted);
  font-size: 0.9rem; transition: all 0.2s;
}
.hero-social a:hover { border-color: var(--theme-color); color: var(--theme-color); background: var(--tag-bg); }

/* ===== Highlights Grid ===== */
.highlights-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}

.highlight-card {
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}
.highlight-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); }

.highlight-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.highlight-card h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.4rem; }
.highlight-card p { font-size: 0.8rem; color: var(--text-muted); }

/* ===== CTA ===== */
.cta-section { text-align: center; padding: 2.5rem 0; }
.cta-section p { color: var(--text-muted); margin-bottom: 1rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--theme-color); color: #fff;
  padding: 0.6rem 1.4rem; border-radius: 8px;
  font-weight: 600; font-size: 0.9rem;
  border: none; cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.btn:hover { background: var(--theme-color-hover); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-outline {
  background: transparent; color: var(--theme-color);
  border: 1.5px solid var(--theme-color);
}
.btn-outline:hover { background: var(--theme-color); color: #fff; }

/* ===== Section Headers ===== */
.section-header { margin-bottom: 2rem; }
.section-header h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.section-header p { color: var(--text-muted); margin-top: 0.4rem; font-size: 0.95rem; }
.section-divider { width: 40px; height: 3px; background: var(--theme-color); border-radius: 2px; margin-top: 0.75rem; }

/* ===== Recent Posts Table ===== */
.posts-table { width: 100%; border-collapse: collapse; }
.posts-table tr { border-bottom: 1px solid var(--border-color); }
.posts-table tr:last-child { border-bottom: none; }
.posts-table td { padding: 0.875rem 0; font-size: 0.9rem; }
.posts-table .post-date { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; width: 110px; font-family: monospace; }
.posts-table .post-title a { color: var(--text-color); font-weight: 500; }
.posts-table .post-title a:hover { color: var(--theme-color); }
.posts-table .post-tag { margin-left: 0.5rem; }

/* ===== Talks ===== */
.talks-list { display: flex; flex-direction: column; gap: 1rem; }
.talk-card {
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 1.5rem;
  display: grid; grid-template-columns: 90px 1fr;
  gap: 1.25rem; align-items: start;
  transition: box-shadow 0.2s;
}
.talk-card:hover { box-shadow: var(--card-shadow-hover); }
.talk-date-col { text-align: center; }
.talk-year { font-size: 1.1rem; font-weight: 800; color: var(--theme-color); }
.talk-month { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.talk-content h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.talk-content .talk-event { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.talk-content .talk-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.talk-content .talk-location { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; }
.talk-links { display: flex; gap: 0.5rem; }
.talk-link {
  font-size: 0.78rem; padding: 0.25rem 0.6rem; border-radius: 5px;
  background: var(--tag-bg); color: var(--tag-color);
  font-weight: 600; border: 1px solid transparent;
  transition: all 0.2s;
}
.talk-link:hover { background: var(--theme-color); color: #fff; }

/* ===== CV ===== */
.cv-section { margin-bottom: 2.5rem; }
.cv-section h2 { font-size: 1.1rem; font-weight: 700; color: var(--theme-color); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }
.cv-entry { display: grid; grid-template-columns: 130px 1fr; gap: 1rem; margin-bottom: 1.25rem; align-items: start; }
.cv-date { font-size: 0.8rem; color: var(--text-muted); font-family: monospace; padding-top: 0.15rem; }
.cv-content h3 { font-size: 0.975rem; font-weight: 700; }
.cv-content .cv-org { font-size: 0.875rem; color: var(--theme-color); font-weight: 500; }
.cv-content p { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.3rem; }
.cv-skills-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tag { background: var(--tag-bg); color: var(--tag-color); font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 6px; }

/* ===== Certifications ===== */
.certs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.cert-card {
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cert-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }
.cert-provider { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.cert-name { font-size: 0.9rem; font-weight: 700; line-height: 1.4; }
.cert-year { font-size: 0.8rem; color: var(--text-muted); font-family: monospace; }
.cert-badge { width: 48px; height: 48px; border-radius: 8px; }

/* ===== Blog ===== */
.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.blog-card {
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 12px; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }
.blog-card-body { padding: 1.25rem; }
.blog-card-meta { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.625rem; }
.blog-date { font-size: 0.78rem; color: var(--text-muted); font-family: monospace; }
.blog-category { font-size: 0.75rem; font-weight: 600; color: var(--tag-color); background: var(--tag-bg); padding: 0.15rem 0.5rem; border-radius: 4px; }
.blog-card h3 { font-size: 0.975rem; font-weight: 700; line-height: 1.4; margin-bottom: 0.5rem; }
.blog-card h3 a { color: var(--text-color); }
.blog-card h3 a:hover { color: var(--theme-color); }
.blog-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

/* ===== Gallery ===== */
.gallery-grid { columns: 3; gap: 0.75rem; }
.gallery-item { break-inside: avoid; margin-bottom: 0.75rem; border-radius: 10px; overflow: hidden; cursor: pointer; position: relative; }
.gallery-item img { width: 100%; transition: transform 0.3s, filter 0.3s; }
.gallery-item:hover img { transform: scale(1.03); filter: brightness(0.9); }
.gallery-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: flex-end; padding: 0.75rem; opacity: 0; transition: opacity 0.3s; }
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-caption { color: #fff; font-size: 0.8rem; font-weight: 500; }

/* Lightbox */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 9998; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox-img { max-width: 90vw; max-height: 85vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 1rem; right: 1.5rem; color: #fff; font-size: 2rem; cursor: pointer; background: none; border: none; }

/* ===== Footer ===== */
footer {
  background: var(--footer-bg); color: var(--footer-text);
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.footer-inner { max-width: 900px; margin: 0 auto; }
.footer-social { display: flex; justify-content: center; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.footer-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15); color: var(--footer-text);
  font-size: 1rem; transition: all 0.2s;
}
.footer-social a:hover { border-color: var(--theme-color); color: var(--theme-color); background: rgba(96,165,250,0.1); }
.footer-copyright { font-size: 0.8rem; color: #64748b; }
.footer-copyright a { color: #64748b; }
.footer-copyright a:hover { color: var(--theme-color); }

/* ===== Page Header ===== */
.page-header { padding: 2.5rem 0 2rem; }
.page-header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.page-header p { color: var(--text-muted); margin-top: 0.5rem; }

/* ===== Filter Tabs ===== */
.filter-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-tab {
  padding: 0.35rem 0.875rem; border-radius: 999px;
  border: 1.5px solid var(--border-color); background: none;
  color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.filter-tab:hover, .filter-tab.active { border-color: var(--theme-color); color: var(--theme-color); background: var(--tag-bg); }

/* ===== Utilities ===== */
.text-muted { color: var(--text-muted); }
.text-theme { color: var(--theme-color); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.justify-between { justify-content: space-between; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .highlights-grid { grid-template-columns: repeat(2, 1fr); }
  .certs-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-grid { grid-template-columns: 1fr; }
  .gallery-grid { columns: 2; }
}

@media (max-width: 768px) {
  .navbar-nav { display: none; }
  .hamburger { display: flex; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-image-col { order: -1; align-items: flex-start; flex-direction: row; align-items: center; gap: 1.25rem; }
  .hero-avatar { width: 90px; height: 90px; border-radius: 50%; }
  .hero-text h1 { font-size: 1.75rem; }
  .talk-card { grid-template-columns: 70px 1fr; gap: 1rem; }
  .cv-entry { grid-template-columns: 100px 1fr; }
}

@media (max-width: 576px) {
  .highlights-grid { grid-template-columns: 1fr 1fr; }
  .certs-grid { grid-template-columns: 1fr; }
  .gallery-grid { columns: 1; }
  .filter-tabs { gap: 0.375rem; }
}
