/* ─── The Agent Report — Magazine Styles ─── */
:root {
  --bg: #0f0f13;
  --bg-card: #18181e;
  --bg-hover: #1e1e26;
  --text: #e8e8ed;
  --text-muted: #888899;
  --text-dim: #5c5c6e;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-green: #00cec9;
  --accent-orange: #fdcb6e;
  --accent-pink: #e84393;
  --accent-blue: #74b9ff;
  --border: #2a2a35;
  --border-light: #333344;
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 1200px;
  --card-shadow: 0 8px 25px rgba(0,0,0,.3);
}

/* ─── Light Mode ─── */
[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f2;
  --text: #1a1a2e;
  --text-muted: #555566;
  --text-dim: #888899;
  --accent: #6c5ce7;
  --accent-light: #6c5ce7;
  --accent-green: #00b894;
  --accent-orange: #e17055;
  --accent-pink: #e84393;
  --accent-blue: #0984e3;
  --border: #d4d4dc;
  --border-light: #e0e0e6;
  --card-shadow: 0 8px 25px rgba(0,0,0,.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Screen-reader only — accessible hiding for SEO headings */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; transition: color .2s; }
a:hover { color: var(--text); }

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

.main-content { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ─── Header ─── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 15, 19, .9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.site-logo img {
  max-height: 36px;
  width: auto;
  display: block;
}
.site-nav {
  display: flex;
  gap: 28px;
}
.nav-link {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  position: relative;
}
.nav-link:hover,
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #e8e8ed;
  font-size: 1.5rem;
  cursor: pointer;
}

/* ─── Header Actions & Theme Toggle ─── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
  color: var(--text);
  line-height: 1;
}
.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* ─── Hero Section ─── */
.hero-section {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero-featured {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform .3s, box-shadow .3s;
}
.hero-featured:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, .15);
}
.hero-featured-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}
.hero-featured-body {
  padding: 24px;
}
.hero-featured-body .category-badge { margin-bottom: 12px; display: inline-block; }
.hero-featured-body h2 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text);
}
.hero-featured-body h2 a { color: var(--text); }
.hero-featured-body h2 a:hover { color: var(--accent-light); }
.hero-featured-body p {
  color: var(--text-muted);
  font-size: .95rem;
}
.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hero-side-article {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: background .2s;
}
.hero-side-article:hover { background: var(--bg-hover); }
.hero-side-article-image {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.hero-side-article-body { flex: 1; }
.hero-side-article-body h3 { font-size: .95rem; font-weight: 600; line-height: 1.4; color: var(--text); }
.hero-side-article-body h3 a { color: var(--text); }
.hero-side-article-body h3 a:hover { color: var(--accent-light); }
.hero-side-article-body .article-date { font-size: .78rem; color: var(--text-dim); }

/* ─── Category Badges ─── */
.category-badge {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--border);
  color: var(--text-muted);
}
.category-badge.research { background: rgba(108, 92, 231, .15); color: var(--accent-light); }
.category-badge.tools-frameworks { background: rgba(0, 206, 201, .15); color: var(--accent-green); }
.category-badge.industry { background: rgba(116, 185, 255, .15); color: var(--accent-blue); }
.category-badge.opinion { background: rgba(253, 203, 110, .15); color: var(--accent-orange); }
.category-badge.hermes-agent { background: rgba(253, 121, 168, .15); color: #fd79a8; }
.category-badge.openclaw { background: rgba(85, 239, 196, .15); color: #55efc4; }

/* ─── Section Headers ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.section-header .section-link {
  font-size: .85rem;
  color: var(--text-muted);
}

/* ─── Post Grid (magazine cards) ─── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s, box-shadow .3s, border-color .3s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow);
  border-color: var(--accent);
}
.post-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.post-card-body { padding: 20px; }
.post-card-meta {
  font-size: .78rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.post-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
}
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent-light); }
.post-card-excerpt {
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.read-more {
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent-light);
}

/* ─── Category Sections (Home) ─── */
.category-section {
  margin-bottom: 48px;
  padding-top: 8px;
}

/* ─── Single Article ─── */
.post-article {
  max-width: 740px;
  margin: 0 auto;
  padding: 40px 0;
}
.post-header { margin-bottom: 32px; }
.post-meta-top { margin-bottom: 16px; }
.post-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.post-meta {
  font-size: .9rem;
  color: var(--text-dim);
}
.post-hero {
  margin-top: 24px;
}
.post-hero img {
  width: 100%;
  border-radius: var(--radius);
}
.post-content {
  font-size: 1.05rem;
  line-height: 1.8;
}
.post-content p { margin-bottom: 1.2em; }
.post-content h2 { font-size: 1.5rem; margin: 1.5em 0 .5em; font-weight: 700; color: var(--text); }
.post-content h3 { font-size: 1.2rem; margin: 1.5em 0 .5em; font-weight: 600; color: var(--text); }
.post-content ul, .post-content ol { margin: 1em 0; padding-left: 1.5em; }
.post-content li { margin-bottom: .4em; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 1.5em 0;
  color: var(--text-muted);
  font-style: italic;
}
.post-content code {
  font-family: var(--font-mono);
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
}
.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin: 1.5em 0;
}
.post-content pre code {
  background: none;
  padding: 0;
}
.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.post-tags { margin-bottom: 24px; }
.tag {
  display: inline-block;
  font-size: .78rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bg-hover);
  color: var(--text-muted);
  margin: 0 4px 4px 0;
}
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.post-nav a { font-size: .9rem; font-weight: 500; }

/* ─── Newsletter CTA in Article ─── */
.post-newsletter-cta {
  margin: 40px 0;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  text-align: center;
}
.post-newsletter-cta h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.post-newsletter-cta p {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}
.cta-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
  justify-content: center;
}
.cta-form .newsletter-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .88rem;
  background: var(--bg);
  color: var(--text);
}
.cta-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent, #6c5ce7);
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}
.cta-btn:hover { opacity: .85; }

/* ─── Newsletter Hero Banner (Homepage) ─── */
.newsletter-hero {
  background: linear-gradient(135deg, rgba(108,92,231,.08) 0%, rgba(0,206,201,.05) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
  text-align: center;
}
.newsletter-hero-content { max-width: 520px; margin: 0 auto; }
.newsletter-hero h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.newsletter-hero > .newsletter-hero-content > p {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}
.newsletter-hero-form {
  display: flex;
  gap: 6px;
  justify-content: center;
  max-width: 380px;
  margin: 0 auto;
}
.hero-input {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .82rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color .2s;
}
.hero-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(108,92,231,.12);
}
.hero-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .2s, box-shadow .2s;
}
.hero-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(108,92,231,.25);
}
.newsletter-hero-footnote {
  font-size: .72rem !important;
  color: var(--text-dim) !important;
  margin-top: 10px !important;
  margin-bottom: 0 !important;
}

/* ─── Thank You Page ─── */
.thanks-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}
.thanks-card {
  max-width: 560px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 36px;
}
.thanks-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}
.thanks-card h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.thanks-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.thanks-card p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.thanks-actions {
  margin: 28px 0;
  padding: 24px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}
.thanks-actions p {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}
.thanks-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.thanks-link {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-light);
  font-weight: 500;
  font-size: .9rem;
  transition: border-color .2s;
}
.thanks-link:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}
.thanks-rss {
  margin-top: 20px;
  font-size: .85rem;
}
.thanks-rss a { color: var(--accent-light); font-weight: 500; }

/* ─── Social Share Buttons ─── */
.post-share {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 32px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.share-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.share-buttons {
  display: flex;
  gap: 8px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s;
}
.share-btn:hover {
  border-color: var(--accent, #6c5ce7);
  color: var(--accent, #6c5ce7);
  transform: translateY(-2px);
}
.share-btn.twitter:hover { border-color: #1da1f2; color: #1da1f2; }
.share-btn.linkedin:hover { border-color: #0a66c2; color: #0a66c2; }
.share-btn.reddit:hover { border-color: #ff4500; color: #ff4500; }
.share-btn.email:hover { border-color: var(--accent, #6c5ce7); color: var(--accent, #6c5ce7); }

/* ─── Category Page ─── */
.category-page { padding: 40px 0; }
.category-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.category-title { font-size: 2rem; font-weight: 800; color: var(--text); }
.category-description { color: var(--text-muted); margin-top: 8px; }

/* ─── Latest Page ─── */
.latest-page { padding: 40px 0; }
.latest-header { margin-bottom: 32px; }
.latest-header h1 { font-size: 2rem; font-weight: 800; color: var(--text); }
.latest-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
}
.latest-item {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.latest-item:hover { background: var(--bg-hover); }
.latest-item-image {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.latest-item-body { flex: 1; }
.latest-item-meta { font-size: .78rem; color: var(--text-dim); margin-bottom: 4px; }
.latest-item-body h2 { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.latest-item-body h2 a { color: var(--text); }
.latest-item-body h2 a:hover { color: var(--accent-light); }
.latest-item-body p { font-size: .88rem; color: var(--text-muted); margin-top: 4px; }

.latest-hidden,
.archive-hidden { display: none; }

/* ─── About Page ─── */
.about-page { padding: 40px 0; max-width: 700px; margin: 0 auto; }
.about-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 24px; color: var(--text); }
.about-page p { color: var(--text-muted); line-height: 1.8; margin-bottom: 1em; }

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 48px 20px 0;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 2fr;
  gap: 48px;
  padding-bottom: 32px;
}
.footer-brand .logo-icon { font-size: 1.3rem; }
.footer-brand .logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.footer-tagline {
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: 8px;
}
.footer-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.footer-col h4 {
  font-size: .85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
}
.footer-bottom p {
  font-size: .8rem;
  color: var(--text-dim);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
  }
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-inner {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .site-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    gap: 16px;
  }
  .site-nav.open { display: flex; }
  .menu-toggle { display: block; }
  .nav-link.active::after { display: none; }
  .post-grid {
    grid-template-columns: 1fr;
  }
  .hero-side-article {
    flex-direction: column;
  }
  .hero-side-article-image {
    width: 100%;
    height: 140px;
  }
  .latest-item {
    flex-direction: column;
  }
  .latest-item-image {
    width: 100%;
    height: 160px;
  }
  .post-title {
    font-size: 1.6rem;
  }
  .footer-links {
    grid-template-columns: 1fr;
  }
}

/* ─── Breadcrumbs ─── */
.breadcrumbs {
  margin-bottom: 20px;
  font-size: 0.85rem;
}
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.breadcrumbs li {
  color: var(--text-dim);
}
.breadcrumbs li + li::before {
  content: "›";
  margin-right: 8px;
  color: var(--text-dim);
}
.breadcrumbs a {
  color: var(--accent-light);
}
.breadcrumbs a:hover {
  color: var(--text);
}
.breadcrumbs li[aria-current="page"] {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ─── Newsletter ─── */
.post-comments {
  max-width: 740px;
  margin: 48px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.newsletter-col {
  min-width: 200px;
}
.newsletter-form {
  display: flex;
  gap: 8px;
}
.newsletter-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .85rem;
  outline: none;
  transition: border-color .2s;
}
.newsletter-input:focus {
  border-color: var(--accent);
}
.newsletter-btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}
.newsletter-btn:hover {
  opacity: .85;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hero-section,
.post-card,
.hero-side-article,
.latest-item {
  animation: fadeInUp .5s ease-out both;
}
.hero-featured { animation-delay: .05s; }
.hero-side-article:nth-child(1) { animation-delay: .1s; }
.hero-side-article:nth-child(2) { animation-delay: .2s; }
.hero-side-article:nth-child(3) { animation-delay: .3s; }
.post-card:nth-child(1) { animation-delay: .05s; }
.post-card:nth-child(2) { animation-delay: .1s; }
.post-card:nth-child(3) { animation-delay: .15s; }
.post-card:nth-child(4) { animation-delay: .2s; }
.post-card:nth-child(5) { animation-delay: .25s; }
.post-card:nth-child(6) { animation-delay: .3s; }

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Back to Top ─── */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s, transform .3s, background .2s;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Table of Contents ─── */
.post-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 32px;
  overflow: hidden;
}
.toc-toggle {
  padding: 14px 20px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.toc-toggle:hover { color: var(--accent-light); }
details[open] .toc-toggle { border-bottom: 1px solid var(--border); }
.toc-body { padding: 0 20px 14px; }
.toc-body ul { list-style: none; padding: 0; margin: 0; }
.toc-body li { margin: 6px 0; font-size: .9rem; }
.toc-body li a { color: var(--text-muted); }
.toc-body li a:hover { color: var(--accent-light); }
.toc-body .toc-h3 { padding-left: 20px; font-size: .85rem; }

/* ─── Related Articles ─── */
.related-posts {
  margin-bottom: 32px;
}
.related-posts h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.related-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.related-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.related-card-body { padding: 12px; }
.related-card-meta { margin-bottom: 6px; }
.related-card-meta .category-badge { font-size: .6rem; padding: 1px 6px; }
.related-card-date { font-size: .75rem; color: var(--text-dim); margin-left: 6px; }
.related-card-body h4 {
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 4px;
}
.related-card-body .reading-time {
  font-size: .75rem;
  color: var(--text-dim);
}

/* ─── Card Reading Time ─── */
.read-more-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-reading-time {
  font-size: .75rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.card-reading-time::before {
  content: "· ";
}

/* ─── Search Page ─── */
.search-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 40px 0;
}
.search-header h1 { font-size: 2rem; font-weight: 800; color: var(--text); }
.search-box {
  position: relative;
  margin: 24px 0 16px;
}
.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  pointer-events: none;
}
.search-stats {
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.search-noquery {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: .95rem;
}
.search-results { margin-bottom: 32px; }
.search-result {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: background .2s, border-color .2s;
}
.search-result:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.search-result-image {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.search-result-body { flex: 1; }
.search-result-meta {
  font-size: .75rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.search-result-body h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.search-result-body h2:hover { color: var(--accent-light); }
.search-result-body p {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── Pagination ─── */
.pagination {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 8px;
}
.pagination a,
.pagination span,
.load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: background .2s, border-color .2s;
  cursor: pointer;
  font-family: var(--font-sans);
}
.pagination a:hover,
.load-more-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination .disabled {
  opacity: .4;
  pointer-events: none;
}

/* ─── Back to Top + Search responsive ─── */
@media (max-width: 640px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
  .search-result {
    flex-direction: column;
  }
  .search-result-image {
    width: 100%;
    height: 140px;
  }
}