/* ============================================
   Clean Professional Blog Theme v2
   Refined, Polished, Fast
   ============================================ */

/* CSS Variables for theming */
:root {
  /* Light mode (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f4f4f5;
  --bg-elevated: #ffffff;
  --text-primary: #18181b;
  --text-secondary: #3f3f46;
  --text-muted: #71717a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: rgba(37, 99, 235, 0.08);
  --border: #e4e4e7;
  --border-light: #f4f4f5;
  --code-bg: #f4f4f5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-display: 'Newsreader', 'Georgia', serif;
  
  /* Spacing & Layout */
  --container-width: 680px;
  --container-wide: 1080px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Code Block Theme - Light (GitHub-inspired) */
  --code-block-bg: #f6f8fa;
  --code-border: #d0d7de;
  --code-text: #24292f;
  --code-line-number: #57606a;
  --code-comment: #6e7781;
  --code-keyword: #cf222e;
  --code-string: #0a3069;
  --code-number: #0550ae;
  --code-function: #8250df;
  --code-variable: #953800;
  --code-operator: #24292f;
  --code-class: #953800;
  --code-property: #0550ae;
}

[data-theme="dark"] {
  /* Tailwind Slate dark theme - subtle blue undertones */
  --bg-primary: #020617;       /* slate-950 */
  --bg-secondary: #0f172a;     /* slate-900 */
  --bg-tertiary: #1e293b;      /* slate-800 */
  --bg-elevated: #334155;      /* slate-700 */
  --text-primary: #f8fafc;     /* slate-50 */
  --text-secondary: #cbd5e1;   /* slate-300 */
  --text-muted: #94a3b8;       /* slate-400 */
  --accent: #3b82f6;           /* blue-500 */
  --accent-hover: #60a5fa;     /* blue-400 */
  --accent-subtle: rgba(59, 130, 246, 0.15);
  --border: #334155;           /* slate-700 */
  --border-light: #1e293b;     /* slate-800 */
  --code-bg: #1e293b;          /* slate-800 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.6), 0 4px 6px -2px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  
  /* Code Block Theme - Dark (One Dark Pro / VS Code inspired) */
  --code-block-bg: #0d1117;
  --code-border: #30363d;
  --code-text: #e6edf3;
  --code-line-number: #6e7681;
  --code-comment: #8b949e;
  --code-keyword: #ff7b72;
  --code-string: #a5d6ff;
  --code-number: #79c0ff;
  --code-function: #d2a8ff;
  --code-variable: #ffa657;
  --code-operator: #e6edf3;
  --code-class: #f0883e;
  --code-property: #79c0ff;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  transition: background-color var(--transition-slow), color var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Smooth fade-in for page content */
main {
  flex: 1;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

::selection {
  background: var(--accent);
  color: white;
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  z-index: 1000;
  transition: width 50ms linear;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: var(--container-wide);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { 
  font-size: 2.5rem; 
  font-weight: 700;
  letter-spacing: -0.03em;
}

h2 { 
  font-size: 1.5rem; 
  margin-top: 2.5em;
  margin-bottom: 0.75em;
}

h3 { 
  font-size: 1.25rem; 
  margin-top: 2em;
  margin-bottom: 0.5em;
}

h4 { 
  font-size: 1.125rem; 
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

p {
  margin-bottom: 1.5em;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* ==========================================
   HEADER
   ========================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-slow), border-color var(--transition);
}

[data-theme="dark"] .site-header {
  background: rgba(9, 9, 11, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 24px;
}

.site-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: opacity var(--transition-fast);
}

.site-logo:hover {
  color: var(--text-primary);
  opacity: 0.7;
}

/* Navigation */
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2px;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  margin-left: 12px;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.sun-icon { display: none; }
.moon-icon { display: block; }

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 10px;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: all var(--transition-fast);
}

.menu-toggle:hover span {
  background: var(--text-primary);
}

/* ==========================================
   HERO SECTION (Homepage)
   ========================================== */
.hero {
  padding: 32px 0 24px;
}

.hero .container {
  max-width: 800px;
}

.hero-content {
  max-width: 100%;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero .tagline {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-weight: 400;
  line-height: 1.5;
}

.hero .section-header {
  margin-bottom: 12px;
}

.hero .bio {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.hero .bio p {
  margin-bottom: 0.6em;
}

.hero .bio p:last-child {
  margin-bottom: 0;
}

/* Social Links */
.social-links {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.social-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.social-links svg {
  width: 18px;
  height: 18px;
}

/* ==========================================
   SECTION STYLING
   ========================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: -0.01em;
}

.section-header a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition-fast);
}

.section-header a:hover {
  color: var(--accent-hover);
}

/* ==========================================
   SECTION DIVIDER (Homepage)
   ========================================== */
.section-divider {
  padding: 20px 0;
}

.section-divider .container {
  max-width: 800px;
}

.divider-line {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border) 20%,
    var(--border) 80%,
    transparent
  );
}

/* ==========================================
   POSTS SECTION (Homepage)
   ========================================== */
.posts-section {
  padding-bottom: 24px;
}

.posts-section .container {
  max-width: 800px;
}

/* ==========================================
   POST LIST (Editorial Style)
   ========================================== */
.posts-list {
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.post-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

.post-item:hover {
  background: linear-gradient(90deg, var(--bg-secondary), transparent);
  margin: 0 -16px;
  padding: 14px 16px;
  border-radius: var(--radius);
}

.post-item:hover + .post-item {
  border-top-color: transparent;
}

.post-item-content {
  min-width: 0;
}

.post-item h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.post-item:hover h3 {
  color: var(--accent);
}

.post-item p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
}

.post-item-meta time {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.post-item-meta .reading-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.post-item-meta .reading-time::before {
  display: none;
}

/* ==========================================
   POST CARDS (Blog List Page)
   ========================================== */
.posts-grid {
  display: grid;
  gap: 16px;
}

.post-card {
  display: block;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  position: relative;
}

.post-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-subtle), transparent);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.post-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.post-card:hover::before {
  opacity: 1;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  position: relative;
}

.post-card-meta time {
  font-weight: 500;
}

.post-card h3 {
  font-size: 1.1875rem;
  margin: 0 0 8px;
  color: var(--text-primary);
  line-height: 1.35;
  position: relative;
}

.post-card p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
  position: relative;
}

.reading-time {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-time::before {
  content: "·";
  font-weight: 700;
}

/* ==========================================
   BLOG LIST PAGE
   ========================================== */
.page-header {
  padding: 56px 0 40px;
}

.page-header h1 {
  margin-bottom: 8px;
  font-size: 2.25rem;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  margin: 0;
}

.container-posts {
  max-width: 800px;
}

.posts-section .posts-list {
  border-top: 1px solid var(--border);
}

.posts-section {
  padding-bottom: 24px;
}

/* ==========================================
   SINGLE POST LAYOUT
   ========================================== */
.post-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 64px;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 24px;
}

.post-sidebar {
  position: relative;
}

.toc-wrapper {
  position: sticky;
  top: calc(var(--header-height) + 32px);
}

.toc-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.toc {
  list-style: none;
}

.toc ul {
  list-style: none;
  counter-reset: toc-counter;
}

.toc li {
  margin-bottom: 6px;
}

.toc > li {
  margin-bottom: 8px;
}

.toc a {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 4px 0;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.toc a:hover {
  color: var(--text-primary);
}

.toc a.active {
  color: var(--text-primary);
  font-weight: 500;
}

/* Top-level items (h2) - bold with bullet */
.toc > li > a {
  font-weight: 500;
  color: var(--text-secondary);
}

.toc > li > a::before {
  content: "•";
  display: inline-block;
  margin-right: 8px;
  color: var(--text-muted);
}

.toc > li > a:hover,
.toc > li > a.active {
  color: var(--text-primary);
}

/* Nested items (h3, h4) - numbered */
.toc ul li {
  counter-increment: toc-counter;
}

.toc ul li a {
  padding-left: 16px;
  font-weight: 400;
}

.toc ul li a::before {
  content: counter(toc-counter) ".";
  display: inline-block;
  margin-right: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Deeper nesting */
.toc ul ul {
  counter-reset: toc-sub-counter;
}

.toc ul ul li {
  counter-increment: toc-sub-counter;
}

.toc ul ul li a {
  padding-left: 32px;
}

.toc ul ul li a::before {
  content: counter(toc-sub-counter) ".";
}

/* ==========================================
   ARTICLE CONTENT
   ========================================== */
.post-content {
  max-width: var(--container-width);
  min-width: 0;
}

.post-header {
  margin-top: 32px;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.post-meta time {
  font-weight: 500;
}

.meta-separator {
  color: var(--border);
}

.reading-time-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-time-meta svg {
  opacity: 0.6;
}

/* Article Body */
.article-body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--font-sans);
  color: var(--text-primary);
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.article-body h2 {
  font-size: 1.5rem;
  margin-top: 56px;
  margin-bottom: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.article-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-body h3 {
  font-size: 1.25rem;
  margin-top: 40px;
  margin-bottom: 16px;
}

.article-body h4 {
  font-size: 1.125rem;
  margin-top: 32px;
  margin-bottom: 12px;
}

.article-body p {
  margin-bottom: 1.5em;
}

.article-body a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast);
}

.article-body a:hover {
  text-decoration-color: var(--accent);
}

.article-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.article-body li {
  margin-bottom: 0.5em;
  padding-left: 0.25em;
}

.article-body li::marker {
  color: var(--text-muted);
}

.article-body blockquote {
  margin: 2em 0;
  padding: 1.25em 1.5em;
  border-left: 3px solid var(--accent);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

.article-body blockquote p {
  margin: 0;
  color: var(--text-secondary);
}

/* Inline code */
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-weight: 400;
}

/* Pre blocks - reset everything, .highlight in syntax.css is the container */
.article-body pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.article-body pre code {
  display: block;
  background: transparent;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--code-text);
  overflow-x: auto;
  border-radius: 0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 2em 0;
  box-shadow: var(--shadow-md);
}

.article-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 3em 0;
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.article-body th,
.article-body td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  font-family: var(--font-sans);
}

.article-body td {
  color: var(--text-secondary);
}

.article-body tbody tr:hover {
  background: var(--bg-tertiary);
}

/* Prevent table styles from affecting code block line-number tables */
.article-body .highlight table,
.article-body .highlight td,
.article-body .highlight th {
  border: none;
  padding: 0;
  background: transparent;
}

.article-body .highlight tbody tr:hover {
  background: transparent;
}

/* Post Footer */
.post-footer {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tags a {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.post-tags a:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

/* Post Navigation */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.post-nav a:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.post-nav a:first-child {
  text-align: left;
}

.post-nav a:last-child {
  text-align: right;
}

.post-nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.post-nav-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* Copy Code Button */
.highlight {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
}

.highlight:hover .copy-button {
  opacity: 1;
}

.copy-button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.copy-button.copied {
  background: #10b981;
  border-color: #10b981;
  color: white;
  opacity: 1;
}

/* External Link Indicator */
.article-body a[href^="http"]:not([href*="yourdomain.com"])::after {
  content: "↗";
  display: inline-block;
  margin-left: 3px;
  font-size: 0.75em;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.article-body a[href^="http"]:not([href*="yourdomain.com"]):hover::after {
  opacity: 1;
}

/* ==========================================
   ABOUT PAGE
   ========================================== */
.about-content {
  padding: 56px 0 80px;
}

.about-content h1 {
  margin-bottom: 36px;
  font-size: 2.25rem;
}

.about-content .bio-full {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.about-content .bio-full h2 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-top: 40px;
  margin-bottom: 16px;
}

.about-content .bio-full h2:first-child {
  margin-top: 0;
}

.about-content .bio-full p {
  margin-bottom: 1.25em;
}

/* Contact Section */
.contact-section {
  padding: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 48px;
}

.contact-section h2 {
  font-size: 1.125rem;
  margin: 0 0 12px;
}

.contact-section p {
  margin-bottom: 20px;
  font-size: 0.9375rem;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.contact-btn:hover {
  background: var(--accent-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.contact-btn:active {
  transform: translateY(0);
}

.contact-btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================
   FOOTER
   ========================================== */
.site-footer {
  padding: 0;
  border-top: 1px solid var(--border);
  margin-top: 0;
  flex-shrink: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 4px 0;
  line-height: 1;
}

.footer-inner p {
  margin: 0;
  line-height: 1;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* ==========================================
   PAGINATION
   ========================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.pagination .active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .post-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }
  
  body {
    font-size: 15px;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    gap: 4px;
    box-shadow: var(--shadow-lg);
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .nav-links a {
    padding: 12px 16px;
    border-radius: var(--radius);
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .hero {
    padding: 24px 0 16px;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero .tagline {
    font-size: 1.125rem;
  }
  
  .page-header {
    padding: 40px 0 28px;
  }
  
  .page-header h1 {
    font-size: 1.75rem;
  }
  
  .post-header h1 {
    font-size: 1.875rem;
  }
  
  .article-body {
    font-size: 1rem;
  }
  
  .article-body h2 {
    font-size: 1.375rem;
    margin-top: 40px;
  }
  
  .article-body h3 {
    font-size: 1.125rem;
  }
  
  .section-header {
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }
  
  .post-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .post-item-meta {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  
  .post-item-meta .reading-time::before {
    content: "·";
    display: inline;
    margin-right: 12px;
    font-weight: 700;
  }
  
  .footer-inner {
    flex-direction: column;
    gap: 0;
    text-align: center;
  }
  
  .contact-section {
    padding: 24px;
  }
  
  .social-links {
    gap: 8px;
  }
  
  .social-links a {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  
  .header-inner {
    padding: 0 16px;
  }
  
  .post-layout {
    padding: 0 16px;
  }
  
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .post-card {
    padding: 20px;
  }
  
  .post-card h3 {
    font-size: 1.0625rem;
  }
  
  .post-nav {
    grid-template-columns: 1fr;
  }
  
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
  .site-header,
  .site-footer,
  .post-sidebar,
  .theme-toggle,
  .social-links,
  .contact-section {
    display: none !important;
  }
  
  .post-layout {
    grid-template-columns: 1fr;
  }
  
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }
  
  .article-body {
    font-size: 11pt;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
a:focus-visible,
button: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-width: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}
