/* WIN-850 article readability and layout.
   Loaded on single articles only (functions.php), after the theme CSS.
   Brand colours reused from the theme: navy #1f2d69, blue #2e5eb1, yellow #ffd23f. */

.single-articles {
  --a-ink: #1e293b;
  --a-muted: #475569;
  --a-navy: #1f2d69;
  --a-blue: #2e5eb1;
  --a-blue-tint: #eef3fb;
  --a-yellow: #ffd23f;
  --a-rule: #e2e8f0;
}

/* ---------- Reading column ---------- */
.single-articles .article-details-main-content {
  max-width: 720px;
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
}

.single-articles .article-details-main-content section {
  scroll-margin-top: 120px; /* TOC jumps no longer hide the heading under the header */
}

.single-articles .article-details-main-content p,
.single-articles .article-details-main-content li {
  font-size: calc(19px * var(--a-fs, 1));
  line-height: 1.7;
  font-weight: 400 !important; /* all.css forces p { font-weight: 300 !important } site-wide */
  color: var(--a-ink);
  letter-spacing: -0.003em;
}

.single-articles .article-details-main-content p {
  margin: 0;
  padding-bottom: 1.05em;
}

/* Lead paragraph */
.single-articles #arti-details-1 p:first-child {
  font-size: calc(22px * var(--a-fs, 1));
  line-height: 1.6;
  color: var(--a-navy);
}

/* ---------- Headings ---------- */
.single-articles .article-details-main-content h2 {
  font-family: "Plus Jakarta Sans", Arial, Helvetica, sans-serif;
  font-size: calc(34px * var(--a-fs, 1));
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--a-navy);
  margin: 64px 0 14px;
  padding: 22px 0 0;
  position: relative;
  text-wrap: balance;
}
.single-articles .article-details-main-content h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: var(--a-yellow);
}
/* The WIN-74 servicer-help box has its own heading style and no top padding for the accent. */
.single-articles .article-details-main-content .srm-servicer-help h2::before { content: none; }

.single-articles .article-details-main-content h3 {
  font-family: "Plus Jakarta Sans", Arial, Helvetica, sans-serif;
  font-size: calc(23px * var(--a-fs, 1));
  line-height: 1.3;
  color: var(--a-navy);
  margin: 40px 0 10px;
  text-wrap: balance;
}

/* ---------- Inline ---------- */
.single-articles .article-details-main-content strong { font-weight: 650; color: var(--a-navy); }

.single-articles .article-details-main-content p a,
.single-articles .article-details-main-content li a {
  color: var(--a-blue);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(46, 94, 177, .4);
}
.single-articles .article-details-main-content p a:hover { text-decoration-color: currentColor; }

/* ---------- Lists ---------- */
.single-articles .article-details-main-content ul,
.single-articles .article-details-main-content ol {
  margin: 4px 0 1.3em;
  padding: 0 0 .6em !important;
  list-style: none !important;
}
.single-articles .article-details-main-content ul li,
.single-articles .article-details-main-content ol li {
  position: relative;
  list-style: none !important;
  --a-li-pad: 5px; /* the theme's li top padding; markers below add it back */
  padding: var(--a-li-pad) 0 0 30px !important;
  margin: 0 0 .45em;
}
.single-articles .article-details-main-content ul li::before {
  content: "";
  position: absolute;
  left: 6px;
  /* Centred on the first line's lowercase letters: Inter's x-height sits ~.05em below the line centre. */
  top: calc(var(--a-li-pad) + .9em - 4px);         /* fallback for browsers without lh */
  top: calc(var(--a-li-pad) + .5lh + .05em - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--a-blue);
}
.single-articles .article-details-main-content ol { counter-reset: a-ol; }
.single-articles .article-details-main-content ol li { counter-increment: a-ol; }
.single-articles .article-details-main-content ol li::before {
  content: counter(a-ol);
  position: absolute;
  left: 0;
  /* The badge sets its own font, so em/lh would resolve against 13px/22px here:
     li padding + x-height centre of 19px/1.7 text (17.1px) - half the badge. */
  top: calc(var(--a-li-pad) + 17.1px * var(--a-fs, 1) - 11px);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--a-blue-tint);
  color: var(--a-blue);
  font: 700 13px/22px Inter, Arial, sans-serif;
  text-align: center;
}

/* ---------- Key point and formula
   srm_article_tag_callouts() adds these classes to bold-only paragraphs. */
.single-articles .article-details-main-content p.a-key {
  background: #fff;
  border-left: 4px solid var(--a-blue);
  border-radius: 0 10px 10px 0;
  padding: 16px 22px !important; /* theme sets padding-left: 0 !important */
  margin: 6px 0 1.5em;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.single-articles .article-details-main-content p.a-formula {
  background: var(--a-blue-tint);
  border-radius: 10px;
  padding: 14px 20px !important;
  margin: 4px 0 1.5em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------- Images ---------- */
.single-articles .article-details-main-content section img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 12px 0 8px;
}
.single-articles .article-details-main-content p:has(> img) { padding-bottom: 1.6em; }

/* ---------- Byline reading time ---------- */
.single-articles .a-readtime::before { content: "·"; margin: 0 8px; color: #94a3b8; }

/* ---------- Table of contents ----------
   One flush left rail. Links never shift sideways: hover and active only
   change colour, weight and background (the theme's translateX/shadow are off). */
.single-articles .sticky-toc {
  padding: 20px 18px 10px;
  border: 1px solid var(--a-rule);
  border-radius: 14px;
}
.single-articles .sticky-toc .toc-header { flex: none; margin-bottom: 10px; }
.single-articles .sticky-toc .toc-header h3 {
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--a-muted);
  display: block;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--a-rule);
}
.single-articles .sticky-toc .toc-meta {
  display: block;
  margin-top: 4px;
  font: 500 13px/1.4 Inter, Arial, sans-serif;
  letter-spacing: 0;
  text-transform: none;
  color: #64748b;
}
.single-articles .sticky-toc #toc-content {
  position: relative;
  padding: 2px 0 28px;
  scrollbar-width: thin;
}
.single-articles .sticky-toc .toc-link,
.single-articles .sticky-toc .toc-link:hover,
.single-articles .sticky-toc .toc-link.active {
  display: block;
  margin: 0;
  padding: 7px 10px 7px 14px;
  color: var(--a-muted); /* 7.58:1 on white; was #7e8492 (3.8:1) */
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.45;
  border-left: 3px solid var(--a-rule);
  border-radius: 0 6px 6px 0;
  transform: none;
  box-shadow: none;
  transition: background .15s, color .15s, border-color .15s;
}
.single-articles .sticky-toc .toc-link:hover { color: var(--a-navy); background: #f8fafc; }
/* Progress is shown on the rail: light blue read, blue current, grey ahead. */
.single-articles .sticky-toc .toc-link.a-read { border-left-color: #9db7e3; }
.single-articles .sticky-toc .toc-link.active {
  color: var(--a-navy);
  font-weight: 700;
  background: var(--a-blue-tint);
  border-left-color: var(--a-blue);
}
.single-articles .sticky-toc .toc-link.active::before { display: none; }

/* ---------- Reading progress ---------- */
.a-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  z-index: 10000;
  pointer-events: none;
}
.a-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--a-yellow);
}

/* ---------- Desktop layout: one centred 1124px grid (720 text + 64 gap + 340 sidebar) ---------- */
@media (min-width: 902px) {
  .single-articles .article-details .container-2 { max-width: 1124px; margin-inline: auto; }
  .single-articles .article-page-title { max-width: 900px; }
  .single-articles .article-details-flex { justify-content: flex-start; gap: 64px; }
  .single-articles .article-details-sub1 { flex: 0 1 720px; width: auto; min-width: 0; }
  .single-articles .article-details-sub2 {
    width: 340px;
    position: sticky;
    align-self: flex-start;
    top: var(--a-top, 24px); /* js keeps the sidebar clear of the slide-in header */
    transition: top .25s;
  }

  .single-articles .article-details-sub2 .sticky-toc {
    margin: 0 !important; /* theme and announcement-banner.css add 80px; the CTA sits right under the TOC */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* the list scrolls, not the whole card */
    max-height: calc(100vh - var(--a-top, 24px) - var(--a-bottom, 0px) - 212px); /* room for the CTA */
  }
  .single-articles .sticky-toc #toc-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
            mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  }
  .single-articles .article-details-sub2 > .sticky-toc + * { margin-top: 16px !important; }
}

/* ---------- Mobile outline (rendered in single-articles.php) ---------- */
.a-mtoc { display: none; }
@media (max-width: 901px) {
  .single-articles .a-mtoc {
    display: block;
    margin: 4px 0 28px;
    background: #fff;
    border: 1px solid var(--a-rule);
    border-radius: 14px;
    overflow: hidden;
  }
  .a-mtoc summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    font: 700 16px/1.3 "Plus Jakarta Sans", Arial, sans-serif;
    color: var(--a-navy);
  }
  .a-mtoc summary::-webkit-details-marker { display: none; }
  .a-mtoc summary small { font: 500 13px Inter, Arial, sans-serif; color: #64748b; margin-left: 8px; }
  .a-mtoc summary::after {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid var(--a-blue);
    border-bottom: 2.5px solid var(--a-blue);
    transform: translateY(-3px) rotate(45deg);
    transition: transform .2s;
  }
  .a-mtoc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .single-articles .article-details-main-content .a-mtoc ol {
    margin: 0;
    padding: 4px 18px 14px !important;
    border-top: 1px solid var(--a-rule);
    counter-reset: m;
  }
  .single-articles .article-details-main-content .a-mtoc li {
    padding: 0 0 0 30px !important;
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    counter-increment: m;
  }
  .single-articles .article-details-main-content .a-mtoc li::before {
    content: counter(m);
    top: 11px;
    width: 20px;
    height: 20px;
    font: 700 11px/20px Inter, Arial, sans-serif;
  }
  .a-mtoc li a {
    display: block;
    padding: 10px 0;
    color: var(--a-ink) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    border-bottom: 1px solid #f1f5f9;
  }
  .a-mtoc li:last-child a { border-bottom: 0; }

  .single-articles .article-details-main-content p,
  .single-articles .article-details-main-content li { font-size: calc(18px * var(--a-fs, 1)); line-height: 1.65; }
  /* x-height centre of 18px/1.65 text is 15.75px */
  .single-articles .article-details-main-content ol li::before { top: calc(var(--a-li-pad) + 15.75px * var(--a-fs, 1) - 11px); }
}

/* ---------- Related articles: compact rows that fit the text column ---------- */
.single-articles .article-headline.on-detial { max-width: 720px; }
.single-articles .article-headline.on-detial h2 {
  text-align: left;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 26px;
  color: var(--a-navy);
  margin: 0 0 16px;
}
.single-articles .a-related {
  display: grid;
  gap: 12px;
  max-width: 720px;
}
.single-articles .a-related-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--a-rule);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.single-articles .a-related-card:hover {
  border-color: #c7d6ef;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .07);
}
.single-articles .a-related-thumb {
  flex: none;
  width: 200px;
  aspect-ratio: 3 / 2;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
}
.single-articles .a-related-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.single-articles .a-related-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.single-articles .a-related-title {
  font: 700 19px/1.3 "Plus Jakarta Sans", Arial, sans-serif;
  color: var(--a-navy);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.single-articles .a-related-card:hover .a-related-title { color: var(--a-blue); }
.single-articles .a-related-summary {
  font: 400 15px/1.5 Inter, Arial, sans-serif;
  color: var(--a-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.single-articles .a-related-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  font: 500 14px/1.4 Inter, Arial, sans-serif;
  color: #64748b;
}
.single-articles .a-related-cta { color: var(--a-blue); font-weight: 600; white-space: nowrap; }

@media (max-width: 600px) {
  .single-articles .a-related-card { gap: 14px; padding: 10px; }
  .single-articles .a-related-thumb { width: 88px; aspect-ratio: 1 / 1; }
  .single-articles .a-related-title { font-size: 16px; -webkit-line-clamp: 3; }
  .single-articles .a-related-summary { display: none; }
  .single-articles .a-related-meta { font-size: 13px; }
  .single-articles .a-related-cta { display: none; }
}

@media (max-width: 767px) {
  .single-articles #arti-details-1 p:first-child { font-size: calc(20px * var(--a-fs, 1)); }
  .single-articles .article-details-main-content h2 {
    font-size: calc(26px * var(--a-fs, 1)); /* was 20px: smaller than the lead paragraph */
    margin: 44px 0 14px;
    padding-top: 18px;
  }
  .single-articles .article-details-main-content h3 { font-size: calc(21px * var(--a-fs, 1)); margin-top: 32px; }
  .single-articles .article-details-main-content p.a-key { padding: 14px 16px !important; }
  .single-articles .article-details-main-content section img { border-radius: 12px; }
}

/* ---------- Reading tools: listen + text size ---------- */
.single-articles .a-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 4px 0 28px;
  padding: 12px 0;
  border-top: 1px solid var(--a-rule);
  border-bottom: 1px solid var(--a-rule);
  font-family: Inter, Arial, Helvetica, sans-serif;
}
.single-articles .a-listen,
.single-articles .a-size { display: flex; align-items: center; gap: 8px; }
.single-articles .a-listen[hidden],
.single-articles .a-tools [hidden] { display: none !important; }
.single-articles .a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;   /* comfortable touch target */
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid #c7d6ef;
  border-radius: 999px;
  background: #fff;
  color: var(--a-navy);
  font: 600 15px/1 Inter, Arial, Helvetica, sans-serif;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.single-articles .a-btn:hover { background: var(--a-blue-tint); border-color: var(--a-blue); }
.single-articles .a-btn:focus-visible,
.single-articles .a-speed select:focus-visible { outline: 3px solid var(--a-yellow); outline-offset: 2px; }
.single-articles .a-btn:disabled { opacity: .45; cursor: default; background: #fff; border-color: var(--a-rule); }
.single-articles .a-btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.single-articles .a-play { background: var(--a-blue); border-color: var(--a-blue); color: #fff; padding: 0 18px 0 14px; }
.single-articles .a-play:hover { background: var(--a-navy); border-color: var(--a-navy); }
.single-articles .a-ico-pause,
.single-articles .a-play[aria-pressed="true"] .a-ico-play { display: none; }
.single-articles .a-play[aria-pressed="true"] .a-ico-pause { display: block; }
.single-articles .a-speed { display: flex; align-items: center; gap: 6px; font: 500 14px Inter, Arial, sans-serif; color: var(--a-muted); }
.single-articles .a-speed select {
  min-height: 44px;
  padding: 0 30px 0 12px;
  border: 1px solid #c7d6ef;
  border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%232e5eb1' stroke-width='1.8' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none;
          appearance: none;
  color: var(--a-navy);
  font: 600 15px Inter, Arial, sans-serif;
  cursor: pointer;
}
.single-articles .a-size-label { font: 500 14px Inter, Arial, sans-serif; color: var(--a-muted); margin-right: 2px; }
.single-articles .a-size-down { font-size: 14px; }
.single-articles .a-size-up { font-size: 19px; }
.single-articles .a-size-down,
.single-articles .a-size-up { gap: 1px; padding: 0 12px; }

/* Floating mini player while listening and the toolbar is off screen */
.a-player {
  position: fixed;
  left: 50%;
  bottom: calc(var(--a-player-bottom, 0px) + 16px);
  transition: bottom .4s ease; /* moves with the footer's "START HERE" bar */
  transform: translateX(-50%);
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--a-rule);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
}
.a-player.is-visible { display: flex; }
.a-player .a-player-label { font: 600 14px Inter, Arial, sans-serif; color: var(--a-navy); padding: 0 6px 0 4px; white-space: nowrap; }

@media (max-width: 600px) {
  .single-articles .a-tools { gap: 10px 12px; }
  .single-articles .a-play-label { font-size: 15px; }
  .single-articles .a-size-label { display: none; }
  .a-player { left: 16px; transform: none; } /* left-aligned and compact, clear of the floating phone button */
  .a-player .a-player-label { display: none; }
}
