/* ============================================
   CloudRPS — Clean Technical Blog Theme
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg: #ffffff;
  --bg-surface: #f8fafc;
  --bg-elevated: #f1f5f9;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --content-width: 720px;
  --header-height: 72px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #334155;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #1e3a5f;
  --border: #334155;
  --border-light: #1e293b;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

main { flex: 1; }

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

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

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
}
[data-theme="dark"] .site-header {
  background: rgba(15,23,42,0.9);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo:hover { opacity: 0.85; }
.logo-img {
  height: 40px;
  width: auto;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.nav-link {
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg-surface);
}
.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  transition: all var(--transition);
}
.theme-toggle:hover { color: var(--text); background: var(--bg-surface); }
.moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* --- Hero --- */
.hero {
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg) 100%);
}
.hero-inner {
  max-width: 700px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}
.accent { color: var(--accent); }
.hero-sub {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2rem;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* --- Sections --- */
.section {
  padding: 4rem 1.5rem;
}
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2rem;
}
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.see-all {
  font-size: 0.9rem;
  font-weight: 600;
}

/* --- Category Grid --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.category-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  color: var(--text);
}
.category-card:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.category-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.75rem;
}
.category-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.category-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Post Grid --- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.post-grid-small {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.post-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  background: var(--bg);
}
.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.post-card-link {
  display: block;
  color: var(--text);
}
.post-card-link:hover { color: var(--text); }

.post-card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-surface);
}
.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.post-card:hover .post-card-image img {
  transform: scale(1.03);
}

.post-card-body {
  padding: 1.25rem;
}
.post-card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.post-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.post-card-excerpt {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.dot { font-size: 0.5rem; }

/* --- Blog Listing --- */
.blog-listing {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.listing-header {
  margin-bottom: 2.5rem;
}
.listing-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.listing-desc {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  max-width: 600px;
}
.listing-count {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.page-link {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
}
.page-link:hover { border-color: var(--accent); }
.page-info { font-size: 0.85rem; color: var(--text-tertiary); }

/* --- Article --- */
.article {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 2rem;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 0.4rem; }

.article-header {
  max-width: var(--content-width);
  margin-bottom: 2rem;
}
.article-categories { margin-bottom: 1rem; }
.category-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.article-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.article-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.article-meta {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tag {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
}
.tag:hover { color: var(--accent); background: var(--accent-light); }

.article-hero-image {
  max-width: var(--content-width);
  margin-bottom: 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* --- Article Layout (content + TOC sidebar) --- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3rem;
  align-items: start;
}

.toc-sidebar {
  order: 2;
}
.toc-sticky {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
}
.toc-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}
.toc-sidebar nav#TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-sidebar nav#TableOfContents > ul > li {
  margin-bottom: 0.25rem;
}
.toc-sidebar nav#TableOfContents ul ul {
  padding-left: 1rem;
  margin-top: 0.25rem;
}
.toc-sidebar nav#TableOfContents a {
  display: block;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  padding: 0.2rem 0;
  line-height: 1.4;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  transition: all var(--transition);
}
.toc-sidebar nav#TableOfContents a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

.article-content {
  max-width: var(--content-width);
  order: 1;
}

/* --- Article Content Typography --- */
.article-content h2 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.article-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}
.article-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.article-content p {
  margin-bottom: 1.25rem;
}
.article-content ul, .article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}
.article-content li {
  margin-bottom: 0.4rem;
}
.article-content li > ul, .article-content li > ol {
  margin-top: 0.4rem;
  margin-bottom: 0;
}
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.article-content blockquote p:last-child { margin-bottom: 0; }

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}
.article-content pre {
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}
.article-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--code-text);
  line-height: 1.6;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.article-content table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 0.85rem;
}
.article-content table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}
.article-content table tr:hover td {
  background: var(--bg-surface);
}

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

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.article-content strong { font-weight: 600; }

/* Key takeaway / callout boxes */
.article-content .callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-surface);
}
.article-content .callout-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

/* --- FAQ Section --- */
.faq-section { margin-top: 3rem; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.faq-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  margin-top: 0;
  border: none;
}
.faq-item p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* --- Related Posts --- */
.related-posts {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}
.related-posts h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* --- Ad Slots --- */
.ad-slot {
  max-width: var(--max-width);
  margin: 1.5rem auto;
  min-height: 0;
}
.ad-slot-banner {
  padding: 0 1.5rem;
}
.ad-slot-inline {
  margin-bottom: 2rem;
}
.ad-slot-article-top {
  max-width: var(--content-width);
  margin-bottom: 2rem;
}
.ad-slot-article-bottom {
  max-width: var(--content-width);
  margin-top: 2rem;
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3rem;
}
.footer-logo {
  margin-bottom: 0.75rem;
}
.footer-logo .logo-img {
  height: 32px;
  width: auto;
}
.footer-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}
.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* --- Mobile Responsive --- */
@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .toc-sidebar {
    order: -1;
    position: relative;
  }
  .toc-sticky {
    position: relative;
    top: 0;
    background: var(--bg-surface);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  html { font-size: 16px; }

  .hero { padding: 3rem 1.5rem; }
  .hero h1 { font-size: 2rem; }
  .hero-stats { gap: 1.5rem; }
  .stat-num { font-size: 1.5rem; }

  .menu-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }
  .main-nav.open { display: flex; }
  .nav-link { padding: 0.75rem 1rem; }
  .header-actions { gap: 0.15rem; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .post-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr 1fr; }

  .article-header h1 { font-size: 1.75rem; }
  .section-title { font-size: 1.4rem; }
  .listing-header h1 { font-size: 1.75rem; }
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.65rem; }
}

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

/* --- Social Share Buttons --- */
.social-share {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.social-share-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.social-share-buttons {
  display: flex;
  gap: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}

.share-btn:hover {
  border-color: transparent;
  color: #fff;
}

.share-whatsapp:hover { background: #25D366; }
.share-x:hover { background: #000; }
[data-theme="dark"] .share-x:hover { background: #e2e8f0; color: #000; }
.share-linkedin:hover { background: #0A66C2; }
.share-instagram:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

.share-btn svg {
  width: 18px;
  height: 18px;
}

.copied-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

.share-btn.copied .copied-tooltip {
  display: block;
}

/* --- Email Capture --- */
.email-capture {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.email-capture-inner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}
.email-capture-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.email-capture-desc {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}
.email-capture-form {
  display: flex;
  gap: 0.5rem;
  max-width: 480px;
  margin: 0 auto;
}
.email-input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
}
.email-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.email-btn {
  white-space: nowrap;
  padding: 0.6rem 1.25rem;
}
.email-consent {
  display: block;
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.email-success {
  color: #16a34a;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.75rem;
}
.email-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* --- Author Bio --- */
.author-bio {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  margin: 2rem 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.author-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.author-name {
  display: block;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.author-name:hover { color: var(--accent); }
.author-desc {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- Affiliate CTA --- */
.affiliate-cta {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
}
.affiliate-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  font-size: 1rem;
}
.affiliate-link:hover { color: var(--accent); }
.affiliate-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.affiliate-arrow {
  margin-left: auto;
  font-size: 1.25rem;
  color: var(--accent);
}
.affiliate-disclosure {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-style: italic;
}
.affiliate-footer-disclosure {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* --- CTA Box --- */
.cta-box {
  margin: 2rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.02));
  border: 1px solid var(--accent);
  border-radius: 10px;
  text-align: center;
}
.cta-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.cta-desc {
  color: var(--text-muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.cta-btn {
  display: inline-block;
}

/* --- Responsive: Email Capture --- */
@media (max-width: 480px) {
  .email-capture-form {
    flex-direction: column;
  }
  .email-btn {
    width: 100%;
  }
}

/* --- Search Page --- */
.search-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  padding: 2rem 1.5rem;
}
.search-container {
  max-width: 800px;
  margin: 0 auto;
}
.search-box {
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  background: var(--bg);
  padding: 1rem 0 0;
  margin-bottom: 1rem;
}
.search-input-wrapper {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 1rem 3.5rem 1rem 3.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  transition: all var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.search-clear {
  position: absolute;
  right: 3rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}
.search-clear:hover { color: var(--text); }
.search-kbd {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-tertiary);
}
.search-input:focus ~ .search-kbd { display: none; }

/* Filters */
.search-filters {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem 0;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.search-filters::-webkit-scrollbar { display: none; }
.filter-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Status */
.search-status {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  padding: 0.5rem 0;
  min-height: 1.75rem;
}
.search-status strong { color: var(--text-secondary); }

/* Results */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.search-result {
  display: flex;
  gap: 1.25rem;
  padding: 1rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  transition: background var(--transition);
  text-decoration: none;
}
.search-result:hover {
  background: var(--bg-surface);
  color: var(--text);
}
.result-image {
  width: 140px;
  min-width: 140px;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}
.result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-body { flex: 1; min-width: 0; }
.result-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.result-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}
.result-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.search-results mark {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.05em 0.15em;
  border-radius: 2px;
}
[data-theme="dark"] .search-results mark {
  background: rgba(59, 130, 246, 0.2);
}

/* Empty & initial states */
.search-initial {
  padding: 3rem 0;
}
.search-empty-state {
  text-align: center;
  padding: 2rem 0 2.5rem;
}
.search-empty-state p {
  color: var(--text-tertiary);
  margin-top: 1rem;
  font-size: 1rem;
}
.search-shortcut {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}
.search-shortcut kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.search-suggestions {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}
.search-suggestions h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}
.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.suggestion-tag {
  padding: 0.4rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.suggestion-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.search-no-results {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-tertiary);
}
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: inherit;
  text-decoration: underline;
}
.search-more {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .result-image { width: 80px; min-width: 80px; }
  .result-title { font-size: 0.95rem; }
  .result-desc { -webkit-line-clamp: 1; }
  .search-input { font-size: 1rem; padding: 0.85rem 3rem 0.85rem 3rem; }
}
@media (max-width: 480px) {
  .result-image { display: none; }
}

/* --- Search Nav Button --- */
.nav-search {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.nav-search:hover { color: var(--text); background: var(--bg-surface); }

/* --- Print --- */
@media print {
  .site-header, .site-footer, .toc-sidebar, .ad-slot, .related-posts,
  .theme-toggle, .breadcrumbs, .social-share { display: none; }
  .article-layout { grid-template-columns: 1fr; }
  .article-content { max-width: 100%; }
}
