/*
 * Capricorncorp Blog Theme — main stylesheet
 *
 * Authoritative design system: docs/ENTERPRISE_BLOG_RESEARCH_AND_PROPOSAL.md
 *
 * Inherits brand language from services/crm/src/routes/blog-public.js
 * (the canonical capricorncorp.com/blog renderer). Tokens, typography,
 * header/footer pattern, theme handling all match by design.
 *
 * Single bundle. NO per-plugin CSS. Performance budget: <40KB gz.
 */

*,*::before,*::after { box-sizing: border-box; }

/* ─── Design tokens (dark default) ─────────────────────────────── */
:root {
  --brand:          #2563eb;
  --brand-2:        #3b82f6;
  --brand-dark:     #1d4ed8;
  --brand-darker:   #1e40af;
  --brand-deep:     #1e3a8a;

  --ink:            #f1f5f9;
  --ink-2:          #e2e8f0;
  --body:           #cbd5e1;
  --muted:          #94a3b8;
  --muted-2:        #64748b;

  --surface:        #1e293b;
  --bg:             #0f172a;
  --bg-2:           #020617;
  --border:         #334155;
  --border-2:       #1e293b;

  --accent-bg:      #1e3a8a;
  --top-bar:        #1e40af;

  /* Category accents (subtle — used as 2px left-border, never card bg) */
  --cat-engineering: #2563eb;
  --cat-cloud:       #0ea5e9;
  --cat-product:     #7c3aed;
  --cat-ai:          #10b981;
  --cat-security:    #f43f5e;
  --cat-business:    #f59e0b;
  --cat-inside:      #64748b;

  --container:      1200px;
  --container-narrow: 760px;
  --radius:         8px;
  --radius-pill:    99px;
  --shadow-card:    0 1px 2px rgba(0,0,0,.4);
  --shadow-card-hover: 0 12px 28px rgba(0,0,0,.4);
  --transition:     150ms cubic-bezier(.4,0,.2,1);
}

html.light {
  --brand:          #1d4ed8;
  --brand-2:        #2563eb;
  --brand-dark:     #1e40af;
  --brand-darker:   #1e3a8a;
  --brand-deep:     #1e3a8a;

  --ink:            #0d1828;
  --ink-2:          #1f2937;
  --body:           #374151;
  --muted:          #6b7280;
  --muted-2:        #9ca3af;

  --surface:        #ffffff;
  --bg:             #fafbfc;
  --bg-2:           #f3f4f6;
  --border:         #e5e7eb;
  --border-2:       #f3f4f6;

  --accent-bg:      #eef2ff;
  --top-bar:        #1e40af;

  --shadow-card:    0 1px 2px rgba(13,24,40,.06);
  --shadow-card-hover: 0 12px 28px rgba(13,24,40,.12);
}

/* ─── Reset + base ─────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: "cv02","cv03","cv04","cv11";
  line-height: 1.6;
  color: var(--body);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-2);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--ink); }
html.light a:hover { color: var(--brand); }

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

button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

::selection { background: var(--brand); color: #fff; }

/* ─── Skip link (a11y) ─────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff;
  padding: 12px 16px; z-index: 1000; font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ─── Containers ───────────────────────────────────────────────── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 24px; }

/* ─── Top contact bar ──────────────────────────────────────────── */
.topbar {
  background: var(--top-bar); color: #fff; font-size: 14px; padding: 8px 0;
}
.topbar .inner {
  max-width: var(--container); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.topbar .contact { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar a { color: #fff; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.topbar a:hover { color: #bfdbfe; }
.topbar .whatsapp { color: #86efac; }
.topbar .whatsapp:hover { color: #bbf7d0; }
.topbar .phone-secondary svg { display: none; } /* secondary phone is just text after primary */
@media (max-width: 1024px) { .topbar .phone-secondary { display: none; } }
@media (max-width: 720px) { .topbar .email-link { display: none; } }
@media (max-width: 480px) {
  .topbar .whatsapp span, .topbar .whatsapp { font-size: 12px; }
  .topbar .inner > div:last-child { display: none; }
}

/* ─── Site header ──────────────────────────────────────────────── */
.site-header {
  background: #0f172a; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
html.light .site-header { background: #ffffff; border-bottom-color: var(--border); }

.site-header .inner {
  max-width: var(--container); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 32px;
}

.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }
.brand-lockup svg { flex-shrink: 0; display: block; }
.brand-wordmark {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 18px; font-weight: 800; letter-spacing: 0.04em;
  color: #fff; line-height: 1; text-transform: uppercase;
}
html.light .brand-wordmark { color: var(--ink); }

.primary-nav {
  display: flex; gap: 28px; font-size: 15px; font-weight: 500;
  align-items: center; margin-left: auto;
}
.primary-nav > a { color: var(--ink-2); }
.primary-nav > a:hover { color: var(--brand-2); }
html.light .primary-nav > a { color: var(--ink-2); }
html.light .primary-nav > a:hover { color: var(--brand); }

.header-cta { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.btn-console {
  background: #fff; color: #0f172a;
  padding: 8px 14px; border-radius: var(--radius);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.btn-console:hover { background: #e2e8f0; color: #0f172a; }
html.light .btn-console { background: var(--ink); color: #fff; }
html.light .btn-console:hover { background: var(--ink-2); color: #fff; }

.btn-login {
  color: var(--brand-2); background: transparent;
  padding: 8px 14px; border: 2px solid var(--brand-2); border-radius: var(--radius);
  display: inline-flex; align-items: center;
  transition: all var(--transition);
}
.btn-login:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
html.light .btn-login { color: var(--brand); border-color: var(--brand); }
html.light .btn-login:hover { background: var(--brand); color: #fff; }

.btn-signup {
  background: var(--brand); color: #fff;
  padding: 9px 16px; border-radius: var(--radius);
  display: inline-flex; align-items: center;
  transition: background var(--transition);
}
.btn-signup:hover { background: var(--brand-dark); color: #fff; }
@media (max-width: 1100px) { .btn-login, .btn-signup { display: none; } }

.theme-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--ink-2); padding: 7px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
}
.theme-btn:hover { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.15); }
html.light .theme-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); border-color: rgba(0,0,0,.1); }
.theme-btn .icon-sun { display: inline-block; }
.theme-btn .icon-moon { display: none; }
html.light .theme-btn .icon-sun { display: none; }
html.light .theme-btn .icon-moon { display: inline-block; }

@media (max-width: 960px) { .primary-nav { display: none; } }

/* ─── Reading-progress bar (article pages) ─────────────────────── */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; background: transparent; z-index: 100; pointer-events: none;
}
.read-progress .bar { height: 100%; width: 0%; background: var(--brand-2); transition: width 80ms linear; }

/* ─── Editorial masthead (homepage) ────────────────────────────── */
.editorial-masthead {
  padding: 80px 24px 40px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}
html.light .editorial-masthead {
  background: linear-gradient(180deg, var(--bg) 0%, #ffffff 100%);
}
.editorial-masthead .inner {
  max-width: var(--container); margin: 0 auto;
  display: flex; align-items: end; justify-content: space-between; gap: 32px; flex-wrap: wrap;
}
.editorial-masthead h1 {
  font-size: 56px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--ink); line-height: 1; margin: 0 0 12px;
}
.editorial-masthead .lede {
  font-size: 18px; color: var(--body); max-width: 600px; line-height: 1.5; margin: 0;
}
.editorial-masthead .meta-row {
  display: flex; align-items: center; gap: 16px; font-size: 13px;
}
.editorial-masthead .meta-row a { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.editorial-masthead .meta-row a:hover { color: var(--brand-2); }
@media (max-width: 720px) { .editorial-masthead h1 { font-size: 40px; } }

/* ─── Search input (header + masthead) ─────────────────────────── */
.search-form {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  transition: border-color var(--transition);
  min-width: 280px;
}
html.light .search-form { background: #ffffff; }
.search-form:focus-within { border-color: var(--brand-2); }
.search-form input {
  background: transparent; border: 0; outline: 0; flex: 1;
  color: var(--ink); font-family: inherit; font-size: 14px;
}
.search-form input::placeholder { color: var(--muted); }
.search-form button { color: var(--muted); display: inline-flex; align-items: center; }
.search-form button:hover { color: var(--brand-2); }

/* ─── Category chip strip ──────────────────────────────────────── */
.category-strip {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 60px; z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(15,23,42,.92);
}
html.light .category-strip { background: rgba(255,255,255,.92); }
.category-strip .inner {
  max-width: var(--container); margin: 0 auto; padding: 14px 24px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.category-strip .inner::-webkit-scrollbar { display: none; }

.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-2); font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: all var(--transition);
}
html.light .cat-chip { background: #ffffff; }
.cat-chip:hover { color: var(--ink); border-color: var(--brand-2); }
html.light .cat-chip:hover { color: var(--brand); }
.cat-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cat-chip.active:hover { background: var(--brand-dark); color: #fff; }
.cat-chip .count { color: var(--muted); font-size: 12px; }
.cat-chip.active .count { color: rgba(255,255,255,.7); }

/* ─── Featured row ─────────────────────────────────────────────── */
.featured-row {
  padding: 56px 0 32px;
}
.featured-row .inner {
  max-width: var(--container); margin: 0 auto; padding: 0 24px;
  display: grid; gap: 24px;
  grid-template-columns: 2fr 1fr;
}
.featured-row .right { display: grid; gap: 24px; }
@media (max-width: 900px) {
  .featured-row .inner { grid-template-columns: 1fr; }
}

/* ─── Post cards ───────────────────────────────────────────────── */
.post-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
}
.post-card:hover {
  border-color: var(--brand-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  color: inherit;
}
.post-card .cover {
  aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--bg-2);
}
.post-card .cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 350ms cubic-bezier(.4,0,.2,1);
}
.post-card:hover .cover img { transform: scale(1.03); }
.post-card .body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card .cat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--brand-2);
}
.post-card .cat::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.post-card .cat[data-cat="cloud"]       { color: var(--cat-cloud); }
.post-card .cat[data-cat="product"]     { color: var(--cat-product); }
.post-card .cat[data-cat="ai"]          { color: var(--cat-ai); }
.post-card .cat[data-cat="security"]    { color: var(--cat-security); }
.post-card .cat[data-cat="business"]    { color: var(--cat-business); }
.post-card .cat[data-cat="inside"]      { color: var(--cat-inside); }

.post-card h3 {
  font-size: 20px; font-weight: 700; line-height: 1.25;
  color: var(--ink); margin: 0;
  letter-spacing: -0.01em;
}
.post-card .excerpt {
  font-size: 15px; line-height: 1.5; color: var(--body); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card .meta {
  font-size: 13px; color: var(--muted); margin-top: auto;
  padding-top: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.post-card .meta .author { color: var(--ink-2); font-weight: 500; }
.post-card .meta .dot { color: var(--border); }

/* Featured-large variant */
.post-card.featured-large .cover { aspect-ratio: 16 / 8; }
.post-card.featured-large h3 { font-size: 28px; line-height: 1.15; }
.post-card.featured-large .excerpt { -webkit-line-clamp: 4; font-size: 16px; }
.post-card.featured-large .body { padding: 28px; gap: 14px; }
@media (max-width: 720px) {
  .post-card.featured-large h3 { font-size: 22px; }
  .post-card.featured-large .body { padding: 20px; }
}

/* Featured-small variant: side-by-side cover/body for compactness */
.post-card.featured-small {
  flex-direction: row;
}
.post-card.featured-small .cover {
  width: 40%; aspect-ratio: 1 / 1; flex-shrink: 0;
}
.post-card.featured-small .body { padding: 16px; gap: 8px; }
.post-card.featured-small h3 { font-size: 17px; line-height: 1.3; }
.post-card.featured-small .excerpt { display: none; }
.post-card.featured-small .meta { font-size: 12px; padding-top: 8px; }
@media (max-width: 600px) {
  .post-card.featured-small { flex-direction: column; }
  .post-card.featured-small .cover { width: 100%; aspect-ratio: 16 / 9; }
}

/* Related card variant */
.post-card.related .cover { aspect-ratio: 16 / 9; }
.post-card.related .body { padding: 16px; gap: 8px; }
.post-card.related h3 { font-size: 16px; line-height: 1.3; }
.post-card.related .excerpt { display: none; }

/* ─── Latest grid (homepage + archive + search + author) ─────── */
.posts-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 720px) { .posts-grid { grid-template-columns: 1fr; } }

.section-title {
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
  margin: 56px 0 24px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.section-title h2 {
  font-size: 22px; font-weight: 700; color: var(--ink); margin: 0;
  letter-spacing: -0.01em;
}
.section-title .meta { font-size: 13px; color: var(--muted); }
.section-title .meta a { color: var(--muted); }
.section-title .meta a:hover { color: var(--brand-2); }

/* ─── Newsletter card (inline CTA) ─────────────────────────────── */
.newsletter-card {
  margin: 64px 0;
  padding: 40px 32px;
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand-dark) 100%);
  border-radius: 16px;
  color: #fff;
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center;
}
@media (max-width: 720px) { .newsletter-card { grid-template-columns: 1fr; padding: 28px 20px; } }
.newsletter-card h3 { font-size: 24px; font-weight: 700; color: #fff; margin: 0 0 8px; letter-spacing: -0.01em; }
.newsletter-card p { font-size: 15px; color: rgba(255,255,255,.85); margin: 0; line-height: 1.5; }
.newsletter-card form { display: flex; gap: 8px; flex-wrap: wrap; }
.newsletter-card input[type="email"] {
  flex: 1; min-width: 200px;
  padding: 12px 14px;
  background: rgba(255,255,255,.95); color: var(--ink);
  border: 0; border-radius: var(--radius); font-family: inherit; font-size: 15px;
}
.newsletter-card input[type="email"]:focus { outline: 2px solid #fff; }
.newsletter-card button[type="submit"] {
  padding: 12px 20px;
  background: var(--ink); color: #fff;
  border-radius: var(--radius); font-weight: 600; font-size: 15px;
  transition: background var(--transition);
}
.newsletter-card button[type="submit"]:hover { background: var(--brand-darker); }
.newsletter-card .privacy { font-size: 12px; color: rgba(255,255,255,.65); margin-top: 10px; }
.newsletter-card .status { font-size: 13px; margin-top: 8px; min-height: 18px; }
.newsletter-card .status.success { color: #86efac; }
.newsletter-card .status.error { color: #fca5a5; }

/* ─── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin: 56px 0 80px;
  font-size: 14px;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-2); font-weight: 500;
  transition: all var(--transition);
}
html.light .pagination a, html.light .pagination span { background: #ffffff; }
.pagination a:hover { border-color: var(--brand-2); color: var(--brand-2); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ─── Breadcrumbs ──────────────────────────────────────────────── */
.breadcrumbs {
  font-size: 13px; color: var(--muted);
  margin: 0 0 20px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand-2); }
.breadcrumbs .sep { color: var(--border); }

/* ─── Single article ───────────────────────────────────────────── */
.article-hero {
  padding: 56px 0 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.article-hero .inner { max-width: var(--container-narrow); margin: 0 auto; padding: 0 24px; }
.article-hero .cat-chip { font-size: 11px; padding: 5px 12px; margin-bottom: 16px; }
.article-hero h1 {
  font-size: 44px; font-weight: 800; line-height: 1.1; letter-spacing: -0.025em;
  color: var(--ink); margin: 0 0 16px;
}
@media (max-width: 720px) { .article-hero h1 { font-size: 32px; } }
.article-hero .dek {
  font-size: 20px; line-height: 1.5; color: var(--body); margin: 0 0 24px;
}
.article-hero .byline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 14px; color: var(--muted);
}
.article-hero .byline .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); font-weight: 600; font-size: 13px; flex-shrink: 0;
  overflow: hidden;
}
.article-hero .byline .avatar img { width: 100%; height: 100%; object-fit: cover; }
.article-hero .byline .author { color: var(--ink-2); font-weight: 500; }
.article-hero .byline .dot { color: var(--border); }

.article-cover {
  max-width: var(--container); margin: -1px auto 0; padding: 0 24px;
}
.article-cover img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px;
  margin-top: 24px;
}

/* Article body — typography forward */
.article-layout {
  max-width: var(--container); margin: 0 auto; padding: 56px 24px 40px;
  display: grid; grid-template-columns: 1fr min(720px, 100%) 1fr; gap: 40px;
  align-items: start;
}
@media (max-width: 1023px) {
  .article-layout { grid-template-columns: 1fr; gap: 0; padding: 32px 24px; }
}
.article-body {
  grid-column: 2;
  font-size: 18px; line-height: 1.75; color: var(--body);
}
.article-body > * + * { margin-top: 1.4em; }
.article-body > p:first-of-type {
  font-size: 20px; color: var(--ink-2);
}
.article-body h2 {
  font-size: 30px; font-weight: 700; line-height: 1.2; color: var(--ink);
  margin-top: 56px; margin-bottom: 16px; letter-spacing: -0.01em;
  scroll-margin-top: 90px;
}
.article-body h3 {
  font-size: 22px; font-weight: 700; line-height: 1.3; color: var(--ink);
  margin-top: 40px; margin-bottom: 12px;
  scroll-margin-top: 90px;
}
.article-body h4 {
  font-size: 18px; font-weight: 700; color: var(--ink);
  margin-top: 28px; margin-bottom: 8px;
}
.article-body strong { color: var(--ink); }
.article-body em { color: var(--ink-2); }
.article-body a { text-decoration: underline; text-decoration-color: var(--brand); text-underline-offset: 3px; }
.article-body a:hover { color: var(--ink); text-decoration-color: currentColor; }
.article-body ul, .article-body ol { padding-left: 28px; }
.article-body li + li { margin-top: 8px; }
.article-body li::marker { color: var(--muted); }

.article-body blockquote {
  margin: 32px 0;
  padding: 16px 0 16px 24px;
  border-left: 4px solid var(--brand);
  font-size: 24px; font-style: italic; line-height: 1.4; color: var(--ink-2);
}

.article-body code {
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em; padding: 2px 6px;
  background: var(--accent-bg); color: var(--brand-2);
  border-radius: 4px; border: 1px solid var(--border);
}
.article-body pre {
  position: relative;
  margin: 24px -8px;
  padding: 20px 24px;
  background: var(--bg-2); color: var(--ink-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto;
  font-size: 14px; line-height: 1.6;
}
html.light .article-body pre { background: #1f2937; color: #e5e7eb; border-color: #374151; }
.article-body pre code {
  background: none; color: inherit; padding: 0; border: 0;
  font-size: inherit;
}
.article-body pre .copy-btn {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px; font-size: 12px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; transition: all var(--transition);
}
.article-body pre .copy-btn:hover { color: var(--brand-2); border-color: var(--brand-2); }

.article-body img, .article-body figure {
  margin: 32px 0; border-radius: 8px; overflow: hidden;
}
.article-body figure img { margin: 0; border-radius: 0; }
.article-body figcaption {
  margin-top: 8px; font-size: 14px; color: var(--muted); text-align: center;
}

.article-body table {
  width: 100%; border-collapse: collapse; font-size: 15px;
  margin: 24px 0;
}
.article-body table th, .article-body table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left;
}
.article-body table th { color: var(--ink); font-weight: 600; background: var(--surface); }
@media (max-width: 720px) {
  .article-body table { display: block; overflow-x: auto; }
}

/* Sticky ToC (desktop only, shown when article body has h2/h3) */
.article-toc {
  grid-column: 3; grid-row: 1;
  position: sticky; top: 90px; max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: 13px;
  padding-left: 16px; border-left: 1px solid var(--border);
}
@media (max-width: 1023px) { .article-toc { display: none; } }
.article-toc .toc-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 12px;
}
.article-toc ol {
  list-style: none; padding: 0; margin: 0;
}
.article-toc li { margin: 0; }
.article-toc a {
  display: block; padding: 6px 0; color: var(--muted);
  border-left: 2px solid transparent; padding-left: 10px; margin-left: -12px;
  font-size: 13px; line-height: 1.4; transition: all var(--transition);
}
.article-toc a:hover { color: var(--ink-2); }
.article-toc a.is-active {
  color: var(--brand-2); border-left-color: var(--brand-2); font-weight: 500;
}
.article-toc .toc-h3 { padding-left: 22px; font-size: 12px; }

/* Share rail (desktop only, left) */
.share-rail {
  grid-column: 1; grid-row: 1;
  position: sticky; top: 90px;
  display: flex; flex-direction: column; gap: 8px; align-items: end;
}
@media (max-width: 1023px) { .share-rail { display: none; } }
.share-rail a, .share-rail button {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  cursor: pointer;
}
html.light .share-rail a, html.light .share-rail button { background: #ffffff; }
.share-rail a:hover, .share-rail button:hover {
  color: var(--brand-2); border-color: var(--brand-2);
}
.share-rail svg { width: 16px; height: 16px; }
.share-rail .label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 4px;
}

/* Mobile share row (under hero) */
.share-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  font-size: 14px; color: var(--muted);
  padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.share-row a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500;
}
html.light .share-row a { background: #ffffff; }
.share-row a:hover { border-color: var(--brand-2); color: var(--brand-2); }
@media (min-width: 1024px) { .share-row { display: none; } }

/* Author card */
.author-card {
  max-width: var(--container-narrow); margin: 56px auto;
  display: flex; gap: 20px; align-items: start; padding: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
html.light .author-card { background: #ffffff; }
.author-card .avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); font-weight: 700; font-size: 22px;
  overflow: hidden;
}
.author-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-card .name {
  font-size: 17px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.author-card .name .role { font-size: 13px; font-weight: 500; color: var(--muted); }
.author-card .bio { font-size: 14px; line-height: 1.5; color: var(--body); margin: 8px 0 12px; }
.author-card .author-link { font-size: 13px; color: var(--brand-2); font-weight: 500; }

/* Inline CTA inside article */
.inline-cta {
  max-width: var(--container-narrow); margin: 40px auto;
  padding: 28px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  border-left: 4px solid var(--brand);
}
html.light .inline-cta { background: #ffffff; }
.inline-cta h4 { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 8px; }
.inline-cta p { font-size: 15px; color: var(--body); margin: 0 0 14px; line-height: 1.5; }
.inline-cta .btn-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; background: var(--brand); color: #fff;
  border-radius: var(--radius); font-size: 14px; font-weight: 600;
  transition: background var(--transition);
}
.inline-cta .btn-cta:hover { background: var(--brand-dark); color: #fff; }

/* Related posts */
.related-strip { max-width: var(--container); margin: 56px auto 80px; padding: 0 24px; }
.related-strip .grid {
  display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) { .related-strip .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .related-strip .grid { grid-template-columns: 1fr; } }

/* Prev/Next */
.prev-next {
  max-width: var(--container-narrow); margin: 40px auto;
  padding: 24px 0; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
.prev-next a {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--muted); font-size: 14px;
}
.prev-next a:hover { color: var(--ink); }
.prev-next .nav-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.prev-next .nav-title { color: var(--ink-2); font-size: 16px; font-weight: 500; line-height: 1.3; }
.prev-next a:hover .nav-title { color: var(--brand-2); }
.prev-next .next { text-align: right; }
@media (max-width: 600px) { .prev-next { grid-template-columns: 1fr; } .prev-next .next { text-align: left; } }

/* ─── Archive header (category/tag/author/search) ──────────────── */
.archive-hero {
  padding: 64px 0 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.archive-hero .inner { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.archive-hero .eyebrow {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brand-2); margin: 0 0 8px;
}
.archive-hero h1 {
  font-size: 44px; font-weight: 800; letter-spacing: -0.025em;
  color: var(--ink); line-height: 1.05; margin: 0 0 12px;
}
@media (max-width: 720px) { .archive-hero h1 { font-size: 32px; } }
.archive-hero .description { font-size: 17px; color: var(--body); max-width: 720px; line-height: 1.5; margin: 0; }
.archive-hero .count { font-size: 14px; color: var(--muted); margin-top: 16px; }

/* Author hero */
.author-hero {
  padding: 64px 0 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.author-hero .inner {
  max-width: var(--container); margin: 0 auto; padding: 0 24px;
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
}
.author-hero .avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); font-weight: 700; font-size: 36px;
  overflow: hidden; flex-shrink: 0;
}
.author-hero .avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-hero h1 { font-size: 38px; font-weight: 800; color: var(--ink); margin: 0 0 6px; letter-spacing: -0.02em; }
.author-hero .role { font-size: 15px; color: var(--muted); margin: 0 0 12px; }
.author-hero .bio { font-size: 16px; color: var(--body); max-width: 600px; line-height: 1.5; margin: 0; }

/* Search + 404 */
.search-empty {
  max-width: var(--container-narrow); margin: 60px auto; padding: 0 24px; text-align: center;
}
.search-empty h2 { font-size: 28px; font-weight: 700; color: var(--ink); margin: 0 0 12px; }
.search-empty p { color: var(--body); font-size: 16px; margin: 0 0 24px; }

.error-404 {
  max-width: var(--container-narrow); margin: 80px auto; padding: 0 24px; text-align: center;
}
.error-404 h1 { font-size: 80px; font-weight: 800; color: var(--brand); margin: 0; line-height: 1; letter-spacing: -0.04em; }
.error-404 h2 { font-size: 28px; font-weight: 700; color: var(--ink); margin: 12px 0 8px; }
.error-404 p { color: var(--body); font-size: 16px; margin: 0 0 24px; }

/* ─── Site footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-2); border-top: 1px solid var(--border);
  color: var(--muted); padding: 56px 0 32px;
}
html.light .site-footer { background: #ffffff; border-top-color: var(--border); }
.site-footer .inner {
  max-width: var(--container); margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 32px;
}
@media (max-width: 900px) { .site-footer .inner { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .site-footer .inner { grid-template-columns: 1fr; gap: 24px; } }
.site-footer h4 {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink); margin: 0 0 14px;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 8px; }
.site-footer a { color: var(--muted); font-size: 14px; }
.site-footer a:hover { color: var(--brand-2); }
.site-footer .brand-block .brand-wordmark { color: var(--ink); font-size: 16px; }
.site-footer .blurb { font-size: 14px; color: var(--body); margin: 14px 0 0; line-height: 1.5; max-width: 320px; }
.site-footer .legal {
  max-width: var(--container); margin: 32px auto 0; padding: 24px 24px 0;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted-2);
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
}
.site-footer .legal a { color: var(--muted-2); }

/* ─── Print styles ─────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .topbar, .category-strip,
  .read-progress, .share-rail, .share-row, .article-toc,
  .newsletter-card, .related-strip, .prev-next, .inline-cta { display: none !important; }
  .article-body { font-size: 12pt; color: #000; }
  .article-body h2 { color: #000; }
  body { background: #fff; color: #000; }
}
