/* ==========================================
   Treasurlytics Blog Article Styles
   Targets the shared article structure and
   markdown-generated HTML inside .markdown-body
   ========================================== */

:root {
  --ta-bg: #f6f8fb;
  --ta-surface: #ffffff;
  --ta-surface-soft: #f9fbfd;
  --ta-border: #d9e1ea;
  --ta-border-strong: #c7d3df;

  --ta-text: #1c2431;
  --ta-text-soft: #627084;
  --ta-heading: #0f1728;

  --ta-navy: #16233b;
  --ta-blue: #2b63d9;
  --ta-blue-2: #1f56c8;
  --ta-gold: #b89246;
  --ta-green: #157347;

  --ta-code-bg: #111827;
  --ta-inline-code-bg: #eef3f8;

  --ta-shadow-sm: 0 10px 24px rgba(15, 23, 40, 0.06);
  --ta-shadow-md: 0 18px 42px rgba(15, 23, 40, 0.10);

  --ta-radius-sm: 12px;
  --ta-radius-md: 18px;
  --ta-radius-lg: 24px;

  --ta-content-width: 820px;
}

/* Main article width refinement */
.row.justify-content-center > .col-lg-9.col-xl-8 {
  max-width: var(--ta-content-width);
}

/* Article shell */
.row.justify-content-center article.py-4 {
  position: relative;
}

/* Back link */
.row.justify-content-center article.py-4 > a.text-decoration-none.d-inline-block.mb-4 {
  color: var(--ta-blue);
  font-weight: 600;
  font-size: 0.96rem;
  padding: 0.15rem 0;
  transition: color 0.18s ease, transform 0.18s ease;
}

.row.justify-content-center article.py-4 > a.text-decoration-none.d-inline-block.mb-4:hover {
  color: var(--ta-blue-2);
  transform: translateX(-2px);
}

/* Header */
.row.justify-content-center article header.mb-4 {
  margin-bottom: 1.6rem !important;
}

.row.justify-content-center article header .badge {
  border-radius: 999px;
  padding: 0.5rem 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.row.justify-content-center article header .badge.text-bg-light {
  background: #f7f9fc !important;
  color: #415065 !important;
  border-color: #d7e0ea !important;
}

.row.justify-content-center article header .badge.text-bg-primary {
  background: linear-gradient(135deg, #2b63d9, #0ea5c6) !important;
  border: none !important;
  color: #fff !important;
}

.row.justify-content-center article header .badge.text-bg-dark {
  background: linear-gradient(135deg, #16233b, #223655) !important;
  border: none !important;
  color: #fff !important;
}

.row.justify-content-center article header h1.display-6 {
  color: var(--ta-heading);
  font-size: clamp(2.05rem, 4vw, 3.05rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 1rem !important;
}

.row.justify-content-center article header .lead {
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--ta-text-soft) !important;
  max-width: 54rem;
}

/* Tag pills below header */
.row.justify-content-center article .badge.rounded-pill.text-bg-light.border {
  background: #fbfcfe !important;
  color: #425268 !important;
  border-color: #d8e0ea !important;
  padding: 0.5rem 0.82rem;
  font-weight: 600;
}

/* Main markdown card */
.row.justify-content-center .markdown-body {
  color: var(--ta-text);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(249,251,253,0.98));
  border: 1px solid rgba(217, 225, 234, 0.88);
  border-radius: var(--ta-radius-lg);
  box-shadow: var(--ta-shadow-sm);
}

/* Better internal spacing */
.row.justify-content-center .markdown-body {
  padding-top: 2rem !important;
  padding-bottom: 2.2rem !important;
}

/* Typography */
.markdown-body > *:first-child {
  margin-top: 0 !important;
}

.markdown-body > *:last-child {
  margin-bottom: 0 !important;
}

.markdown-body p,
.markdown-body li {
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--ta-text);
}

.markdown-body p {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

.markdown-body strong {
  color: var(--ta-heading);
  font-weight: 750;
}

.markdown-body em {
  color: #43536a;
}

/* Headings */
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--ta-heading);
  letter-spacing: -0.025em;
}

.markdown-body h2 {
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.2;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 0.15rem;
}

.markdown-body h3 {
  font-size: clamp(1.18rem, 1.5vw, 1.42rem);
  line-height: 1.3;
  margin-top: 1.85rem;
  margin-bottom: 0.7rem;
}

.markdown-body h4 {
  font-size: 1.08rem;
  line-height: 1.35;
  margin-top: 1.4rem;
  margin-bottom: 0.55rem;
  color: #23314b;
}

/* Horizontal rule */
.markdown-body hr {
  border: 0;
  height: 1px;
  margin: 2rem 0 2.1rem;
  background: linear-gradient(
    90deg,
    rgba(184,146,70,0),
    rgba(184,146,70,0.45),
    rgba(43,99,217,0.25),
    rgba(184,146,70,0.45),
    rgba(184,146,70,0)
  );
}

/* Links */
.markdown-body a {
  color: var(--ta-blue);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(43, 99, 217, 0.2);
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.markdown-body a:hover {
  color: var(--ta-blue-2);
  border-bottom-color: rgba(31, 86, 200, 0.5);
}

/* Lists */
.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4rem;
  margin-top: 0.35rem;
  margin-bottom: 1.25rem;
}

.markdown-body li {
  margin-bottom: 0.45rem;
}

.markdown-body li::marker {
  color: #5c6f88;
  font-weight: 700;
}

/* First image presentation */
.markdown-body > p:first-child:has(img) {
  margin-bottom: 1.5rem;
}

.markdown-body img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 1.1rem;
  border: 1px solid rgba(217, 225, 234, 0.9);
  box-shadow: var(--ta-shadow-md);
  background: #fff;
}

/* Blockquote */
.markdown-body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem 1rem 1.2rem;
  border-left: 4px solid var(--ta-gold);
  background: linear-gradient(180deg, #fbfcfe, #f4f8fc);
  color: #4d5c71;
  border-radius: 0 14px 14px 0;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

/* Inline code */
.markdown-body code {
  background: var(--ta-inline-code-bg);
  color: #15365b;
  padding: 0.14rem 0.42rem;
  border-radius: 0.45rem;
  font-size: 0.94em;
  border: 1px solid #dce5ef;
}

/* Pre/code blocks */
.markdown-body pre {
  background: linear-gradient(180deg, #0f172a, #111827);
  color: #eef2ff;
  padding: 1.1rem 1.15rem;
  border-radius: 1rem;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

.markdown-body pre code {
  background: transparent;
  color: inherit;
  border: 0;
  padding: 0;
}

/* Tables */
.markdown-body table {
  width: 100%;
  margin: 1.35rem 0 1.5rem;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--ta-border);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 40, 0.05);
  display: block;
  overflow-x: auto;
}

.markdown-body thead th {
  background: linear-gradient(180deg, #f7f9fc, #eef3f8);
  color: var(--ta-heading);
  font-weight: 700;
  border-bottom: 1px solid var(--ta-border);
  white-space: nowrap;
}

.markdown-body th,
.markdown-body td {
  padding: 0.85rem 0.95rem;
  text-align: left;
  vertical-align: top;
  border-right: 1px solid #e7edf4;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.markdown-body tbody tr:not(:last-child) td {
  border-bottom: 1px solid #ecf1f6;
}

.markdown-body tbody tr:nth-child(even) td {
  background: #fbfdff;
}

/* Make call-to-action lines with arrows feel nicer */
.markdown-body p:has(> a):has(br),
.markdown-body p:has(> a):not(:has(img)) {
  color: #48586d;
}

/* Article disclaimer and nearby sections */
.row.justify-content-center > .text-muted.small.mt-4 {
  font-size: 0.92rem !important;
  color: #67768a !important;
}

/* PDF section polish */
.row.justify-content-center section.card form .form-label {
  color: var(--ta-heading);
  font-weight: 700;
}

.row.justify-content-center section.card form .form-control {
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid var(--ta-border-strong);
}

.row.justify-content-center section.card form .form-control:focus {
  border-color: rgba(43, 99, 217, 0.48);
  box-shadow: 0 0 0 0.22rem rgba(43, 99, 217, 0.11);
}

/* Related articles section */
.row.justify-content-center .blog-image {
  transition: transform 0.28s ease;
}

.row.justify-content-center .card:hover .blog-image {
  transform: scale(1.03);
}

/* Responsive */
@media (max-width: 991.98px) {
  .row.justify-content-center article header h1.display-6 {
    font-size: clamp(1.9rem, 6vw, 2.6rem);
  }
}

@media (max-width: 767.98px) {
  .markdown-body {
    padding: 1.4rem !important;
  }

  .markdown-body p,
  .markdown-body li {
    font-size: 1rem;
    line-height: 1.82;
  }

  .markdown-body h2 {
    margin-top: 2.1rem;
    font-size: 1.45rem;
  }

  .markdown-body h3 {
    font-size: 1.16rem;
  }

  .markdown-body table {
    font-size: 0.95rem;
  }

  .row.justify-content-center article header .lead {
    font-size: 1.03rem;
  }
}