/* ============================================
   FONTS — loaded via <link> in default.html:
   DM Serif Display (display)
   Instrument Sans (body)
   JetBrains Mono (code / mono accents)
   ============================================ */

/* ============================================
   VARIABLES
   ============================================ */
:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --text-primary: #1C1917;
  --text-secondary: #57534E;
  --text-tertiary: #A8A29E;
  --accent: #3B5BDB;
  --accent-hover: #364FC7;
  --accent-soft: rgba(59, 91, 219, 0.07);
  --accent-glow: rgba(59, 91, 219, 0.15);
  --border: #E7E5E0;
  --border-light: #EEECE7;
  --tag-bg: #F0EDE8;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 5px;

  /* Category palette — warm, muted, cohesive */
  --cat-dl: #DBEAFE;       --cat-dl-text: #1E40AF;
  --cat-eng: #FEF3C7;      --cat-eng-text: #92400E;
  --cat-life: #D1FAE5;     --cat-life-text: #065F46;
  --cat-paper: #FCE7F3;    --cat-paper-text: #9D174D;
  --cat-tool: #EDE9FE;     --cat-tool-text: #5B21B6;

  /* Code block */
  --code-bg: #1E1E2E;
  --code-text: #CDD6F4;

  /* Nav */
  --nav-bg: rgba(246, 245, 241, 0.8);
  --nav-border: rgba(231, 229, 224, 0.6);
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
  --bg: #1A1A1E;
  --surface: #242428;
  --text-primary: #E4E2DB;
  --text-secondary: #A09E96;
  --text-tertiary: #6B6964;
  --accent: #748FFC;
  --accent-hover: #8DA2FF;
  --accent-soft: rgba(116, 143, 252, 0.1);
  --accent-glow: rgba(116, 143, 252, 0.2);
  --border: #333338;
  --border-light: #2A2A2E;
  --tag-bg: #2C2C30;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.15);

  --cat-dl: #1E3A5F;       --cat-dl-text: #93B8F4;
  --cat-eng: #3D2E0A;      --cat-eng-text: #F5D58A;
  --cat-life: #0A3D2A;     --cat-life-text: #6EECC0;
  --cat-paper: #3D1428;     --cat-paper-text: #F4A0C5;
  --cat-tool: #2A1D4E;     --cat-tool-text: #C4B5FD;

  --code-bg: #141418;
  --code-text: #CDD6F4;

  --nav-bg: rgba(26, 26, 30, 0.85);
  --nav-border: rgba(51, 51, 56, 0.6);
}

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

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ============================================
   NAVIGATION
   ============================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--nav-border);
  padding: 0 28px;
}

nav .nav-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

nav .nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.3px;
  transition: opacity 0.2s;
}

nav .nav-logo:hover { opacity: 0.7; }

nav .nav-links { display: flex; gap: 4px; }

nav .nav-links a {
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  letter-spacing: 0.1px;
}

nav .nav-links a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

nav .nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ============================================
   HEADER (HOME)
   ============================================ */
header { padding: 56px 0 0; }

.header-top {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 28px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #748FFC);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 40px;
  color: #fff;
  flex-shrink: 0;
  box-shadow:
    0 4px 16px rgba(59, 91, 219, 0.25),
    0 0 0 3px var(--bg),
    0 0 0 5px rgba(59, 91, 219, 0.1);
  transition: transform 0.3s ease;
}

.avatar:hover { transform: scale(1.04) rotate(-2deg); }

.header-info h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.header-info .role {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 450;
}

.header-info .role span {
  color: var(--accent);
  font-weight: 600;
}

.bio {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.85;
  max-width: 580px;
  margin-bottom: 28px;
}

/* Social links */
.links { display: flex; gap: 10px; flex-wrap: wrap; }

.links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  letter-spacing: 0.2px;
}

.links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm), 0 2px 8px var(--accent-glow);
}

.links a svg { width: 14px; height: 14px; }

.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 52px 0;
}

/* ============================================
   SECTIONS
   ============================================ */
section { margin-bottom: 56px; }

.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-tertiary);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ============================================
   SKILLS
   ============================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.skill-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), #748FFC);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.skill-card:hover {
  border-color: rgba(59, 91, 219, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.skill-card:hover::after { opacity: 1; }

.skill-card h3 {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.skill-card h3 .icon { font-size: 17px; }

.skill-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 450;
  color: var(--text-secondary);
  background: var(--tag-bg);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.2px;
}

/* ============================================
   PROJECTS
   ============================================ */
.project-list { display: flex; flex-direction: column; gap: 14px; }

.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.project::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), #748FFC);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0 2px 2px 0;
}

.project:hover {
  border-color: rgba(59, 91, 219, 0.3);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.project:hover::before { opacity: 1; }

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.project h3 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

.project-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-left: 16px;
}

.project p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

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

.pub {
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.pub::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), #748FFC);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0 2px 2px 0;
}

.pub:hover {
  border-color: rgba(59, 91, 219, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pub:hover::before { opacity: 1; }

.pub-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.1px;
}

.pub-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   BLOG LIST
   ============================================ */
.blog-header { padding: 56px 0 0; }

.blog-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.blog-header p {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.cat-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.cat-btn {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 12px;
  font-weight: 550;
  padding: 6px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.1px;
}

.cat-btn:hover {
  border-color: var(--text-tertiary);
  background: var(--tag-bg);
}

.cat-btn.active {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.blog-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 56px; }

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 30px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.blog-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: 0 0 0 0 var(--accent-glow);
  transition: box-shadow 0.35s ease;
  pointer-events: none;
}

.blog-card:hover {
  border-color: rgba(59, 91, 219, 0.3);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.blog-card:hover::after {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.blog-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.blog-cat {
  font-size: 10.5px;
  font-weight: 650;
  padding: 3px 11px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.3px;
  text-transform: none;
}

.blog-cat[data-cat="深度学习"]  { background: var(--cat-dl);    color: var(--cat-dl-text); }
.blog-cat[data-cat="工程实践"]  { background: var(--cat-eng);   color: var(--cat-eng-text); }
.blog-cat[data-cat="生活随笔"]  { background: var(--cat-life);  color: var(--cat-life-text); }
.blog-cat[data-cat="论文笔记"]  { background: var(--cat-paper); color: var(--cat-paper-text); }
.blog-cat[data-cat="工具推荐"]  { background: var(--cat-tool);  color: var(--cat-tool-text); }

.blog-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
}

.blog-card h3 {
  font-size: 17px;
  font-weight: 650;
  margin-bottom: 8px;
  line-height: 1.45;
  letter-spacing: -0.3px;
}

.blog-card .excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card .read-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 14px;
  opacity: 0;
  transform: translateX(-6px);
  transition: all 0.3s ease;
}

.blog-card:hover .read-more { opacity: 1; transform: translateX(0); }

/* ============================================
   ARTICLE DETAIL
   ============================================ */
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 0;
  margin-top: 48px;
  margin-bottom: 36px;
  transition: all 0.2s ease;
  letter-spacing: 0.1px;
}

.article-back:hover { color: var(--accent); gap: 10px; }

.article-detail-header { margin-bottom: 40px; }
.article-detail-header .blog-cat { margin-bottom: 14px; display: inline-block; }

.article-detail-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.6px;
  margin-bottom: 14px;
}

.article-detail-header .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-detail-header .meta span + span::before {
  content: '·';
  margin-right: 8px;
}

/* ============================================
   ARTICLE BODY (Markdown-rendered content)
   ============================================ */
.article-body {
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--text-primary);
  margin-bottom: 48px;
}

.article-body h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.3px;
  margin: 44px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.article-body h3 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.2px;
  margin: 32px 0 12px;
}

.article-body p {
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.article-body strong { color: var(--text-primary); font-weight: 650; }

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s;
}

.article-body a:hover { text-decoration-color: var(--accent); }

.article-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--tag-bg);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-primary);
}

.article-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 22px 26px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.75;
  margin: 24px 0 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.05);
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 14px 24px;
  margin: 24px 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-body blockquote p { margin-bottom: 0; }

.article-body ul, .article-body ol {
  padding-left: 24px;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.article-body li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.article-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
  box-shadow: var(--shadow-md);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.article-body th, .article-body td {
  padding: 12px 18px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--tag-bg);
  font-weight: 650;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.article-body td { color: var(--text-secondary); }

.article-body hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 40px 0;
}

/* Post navigation */
.post-nav {
  display: flex;
  gap: 14px;
  margin: 48px 0;
  padding-top: 36px;
  border-top: 1px solid var(--border-light);
}

.post-nav-item {
  flex: 1;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

.post-nav-item:hover {
  border-color: rgba(59, 91, 219, 0.3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.post-nav-item.next { text-align: right; }

.post-nav-label {
  display: block;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.post-nav-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.1px;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  padding: 44px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-light);
  margin-top: 40px;
  letter-spacing: 0.2px;
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

/* Dark mode avatar tweak */
[data-theme="dark"] .avatar {
  background: linear-gradient(145deg, var(--accent), #5C7CFA);
  box-shadow:
    0 4px 16px rgba(116, 143, 252, 0.3),
    0 0 0 3px var(--bg),
    0 0 0 5px rgba(116, 143, 252, 0.15);
}

[data-theme="dark"] .skill-card::after {
  background: linear-gradient(to right, var(--accent), #5C7CFA);
}

[data-theme="dark"] .project::before {
  background: linear-gradient(to bottom, var(--accent), #5C7CFA);
}

[data-theme="dark"] .divider {
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

[data-theme="dark"] .cat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

[data-theme="dark"] .section-title::after {
  background: linear-gradient(to right, var(--border), transparent);
}

/* Smooth transition for theme switching */
body,
nav,
.container,
.skill-card,
.project,
.blog-card,
.pub,
.cat-btn,
.links a,
.tag,
.article-body,
.article-detail-header,
.blog-header,
.post-nav-item,
footer,
header,
.avatar,
.theme-toggle,
.blog-cat,
.section-title,
.divider {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

nav .nav-logo,
nav .nav-links a,
.header-info h1,
.header-info .role,
.bio,
.skill-card h3,
.skill-card p,
.project h3,
.project p,
.project-year,
.pub-title,
.pub-meta,
.blog-card h3,
.blog-card .excerpt,
.blog-date,
.blog-header h2,
.blog-header p,
.article-detail-header h1,
.article-detail-header .meta,
.article-body p,
.article-body h2,
.article-body h3,
.article-back,
.post-nav-label,
.post-nav-title,
.section-title {
  transition: color 0.3s ease;
}

/* Disable transition on heavy elements to avoid lag */
pre, code { transition: none !important; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

header { animation: fadeUp 0.7s ease; }
section { animation: fadeUp 0.55s ease backwards; }
section:nth-of-type(1) { animation-delay: 0.05s; }
section:nth-of-type(2) { animation-delay: 0.12s; }
section:nth-of-type(3) { animation-delay: 0.19s; }

.blog-header { animation: fadeUp 0.5s ease; }
.blog-card { animation: fadeUp 0.45s ease backwards; }
.blog-card:nth-child(1) { animation-delay: 0.04s; }
.blog-card:nth-child(2) { animation-delay: 0.08s; }
.blog-card:nth-child(3) { animation-delay: 0.12s; }
.blog-card:nth-child(4) { animation-delay: 0.16s; }
.blog-card:nth-child(5) { animation-delay: 0.20s; }
.blog-card:nth-child(6) { animation-delay: 0.24s; }

.article-detail-header { animation: fadeUp 0.6s ease; }
.article-body { animation: fadeIn 0.8s ease 0.15s backwards; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .container { padding: 0 20px; }
  nav { padding: 0 20px; }
  header { padding: 40px 0 0; }
  .header-top { gap: 20px; }
  .avatar { width: 72px; height: 72px; font-size: 30px; }
  .header-info h1 { font-size: 28px; }
  .skills-grid { grid-template-columns: 1fr; }
  .blog-card { padding: 20px 22px; }
  .article-detail-header h1 { font-size: 26px; }
  nav .nav-links a { padding: 6px 12px; font-size: 12px; }
  .post-nav { flex-direction: column; }
  .post-nav-item.next { text-align: left; }
  .blog-header h2 { font-size: 26px; }
}
