/* ==========================================================
   REWIRED FINANCE | ARTICLE PAGE (editorial column)
   Load AFTER styles.css. Classes are prefixed rfa- so they
   don't clash with the older rf-article-* rules.
   One reading column (720px); only the "More from Field Notes"
   section is wider (1000px).
   Breakpoints: 760px (columns stack), 520px (phones)
   ========================================================== */

:root {
  --rfa-navy: #16214a;
  --rfa-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --rfa-sans: "Poppins", "Trebuchet MS", Arial, sans-serif;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Reading progress bar ---------- */
.rfa-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 50; pointer-events: none; }
.rfa-progress span {
  display: block; height: 100%; background: var(--rf-teal);
  transform: scaleX(0); transform-origin: left;
}

/* ---------- Page grid: text column in the middle, wide blocks span all ---------- */
.rfa { background: #fff; overflow-x: clip; }
.rfa-flow {
  display: grid;
  grid-template-columns: [wide-start] minmax(0, 1fr) [text-start] minmax(0, 720px) [text-end] minmax(0, 1fr) [wide-end];
  width: min(calc(100% - 2 * clamp(20px, 5vw, 48px)), 1000px);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 72px) 0 clamp(48px, 6vw, 96px);
}
.rfa-flow > * { grid-column: text; min-width: 0; }
.rfa-flow > .rfa-more { grid-column: wide; }

/* ---------- Intro ---------- */
.rfa-kicker {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 clamp(16px, 2vw, 26px);
  color: var(--rf-teal-dark);
  font-family: var(--rfa-sans); font-size: 11px; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase;
}
.rfa-kicker__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rf-teal); }
.rfa-kicker__num { margin-right: 2px; color: var(--rfa-navy); }
.rfa-title {
  margin: 0 0 clamp(18px, 2vw, 28px);
  color: var(--rfa-navy);
  font-family: var(--rfa-serif);
  font-size: clamp(38px, 5.4vw, 68px);
  font-weight: 700; letter-spacing: -.02em; line-height: 1.04;
}
.rfa-deck {
  margin: 0 0 clamp(18px, 2vw, 26px);
  color: var(--rf-slate);
  font-family: var(--rfa-serif);
  font-size: clamp(19px, 2vw, 25px); line-height: 1.4;
}
.rfa-meta {
  display: flex; align-items: center; gap: 10px;
  margin: 0;
  padding-bottom: clamp(22px, 2.6vw, 34px);
  border-bottom: 1px solid var(--rf-line);
  color: var(--rf-copy);
  font-family: var(--rfa-sans); font-size: 12px; letter-spacing: .02em;
}

/* ---------- Down arrow (like the Kit email) ---------- */
.rfa-arrow {
  padding: clamp(22px, 3vw, 40px) 0 0;
  color: var(--rfa-navy);
  line-height: 0;
}
.rfa-arrow svg { display: block; width: clamp(22px, 2.4vw, 32px); height: auto; }

/* ---------- Body ---------- */
.rfa-body {
  padding-top: clamp(20px, 2.4vw, 32px);
  color: #2b3a4f;
  font-family: var(--rfa-sans);
  font-size: clamp(15.5px, 1.3vw, 17px);
  line-height: 1.85;
}
.rfa-body + .rfa-body { padding-top: 0; }
.rfa-body p { margin: 0 0 1.25em; }
.rfa-body h2 {
  margin: 1.8em 0 .1em;
  color: var(--rfa-navy);
  font-family: var(--rfa-serif);
  font-size: clamp(16px, 1.45vw, 19px);
  font-weight: 400; letter-spacing: 0; line-height: 1.3;
}
.rfa-body h2 strong { font-weight: 700; }
.rfa-body > h2:first-child { margin-top: .6em; }
.rfa-figure + .rfa-body { padding-top: 0; }
.rfa-figure + .rfa-body h2 { margin-top: 0; }

/* ---------- Tables (same width as the text) ---------- */
.rfa-figure { margin: clamp(18px, 2vw, 28px) 0 clamp(28px, 3vw, 44px); }
.rfa-table-wrap {
  overflow-x: auto;
  border: 1px solid #e3e8ec;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 28px rgb(22 33 74 / 7%);
}
.rfa-table-wrap:focus-visible { outline: 3px solid var(--rf-pink); outline-offset: 3px; }
.rfa-table {
  width: 100%; min-width: 520px;
  border-collapse: collapse;
  font-family: var(--rfa-sans); font-size: 12.5px; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.rfa-table th, .rfa-table td { padding: 9px 10px; text-align: right; }
.rfa-table thead th:first-child, .rfa-table tbody th { text-align: left; }
.rfa-table tbody th { font-weight: 600; color: var(--rfa-navy); white-space: nowrap; }

/* Default: every cell coloured on a scale */
.rfa-table--default thead th { background: #f4f6f7; color: var(--rfa-navy); font-weight: 600; }
.rfa-table--default th, .rfa-table--default td { border: 1px solid rgb(255 255 255 / 85%); }
.rfa-table--default tbody th { background: #fff; border-color: #eef1f3; }
.rfa-table--default td { color: #2b3a4f; }

/* Rewired: quiet table, colour only the exceptions */
.rfa-table--rewired thead th { background: var(--rfa-navy); color: #fff; font-weight: 600; }
.rfa-table--rewired tbody tr { border-bottom: 1px solid #eef1f3; }
.rfa-table--rewired td { color: #a3adb9; }
.rfa-table--rewired td.is-up,
.rfa-table--rewired td.is-down { color: #fff; font-weight: 600; }
.rfa-table--rewired td.is-up { background: var(--rf-teal); }
.rfa-table--rewired td.is-down { background: var(--rf-pink); }

/* ---------- Pull quote (no box) ---------- */
.rfa-quote {
  margin: clamp(8px, 1vw, 16px) 0 clamp(40px, 5vw, 72px);
  padding: 4px 0 4px clamp(18px, 2.4vw, 28px);
  border-left: 3px solid var(--rf-pink);
}
.rfa-quote p {
  margin: 0;
  color: var(--rfa-navy);
  font-family: var(--rfa-serif);
  font-size: clamp(22px, 2.6vw, 32px);
  font-style: italic; line-height: 1.25; letter-spacing: -.01em;
}

/* ---------- More from Field Notes ---------- */
.rfa-more { margin: 0 0 clamp(40px, 5vw, 72px); }
.rfa-more__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: clamp(18px, 2vw, 28px);
}
.rfa-more__head h2 {
  margin: 0; color: var(--rfa-navy);
  font-family: var(--rfa-serif);
  font-size: clamp(24px, 2.6vw, 34px); font-weight: 700; line-height: 1.2;
}
.rfa-more__head a {
  color: var(--rf-slate-mid); font-family: var(--rfa-sans); font-size: 13px; text-decoration: none;
}
.rfa-more__head a:hover { color: var(--rf-teal-dark); }
.rfa-more__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 3vw, 40px); }
.rfa-more__item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding-top: 16px;
  border-top: 3px solid var(--rf-slate);
  color: inherit; text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}
.rfa-more__item:hover { border-color: var(--rf-teal); transform: translateY(-2px); }
.rfa-more__item--pink:hover { border-color: var(--rf-pink); }
.rfa-more__num {
  color: var(--rf-teal);
  font-family: var(--rfa-serif); font-size: clamp(34px, 3.6vw, 48px);
  font-weight: 700; line-height: 1; letter-spacing: -.02em;
}
.rfa-more__item--pink .rfa-more__num { color: var(--rf-pink); }
.rfa-more__item h3 {
  margin: 0; color: var(--rfa-navy);
  font-family: var(--rfa-serif); font-size: clamp(18px, 1.7vw, 22px); font-weight: 700; line-height: 1.25;
}
.rfa-more__item p {
  margin: 0; color: var(--rf-slate-mid);
  font-family: var(--rfa-sans); font-size: 13px; line-height: 1.6;
}
.rfa-more__meta {
  margin-top: auto; padding-top: 4px;
  color: var(--rf-copy); font-family: var(--rfa-sans); font-size: 12px;
}
.rfa-more__item:hover .rfa-more__meta { color: var(--rf-teal-dark); }

/* ---------- Closing subscribe note (quiet, light, text-column width) ---------- */
.rfa-cta {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 16px 28px;
  padding: 22px 26px;
  border: 1px solid var(--rf-line);
  border-radius: 10px;
  background: #fafbfb;
}
.rfa-cta h2 {
  margin: 0 0 4px; color: var(--rfa-navy);
  font-family: var(--rfa-serif); font-size: clamp(19px, 1.7vw, 22px); font-weight: 700; line-height: 1.25;
}
.rfa-cta p {
  margin: 0; max-width: 40ch; color: var(--rf-slate-mid);
  font-family: var(--rfa-sans); font-size: 13px; line-height: 1.6;
}
.rfa-cta .button--pink {
  flex: 0 0 auto; min-height: 40px; padding: 0 22px;
  font-family: var(--rfa-sans); font-size: 13px; font-weight: 600;
}

/* ---------- Tablet / phone ---------- */
@media (max-width: 760px) {
  .rfa-more__grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .rfa-more__item { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 16px; }
  .rfa-more__num { font-size: 32px; }
  .rfa-more__item h3 { flex: 1 1 60%; }
  .rfa-more__item p, .rfa-more__meta { flex: 1 1 100%; margin-left: calc(32px + 16px); }
  .rfa-cta { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .rfa-meta { flex-wrap: wrap; }
  .rfa-more__item p, .rfa-more__meta { margin-left: 0; }
  .rfa-more__item h3 { flex-basis: 100%; }
  .rfa-more__num { flex: 1 1 100%; }
}
