/* ============================================================
   CircumFi — Insights (articles + listing)
   Additive layer that reuses the design tokens in styles.css.
   Loaded only on Eleventy-generated insight pages.
   ============================================================ */

/* Both surfaces sit in the standard 1140px .container (breadcrumb and page
   header span it); on article pages the long-form column below keeps a
   readable ~760px measure so prose lines never stretch to the full width. */
.insight,
.insights-index {
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
.insight-head,
.insight-source,
.insight-body,
.insight-cta,
.insight-back {
  max-width: 760px;
}

/* ---------- Shared eyebrow ---------- */
.insight-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 0.75rem;
}
.insight-eyebrow a { color: inherit; text-decoration: none; }
.insight-eyebrow a:hover { text-decoration: underline; }

/* ---------- Article ---------- */
.insight-title {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
}
.insight-body {
  margin-top: 2rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.7;
}
.insight-body > * + * { margin-top: 1.1rem; }
.insight-body h2 {
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 2.25rem;
}
.insight-body h3 {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 1.75rem;
}
.insight-body ul,
.insight-body ol { padding-left: 1.35rem; }
.insight-body li { margin-top: 0.4rem; }
.insight-body a { color: var(--blue); }
.insight-body code {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}
.insight-body blockquote {
  border-left: 3px solid var(--line);
  padding-left: 1rem;
  color: var(--muted);
}
/* Markdown tables (markdown-it's default table rule; raw HTML stays disabled).
   display:block + overflow-x lets a wide table scroll inside the article
   column instead of stretching the page on narrow screens. Numeric columns
   are right-aligned by the Markdown source (`---:`); tabular-nums keeps the
   digits comparable down a column, matching the data pages. */
.insight-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.insight-body th,
.insight-body td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.insight-body thead th {
  color: var(--ink);
  font-weight: 700;
  border-bottom: 2px solid var(--line);
}
.insight-body tbody tr:last-child td { border-bottom: 0; }
.insight-back {
  margin-top: 3rem;
  font-weight: 600;
}
.insight-back a { color: var(--blue); }

/* ---------- Listing ---------- */
.insights-index-title {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}
.insights-index-intro {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}
.insight-list {
  list-style: none;
  margin: 2.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}
/* Slim blue-left-bevel cards, matching the /resources/ entry treatment:
   the listing sits on a white page, so cards carry the tint (the homepage's
   tinted-card-on-white-band inversion). The anchor keeps filling the card. */
.insight-list-item {
  background: var(--surface-blue);
  border: 1px solid #d4e8f4;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
}
.insight-list-link {
  display: block;
  padding: 1.05rem 1.25rem;
  text-decoration: none;
  color: inherit;
  border-radius: inherit;
}
.insight-list-link:hover .insight-list-title { color: var(--blue); }
.insight-list-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.insight-list-desc {
  display: block;
  margin-top: 0.5rem;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 75ch;
}
.insights-empty {
  margin-top: 2rem;
  color: var(--muted);
}
@media (max-width: 560px) {
  .insight-list-link { padding: 0.9rem 1rem; }
}

/* ---------- Outbound links (link posts; shared treatment) ----------
   .visually-hidden / .outbound-marker — the shared accessible outbound
   treatment (KTD6) — live in styles.css so every page (including
   /ecosystem/, which does not load this file) gets them. */
.insight-source {
  margin-top: 1.5rem;
  font-weight: 600;
}
.insight-source a { color: var(--blue); text-decoration: none; }
.insight-source a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Link posts on the listing: the arrow marker is the primary affordance
   (its hover nudge comes from the shared rules in styles.css); the blurb
   steps back to read as annotation on someone else's work, keeping
   CircumFi-authored articles the visually weightier entries. */
.insight-list-title .outbound-marker { font-size: .7em; }
.insight-list-link.outbound-link .insight-list-desc { color: var(--muted); }
.insight-list-link.outbound-link:hover .insight-list-title { color: var(--blue-dark); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { margin: 0 0 1.25rem; }
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--line);
}
.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"] {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40ch;
}

/* ---------- Article header ---------- */
.insight-head { margin-bottom: 0.5rem; }

/* ---------- Stat tiles (front-matter `stats`) ----------
   Data-backed articles lead with 1-4 build-validated stat tiles directly
   under the header. Same visual language as the SBA data page / homepage
   tiles (white card, blue top bevel, tabular numerals) but scoped to the
   article column so counts other than three lay out cleanly. */
.insight-stats {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  max-width: 760px;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.insight-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-sm);
}
.insight-stat-value {
  display: block;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.insight-stat-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.insight-stat-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.825rem;
  color: var(--muted);
}
@media (max-width: 560px) {
  .insight-stats { grid-template-columns: 1fr; }
}

/* ---------- Trend chart (front-matter `trend`) ----------
   Build-rendered horizontal bar list (KTD3): single-hue blue bars whose
   widths are stamped at build as percentages of the series max, with the
   period label left and the exact value as visible text right — the number
   column, not the color, carries the reading. Same white-card-with-blue-
   top-bevel band language as the stat tiles above it. Bars are 14px (under
   the 24px mark cap), square at the left baseline with a rounded data-end. */
.insight-trend {
  margin: 1.75rem 0 0;
  max-width: 760px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.insight-trend-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.9rem;
}
.insight-trend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.insight-trend-row {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
}
.insight-trend-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.insight-trend-track { min-width: 0; }
.insight-trend-bar {
  display: block;
  height: 14px;
  background: var(--blue);
  border-radius: 0 4px 4px 0;
}
.insight-trend-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.insight-trend-note {
  grid-column: 2 / -1;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}
@media (max-width: 560px) {
  .insight-trend { padding: 1rem; }
  .insight-trend-row { grid-template-columns: 3.9em minmax(0, 1fr) auto; column-gap: 0.55rem; }
}

/* ---------- Data-page link card (front-matter `dataCta`) ----------
   Visually distinct internal link card near the end of the article, ahead of
   the contextual CTA: the blue-left-bevel card treatment the listing uses,
   with the whole card as the (internal) anchor — no outbound marker. */
.insight-data-cta {
  margin-top: 2.5rem;
  max-width: 760px;
  background: var(--surface-blue);
  border: 1px solid #d4e8f4;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
}
.insight-data-cta-link {
  display: block;
  padding: 1.15rem 1.25rem;
  text-decoration: none;
  color: inherit;
  border-radius: inherit;
}
.insight-data-cta-label {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.insight-data-cta-arrow { transition: transform 0.15s ease; display: inline-block; }
.insight-data-cta-link:hover .insight-data-cta-label { color: var(--blue); }
.insight-data-cta-link:hover .insight-data-cta-arrow { transform: translateX(3px); }
.insight-data-cta-blurb {
  display: block;
  margin-top: 0.45rem;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 70ch;
}

/* ---------- Contextual CTA ---------- */
.insight-cta {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--surface-blue);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.insight-cta p { margin: 0 0 1rem; color: var(--ink); font-weight: 600; }

/* ---------- Draft chrome (local preview only) ---------- */
.draft-banner {
  margin: 0;
  padding: 0.75rem var(--gutter);
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  color: #7c4a03;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}
.draft-banner code {
  background: rgba(124, 74, 3, 0.12);
  border-radius: 4px;
  padding: 0.05em 0.3em;
}
.draft-tag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.4rem;
  padding: 0.05em 0.45em;
  background: #f59e0b;
  color: #fff;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 4px;
}
