/* ============================================
   Yiheng's Blog — Modern Design System
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Colors - Dark Theme (default) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;

  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #ec4899;
  --gradient-accent: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  --gradient-accent-subtle: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15), rgba(236,72,153,0.15));

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --nav-height: 70px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* --- Light Theme --- */
[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.02);
  --bg-card-hover: rgba(0, 0, 0, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --text-primary: #1a1a2e;
  --text-secondary: #555570;
  --text-muted: #8888a0;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--accent-2);
}

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

ul, ol {
  list-style: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* --- Navigation --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-base);
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  padding: 0 var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 1px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 1.1rem;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-card);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--nav-height) var(--space-xl) 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg canvas {
  width: 100%;
  height: 100%;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
}

.hero-glow-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-1);
  top: 10%;
  left: 10%;
  animation: float 8s ease-in-out infinite;
}

.hero-glow-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-3);
  bottom: 10%;
  right: 10%;
  animation: float 8s ease-in-out infinite reverse;
}

.hero-glow-3 {
  width: 300px;
  height: 300px;
  background: var(--accent-2);
  top: 40%;
  left: 50%;
  animation: float 6s ease-in-out infinite 2s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  backdrop-filter: blur(10px);
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
}

.hero h1 .gradient-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-2xl);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.8rem 1.8rem;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.4);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  color: var(--text-primary);
}

/* --- Scroll Indicator --- */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

.scroll-indicator svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
}

/* --- Sections --- */
.section {
  padding: var(--space-4xl) var(--space-xl);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-1);
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* --- About Section --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.about-image-wrapper {
  position: relative;
}

.about-image {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: var(--gradient-accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  border: 1px solid var(--border-color);
}

.about-image-decoration {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 12px;
  left: 12px;
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--accent-1);
  opacity: 0.2;
  z-index: -1;
}

.about-text h3 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.8;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.stat {
  text-align: center;
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* --- Skills Section --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.skill-card {
  padding: var(--space-2xl);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: all var(--transition-base);
}

.skill-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.skill-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-accent-subtle);
  border-radius: var(--border-radius-sm);
  font-size: 1.5rem;
  margin-bottom: var(--space-lg);
}

.skill-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.skill-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* --- Blog Cards --- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--space-xl);
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.blog-card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--gradient-accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.blog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card-cover .cover-placeholder {
  font-size: 3rem;
  opacity: 0.3;
}

.blog-card-body {
  padding: var(--space-xl);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.blog-card-date {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.blog-card-tags {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 2px 10px;
  background: var(--gradient-accent-subtle);
  color: var(--accent-1);
  border-radius: 100px;
  font-weight: 500;
}

[data-theme="light"] .tag {
  color: var(--accent-2);
}

.blog-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.blog-card:hover h3 {
  color: var(--accent-1);
}

.blog-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
  flex: 1;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.read-more {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-1);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: gap var(--transition-fast);
}

.blog-card:hover .read-more {
  gap: var(--space-sm);
}

.read-time {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.view-all-wrapper {
  text-align: center;
  margin-top: var(--space-3xl);
}

/* --- Blog Page --- */
.blog-page {
  padding-top: calc(var(--nav-height) + var(--space-3xl));
  min-height: 100vh;
}

.blog-page .section-inner {
  max-width: var(--max-width);
}

.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.filter-btn {
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-1);
  color: #fff;
  border-color: var(--accent-1);
}

.blog-search {
  max-width: 500px;
  margin: 0 auto var(--space-2xl);
  position: relative;
}

.blog-search input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition-fast);
}

.blog-search input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.blog-search input::placeholder {
  color: var(--text-muted);
}

.blog-search .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.no-results {
  text-align: center;
  padding: var(--space-4xl) 0;
  color: var(--text-muted);
}

.no-results p {
  font-size: 1.1rem;
  margin-top: var(--space-md);
}

/* --- Post Page --- */
.post-page {
  padding-top: calc(var(--nav-height) + var(--space-2xl));
  min-height: 100vh;
}

.post-header {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-2xl);
  text-align: center;
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-2xl);
  transition: color var(--transition-fast);
}

.post-back:hover {
  color: var(--text-primary);
}

.post-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.post-meta .separator {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
}

.post-cover {
  max-width: var(--max-width-narrow);
  margin: 0 auto var(--space-2xl);
  padding: 0 var(--space-xl);
}

.post-cover img {
  width: 100%;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  height: 3px;
  background: var(--gradient-accent);
  z-index: 999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* --- Post Content (Article Prose) --- */
.post-content {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-4xl);
  font-size: 1.05rem;
  line-height: 1.85;
}

.post-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: var(--space-3xl) 0 var(--space-lg);
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: var(--space-2xl) 0 var(--space-md);
}

.post-content p {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
}

.post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

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

.post-content ul,
.post-content ol {
  margin-bottom: var(--space-lg);
  padding-left: 1.5rem;
}

.post-content ul {
  list-style: disc;
}

.post-content ol {
  list-style: decimal;
}

.post-content li {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.post-content blockquote {
  margin: var(--space-2xl) 0;
  padding: var(--space-lg) var(--space-xl);
  border-left: 3px solid var(--accent-1);
  background: var(--bg-card);
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.post-content blockquote p {
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0;
}

.post-content pre {
  margin: var(--space-2xl) 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xl);
  overflow-x: auto;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.post-content pre code {
  color: var(--text-primary);
  line-height: 1.6;
}

.post-content p code {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-2);
}

.post-content img {
  margin: var(--space-2xl) auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-3xl) 0;
}

/* --- Footer --- */
.footer {
  padding: var(--space-3xl) var(--space-xl);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
  justify-content: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

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

.footer-copy {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Scroll Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children animation */
.stagger-children .reveal {
  transition-delay: calc(var(--stagger-index, 0) * 0.1s);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .about-image-wrapper {
    max-width: 350px;
    margin: 0 auto;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 60px;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    z-index: 999;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 1.2rem;
  }

  .mobile-menu-btn {
    display: block;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .section {
    padding: var(--space-3xl) var(--space-md);
  }

  .about-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }

  .stat {
    padding: var(--space-md);
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .post-content {
    padding: 0 var(--space-md) var(--space-3xl);
    font-size: 1rem;
  }

  .post-header {
    padding: 0 var(--space-md) var(--space-xl);
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .blog-card-cover {
    aspect-ratio: 16 / 9;
  }
}

/* --- Admin Page Styles --- */
.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + var(--space-2xl)) var(--space-xl) var(--space-2xl);
}

.admin-header {
  margin-bottom: var(--space-2xl);
}

.admin-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.admin-header p {
  color: var(--text-secondary);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-1);
}

.form-group textarea {
  min-height: 400px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  gap: var(--space-sm);
  padding: 0.5rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-1);
  color: var(--text-primary);
}

.toolbar-btn svg {
  flex-shrink: 0;
}

.editor-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Image Insert Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-base);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.img-preview-box {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.modal-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.video-preview-box {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  text-align: center;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.video-preview-label {
  font-size: 0.8rem;
  color: var(--accent-1);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 1.5rem 0;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--border-radius-sm);
}

.post-content video {
  max-width: 100%;
  border-radius: var(--border-radius-sm);
  margin: 1.5rem 0;
}

.admin-preview {
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow-y: auto;
  max-height: 80vh;
}

.admin-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.code-output {
  margin-top: var(--space-xl);
}

.code-output pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-xl);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-primary);
  max-height: 300px;
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: var(--space-md) var(--space-xl);
  background: var(--accent-1);
  color: #fff;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-base);
  z-index: 9999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}
