/* ============================================================
   blog.css — styles for blog index (/blog/) and individual posts (/blog/<slug>/)
   Shares brand tokens with legal.css (same design system).

   Brand tokens (from src/index.css):
     --accent:       #0065A9 (primary blue)
     --accent-2:     #28AE97 (teal)
     --accent-2-soft:#50E6CD (soft teal)
     --dark:         #18162B (near-black)
     --text-main:    #18162B
     --text-muted:   #5b6478
     --bg-soft:      #f6f8fb
     --border-soft:  #ECEEF3
   Fonts: Inter (body), Outfit (headings), Poppins (accents) — same as landing.
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&family=Poppins:wght@600;700&display=swap');

/* ── CSS custom properties (brand tokens) ── */
:root {
  --accent:        #0065A9;
  --accent-hover:  #004f87;
  --accent-2:      #28AE97;
  --accent-2-soft: #50E6CD;
  --dark:          #18162B;
  --text-main:     #18162B;
  --text-muted:    #5b6478;
  --bg-soft:       #f6f8fb;
  --card-bg:       #ffffff;
  --border-soft:   #ECEEF3;
  --shadow-soft:   0 1px 2px rgba(24,22,43,0.04), 0 8px 24px rgba(24,22,43,0.05);
  --radius-md:     16px;
  --radius-sm:     10px;
  --transition:    all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Minimal reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base document ── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-soft);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   SCROLL PROGRESS BAR (post pages only)
   ============================================================ */
.blog-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: var(--accent-2);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ============================================================
   HEADER — shared with legal.css pattern
   ============================================================ */
.blog-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}

.blog-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.blog-logo {
  display: inline-flex;
  align-items: center;
  height: 22px;
  text-decoration: none;
  flex-shrink: 0;
}

.blog-logo img {
  height: 100%;
  width: auto;
  display: block;
}

.blog-back {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.25s ease;
}

.blog-back:hover { color: var(--accent); }

.blog-back-arrow {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.blog-back:hover .blog-back-arrow { transform: translateX(-3px); }

/* ============================================================
   BLOG INDEX — /blog/
   ============================================================ */
.blog-index-main {
  flex: 1;
  padding: 56px 24px 80px;
}

.blog-index-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* Index page title */
.blog-index-heading {
  margin-bottom: 48px;
}

.blog-index-heading .blog-eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 12px;
}

.blog-index-heading h1 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text-main);
}

.blog-index-heading p {
  margin-top: 12px;
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 620px;
}

/* 3-column grid for post cards */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  list-style: none;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 32px 28px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  height: 100%;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(24,22,43,0.06), 0 16px 40px rgba(24,22,43,0.09);
  border-color: rgba(0, 101, 169, 0.18);
}

.blog-card-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(40, 174, 151, 0.08);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.blog-card h2 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.3px;
  color: var(--text-main);
  margin-bottom: 12px;
  flex: 1;
}

.blog-card-excerpt {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.blog-card-meta span { font-weight: 500; }

.blog-card-arrow {
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.25s ease;
}

.blog-card:hover .blog-card-arrow { transform: translateX(4px); }

/* ============================================================
   POST LAYOUT — /blog/<slug>/
   ============================================================ */
.blog-post-main {
  flex: 1;
  padding: 0 24px 80px;
}

/* Post layout: sidebar TOC + content column */
.blog-post-layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  align-items: start;
  padding-top: 48px;
}

/* ── Post hero (full width above the grid) ── */
.blog-post-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 0 40px;
}

.blog-eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 16px;
}

.blog-post-hero h1 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -1px;
  color: var(--text-main);
  margin-bottom: 20px;
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.blog-post-meta time { font-weight: 500; }
.blog-post-meta .dot { opacity: 0.4; }
.blog-post-meta .read-time { font-weight: 500; }
.blog-post-meta .author { font-weight: 500; }

/* ── TOC sidebar ── */
.blog-toc {
  position: sticky;
  top: 80px;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: var(--shadow-soft);
  font-size: 0.875rem;
}

.blog-toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.blog-toc ol {
  list-style: none;
  counter-reset: toc-counter;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.blog-toc li { counter-increment: toc-counter; }

.blog-toc a {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.45;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.blog-toc a::before {
  content: counter(toc-counter);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
  min-width: 18px;
  margin-top: 1px;
}

.blog-toc a:hover {
  color: var(--accent);
  background: rgba(0, 101, 169, 0.05);
}

.blog-toc a.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(0, 101, 169, 0.06);
}

/* Mobile TOC — collapsible at top */
.blog-toc-mobile {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 32px;
  overflow: hidden;
}

.blog-toc-mobile summary {
  padding: 16px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  list-style: none;
}

.blog-toc-mobile summary::-webkit-details-marker { display: none; }

.blog-toc-mobile summary::after {
  content: '▾';
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.blog-toc-mobile[open] summary::after { transform: rotate(180deg); }

.blog-toc-mobile-list {
  padding: 0 20px 16px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blog-toc-mobile-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 5px 0;
  display: block;
  border-bottom: 1px solid var(--border-soft);
  transition: color 0.2s;
}

.blog-toc-mobile-list a:hover { color: var(--accent); }
.blog-toc-mobile-list li:last-child a { border-bottom: none; }

/* ── Main post content column ── */
.blog-post-content {
  min-width: 0; /* prevent overflow in grid */
  max-width: 720px;
}

/* ── Typography for long-form reading ── */
.blog-post-body {
  font-size: 1.0rem;
  line-height: 1.78;
  color: var(--text-muted);
}

.blog-post-body h2 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.4px;
  color: var(--text-main);
  margin: 48px 0 16px;
  padding-top: 8px;
  scroll-margin-top: 88px; /* sticky header offset */
}

.blog-post-body h2:first-child { margin-top: 0; }

.blog-post-body h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.2px;
  color: var(--text-main);
  margin: 32px 0 12px;
}

.blog-post-body p {
  margin-bottom: 18px;
}

.blog-post-body p:last-child { margin-bottom: 0; }

.blog-post-body strong {
  font-weight: 700;
  color: var(--text-main);
}

.blog-post-body em { font-style: italic; }

/* ── Lists ── */
.blog-post-body ul,
.blog-post-body ol {
  padding-left: 24px;
  margin-bottom: 18px;
}

.blog-post-body li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.blog-post-body li strong { color: var(--text-main); }

/* ── Links in body ── */
.blog-post-body a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(0, 101, 169, 0.25);
  transition: border-color 0.2s, color 0.2s;
}

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

/* ── Blockquote ── */
.blog-post-body blockquote {
  border-left: 3px solid var(--accent-2);
  padding: 12px 20px;
  margin: 24px 0;
  background: rgba(40, 174, 151, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}

/* ── Tables ── */
.blog-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.92rem;
}

.blog-post-body th,
.blog-post-body td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border-soft);
}

.blog-post-body th {
  background: var(--bg-soft);
  font-weight: 700;
  color: var(--text-main);
}

.blog-post-body tr:nth-child(even) td { background: rgba(246,248,251,0.5); }

/* ============================================================
   CTA BLOCK — end of post
   ============================================================ */
.blog-post-cta {
  background: var(--accent-2);
  border-radius: var(--radius-md);
  padding: 40px 36px;
  margin-top: 56px;
  text-align: center;
}

.blog-post-cta h2 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
  line-height: 1.3;
}

.blog-post-cta p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.blog-post-cta a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: 40px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.blog-post-cta a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}

.blog-post-cta .cta-note {
  display: block;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 14px;
}

/* ============================================================
   "KEEP READING" section
   ============================================================ */
.blog-keep-reading {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border-soft);
}

.blog-keep-reading h2 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
  letter-spacing: -0.2px;
}

.blog-keep-reading-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  list-style: none;
}

.blog-keep-reading-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.blog-keep-reading-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 101, 169, 0.2);
  box-shadow: var(--shadow-soft);
}

.blog-keep-reading-card h3 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 8px;
}

.blog-keep-reading-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.blog-keep-reading-arrow {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ============================================================
   FOOTER — matches legal.css
   ============================================================ */
.blog-footer {
  background: var(--dark);
  color: rgba(255, 255, 255, 0.6);
  padding: 32px 48px;
  margin-top: auto;
}

.blog-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.blog-footer-copy {
  font-size: 0.84rem;
  line-height: 1.5;
}

.blog-footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.blog-footer-links a {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.25s ease;
}

.blog-footer-links a:hover { color: #ffffff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: single-column post layout, hide sidebar TOC */
@media (max-width: 1023px) {
  .blog-post-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 32px;
  }

  .blog-toc { display: none; }
  .blog-toc-mobile { display: block; }

  .blog-post-content { max-width: 100%; }
}

/* Tablet: 2-column grid */
@media (max-width: 860px) {
  .blog-header-inner { padding: 0 24px; }
  .blog-footer { padding: 28px 24px; }
  .blog-footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .blog-footer-links { gap: 16px; }

  .blog-grid { grid-template-columns: repeat(2, 1fr); }

  .blog-keep-reading-grid { grid-template-columns: 1fr; }
}

/* Mobile: 1-column, tighter spacing */
@media (max-width: 600px) {
  .blog-index-main { padding: 32px 16px 56px; }
  .blog-post-main  { padding: 0 16px 56px; }

  .blog-grid { grid-template-columns: 1fr; gap: 16px; }

  .blog-index-heading h1 { font-size: 1.8rem; }

  .blog-post-hero { padding: 32px 0 24px; }
  .blog-post-hero h1 { font-size: 1.7rem; }

  .blog-post-body h2 { font-size: 1.2rem; margin: 36px 0 12px; }
  .blog-post-body h3 { font-size: 1rem; }

  .blog-post-cta { padding: 28px 20px; }
  .blog-post-cta h2 { font-size: 1.2rem; }

  .blog-header-inner { padding: 0 16px; }
  .blog-footer { padding: 24px 16px; }
}

/* ── Accessibility ── */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── Reduce motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .blog-progress { display: none; }
}
