/* ========================================
   Sebastian Claesson - Techblog
   Modern Dark Theme
   ======================================== */

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

:root {
  --bg-primary: #181a24;
  --bg-secondary: #1e2130;
  --bg-tertiary: #252839;
  --bg-card: #222535;
  --bg-card-hover: #292d40;
  --bg-code: #1b1e2b;
  --text-primary: #e4e6f0;
  --text-secondary: #a0a5bb;
  --text-muted: #787d96;
  --accent: #7b9aff;
  --accent-hover: #99b2ff;
  --accent-glow: rgba(123, 154, 255, 0.15);
  --border: #2e3247;
  --border-light: #383d55;
  --tag-bg: rgba(108, 140, 255, 0.1);
  --tag-text: #8da6ff;
  --success: #4ade80;
  --warning: #fbbf24;
  --info: #38bdf8;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --max-width: 1100px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --transition: 0.2s ease;
}

/* Light mode */
[data-theme="light"] {
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f1f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f6fa;
  --bg-code: #f4f5f9;
  --text-primary: #1a1d2e;
  --text-secondary: #4a4f65;
  --text-muted: #7b8098;
  --accent: #4a6cf7;
  --accent-hover: #3a5ce5;
  --accent-glow: rgba(74, 108, 247, 0.12);
  --border: #e2e4ed;
  --border-light: #d0d3e0;
  --tag-bg: rgba(74, 108, 247, 0.08);
  --tag-text: #4a6cf7;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f1f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f6fa;
    --bg-code: #f4f5f9;
    --text-primary: #1a1d2e;
    --text-secondary: #4a4f65;
    --text-muted: #7b8098;
    --accent: #4a6cf7;
    --accent-hover: #3a5ce5;
    --accent-glow: rgba(74, 108, 247, 0.12);
    --border: #e2e4ed;
    --border-light: #d0d3e0;
    --tag-bg: rgba(74, 108, 247, 0.08);
    --tag-text: #4a6cf7;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
}

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

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

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

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

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* ========================================
   Header / Navigation
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: all var(--transition);
}

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

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

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

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

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
}

.site-logo:hover {
  color: var(--accent);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: white;
  font-weight: 800;
}

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

.nav-links a {
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

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

.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-social {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.nav-social a {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0.4rem;
  border-radius: 6px;
  transition: all var(--transition);
}

.nav-social a:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
}

.nav-social svg {
  width: 18px;
  height: 18px;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    flex-direction: column;
  }

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

  .nav-links {
    flex-direction: column;
    gap: 0;
  }

  .nav-links a {
    display: block;
    padding: 0.75rem 1rem;
  }

  .nav-social {
    margin-left: 0;
    padding-left: 0;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-left: none;
    border-top: 1px solid var(--border);
    justify-content: center;
  }
}

/* ========================================
   Main Content
   ======================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

main {
  padding: 3rem 0 4rem;
}

/* ========================================
   Hero Section (Home)
   ======================================== */

.hero {
  padding: 4rem 0 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse at center,
    rgba(108, 140, 255, 0.12) 0%,
    rgba(167, 139, 250, 0.06) 40%,
    transparent 70%);
  animation: hero-glow 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes hero-glow {
  0%   { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50%  { opacity: 1;   transform: translateX(-50%) scale(1.1); }
  100% { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #e2e4ed 0%, #6c8cff 50%, #a78bfa 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.hero-tags {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: transform 0.2s ease, background 0.2s ease;
}

.hero-tag:hover {
  transform: translateY(-1px);
  background: rgba(108, 140, 255, 0.18);
}

/* ========================================
   Search & Filter
   ======================================== */

.search-filter {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-box {
  position: relative;
  max-width: 400px;
}

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

.search-box input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

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

.search-box input:focus {
  border-color: var(--accent);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cat-btn {
  padding: 0.35rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.cat-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-light);
}

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

/* ========================================
   Post Cards (Home listing)
   ======================================== */

.posts-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: all 0.3s ease;
  display: block;
  color: var(--text-primary);
  position: relative;
  animation: card-enter 0.4s ease both;
}

.post-card:nth-child(1)  { animation-delay: 0s; }
.post-card:nth-child(2)  { animation-delay: 0.05s; }
.post-card:nth-child(3)  { animation-delay: 0.1s; }
.post-card:nth-child(4)  { animation-delay: 0.15s; }
.post-card:nth-child(5)  { animation-delay: 0.2s; }
.post-card:nth-child(6)  { animation-delay: 0.25s; }
.post-card:nth-child(7)  { animation-delay: 0.3s; }
.post-card:nth-child(8)  { animation-delay: 0.35s; }
.post-card:nth-child(9)  { animation-delay: 0.4s; }
.post-card:nth-child(10) { animation-delay: 0.45s; }
.post-card:nth-child(11) { animation-delay: 0.5s; }

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(108, 140, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(108, 140, 255, 0.08), var(--shadow);
  color: var(--text-primary);
}

.post-card:hover h2 {
  color: var(--accent);
  transition: color 0.2s ease;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.post-card-date {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.post-card-category {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.post-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.post-card-tags span {
  padding: 0.15rem 0.5rem;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ========================================
   Single Post Page
   ======================================== */

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

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

.post-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  flex-wrap: wrap;
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.post-meta svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.post-categories {
  display: flex;
  gap: 0.4rem;
}

.post-categories span {
  padding: 0.2rem 0.65rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
}

/* Post Content */
.post-content {
  max-width: 780px;
  overflow-x: hidden;
  min-width: 0;
}

.post-content h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.02em;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
}

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

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

.post-content em {
  color: var(--text-secondary);
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content ul, .post-content ol {
  margin: 1rem 0 1.25rem 1.5rem;
  color: var(--text-secondary);
}

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

.post-content img {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* Code blocks */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-code);
  padding: 0.2em 0.45em;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
  word-break: break-word;
}

.post-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  line-height: 1.55;
  max-width: 100%;
}

.post-content pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
}

/* Callout boxes */
.callout {
  border-left: 3px solid var(--info);
  background: rgba(56, 189, 248, 0.06);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.callout.info {
  border-color: var(--info);
  background: rgba(56, 189, 248, 0.06);
}

.callout.tip {
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.06);
}

.callout.warning {
  border-color: var(--warning);
  background: rgba(251, 191, 36, 0.06);
}

/* Details/Summary */
.post-content details {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 1.25rem 0;
  overflow: hidden;
}

.post-content details summary {
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  user-select: none;
}

.post-content details summary:hover {
  background: var(--bg-card-hover);
}

.post-content details[open] summary {
  border-bottom: 1px solid var(--border);
}

.post-content details > *:not(summary) {
  padding: 0 1.25rem;
}

/* ========================================
   Table of Contents (sidebar)
   ======================================== */

.post-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  align-items: start;
  min-width: 0;
}

.post-layout > * {
  min-width: 0;
}

.toc {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  font-size: 0.82rem;
}

.toc-title {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  margin-bottom: 0.75rem;
}

.toc ul {
  list-style: none;
  border-left: 1px solid var(--border);
  padding-left: 0;
}

.toc li {
  padding-left: 1rem;
}

.toc a {
  display: block;
  padding: 0.3rem 0;
  color: var(--text-muted);
  transition: all var(--transition);
  line-height: 1.4;
}

.toc a:hover,
.toc a.active {
  color: var(--accent);
}

@media (max-width: 960px) {
  .post-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    display: none;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  .post-header h1 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .post-meta {
    font-size: 0.8rem;
    gap: 0.75rem;
  }

  .post-content h1 {
    font-size: 1.35rem;
  }

  .post-content h2 {
    font-size: 1.2rem;
  }

  .post-content h3 {
    font-size: 1.05rem;
  }

  .post-content pre {
    padding: 1rem;
    font-size: 0.78rem;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .post-content img {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
    max-width: calc(100% + 2.5rem);
    border-radius: 0;
  }

  .post-content table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
  }

  .callout {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    border-radius: 0;
    padding: 0.85rem 1.25rem;
  }

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

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

/* ========================================
   About Page
   ======================================== */

.about-content {
  max-width: 680px;
}

.about-content h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.about-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.about-content p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
}

.about-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
}

.about-link:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.about-link svg {
  width: 18px;
  height: 18px;
}

/* ========================================
   Footer
   ======================================== */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-inner a {
  color: var(--text-muted);
}

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

@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* ========================================
   Utilities
   ======================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

/* Back to posts (floating, post pages only) */
.back-to-posts {
  position: fixed;
  bottom: 2rem;
  right: 5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  z-index: 50;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.back-to-posts:hover {
  color: var(--accent);
  border-color: rgba(123, 154, 255, 0.3);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow);
}

.back-to-posts svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 600px) {
  .back-to-posts span {
    display: none;
  }
  .back-to-posts {
    padding: 0.6rem;
    border-radius: 50%;
    right: 4.5rem;
  }
}

/* ========================================
   Highlight.js theme overrides (dark)
   ======================================== */

.hljs {
  background: transparent !important;
  color: var(--text-primary) !important;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
  color: #c678dd !important;
}

.hljs-string,
.hljs-title,
.hljs-name,
.hljs-type,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
  color: #98c379 !important;
}

.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta {
  color: #5c6370 !important;
}

.hljs-number,
.hljs-regexp,
.hljs-literal,
.hljs-params {
  color: #d19a66 !important;
}

.hljs-built_in,
.hljs-builtin-name {
  color: #e6c07b !important;
}

.hljs-function {
  color: #61afef !important;
}

/* Light mode overrides */
[data-theme="light"] .nav-social a,
[data-theme="light"] .theme-toggle,
[data-theme="light"] .nav-links a,
[data-theme="light"] .cat-btn {
  color: #1a1d2e;
}

[data-theme="light"] .nav-social a:hover,
[data-theme="light"] .theme-toggle:hover {
  color: var(--accent);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .nav-social a,
  :root:not([data-theme="dark"]) .theme-toggle,
  :root:not([data-theme="dark"]) .nav-links a,
  :root:not([data-theme="dark"]) .cat-btn { color: #1a1d2e; }
  :root:not([data-theme="dark"]) .nav-social a:hover,
  :root:not([data-theme="dark"]) .theme-toggle:hover { color: var(--accent); }
}
[data-theme="light"] .hero::before,
:root:not([data-theme="dark"]) .hero::before {
  background: radial-gradient(ellipse at center,
    rgba(74, 108, 247, 0.08) 0%,
    rgba(167, 139, 250, 0.04) 40%,
    transparent 70%);
}

[data-theme="light"] .post-card:hover,
:root:not([data-theme="dark"]) .post-card:hover {
  box-shadow: 0 8px 32px rgba(74, 108, 247, 0.06), 0 4px 24px rgba(0,0,0,0.04);
}

[data-theme="light"] .hljs,
:root:not([data-theme="dark"]) .hljs {
  color: #383a42 !important;
}

[data-theme="light"] .hljs-keyword,
[data-theme="light"] .hljs-selector-tag,
[data-theme="light"] .hljs-literal,
[data-theme="light"] .hljs-section {
  color: #a626a4 !important;
}

[data-theme="light"] .hljs-string,
[data-theme="light"] .hljs-title,
[data-theme="light"] .hljs-name,
[data-theme="light"] .hljs-variable {
  color: #50a14f !important;
}

[data-theme="light"] .hljs-comment,
[data-theme="light"] .hljs-quote {
  color: #a0a1a7 !important;
}

[data-theme="light"] .hljs-number,
[data-theme="light"] .hljs-regexp {
  color: #986801 !important;
}

[data-theme="light"] .hljs-built_in,
[data-theme="light"] .hljs-builtin-name {
  color: #c18401 !important;
}

[data-theme="light"] .hljs-function {
  color: #4078f2 !important;
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .toc,
  .back-to-top {
    display: none;
  }

  body {
    background: white;
    color: #1a1a1a;
  }
}
