/* Audit Friendly blog post — Core type ramp, links, tables, contents rail.
 *
 * Paste inside <style> in Blog Template → Page Settings → Inside <head>.
 * Every value comes from docs/prototypes/blog-redesign/BuildSpec.dc.html,
 * which comes from DESIGN_SYSTEM.md. Nothing here is a new token.
 *
 * Everything is scoped to .af-post, a class enhance.js puts on <body> only
 * after it finds the article. If the script does not run, or the markup
 * changes, none of this applies and the page renders exactly as it does
 * today — the override layer fails off, not broken.
 */

.af-post {
  --af-ink: #0F2137;
  --af-body: #2B3D52;
  --af-muted: #48596E;
  --af-green: #0E7C52;
  --af-underline: #9EDDBE;
  --af-band: #F4F7FA;
  --af-rule: #EEF2F7;
  --af-font: Figtree, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* 1 · Type ramp ---------------------------------------------------------- */

.af-post,
.af-post p,
.af-post li {
  font-family: var(--af-font);
}

.af-post .h1-44 {
  font-size: clamp(40px, 4.2vw, 58px);
  font-weight: 800;
  letter-spacing: -0.032em;
  line-height: 1.02;
  max-width: 24ch;
  margin-bottom: 24px;
}

.af-post .blog-post-rich-text-18 {
  font-size: 17.5px;
  line-height: 1.72;
  color: var(--af-body);
  max-width: 72ch;
  margin-bottom: 0; /* was -24px */
}

.af-post .blog-post-rich-text-18 h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.18;
  color: var(--af-ink);
  margin: 54px 0 16px;
  padding-top: 26px;
  border-top: 1px solid var(--af-rule);
}

.af-post .blog-post-rich-text-18 h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.3;
  color: var(--af-ink);
  margin: 38px 0 12px;
}

.af-post .blog-post-rich-text-18 p { margin: 0 0 20px; }
.af-post .blog-post-rich-text-18 li { margin-bottom: 9px; }

/* The standfirst was a serif accent; Core has no serif. */
.af-post .p-22-gascogne {
  font-family: var(--af-font);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: normal;
  color: var(--af-muted);
  max-width: 62ch;
}

/* 2 · Links in body copy ------------------------------------------------- */

.af-post .blog-post-rich-text-18 a {
  color: var(--af-green);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: var(--af-underline);
  transition: color .15s, text-decoration-color .15s;
}
.af-post .blog-post-rich-text-18 a:hover {
  color: var(--af-ink);
  text-decoration-color: var(--af-ink);
}

/* 3 · Tables — horizontal rules only, tabular figures -------------------- */

.af-post .blog-post-rich-text-18 table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
}
.af-post .blog-post-rich-text-18 th,
.af-post .blog-post-rich-text-18 td {
  padding: 12px 14px 12px 0;
  border: 0;
  border-bottom: 1px solid var(--af-rule);
  text-align: left;
  vertical-align: top;
}
.af-post .blog-post-rich-text-18 th {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--af-muted);
  border-bottom: 1px solid var(--af-ink);
  white-space: nowrap;
}
/* enhance.js tags columns that are mostly numeric. */
.af-post .blog-post-rich-text-18 td.af-num,
.af-post .blog-post-rich-text-18 th.af-num { text-align: right; padding-right: 0; }
.af-post .blog-post-rich-text-18 tbody tr:last-child td { border-bottom: 0; }

/* 4 · Contents rail ------------------------------------------------------ */

/* enhance.js builds this wrapper itself rather than relying on Webflow's,
 * so the layout does not depend on the template's container classes. */
.af-post .af-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 56px;
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
}

.af-post .af-toc {
  position: sticky;
  top: 84px;
  font-size: 14px;
  line-height: 1.45;
}
.af-post .af-toc-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--af-muted);
  margin-bottom: 14px;
}
.af-post .af-toc ol { list-style: none; margin: 0; padding: 0; }
.af-post .af-toc li { margin: 0 0 2px; }
.af-post .af-toc a {
  display: block;
  padding: 7px 0 7px 14px;
  border-left: 2px solid var(--af-rule);
  color: var(--af-muted);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.af-post .af-toc a:hover { color: var(--af-ink); }
.af-post .af-toc a.af-on {
  color: var(--af-ink);
  font-weight: 600;
  border-left-color: var(--af-green);
}
.af-post .af-toc .af-sub a { padding-left: 26px; font-size: 13.5px; }

.af-post .af-readtime {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--af-rule);
  font-size: 13px;
  color: var(--af-muted);
}

/* 5 · Reading progress --------------------------------------------------- */

.af-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--af-rule, #EEF2F7);
  z-index: 900;
}
.af-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: #0E7C52;
  transition: width .08s linear;
}

/* 6 · Mobile — rail becomes a pill and a bottom sheet -------------------- */

.af-fab, .af-sheet, .af-scrim { display: none; }

@media (max-width: 900px) {
  .af-post .af-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .af-post .af-toc-rail { display: none; }

  .af-post .af-fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: var(--af-ink);
    color: #fff;
    font-family: var(--af-font);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(15, 33, 55, .28);
    z-index: 901;
    cursor: pointer;
  }

  .af-post .af-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 33, 55, .38);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 902;
  }
  .af-post .af-sheet {
    display: block;
    position: fixed;
    /* The sheet reuses .af-toc for its list styling, which carries the
     * sticky rail's `top: 84px`. Left set, the sheet stretches between top
     * and bottom instead of resting on the bottom edge. */
    top: auto;
    box-sizing: border-box;
    left: 0; right: 0; bottom: 0;
    max-height: 70vh;
    overflow-y: auto;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
    /* Hidden on visibility as well as transform: a percentage translate is
     * only as correct as the measured height, and a sheet that peeks above
     * the fold is worse than one that animates a frame late. Also keeps it
     * out of the accessibility tree while closed. */
    visibility: hidden;
    transition: transform .24s ease, visibility 0s linear .24s;
    z-index: 903;
  }
  .af-post.af-sheet-open .af-scrim { opacity: 1; pointer-events: auto; }
  .af-post.af-sheet-open .af-sheet {
    transform: translateY(0);
    visibility: visible;
    transition: transform .24s ease, visibility 0s;
  }
  .af-post.af-sheet-open { overflow: hidden; }

  .af-post .af-sheet a { min-height: 44px; display: flex; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .af-post *, .af-progress > i { transition: none !important; }
}
