/* ========================
   Fonts
   ======================== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ========================
   Variables & Theming
   ======================== */
:root {
  --bg: #0d1117;
  --bg-header: rgba(13, 17, 23, 0.88);
  --surface: #161b22;
  --border: #21262d;
  --text: #e6edf3;
  --muted: #7d8590;
  --accent: #58a6ff;
  --accent-faint: rgba(88, 166, 255, 0.1);
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Mono', Menlo, Consolas, monospace;
  --font-sans: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --max-w: 680px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.88);
  --surface: #f6f8fa;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #636c76;
  --accent: #0969da;
  --accent-faint: rgba(9, 105, 218, 0.08);
}

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

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s, color 0.2s;
}

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

a:hover {
  text-decoration: underline;
}

/* ========================
   Layout
   ======================== */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main.container {
  flex: 1;
  padding-top: 3.5rem;
  padding-bottom: 4rem;
}

/* ========================
   Header & Nav
   ======================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-title .prompt {
  color: var(--accent);
}

.cursor {
  color: var(--accent);
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ========================
   Theme Toggle
   ======================== */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--text);
}

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

/* ========================
   Hero
   ======================== */
.hero {
  margin-bottom: 4rem;
}

.hero-intro {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.2s, transform 0.2s;
}

.avatar:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

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

.hero-text .tagline {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}

.bio {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 55ch;
  margin-bottom: 1.5rem;
}

.bio a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 480px) {
  .hero-intro {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .avatar {
    width: 96px;
    height: 96px;
  }
}

/* ========================
   Social Links
   ======================== */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.social-link:hover {
  color: var(--text);
  border-color: var(--accent);
  background-color: var(--accent-faint);
  text-decoration: none;
}

/* ========================
   Post List (shared)
   ======================== */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.view-all {
  font-size: 0.85rem;
  color: var(--accent);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.post-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.post-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

.post-title:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-style: dashed;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.post-meta .sep {
  opacity: 0.4;
}

.post-excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 58ch;
}

/* ========================
   Posts Page Header
   ======================== */
.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ========================
   About Page
   ======================== */
.about-intro {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
  margin-bottom: 1rem;
}

.about-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  filter: grayscale(100%);
  transition: filter 0.3s, border-color 0.3s;
}

.about-avatar:hover {
  filter: grayscale(0%);
  border-color: var(--accent);
}

.about-location {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.about-location svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.about-content p {
  font-size: 1rem;
  line-height: 1.8;
  max-width: 54ch;
  margin-bottom: 0.8rem;
}

.about-content h2 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2.5rem 0 1rem;
}

.stack-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stack-chips span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}

/* GitHub Activity */
.github-activity {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
}

.gh-chart {
  width: 100%;
  max-width: 100%;
  display: block;
  border-radius: 4px;
}

[data-theme="light"] .gh-chart {
  filter: none;
}

[data-theme="dark"] .gh-chart {
  filter: brightness(0.9);
}

/* Certification logos */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.cert-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s;
}

.cert-item:hover {
  border-color: var(--accent);
  background-color: var(--accent-faint);
}

.cert-logo {
  opacity: 0.5;
  transition: opacity 0.2s;
}

.cert-item:hover .cert-logo {
  opacity: 0.85;
}

.cert-name {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Publications */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pub-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.pub-item:hover {
  border-color: var(--accent);
  background-color: var(--accent-faint);
  text-decoration: none;
}

.pub-title {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

.pub-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

@media (max-width: 480px) {
  .about-intro {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .about-location {
    justify-content: center;
  }
  .about-avatar {
    width: 160px;
    height: 160px;
  }
  .cert-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================
   Blog Post Article
   ======================== */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
  text-decoration: none;
}

.post-body {
  font-size: 1rem;
  line-height: 1.85;
}

.post-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 2.75rem 0 0.9rem;
  color: var(--text);
}

.post-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.post-body p {
  margin-bottom: 1.4rem;
}

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.4rem 1.5rem;
}

.post-body li {
  margin-bottom: 0.4rem;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.75rem 0;
  color: var(--muted);
  font-style: italic;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.855em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.15em 0.45em;
  border-radius: 4px;
}

.post-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.75rem 0;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.7;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.75rem 0;
}

.post-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

.post-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-footer a:hover {
  color: var(--text);
}

/* ========================
   Footer
   ======================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

.site-footer .container {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.83rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--text);
}

.footer-sep {
  opacity: 0.35;
}

/* ========================
   Responsive
   ======================== */
@media (max-width: 600px) {
  .hero h1       { font-size: 1.5rem; }
  .post-header h1 { font-size: 1.4rem; }
}
