/* ================================================================
   Blog Design Tokens (matches main app)
   ================================================================ */
:root {
  --bg: #0b0d13;
  --surface: #141720;
  --surface2: #1a1e2c;
  --border: #252a3a;
  --text: #e1e4ed;
  --text-dim: #6b7194;
  --text-muted: #4a5072;
  --accent: #e8590c;
  --accent-hover: #f97316;
  --accent-bg: rgba(232,89,12,.08);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,.08);
  --red: #ef4444;
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,.08);
  --purple: #a855f7;
  --purple-bg: rgba(168,85,247,.08);
  --teal: #14b8a6;
  --teal-bg: rgba(20,184,166,.08);
  --radius: 16px;
  --radius-sm: 10px;
  --max-w: 1200px;
  --content-w: 780px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Skip to content */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--accent); color: #fff;
  padding: 10px 18px; border-radius: var(--radius-sm);
  z-index: 9999; font-weight: 600; font-size: .9rem;
  transition: top .2s;
}
.skip-link:focus { top: 16px; color: #fff; }

/* ================================================================
   Header
   ================================================================ */
.blog-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,13,19,.9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  letter-spacing: -.02em;
}
.logo:hover { color: var(--text); }
.logo-icon { width: 32px; height: 32px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--text-dim); font-size: .88rem; font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  background: var(--accent); color: #fff !important;
  padding: 8px 20px; border-radius: var(--radius-sm);
  font-weight: 600; transition: background .15s;
}
.nav-cta:hover { background: var(--accent-hover); }
.mobile-menu-btn {
  display: none; background: none; border: none; cursor: pointer; padding: 6px;
}
.mobile-menu-btn span {
  display: block; width: 22px; height: 2px; background: var(--text);
  margin: 5px 0; border-radius: 2px;
}
.mobile-nav {
  display: none; position: fixed; inset: 0; top: 64px;
  background: var(--bg); z-index: 999;
  flex-direction: column; padding: 24px 20px; gap: 4px;
  overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 16px 18px; border-radius: var(--radius-sm);
  font-size: 1.05rem; color: var(--text); font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover, .mobile-nav a:active { background: var(--surface); }
.mobile-nav-cta {
  margin-top: 12px;
  background: var(--accent) !important; color: #fff !important;
  text-align: center; border-radius: var(--radius-sm) !important;
  border-bottom: none !important; font-weight: 700 !important;
}
.mobile-nav-cta:hover { background: var(--accent-hover) !important; }

/* ================================================================
   Category Colors
   ================================================================ */
.cat-trading-bots { --cat-color: var(--accent); --cat-bg: var(--accent-bg); }
.cat-strategies { --cat-color: var(--blue); --cat-bg: var(--blue-bg); }
.cat-getting-started { --cat-color: var(--green); --cat-bg: var(--green-bg); }
.cat-ai-automation { --cat-color: var(--purple); --cat-bg: var(--purple-bg); }

/* ================================================================
   Blog Index
   ================================================================ */
.blog-hero {
  max-width: var(--max-w); margin: 0 auto;
  padding: 60px 32px 40px;
  text-align: center;
}
.blog-hero h1 {
  font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em;
  margin-bottom: 12px;
}
.blog-hero p { color: var(--text-dim); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.section-heading {
  max-width: var(--max-w); margin: 0 auto;
  padding: 20px 32px 16px;
}
.section-heading h2 {
  font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em;
  text-align: center;
}

.blog-grid {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 32px 60px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

/* Card link wrapper */
a.article-card-link {
  display: block; text-decoration: none; color: inherit;
  border-radius: var(--radius);
  transition: transform .2s;
}
a.article-card-link:hover { color: inherit; }
a.article-card-link:hover .article-card {
  border-color: var(--cat-color, var(--accent));
  transform: translateY(-2px);
}
a.article-card-link:hover .card-title { color: var(--cat-color, var(--accent)); }

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  transition: border-color .2s, transform .2s;
  overflow: hidden;
}

/* Card hero image area */
.card-hero {
  height: 160px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card-hero-bg {
  position: absolute; inset: 0;
  opacity: .6;
}
/* Category-specific gradient backgrounds */
.cat-trading-bots .card-hero-bg {
  background: linear-gradient(135deg, #1a0f05 0%, #2d1a0a 40%, #1a0f05 100%);
}
.cat-strategies .card-hero-bg {
  background: linear-gradient(135deg, #0a1628 0%, #0f1f3d 40%, #0a1628 100%);
}
.cat-getting-started .card-hero-bg {
  background: linear-gradient(135deg, #051a0f 0%, #0a2d1a 40%, #051a0f 100%);
}
.cat-ai-automation .card-hero-bg {
  background: linear-gradient(135deg, #150a28 0%, #1f0f3d 40%, #150a28 100%);
}
/* Real photo in hero */
.card-hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .7;
  transition: opacity .3s, transform .4s;
}
a.article-card-link:hover .card-hero-img {
  opacity: .85; transform: scale(1.03);
}
/* Decorative icon in hero (fallback) */
.card-hero-icon {
  position: relative; z-index: 1;
  font-size: 3rem; opacity: .25;
  filter: grayscale(.3);
}
/* Decorative grid pattern overlay */
.card-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.03) 1px, transparent 0);
  background-size: 24px 24px;
}
/* Bottom fade */
.card-hero::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 60px; z-index: 2;
  background: linear-gradient(to top, var(--surface), transparent);
}

.card-body {
  padding: 20px 24px 24px;
  display: flex; flex-direction: column; flex: 1;
}
.article-card .card-category {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--cat-color, var(--accent)); margin-bottom: 10px;
}
.article-card .card-title {
  font-size: 1.15rem; font-weight: 700; line-height: 1.35;
  margin-bottom: 10px; letter-spacing: -.01em;
  color: var(--text); transition: color .15s;
}
.article-card .card-excerpt {
  color: var(--text-dim); font-size: .88rem; line-height: 1.6;
  margin-bottom: 16px; flex: 1;
}
.article-card .card-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: .76rem; color: var(--text-muted);
}
.card-meta .author-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700; color: var(--cat-color, var(--accent));
}
.card-guide-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: var(--cat-bg, var(--accent-bg)); color: var(--cat-color, var(--accent));
  font-size: .68rem; font-weight: 700; margin-left: auto;
}
.card-read-more {
  display: flex; align-items: center; gap: 6px;
  font-size: .82rem; font-weight: 600; color: var(--cat-color, var(--accent));
  margin-top: 12px;
}
.card-read-more::after {
  content: '\2192'; transition: transform .15s;
}
a.article-card-link:hover .card-read-more::after {
  transform: translateX(4px);
}

/* Featured card (pillar/essential guide) — spans full width */
.featured-card {
  grid-column: 1 / -1;
}
.featured-card .article-card {
  flex-direction: row;
}
.featured-card .card-hero {
  width: 40%; min-width: 280px; height: auto; min-height: 240px;
  flex-shrink: 0;
}
.featured-card .card-body {
  padding: 28px 32px;
  min-width: 0;
}
.featured-card .card-title {
  font-size: 1.4rem;
}
.featured-card .card-hero::before {
  background: linear-gradient(to left, var(--surface), transparent);
  height: auto; width: 60px; bottom: 0; top: 0; right: 0; left: auto;
}

/* ================================================================
   Article Page
   ================================================================ */
/* Article hero banner */
.article-hero-banner {
  position: relative; overflow: hidden;
  max-width: 100%; height: 200px;
}
.article-hero-banner .hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; opacity: .5;
}
.article-hero-banner .hero-bg {
  position: absolute; inset: 0;
}
.cat-trading-bots .hero-bg {
  background: linear-gradient(135deg, #1a0f05 0%, #2d1a0a 30%, #1a1005 60%, #0b0d13 100%);
}
.cat-strategies .hero-bg {
  background: linear-gradient(135deg, #0a1628 0%, #0f1f3d 30%, #0a1225 60%, #0b0d13 100%);
}
.cat-getting-started .hero-bg {
  background: linear-gradient(135deg, #051a0f 0%, #0a2d1a 30%, #051a10 60%, #0b0d13 100%);
}
.cat-ai-automation .hero-bg {
  background: linear-gradient(135deg, #150a28 0%, #1f0f3d 30%, #12081f 60%, #0b0d13 100%);
}
.article-hero-banner::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.03) 1px, transparent 0);
  background-size: 24px 24px;
}
.article-hero-banner .hero-icon {
  position: absolute; right: 10%; top: 50%; transform: translateY(-50%);
  font-size: 6rem; opacity: .1;
}
.article-hero-banner::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 80px; z-index: 2;
  background: linear-gradient(to top, var(--bg), transparent);
}

.article-header {
  max-width: var(--content-w); margin: 0 auto;
  padding: 32px 24px 28px;
}
.article-header .breadcrumb {
  font-size: .8rem; color: var(--text-muted); margin-bottom: 20px;
}
.article-header .breadcrumb a { color: var(--text-dim); }
.article-header h1 {
  font-size: 2.2rem; font-weight: 800; line-height: 1.2;
  letter-spacing: -.03em; margin-bottom: 16px;
}
.article-meta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--text-dim); font-size: .85rem;
}
.article-meta .author-link {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 600;
}
.article-meta .author-link img {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
}
.article-meta .author-link .author-initials {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-bg); border: 1px solid rgba(232,89,12,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--accent);
}
.article-meta .separator { color: var(--text-muted); }
.article-meta time { color: var(--text-dim); }
.article-meta .reading-time { color: var(--text-muted); }
.article-category-badge {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  background: var(--cat-bg, var(--accent-bg));
  color: var(--cat-color, var(--accent));
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em;
}

/* Article body */
.article-body {
  max-width: var(--content-w); margin: 0 auto;
  padding: 0 24px 60px;
  font-size: 1.05rem;
}
.article-body .lead {
  font-size: 1.2rem; color: var(--text); line-height: 1.7;
  margin-bottom: 32px; font-weight: 400;
  border-left: 3px solid var(--accent); padding-left: 20px;
}
.article-body h2 {
  font-size: 1.6rem; font-weight: 700; margin: 48px 0 16px;
  letter-spacing: -.02em; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.article-body h2:first-of-type { border-top: none; }
.article-body h3 {
  font-size: 1.2rem; font-weight: 700; margin: 32px 0 12px;
  color: var(--text);
}
.article-body p { margin-bottom: 18px; color: rgba(225,228,237,.9); }
.article-body ul, .article-body ol {
  margin-bottom: 18px; padding-left: 24px;
}
.article-body li { margin-bottom: 8px; color: rgba(225,228,237,.9); }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body em { font-style: italic; }
.article-body a { text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { text-decoration-color: var(--accent-hover); }

/* Code */
.article-body code {
  background: var(--surface2); padding: 2px 7px;
  border-radius: 5px; font-size: .88em;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--accent);
}
.article-body pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px 24px;
  overflow-x: auto; margin-bottom: 24px;
}
.article-body pre code {
  background: none; padding: 0; color: var(--text-dim);
  font-size: .85rem; line-height: 1.6;
}

/* Tables */
.article-body table {
  width: 100%; border-collapse: collapse;
  margin-bottom: 24px; font-size: .9rem;
}
.article-body th, .article-body td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.article-body th {
  background: var(--surface); font-weight: 700; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim);
}
.article-body td { color: rgba(225,228,237,.85); }
.article-body tr:hover td { background: var(--surface); }

/* TOC */
.article-body .toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px;
  margin-bottom: 36px;
}
.article-body .toc h2 {
  font-size: 1rem; margin: 0 0 12px; padding: 0; border: none;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em;
}
.article-body .toc ol {
  padding-left: 20px; margin-bottom: 0;
}
.article-body .toc li { margin-bottom: 6px; font-size: .92rem; }
.article-body .toc a { text-decoration: none; color: var(--accent); }
.article-body .toc a:hover { color: var(--accent-hover); }

/* Guide backlink banner */
.article-body .pillar-backlink {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 20px;
  margin-bottom: 32px; font-size: .9rem; color: var(--text-dim);
}
.article-body .pillar-backlink a {
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.article-body .pillar-backlink a:hover { color: var(--accent-hover); }

/* CTA Box */
.article-body .cta-box {
  background: linear-gradient(135deg, rgba(232,89,12,.08), rgba(249,115,22,.04));
  border: 1px solid rgba(232,89,12,.25);
  border-radius: var(--radius); padding: 32px;
  margin: 40px 0;
}
.article-body .cta-box h3 {
  font-size: 1.3rem; margin: 0 0 10px; color: var(--text);
}
.article-body .cta-box p { color: var(--text-dim); margin-bottom: 12px; }
.article-body .cta-box ul { list-style: none; padding: 0; }
.article-body .cta-box li { margin-bottom: 6px; }
.article-body .cta-box a { text-decoration: none; font-weight: 600; }
.cta-button {
  display: inline-block; padding: 12px 28px;
  background: var(--accent); color: #fff !important;
  border-radius: var(--radius-sm); font-weight: 700;
  font-size: 1rem; transition: background .15s;
  text-decoration: none !important;
}
.cta-button:hover { background: var(--accent-hover); }

/* Author bio box */
.author-bio-box {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-top: 48px;
}
.author-bio-box .bio-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-bg); border: 2px solid rgba(232,89,12,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; color: var(--accent);
}
.author-bio-box .bio-content h4 { font-size: 1rem; margin-bottom: 2px; }
.author-bio-box .bio-content .bio-title {
  font-size: .8rem; color: var(--text-dim); margin-bottom: 8px;
}
.author-bio-box .bio-content p { font-size: .88rem; color: var(--text-dim); margin: 0; }

/* Related articles */
.related-articles {
  max-width: var(--content-w); margin: 0 auto;
  padding: 0 24px 60px;
}
.related-articles h2 {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 20px;
  color: var(--text-dim);
}
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
a.related-card-link {
  display: block; text-decoration: none; color: inherit;
  border-radius: var(--radius-sm);
}
a.related-card-link:hover { color: inherit; }
a.related-card-link:hover .related-card { border-color: var(--accent); }
.related-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px;
  transition: border-color .2s; height: 100%;
}
.related-card .rc-category {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); margin-bottom: 8px;
}
.related-card .rc-title {
  font-size: .95rem; font-weight: 600; line-height: 1.35;
  color: var(--text);
}

/* ================================================================
   Author Page
   ================================================================ */
.author-header {
  max-width: var(--content-w); margin: 0 auto;
  padding: 60px 24px 40px;
  display: flex; gap: 24px; align-items: flex-start;
}
.author-header .author-avatar-lg {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-bg); border: 3px solid rgba(232,89,12,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: var(--accent);
}
.author-header .author-info h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.author-header .author-info .author-title-text {
  font-size: .95rem; color: var(--accent); font-weight: 600; margin-bottom: 12px;
}
.author-header .author-info .author-long-bio {
  color: var(--text-dim); font-size: .95rem; line-height: 1.7;
}
.author-header .author-links {
  display: flex; gap: 12px; margin-top: 16px;
}
.author-header .author-links a {
  padding: 6px 14px; border-radius: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: .8rem; font-weight: 600; color: var(--text-dim);
  transition: all .15s;
}
.author-header .author-links a:hover {
  color: var(--text); border-color: var(--accent);
}
.author-articles {
  max-width: var(--content-w); margin: 0 auto;
  padding: 0 24px 60px;
}
.author-articles h2 {
  font-size: 1.1rem; font-weight: 700; color: var(--text-dim);
  margin-bottom: 20px; text-transform: uppercase; letter-spacing: .04em;
}

/* ================================================================
   Footer
   ================================================================ */
.blog-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 48px 0 32px;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }
.footer-grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 40px;
}
.footer-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.footer-logo:hover { color: var(--text); }
.footer-tagline { font-size: .85rem; color: var(--text-dim); line-height: 1.5; }
.footer-col h4 {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-dim); margin-bottom: 14px;
}
.footer-col a {
  display: block; font-size: .88rem; color: var(--text-muted);
  padding: 4px 0; transition: color .15s;
}
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  font-size: .78rem; color: var(--text-muted);
}
.footer-disclaimer { margin-top: 6px; font-size: .72rem; }

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .blog-hero h1 { font-size: 1.8rem; }
  .blog-grid { grid-template-columns: 1fr; padding: 0 16px 40px; }
  .blog-hero { padding: 40px 16px 24px; }
  .section-heading { padding: 16px 16px 12px; }
  .section-heading h2 { font-size: 1.2rem; }

  /* Featured card stacks vertically on mobile */
  .featured-card .article-card { flex-direction: column; }
  .featured-card .card-hero { width: 100%; min-width: auto; min-height: 140px; }
  .featured-card .card-body { padding: 20px 20px 24px; }
  .featured-card .card-title { font-size: 1.2rem; }
  .featured-card .card-hero::before {
    background: linear-gradient(to top, var(--surface), transparent);
    width: auto; height: 60px; inset: auto 0 0 0;
  }

  .card-hero { height: 120px; }

  .article-hero-banner { height: 140px; }
  .article-header { padding: 24px 16px 20px; }
  .article-header h1 { font-size: 1.6rem; }
  .article-body { padding: 0 16px 40px; font-size: 1rem; }
  .article-body h2 { font-size: 1.3rem; }
  .article-body .lead { font-size: 1.05rem; }
  .article-body table { font-size: .8rem; }
  .article-body th, .article-body td { padding: 8px 10px; }
  .author-bio-box { flex-direction: column; align-items: center; text-align: center; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .author-header { flex-direction: column; align-items: center; text-align: center; padding: 40px 16px 24px; }
  .author-articles { padding: 0 16px 40px; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .article-meta { flex-direction: column; align-items: flex-start; gap: 8px; }
}
