/* ─── BLOG DESIGN SYSTEM ───────────────────────────────────────────────────
   Loaded on top of application.css (Bootstrap) via the blog layout.
   Nav/footer use .blog-nav* / .blog-footer* prefixes to avoid Bootstrap
   conflicts (.nav, .footer are Bootstrap utility classes).
   Article body classes (.article-hero, article.post, .prose-col, etc.)
   don't conflict with Bootstrap and are used without prefix.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --blue:       #0d6efd;
  --blue-600:   #0a58ca;
  --blue-50:    #f0f4ff;
  --green:      #198754;
  --ink:        #0b1424;
  --ink-2:      #2a3447;
  --ink-3:      #5b6577;
  --ink-4:      #8b95a7;
  --line:       #e6e9ef;
  --bg-soft:    #f6f8fb;
  --grad:       linear-gradient(120deg, #0d6efd 0%, #1a7be0 32%, #1e8b9c 60%, #198754 100%);
  --shadow-sm:  0 1px 2px rgba(11,20,36,.06);
  --shadow-md:  0 8px 24px -8px rgba(11,20,36,.18), 0 2px 6px rgba(11,20,36,.06);
  --shadow-lg:  0 30px 60px -20px rgba(11,20,36,.35), 0 12px 24px -12px rgba(11,20,36,.18);
}

/* ─── Base ─── */
body {
  /* Body prose uses Bootstrap's OS-tuned stack — Plus Jakarta Sans 400 reads
     thin at 16-17 px. Display font is applied to headings below. */
  font-family: var(--bs-body-font-family);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--ink);
}

/* Plus Jakarta Sans is a display font — reserve it for headings + brand. */
.article-hero h1,
article.post h2,
article.post h3,
article.post h4,
.blog-brand,
.blog-nav-cta,
.post-list__item h2 {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* Sticky-footer layout for the blog: body fills the viewport, main grows. */
body.blog-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.blog-main { flex: 1 0 auto; }
/* Scope link color to prose — avoid overriding Bootstrap .btn-primary text color
   and any of our own .btn-cta variants that set their own color. */
a:not(.btn):not(.btn-cta):not(.blog-brand):not(.blog-nav-cta) { color: var(--blue); }

.wrap      { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.narrow    { max-width: 760px;  margin: 0 auto; padding: 0 28px; }
.prose-col { max-width: 720px;  margin: 0 auto; padding: 0 28px; }

/* ─── Nav ─── */
.blog-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease;
}
.blog-nav.scrolled { border-bottom-color: var(--line); }
.blog-nav-inner {
  display: flex; align-items: center; justify-content: space-between; height: 72px;
}
.blog-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -.01em; font-size: 19px;
  color: var(--ink); text-decoration: none;
}
.blog-brand:hover { text-decoration: none; color: var(--ink); }
.blog-brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--grad); display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(13,110,253,.55); flex-shrink: 0;
}
.blog-brand-mark svg { width: 18px; height: 18px; display: block; }
.blog-brand b { color: var(--ink); }
.blog-brand i {
  font-style: normal;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.blog-nav-cta {
  background: var(--blue); color: #fff;
  border: 0; border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(13,110,253,.55);
  transition: transform .15s ease, background .2s ease;
  text-decoration: none; display: inline-block;
}
.blog-nav-cta:hover { background: var(--blue-600); transform: translateY(-1px); color: #fff; text-decoration: none; }

/* ─── Article Hero ─── */
.article-hero {
  padding: 88px 0 56px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--line);
}
.article-hero h1 {
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.18; letter-spacing: -.025em; font-weight: 800;
  margin: 18px 0 0; text-wrap: balance; color: var(--ink);
}
.article-hero .lead,
.article-hero p.lead {
  font-size: 19px; color: var(--ink-3);
  margin: 18px 0 0; text-wrap: pretty; line-height: 1.55;
}

/* ─── Article body ─── */
article.post { padding: 64px 0 32px; }

.post__cover {
  max-width: 960px;
  margin: 0 auto 40px;
  padding: 0 28px;
  text-align: center;
}

.post__cover img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.post__cover-credit {
  margin: 10px auto 0;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
.post__cover-credit a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.post__cover-credit a:hover { color: var(--ink); }

article.post h2 {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 800; letter-spacing: -.02em; line-height: 1.2;
  margin: 52px 0 16px; position: relative; padding-left: 18px;
  text-wrap: balance; color: var(--ink);
}
article.post h2::before {
  content: ""; position: absolute;
  left: 0; top: .35em; bottom: .35em;
  width: 4px; background: var(--grad); border-radius: 4px;
}
article.post h3 {
  font-size: 20px; font-weight: 700; letter-spacing: -.01em;
  margin: 32px 0 10px; color: var(--ink);
}
article.post h4 {
  font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  margin: 24px 0 8px; color: var(--ink);
}
article.post p {
  font-size: 17px; line-height: 1.75; color: var(--ink-2);
  margin: 0 0 18px; text-wrap: pretty;
}
article.post p strong, article.post p b { color: var(--ink); font-weight: 700; }
article.post a:not(.btn):not(.btn-cta) { color: var(--blue); font-weight: 500; }
article.post hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
article.post blockquote {
  margin: 28px 0; padding: 4px 0 4px 24px;
  border-left: 4px solid var(--blue);
  font-size: 19px; font-style: italic; color: var(--ink); line-height: 1.6;
}

/* Custom bullets */
article.post ul {
  list-style: none; padding: 0; margin: 0 0 22px;
  display: flex; flex-direction: column; gap: 10px;
}
article.post ul li {
  position: relative; padding-left: 28px;
  font-size: 17px; line-height: 1.7; color: var(--ink-2);
}
article.post ul li::before {
  content: "";
  position: absolute; left: 4px; top: .65em;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 0 4px rgba(13,110,253,.1);
}
article.post ol {
  padding-left: 0; margin: 0 0 22px;
  counter-reset: liste;
  display: flex; flex-direction: column; gap: 10px;
}
article.post ol li {
  counter-increment: liste;
  position: relative; padding-left: 36px;
  font-size: 17px; line-height: 1.7; color: var(--ink-2);
  list-style: none;
}
article.post ol li::before {
  content: counter(liste);
  position: absolute; left: 0; top: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}

/* ─── Callout / Tip ─── */
.callout {
  background: var(--blue-50); border-left: 4px solid var(--blue);
  border-radius: 12px; padding: 20px 22px 20px 60px;
  position: relative; margin: 32px 0;
}
.callout .ico {
  position: absolute; left: 18px; top: 18px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: grid; place-items: center; font-size: 14px;
}
.callout .ico svg { width: 14px; height: 14px; }
.callout h4 {
  margin: 0 0 4px; font-size: 13px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; color: var(--blue);
}
.callout p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); }
.callout p + p { margin-top: 10px; }
.callout.green { background: #e9f6ee; border-left-color: var(--green); }
.callout.green .ico { background: var(--green); }
.callout.green h4 { color: var(--green); }

/* ─── Inline CTA (gradient) ─── */
.inline-cta {
  margin: 48px auto; max-width: 920px;
  background: var(--grad); color: #fff;
  border-radius: 22px; padding: 44px 48px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px; flex-wrap: wrap;
}
.inline-cta::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(700px 320px at 80% -10%, rgba(255,255,255,.22), transparent 60%);
}
.inline-cta .copy { flex: 1; min-width: 240px; position: relative; }
.inline-cta h3 {
  margin: 0 0 8px; font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 800; letter-spacing: -.015em; line-height: 1.15; text-wrap: balance;
}
.inline-cta p { margin: 0; font-size: 15px; color: rgba(255,255,255,.88); }
.inline-cta .btn-cta {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: var(--blue);
  padding: 14px 22px; border-radius: 14px;
  font-weight: 700; font-size: 15px; border: 0;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.45);
  text-decoration: none; flex-shrink: 0;
  transition: transform .15s ease;
}
.inline-cta .btn-cta:hover { transform: translateY(-2px); color: var(--blue); text-decoration: none; }

/* ─── Data-source credits (under the article, before the CTA) ─── */
.post__sources {
  margin: 48px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
  font-style: italic;
  line-height: 1.55;
}
.post__sources a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-style: normal;
}
.post__sources a:hover { color: var(--ink); }

/* ─── End CTA (white card) ─── */
.end-cta {
  margin: 56px 0 0;
  background: linear-gradient(180deg, #fff 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 40px 36px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.end-cta h3 {
  margin: 0 0 10px; font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 800; letter-spacing: -.015em; color: var(--ink);
  text-wrap: balance;
}
.end-cta p  { margin: 0 0 24px; color: var(--ink-3); font-size: 16px; line-height: 1.55; text-wrap: pretty; }

.end-cta__actions {
  display: flex; justify-content: center; align-items: center;
  gap: 14px; flex-wrap: wrap;
}

.end-cta .btn-cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 14px;
  font-weight: 700; font-size: 15px; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.end-cta .btn-cta--primary {
  background: var(--blue); color: #fff;
  box-shadow: 0 14px 30px -12px rgba(13,110,253,.55);
}
.end-cta .btn-cta--primary:hover {
  background: var(--blue-600); transform: translateY(-2px);
  color: #fff; text-decoration: none;
}
.end-cta .btn-cta--ghost {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--line);
}
.end-cta .btn-cta--ghost:hover {
  border-color: var(--blue); color: var(--blue);
  background: #fff; transform: translateY(-2px); text-decoration: none;
}

@media (max-width: 540px) {
  .end-cta__actions { flex-direction: column; align-items: stretch; }
  .end-cta .btn-cta { justify-content: center; }
}

/* ─── Footer ─── */
.blog-footer {
  background: #fafbfc; border-top: 1px solid var(--line);
  padding: 56px 0 36px; margin-top: 64px;
  font-size: 14px; color: var(--ink-3);
}
.blog-footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px;
}
@media (max-width: 700px) { .blog-footer-grid { grid-template-columns: 1fr 1fr; } }
.blog-footer h6 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-2); margin: 0 0 16px;
}
.blog-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.blog-footer a { color: var(--ink-3); text-decoration: none; }
.blog-footer a:hover { color: var(--ink); }
.blog-foot-bottom {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 13px;
}
.blog-foot-tagline { margin: 14px 0 0; max-width: 280px; line-height: 1.6; }

/* ─── Reveal on scroll ─── */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ─── Table escape — let wide tables break out of the narrow prose column ─── */
@media (min-width: 768px) {
  .prose-col .table-container {
    width: min(90vw, 1000px);
    margin-left: 50%;
    transform: translateX(-50%);
  }
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .article-hero { padding: 56px 0 40px; }
  article.post  { padding: 40px 0 24px; }
  .inline-cta   { padding: 32px 24px; }
  .narrow, .prose-col { padding: 0 20px; }
}
