/* ============================================================
   Convilyn Blog — Design System
   Brand: Plus Jakarta Sans + Noto Sans TC, Purple #7c3aed, Amber #f59e0b
   ============================================================ */

/* ── 1. Design Tokens ───────────────────────────────────────── */
:root {
  /* Colors — mirrors convilyn main app */
  --bg-page:        #fafafa;
  --bg-surface:     #ffffff;
  --bg-secondary:   #f5f5f5;
  --bg-hover:       rgba(0, 0, 0, 0.03);

  --text-primary:   #111827;
  --text-secondary: #475569;
  --text-muted:     #6b7280;
  --text-faint:     #9ca3af;

  --accent-purple:  #7c3aed;
  --accent-purple-dark: #6d28d9;
  --accent-purple-soft: rgba(124, 58, 237, 0.08);
  --accent-purple-faint: rgba(124, 58, 237, 0.05);

  --accent-amber:   #f59e0b;
  --accent-amber-dark: #d97706;
  --accent-amber-soft: rgba(245, 158, 11, 0.10);

  --accent-cyan:    #06b6d4;
  --accent-rose:    #e11d48;
  --accent-emerald: #10b981;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-body:    'Noto Sans TC', -apple-system, sans-serif;
  --font-serif:   'DM Serif Display', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;
  --space-20:  80px;
  --space-24:  96px;
  --space-30:  120px;

  /* Border radius */
  --r-1: 8px;
  --r-2: 12px;
  --r-3: 16px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.09);

  /* Motion */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:   120ms;
  --dur-med:    220ms;
  --dur-slow:   420ms;

  /* Layout */
  --container-max: 1200px;
  --header-h: 64px;

  /* Reading progress (set by JS) */
  --scroll-progress: 0%;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ── 3. Typography Scale ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.375rem); }
h4 { font-size: 1.125rem; font-weight: 700; }

p {
  line-height: 1.75;
  color: var(--text-secondary);
}

/* ── 4. Layout Utilities ────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}
@media (min-width: 1200px) {
  .container { padding-inline: var(--space-10); }
}

/* ── 5. Header ──────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(250, 250, 250, 0.80);
  border-bottom: 1px solid transparent;
  transition:
    background var(--dur-med) var(--ease-out),
    border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.site-header.scrolled {
  background: rgba(250, 250, 250, 0.88);
  border-bottom-color: rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.site-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.logo-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.logo-wordmark .logo-sep {
  color: var(--text-faint);
  font-weight: 400;
  margin-inline: 2px;
}

.logo-wordmark .logo-blog {
  color: var(--accent-purple);
  font-weight: 600;
}

/* Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.header-nav a {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--r-pill);
  transition: color var(--dur-fast), background var(--dur-fast);
}

.header-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* CTA button */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-purple);
  background: var(--accent-purple-soft);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  transition:
    background var(--dur-fast),
    color var(--dur-fast),
    border-color var(--dur-fast),
    transform var(--dur-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-cta:hover {
  background: var(--accent-purple);
  color: #ffffff;
  border-color: var(--accent-purple);
  transform: translateY(-1px);
}

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--r-1);
  transition: background var(--dur-fast);
  margin-left: auto;
}
.nav-toggle:hover { background: var(--bg-hover); }

/* ── 6. Hero Section ────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-16) 0 var(--space-20);
}

/* Atmospheric gradient orbs — matches main app */
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}

.orb-amber {
  width: 700px; height: 700px;
  top: -250px; left: -150px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.10) 0%, transparent 65%);
}

.orb-cyan {
  width: 500px; height: 500px;
  top: -100px; right: 0;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.07) 0%, transparent 65%);
}

.orb-rose {
  width: 400px; height: 400px;
  bottom: 0; left: 30%;
  background: radial-gradient(circle, rgba(225, 29, 72, 0.05) 0%, transparent 65%);
}

.orb-purple {
  width: 600px; height: 600px;
  bottom: -150px; right: -100px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.09) 0%, transparent 65%);
}

.grid-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(124, 58, 237, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.6;
}

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

/* Hero label */
.hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-purple);
  background: var(--accent-purple-faint);
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  margin-bottom: var(--space-8);
}

.hero-label-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Hero grid layout */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-6);
  align-items: start;
}

/* Featured post card */
.featured-post {
  background: var(--bg-surface);
  border-radius: var(--r-3);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}

.featured-post:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.11);
}

.featured-cover {
  height: 280px;
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.12) 0%,
    rgba(245, 158, 11, 0.08) 50%,
    rgba(6, 182, 212, 0.06) 100%
  );
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-cover-icon {
  width: 72px;
  height: 72px;
  opacity: 0.25;
}

.featured-body {
  padding: var(--space-8);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  padding: 4px 10px;
}

.category-badge--purple {
  color: var(--accent-purple);
  background: var(--accent-purple-soft);
}

.category-badge--amber {
  color: var(--accent-amber-dark);
  background: var(--accent-amber-soft);
}

.category-badge--emerald {
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
}

.category-badge--cyan {
  color: #0891b2;
  background: rgba(6, 182, 212, 0.08);
}

.read-time {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-display);
}

.featured-title {
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
}

.featured-title a,
.article-title a {
  color: var(--text-primary);
  transition: color var(--dur-fast);
}

.featured-title a:hover,
.article-title a:hover {
  color: var(--accent-purple);
}

.featured-excerpt {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-6);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-purple  { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.avatar-amber   { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar-cyan    { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.avatar-emerald { background: linear-gradient(135deg, #10b981, #059669); }

.author-info .author-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.author-info .post-date {
  font-size: 12px;
  color: var(--text-faint);
}

/* Hero sidebar */
.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.secondary-post {
  background: var(--bg-surface);
  border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}

.secondary-post:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.secondary-cover {
  height: 140px;
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.08) 0%,
    rgba(6, 182, 212, 0.06) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.secondary-cover-2 {
  background: linear-gradient(135deg,
    rgba(245, 158, 11, 0.08) 0%,
    rgba(225, 29, 72, 0.05) 100%
  );
}

.secondary-body {
  padding: var(--space-5);
}

.secondary-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.secondary-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-3);
}

/* ── 7. Article Grid ────────────────────────────────────────── */
.articles-section {
  padding: var(--space-20) 0 var(--space-30);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-link {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--dur-fast);
}

.section-link:hover { gap: 8px; }

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

/* Article card */
.article-card {
  background: var(--bg-surface);
  border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-cover {
  height: 180px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.card-cover-gradient {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-g1 { background: linear-gradient(135deg, rgba(124, 58, 237, 0.10) 0%, rgba(79, 70, 229, 0.08) 100%); }
.cover-g2 { background: linear-gradient(135deg, rgba(245, 158, 11, 0.10) 0%, rgba(239, 68, 68, 0.06) 100%); }
.cover-g3 { background: linear-gradient(135deg, rgba(6, 182, 212, 0.10) 0%, rgba(59, 130, 246, 0.07) 100%); }
.cover-g4 { background: linear-gradient(135deg, rgba(16, 185, 129, 0.10) 0%, rgba(6, 182, 212, 0.07) 100%); }
.cover-g5 { background: linear-gradient(135deg, rgba(225, 29, 72, 0.08) 0%, rgba(245, 158, 11, 0.07) 100%); }
.cover-g6 { background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(245, 158, 11, 0.07) 100%); }

.card-cover-icon {
  width: 40px;
  height: 40px;
  opacity: 0.20;
}

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

.article-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin: var(--space-3) 0 var(--space-2);
}

.article-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
}

.card-footer .author-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.card-meta-text .author-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-meta-text .post-date {
  font-size: 11px;
  color: var(--text-faint);
}

/* ── 8. Post Layout ─────────────────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--scroll-progress);
  height: 3px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-amber));
  z-index: 200;
  transition: width 0.1s linear;
}

.post-page {
  padding-top: var(--space-16);
  padding-bottom: var(--space-30);
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr min(720px, 100%) 1fr;
  column-gap: var(--space-8);
}

.post-layout > * { grid-column: 2; }

/* Post hero / header area */
.post-header {
  margin-bottom: var(--space-12);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--dur-fast), gap var(--dur-fast);
  margin-bottom: var(--space-8);
}

.back-link:hover {
  color: var(--accent-purple);
  gap: 10px;
}

.post-title {
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: var(--space-4) 0 var(--space-5);
}

.post-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
  font-family: var(--font-body);
  font-weight: 400;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.byline-divider {
  width: 1px;
  height: 20px;
  background: rgba(0, 0, 0, 0.1);
  margin-inline: var(--space-1);
}

.byline-item {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.byline-item strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Scroll offset compensation for sticky header */
.post-content h2,
.post-content h3 {
  scroll-margin-top: calc(var(--header-h) + 24px);
}

/* Post content typography */
.post-content {
  font-size: 17px;
  line-height: 1.80;
  color: var(--text-secondary);
}

.post-content h2 {
  font-size: 1.5rem;
  margin: var(--space-12) 0 var(--space-5);
  color: var(--text-primary);
  padding-top: var(--space-3);
  border-top: 2px solid var(--accent-purple-soft);
}

.post-content h3 {
  font-size: 1.2rem;
  margin: var(--space-8) 0 var(--space-3);
  color: var(--text-primary);
}

.post-content p {
  margin-bottom: var(--space-6);
}

.post-content a {
  color: var(--accent-purple);
  border-bottom: 1px solid rgba(124, 58, 237, 0.25);
  transition: border-color var(--dur-fast);
}

.post-content a:hover {
  border-bottom-color: var(--accent-purple);
}

.post-content ul, .post-content ol {
  list-style: disc;
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
}

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

.post-content li {
  margin-bottom: var(--space-2);
  line-height: 1.7;
}

/* Pull quote */
.post-content blockquote {
  border-left: 3px solid var(--accent-amber);
  margin: var(--space-10) 0;
  padding: var(--space-5) var(--space-8);
  background: var(--accent-amber-soft);
  border-radius: 0 var(--r-1) var(--r-1) 0;
}

.post-content blockquote p {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
}

/* Code blocks */
.post-content pre {
  background: #f8f8ff;
  border: 1px solid rgba(124, 58, 237, 0.10);
  border-radius: var(--r-1);
  padding: var(--space-6);
  overflow-x: auto;
  margin: var(--space-6) 0;
  font-size: 14px;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent-purple-dark);
}

.post-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13.5px;
  color: #2d2d3a;
}

/* Post images */
.post-content img {
  border-radius: var(--r-2);
  margin: var(--space-8) 0;
  box-shadow: var(--shadow-md);
}

/* ── 9. Sticky TOC ──────────────────────────────────────────── */
.toc-sidebar {
  display: none;
  position: sticky;
  top: calc(var(--header-h) + var(--space-8));
  max-height: calc(100vh - var(--header-h) - 80px);
  overflow-y: auto;
  padding-left: var(--space-8);
  align-self: start;
  grid-column: 3;
}

.toc-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-4);
}

.toc-list {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.toc-link {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 0 6px 16px;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--text-primary);
}

.toc-link.active {
  color: var(--accent-purple);
  border-left-color: var(--accent-purple);
  font-weight: 600;
}

/* ── 10. Footer ─────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: var(--space-12) 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.footer-tagline {
  font-size: 13px;
  color: var(--text-muted);
}

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

.footer-links a {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--dur-fast);
}

.footer-links a:hover { color: var(--accent-purple); }

.footer-copyright {
  font-size: 12px;
  color: var(--text-faint);
}

/* ── 11. Entrance Animations ────────────────────────────────── */
.reveal-item {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}

.reveal-item.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.reveal-item:nth-child(2) { transition-delay: 80ms; }
.reveal-item:nth-child(3) { transition-delay: 160ms; }
.reveal-item:nth-child(4) { transition-delay: 240ms; }
.reveal-item:nth-child(5) { transition-delay: 320ms; }
.reveal-item:nth-child(6) { transition-delay: 400ms; }

/* ── 12. Responsive ─────────────────────────────────────────── */
@media (min-width: 1280px) {
  .toc-sidebar { display: block; }
  .post-layout {
    grid-template-columns: 1fr min(720px, 100%) 280px;
  }
}

@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr 320px;
  }
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }

  .header-nav, .btn-cta {
    display: none;
  }

  .nav-toggle { display: flex; }

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

  .hero-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }

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

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero-sidebar {
    grid-template-columns: 1fr;
  }
}

/* ── Mobile nav overlay ─────────────────────────────────────── */
#mobile-nav {
  display: none;
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-lg);
  flex-direction: column;
  gap: var(--space-2);
  z-index: 99;
}

#mobile-nav.open { display: flex; }

#mobile-nav a {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: color var(--dur-fast);
}

#mobile-nav a:last-child { border-bottom: none; }
#mobile-nav a:hover { color: var(--accent-purple); }

/* ── Category Navigation Bar ───────────────────────────────── */
.category-nav-section {
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

.category-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-3) 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-nav::-webkit-scrollbar { display: none; }

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-pill);
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--dur-fast),
    background var(--dur-fast),
    border-color var(--dur-fast),
    transform var(--dur-fast);
  flex-shrink: 0;
}

.category-pill:hover {
  color: var(--accent-purple);
  border-color: rgba(124, 58, 237, 0.25);
  background: var(--accent-purple-faint);
}

.category-pill.active {
  color: var(--accent-purple);
  background: var(--accent-purple-soft);
  border-color: rgba(124, 58, 237, 0.20);
}

.category-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Pillar color dots */
.dot-all      { background: var(--text-faint); }
.dot-start    { background: #6366f1; }
.dot-usecase  { background: var(--accent-amber); }
.dot-tutorial { background: var(--accent-purple); }
.dot-playbook { background: var(--accent-cyan); }
.dot-case     { background: var(--accent-emerald); }
.dot-insights { background: var(--accent-rose); }

/* Hidden articles during filter */
.article-card[data-filtered] {
  display: none;
}

/* ── Pillar Badges ──────────────────────────────────────────── */
.category-badge--indigo {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.08);
}

.category-badge--slate {
  color: #475569;
  background: rgba(71, 85, 105, 0.08);
}

.category-badge--teal {
  color: #059669;
  background: rgba(16, 185, 129, 0.10);
}

/* ── Positioning Banner ─────────────────────────────────────── */
.positioning-banner {
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.04) 0%,
    rgba(245, 158, 11, 0.03) 50%,
    rgba(6, 182, 212, 0.03) 100%
  );
  border: 1px solid rgba(124, 58, 237, 0.10);
  border-radius: var(--r-3);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-10);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.funnel-steps {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.funnel-step {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.funnel-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.funnel-arrow {
  color: var(--text-faint);
  font-size: 14px;
}

.positioning-banner-text {
  flex: 1;
  min-width: 0;
}

.positioning-banner-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.positioning-banner-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ── Lead Magnet Section ────────────────────────────────────── */
.lead-magnet-section {
  position: relative;
  overflow: hidden;
  padding: var(--space-20) 0;
  background: var(--bg-surface);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.lead-magnet-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lead-magnet-bg .orb-amber {
  width: 500px; height: 500px;
  top: -200px; right: -100px;
  opacity: 0.7;
}

.lead-magnet-bg .orb-purple {
  width: 400px; height: 400px;
  bottom: -150px; left: -100px;
  opacity: 0.7;
}

.lead-magnet-inner {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin-inline: auto;
  text-align: center;
}

.lead-magnet-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-amber-dark);
  background: var(--accent-amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.20);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  margin-bottom: var(--space-5);
}

.lead-magnet-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.lead-magnet-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-8);
}

.lead-magnet-perks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.lead-magnet-perk {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.lead-magnet-perk svg {
  color: var(--accent-emerald);
  flex-shrink: 0;
}

.email-form {
  display: flex;
  gap: var(--space-3);
  max-width: 480px;
  margin-inline: auto;
}

.email-input {
  flex: 1;
  height: 48px;
  padding: 0 var(--space-5);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1.5px solid rgba(0, 0, 0, 0.10);
  border-radius: var(--r-pill);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.email-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.10);
}

.email-input::placeholder {
  color: var(--text-faint);
}

.btn-primary {
  height: 48px;
  padding: 0 var(--space-6);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent-purple);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background var(--dur-fast),
    transform var(--dur-fast),
    box-shadow var(--dur-fast);
}

.btn-primary:hover {
  background: var(--accent-purple-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.30);
}

.email-disclaimer {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: var(--space-3);
}

/* ── In-article Soft CTA ────────────────────────────────────── */
.post-cta-soft {
  background: var(--accent-purple-faint);
  border: 1.5px solid rgba(124, 58, 237, 0.12);
  border-radius: var(--r-2);
  padding: var(--space-6);
  margin: var(--space-10) 0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.post-cta-soft-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-1);
  background: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.post-cta-soft-body {
  flex: 1;
  min-width: 0;
}

.post-cta-soft-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-purple);
  margin-bottom: 4px;
}

.post-cta-soft-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.post-cta-soft-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.post-cta-soft-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-3);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-purple);
  transition: gap var(--dur-fast);
}

.post-cta-soft-link:hover { gap: 8px; }

/* ── End-of-article Hard CTA ────────────────────────────────── */
.post-cta-end {
  background: linear-gradient(135deg,
    var(--accent-purple) 0%,
    #4f46e5 60%,
    #4338ca 100%
  );
  border-radius: var(--r-3);
  padding: var(--space-12) var(--space-10);
  margin-top: var(--space-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.post-cta-end::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.post-cta-end-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  margin-bottom: var(--space-4);
}

.post-cta-end-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin-bottom: var(--space-3);
  position: relative;
}

.post-cta-end-desc {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  margin-bottom: var(--space-8);
  max-width: 440px;
  margin-inline: auto;
  position: relative;
}

.post-cta-end .email-form {
  max-width: 420px;
  position: relative;
}

.post-cta-end .email-input {
  background: rgba(255, 255, 255, 0.95);
  border-color: transparent;
}

.post-cta-end .email-input:focus {
  border-color: rgba(255, 255, 255, 0.50);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.post-cta-end .btn-primary {
  background: white;
  color: var(--accent-purple);
}

.post-cta-end .btn-primary:hover {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.20);
}

.post-cta-end .email-disclaimer {
  color: rgba(255, 255, 255, 0.45);
  position: relative;
}

/* ── Pillar description section ─────────────────────────────── */
.pillars-section {
  padding: var(--space-16) 0 var(--space-8);
  background: var(--bg-page);
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.pillar-card {
  background: var(--bg-surface);
  border-radius: var(--r-2);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur-med), transform var(--dur-med);
  cursor: pointer;
}

.pillar-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pillar-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  font-size: 20px;
}

.pillar-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.pillar-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ── Playbooks gateway section ──────────────────────────────── */
.playbooks-gateway {
  padding: 72px 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.04) 0%, rgba(245,158,11,0.04) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.playbooks-gateway-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.playbook-preview-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  font-size: 13px;
  margin-bottom: 12px;
}

.playbook-preview-card--2 { opacity: 0.6; transform: scale(0.97); }

.playbook-flow-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.playbook-flow-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.playbook-flow-label.trigger { background: rgba(245,158,11,0.12); color: #b45309; }
.playbook-flow-label.tools   { background: rgba(124,58,237,0.10); color: #6d28d9; }
.playbook-flow-label.output  { background: rgba(16,185,129,0.10); color: #047857; }

.playbook-flow-text { color: var(--text-primary); line-height: 1.5; }

.playbook-flow-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  margin: 4px 0;
  padding-left: 2px;
}

@media (max-width: 900px) {
  .playbooks-gateway-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .playbooks-gateway-preview { display: none; }
}

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

  .reveal-item {
    opacity: 1;
    transform: none;
  }
}
