/*!
 * wg-article.css  ·  shared stylesheet for Wealthgoal articles  ·  v1
 *
 * Load once per site, after the site's own app.css:
 *   <link rel="stylesheet" href="/css/wg-article.css?v=1">
 *
 * - Styles ONLY content inside <div class="wg-article wg-v1 …">. Older
 *   resources (no wrapper) are untouched.
 * - Articles carry no CSS: no <style>, no style="". Nothing is stored in
 *   the database; changing this file restyles every article at once.
 * - No fixed widths. The article fills its parent column; layout changes
 *   follow the article's own width (container queries), not the screen.
 * - Every selector starts with .wg-article.wg-v1 so it beats the sites'
 *   .af_resource_wrapper rules (font sizes, 30px margins, bullet reset,
 *   word-break on links, table colours) without touching other pages.
 * - A breaking change goes in new .wg-v2 rules; published v1 articles
 *   keep their look.
 */
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");


.wg-article.wg-v1 {
  --wg-ink: #23262B;
  --wg-muted: #4A5563;
  --wg-link: #5C7EFF;
  --wg-focus: #5B7CF5;
  --wg-brand: #87C8E0;
  --wg-tint: #EEF7FB;
  --wg-tint-2: #F6FAFC;
  --wg-line: #DDE5EA;
  --wg-line-2: #C9D6DE;
  --wg-warn: #8A5300;
  --wg-warn-bg: #FFF6E3;
  --wg-warn-line: #E0A63A;
  --wg-ok: #1D6B45;
  --wg-ok-bg: #E7F5EC;
  --wg-radius: .75rem;
  --wg-pad: clamp(.9rem, 4cqi, 1.35rem);
  --wg-gap: 1.4em;

  container-type: inline-size;
  display: block;
  font-family: "Manrope", system-ui, sans-serif;
  width: 100%;
  max-width: 100%;
  margin: 0;
  color: var(--wg-ink);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}
.wg-article.wg-v1 *,
.wg-article.wg-v1 *::before,
.wg-article.wg-v1 *::after { box-sizing: border-box; }

/* ---- Undo the site's article rules inside the wrapper ---------------- */
.wg-article.wg-v1 p, .wg-article.wg-v1 div, .wg-article.wg-v1 li,
.wg-article.wg-v1 td, .wg-article.wg-v1 th, .wg-article.wg-v1 summary,
.wg-article.wg-v1 label, .wg-article.wg-v1 figcaption,
.wg-article.wg-v1 caption, .wg-article.wg-v1 span {
  font-size: inherit; line-height: inherit; color: inherit; margin: 0;
}
.wg-article.wg-v1 ul li::before { content: none; }
.wg-article.wg-v1 img { max-width: 100%; height: auto; padding: 0; }

/* ---- Text ------------------------------------------------------------- */
.wg-article.wg-v1 p { margin: 0 0 1em; }
.wg-article.wg-v1 strong { font-weight: 700; }
.wg-article.wg-v1 dfn { font-style: normal; font-weight: 700; }

.wg-article.wg-v1 h2 {
  display: block; width: auto;
  margin: 1.9em 0 .6em; padding-top: .9em;
  border-top: 1px solid var(--wg-line);
  font-size: clamp(1.3rem, 1.1rem + 1.2cqi, 1.6rem);
  line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: var(--wg-ink);
  scroll-margin-top: 1rem;
}
.wg-article.wg-v1 h3 {
  display: block; width: auto;
  margin: 1.6em 0 .45em;
  font-size: 1.15rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; color: var(--wg-ink);
}
.wg-article.wg-v1 a {
  color: var(--wg-link);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em;
  word-break: normal; overflow-wrap: anywhere;
}
.wg-article.wg-v1 a:hover { text-decoration-thickness: 2px; }
.wg-article.wg-v1 a:focus-visible,
.wg-article.wg-v1 summary:focus-visible,
.wg-article.wg-v1 .wg-tw:focus-visible,
.wg-article.wg-v1 .wg-radio:focus-visible + .wg-chip {
  outline: 3px solid var(--wg-focus); outline-offset: 2px; border-radius: .35rem;
}

/* Narrow articles (phones, side columns): slightly tighter text rhythm so
   long articles stay scannable. The wrapper is the size container, so the
   rule targets its children. */
@container (max-width: 30rem) {
  .wg-article.wg-v1 > * { font-size: 1rem; line-height: 1.55; --wg-gap: 1.15em; }
  .wg-article.wg-v1 h2 { margin: 1.5em 0 .5em; padding-top: .75em; }
  .wg-article.wg-v1 h3 { margin: 1.3em 0 .4em; }
  .wg-article.wg-v1 li { margin-bottom: .35em; }
}

/* Lists: real bullets in the brand colour */
.wg-article.wg-v1 ul { list-style: disc; margin: 0 0 1em; padding-left: 1.35em; }
.wg-article.wg-v1 ol { list-style: decimal; margin: 0 0 1em; padding-left: 1.5em; }
.wg-article.wg-v1 li { margin: 0 0 .45em; padding: 0 0 0 .15em; }
.wg-article.wg-v1 ul > li::marker { color: var(--wg-brand); font-size: 1.15em; }
.wg-article.wg-v1 ol > li::marker { color: var(--wg-link); font-weight: 700; }
.wg-article.wg-v1 li > ul, .wg-article.wg-v1 li > ol { margin: .4em 0 0; }

/* ---- Opening ---------------------------------------------------------- */
.wg-article.wg-v1 .wg-teaser {
  margin: 0 0 .9em;
  font-size: clamp(1.15rem, 1.05rem + .8cqi, 1.3rem); line-height: 1.5;
  font-weight: 600; letter-spacing: -.005em; color: var(--wg-ink);
}
.wg-article.wg-v1 .wg-badge {
  display: inline-flex; align-items: center; gap: .4em;
  margin: 0 0 1.5em; padding: .3em .85em;
  border-radius: 999px; background: var(--wg-ok-bg); color: var(--wg-ok);
  font-size: .85rem; line-height: 1.4; font-weight: 600;
}
.wg-article.wg-v1 .wg-small { font-size: .9rem; line-height: 1.5; color: var(--wg-muted); }

/* ---- Boxes ------------------------------------------------------------ */
.wg-article.wg-v1 .wg-box,
.wg-article.wg-v1 .wg-warn,
.wg-article.wg-v1 .wg-ex,
.wg-article.wg-v1 .wg-tool {
  margin: 0 0 var(--wg-gap); padding: var(--wg-pad);
  border-radius: var(--wg-radius);
}
.wg-article.wg-v1 .wg-box { background: var(--wg-tint); border-left: 4px solid var(--wg-brand); }
.wg-article.wg-v1 .wg-warn { background: var(--wg-warn-bg); border-left: 4px solid var(--wg-warn-line); }
.wg-article.wg-v1 .wg-warn .wg-box-title { color: var(--wg-warn); }
.wg-article.wg-v1 .wg-warn ul > li::marker { color: var(--wg-warn-line); }
.wg-article.wg-v1 .wg-box-title {
  margin: 0 0 .55em; font-size: .8rem; line-height: 1.3; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--wg-link);
}
.wg-article.wg-v1 .wg-box > :last-child,
.wg-article.wg-v1 .wg-warn > :last-child,
.wg-article.wg-v1 .wg-ex > :last-child,
.wg-article.wg-v1 .wg-d > :last-child,
.wg-article.wg-v1 .wg-panel > :last-child,
.wg-article.wg-v1 .wg-box li:last-child,
.wg-article.wg-v1 .wg-warn li:last-child { margin-bottom: 0; }

/* ---- Situation cards (in-page links) ---------------------------------- */
.wg-article.wg-v1 .wg-router {
  display: grid; grid-template-columns: 1fr; gap: .6rem; margin: 0 0 var(--wg-gap);
}
.wg-article.wg-v1 .wg-router a {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 3.25rem; padding: .8rem 1rem;
  border: 1px solid var(--wg-line-2); border-radius: var(--wg-radius);
  background: #fff; color: var(--wg-ink);
  font-weight: 700; line-height: 1.3; text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.wg-article.wg-v1 .wg-router a::after { content: "\2193"; color: var(--wg-link); font-weight: 700; }
.wg-article.wg-v1 .wg-router a:hover { border-color: var(--wg-focus); background: var(--wg-tint-2); }
@container (min-width: 34rem) {
  .wg-article.wg-v1 .wg-router { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
  .wg-article.wg-v1 .wg-router a { flex-direction: column; align-items: flex-start; justify-content: space-between; }
}

/* ---- Collapsed sections ------------------------------------------------ */
.wg-article.wg-v1 details {
  margin: 0 0 .6rem; border: 1px solid var(--wg-line-2); border-radius: var(--wg-radius); background: #fff;
}
.wg-article.wg-v1 details[open] { border-color: var(--wg-brand); }
.wg-article.wg-v1 summary {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 2.9rem; padding: .7rem 1rem;
  list-style: none; cursor: pointer; font-weight: 700; line-height: 1.35;
}
.wg-article.wg-v1 summary::-webkit-details-marker { display: none; }
.wg-article.wg-v1 summary::after {
  content: ""; flex: none; width: .55em; height: .55em; margin-right: .2em;
  border-right: 2px solid var(--wg-link); border-bottom: 2px solid var(--wg-link);
  transform: rotate(45deg) translateY(-25%); transition: transform .15s;
}
.wg-article.wg-v1 details[open] > summary::after { transform: rotate(-135deg) translateY(-25%); }
.wg-article.wg-v1 summary:hover { color: var(--wg-link); }
.wg-article.wg-v1 .wg-d { padding: .1rem 1rem 1rem; }
.wg-article.wg-v1 .wg-jump { list-style: none; margin: 0; padding: 0; }
.wg-article.wg-v1 .wg-jump li { margin: 0; padding: 0; border-top: 1px solid var(--wg-line); }
.wg-article.wg-v1 .wg-jump li:first-child { border-top: 0; }
.wg-article.wg-v1 .wg-jump a { display: flex; align-items: center; min-height: 2.75rem; padding: .35rem 0; text-decoration: none; }
.wg-article.wg-v1 .wg-jump a:hover { text-decoration: underline; }

/* ---- Illustrative examples -------------------------------------------- */
.wg-article.wg-v1 .wg-ex { background: var(--wg-tint-2); border: 1px solid var(--wg-line); }
.wg-article.wg-v1 details .wg-ex { margin-bottom: 0; }
.wg-article.wg-v1 .wg-tag {
  display: inline-block; margin: 0 0 .5em; padding: .15em .65em;
  border-radius: 999px; background: var(--wg-tint); color: var(--wg-link);
  font-size: .72rem; line-height: 1.5; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.wg-article.wg-v1 .wg-ex-title { margin: 0 0 .5em; font-size: 1.08rem; line-height: 1.35; font-weight: 700; }
.wg-article.wg-v1 .wg-math {
  list-style: none; margin: .3em 0 1em; padding: 0;
  border-radius: .5rem; background: #fff; border: 1px solid var(--wg-line);
}
.wg-article.wg-v1 .wg-math li {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem 1rem;
  margin: 0; padding: .55rem .8rem; border-top: 1px solid var(--wg-line);
  font-variant-numeric: tabular-nums;
}
.wg-article.wg-v1 .wg-math li:first-child { border-top: 0; }
.wg-article.wg-v1 .wg-math li span:last-child { margin-left: auto; font-weight: 700; text-align: right; white-space: nowrap; }
.wg-article.wg-v1 .wg-math li:last-child { background: var(--wg-tint); border-radius: 0 0 .5rem .5rem; }

/* ---- Tables (fluid; scroll inside .wg-tw only if a table cannot fit) --- */
.wg-article.wg-v1 .wg-tw {
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 0 .6em; border: 1px solid var(--wg-line-2); border-radius: var(--wg-radius); background: #fff;
}
.wg-article.wg-v1 .wg-tw table {
  width: 100%; margin: 0; border-collapse: collapse; border-spacing: 0;
  font-size: .95rem; line-height: 1.45; font-variant-numeric: tabular-nums;
}
.wg-article.wg-v1 .wg-tw caption {
  caption-side: top; padding: .75rem .9rem .5rem; text-align: left; font-weight: 700; line-height: 1.35;
}
/* Cells. ":nth-child(n)" (matches every cell) only raises specificity above
   the sites' ".af_resource_wrapper :not(…)>table tr td:first-child" rules. */
.wg-article.wg-v1 .wg-tw table tr > :is(td, th):nth-child(n) {
  padding: .6rem .9rem; text-align: left; vertical-align: top;
  border: 0; border-top: 1px solid var(--wg-line); border-radius: 0;
  background: transparent; color: var(--wg-ink); font-size: inherit; line-height: inherit;
}
/* Column headings. !important only because the sites force a white-on-blue
   first row with !important (white on #87C8E0 fails contrast). */
.wg-article.wg-v1 .wg-tw table thead tr > th:nth-child(n) {
  background-color: var(--wg-tint) !important; color: var(--wg-ink) !important; font-weight: 700 !important;
  border-top: 0; font-size: .85rem; line-height: 1.3; vertical-align: bottom;
}
/* Row headings (first cell of a body row) */
.wg-article.wg-v1 .wg-tw table tbody tr > th:nth-child(n) {
  background-color: transparent !important; color: var(--wg-ink) !important; font-weight: 700 !important;
}
.wg-article.wg-v1 .wg-tw table tbody tr:nth-child(even) > :is(td, th):nth-child(n) { background-color: var(--wg-tint-2) !important; }

/* Narrow article (phones, side columns): each row becomes a card, the
   column heading of every value comes from its data-label (added by the
   build). Real tables stay tables for print and wide columns. */
@container (max-width: 34rem) {
  .wg-article.wg-v1 .wg-tw { overflow: visible; border: 0; border-radius: 0; background: none; }
  .wg-article.wg-v1 .wg-tw table,
  .wg-article.wg-v1 .wg-tw tbody,
  .wg-article.wg-v1 .wg-tw tr { display: block; width: 100%; }
  .wg-article.wg-v1 .wg-tw caption { display: block; padding: 0 0 .6rem; }
  .wg-article.wg-v1 .wg-tw thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .wg-article.wg-v1 .wg-tw tbody tr {
    margin: 0 0 .6rem; overflow: hidden;
    border: 1px solid var(--wg-line-2); border-radius: var(--wg-radius); background: #fff;
  }
  .wg-article.wg-v1 .wg-tw table tbody tr > :is(td, th):nth-child(n) {
    display: block; padding: .5rem .85rem; background-color: transparent !important;
  }
  .wg-article.wg-v1 .wg-tw table tbody tr > th:nth-child(n) {
    border-top: 0; background-color: var(--wg-tint) !important; font-size: 1rem;
  }
  .wg-article.wg-v1 .wg-tw table tbody tr > td[data-label]:nth-child(n) {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .75rem;
  }
  .wg-article.wg-v1 .wg-tw td[data-label]::before {
    content: attr(data-label); color: var(--wg-muted); font-size: .85rem; font-weight: 700; line-height: 1.4;
  }
  .wg-article.wg-v1 .wg-tw table tbody tr > :first-child:nth-child(n) { border-top: 0; }
}

/* ---- Figures / SVG: always the width of the column --------------------- */
.wg-article.wg-v1 figure {
  margin: 0 0 var(--wg-gap); max-width: 100%;
  padding: clamp(.9rem, 4cqi, 1.75rem) clamp(.75rem, 4cqi, 2rem);
  border: 1px solid var(--wg-line); border-radius: var(--wg-radius); background: #FAFCFD;
}
.wg-article.wg-v1 figure svg,
.wg-article.wg-v1 svg {
  display: block; width: 100%; height: auto; max-height: min(65vh, 34em); margin: 0 auto; overflow: visible;
}
.wg-article.wg-v1 figcaption { margin: .6em 0 0; font-size: .875rem; line-height: 1.5; color: var(--wg-muted); text-align: center; }

/* Every table inside an article gets the article look, also tables WITHOUT
   the .wg-tw wrapper (inserted with the editor's table button, or pasted from
   an older draft). Beats the sites' old ".af_resource_wrapper … table" rules
   (blue first row with !important, rounded cells, 2px borders). Tables in
   .wg-tw keep their own (more specific) rules above. */
.wg-article.wg-v1 table {
  width: 100%; margin: 0; border: 0; border-collapse: collapse; border-spacing: 0;
  font-size: .95rem; line-height: 1.45; font-variant-numeric: tabular-nums;
}
.wg-article.wg-v1 table caption {
  caption-side: top; padding: .75rem .9rem .5rem; text-align: left; font-weight: 700; line-height: 1.35;
}
.wg-article.wg-v1 table tr > :is(td, th):nth-child(n) {
  padding: .6rem .9rem; text-align: left; vertical-align: top;
  border: 0; border-top: 1px solid var(--wg-line); border-radius: 0;
  background-color: transparent !important; color: var(--wg-ink) !important;
  font-size: inherit; line-height: inherit; font-weight: 400 !important;
}
.wg-article.wg-v1 table tr > :is(td, th):nth-child(n) p { color: inherit !important; margin: 0; font-size: inherit; line-height: inherit; }
.wg-article.wg-v1 table thead tr > th:nth-child(n) {
  background-color: var(--wg-tint) !important; font-weight: 700 !important;
  border-top: 0; font-size: .85rem; line-height: 1.3; vertical-align: bottom;
}
.wg-article.wg-v1 table tbody tr > th:nth-child(n) { font-weight: 700 !important; }
.wg-article.wg-v1 table tbody tr:nth-child(even) > :is(td, th):nth-child(n) { background-color: var(--wg-tint-2) !important; }
/* the frame for a table that isn't in .wg-tw (the editor wraps tables in figure.table) */
.wg-article.wg-v1 figure.table:not(.wg-tw *) {
  display: flex; flex-direction: column; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; float: none;
  margin: 0 0 var(--wg-gap); padding: 0;
  border: 1px solid var(--wg-line-2); border-radius: var(--wg-radius); background: #fff;
}
.wg-article.wg-v1 :not(.wg-tw):not(figure) > table {
  margin: 0 0 var(--wg-gap); border: 1px solid var(--wg-line-2); border-radius: var(--wg-radius);
  border-collapse: separate; overflow: hidden; background: #fff;
}
.wg-article.wg-v1 :not(.wg-tw):not(figure) > table tr:first-child > :is(td, th):nth-child(n) { border-top: 0; }

/* Tables after the admin editor (CKEditor 5): it wraps every table in
   <figure class="table"> and turns <caption> into a <figcaption> AFTER the
   table. Drop the panel look of figures here (the .wg-tw box is the frame)
   and show the caption on top, styled like the table caption above. */
.wg-article.wg-v1 .wg-tw figure.table {
  display: flex; flex-direction: column; width: 100%; max-width: 100%;
  margin: 0; padding: 0; border: 0; border-radius: 0; background: none; overflow: visible;
}
.wg-article.wg-v1 figure.table > table { order: 2; margin: 0; }
.wg-article.wg-v1 figure.table > figcaption {
  order: 1; margin: 0; padding: .75rem .9rem .5rem; text-align: left;
  font-size: .95rem; font-weight: 700; line-height: 1.35; color: var(--wg-ink);
}
@container (max-width: 34rem) {
  .wg-article.wg-v1 figure.table > figcaption { padding: 0 0 .6rem; }
}

/* ---- CSS-only tool (radio chips) --------------------------------------- */
.wg-article.wg-v1 .wg-tool { position: relative; border: 1px solid var(--wg-brand); background: #fff; }
.wg-article.wg-v1 .wg-radio { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.wg-article.wg-v1 .wg-chip {
  display: inline-flex; align-items: center; min-height: 2.75rem; margin: 0 .4rem .5rem 0; padding: .45rem .95rem;
  border: 1.5px solid var(--wg-line-2); border-radius: 999px; background: #fff;
  font-weight: 700; font-size: .95rem; line-height: 1.25; cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.wg-article.wg-v1 .wg-chip:hover { border-color: var(--wg-focus); }
.wg-article.wg-v1 .wg-radio:checked + .wg-chip { background: var(--wg-link); border-color: var(--wg-link); color: #fff; }
.wg-article.wg-v1 .wg-panels { margin-top: .3rem; }
.wg-article.wg-v1 .wg-panel { display: none; padding: var(--wg-pad); border-radius: .6rem; background: var(--wg-tint); }
.wg-article.wg-v1 .wg-panel.wg-p0 { display: block; padding: 0; background: none; color: var(--wg-muted); font-style: italic; }
.wg-article.wg-v1 .wg-radio:checked ~ .wg-panels .wg-p0 { display: none; }
.wg-article.wg-v1 .wg-r1:checked ~ .wg-panels .wg-p1,
.wg-article.wg-v1 .wg-r2:checked ~ .wg-panels .wg-p2,
.wg-article.wg-v1 .wg-r3:checked ~ .wg-panels .wg-p3,
.wg-article.wg-v1 .wg-r4:checked ~ .wg-panels .wg-p4,
.wg-article.wg-v1 .wg-r5:checked ~ .wg-panels .wg-p5,
.wg-article.wg-v1 .wg-r6:checked ~ .wg-panels .wg-p6 { display: block; }

/* ---- Checklist, related resources, disclaimer -------------------------- */
.wg-article.wg-v1 .wg-check { list-style: none; margin: 0 0 1em; padding: 0; }
.wg-article.wg-v1 .wg-check li { position: relative; margin: 0 0 .6em; padding-left: 2em; }
.wg-article.wg-v1 .wg-check li::before {
  content: ""; display: block; position: absolute; left: 0; top: .2em; width: 1.2em; height: 1.2em;
  margin: 0; font-size: 1rem; line-height: 1; font-weight: 400;
  border: 2px solid var(--wg-brand); border-radius: .3em; background: #fff;
}
.wg-article.wg-v1 .wg-disc {
  margin: 2em 0 0; padding-top: 1em; border-top: 1px solid var(--wg-line);
  font-size: .82rem; line-height: 1.5; color: var(--wg-muted);
}

/* ---- Motion and print -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .wg-article.wg-v1 * { transition: none !important; }
}
@media print {
  .wg-article.wg-v1 .wg-noprint { display: none !important; }
  .wg-article.wg-v1 a { color: #000; text-decoration: none; }
  .wg-article.wg-v1 .wg-box, .wg-article.wg-v1 .wg-ex, .wg-article.wg-v1 .wg-warn,
  .wg-article.wg-v1 .wg-tw thead tr th, .wg-article.wg-v1 .wg-tw tr:first-child > th { background: #fff !important; }
  .wg-article.wg-v1 .wg-tw { overflow: visible; }
  .wg-article.wg-v1 details > :not(summary) { display: block; }
  .wg-article.wg-v1 h2 { break-after: avoid; }
  .wg-article.wg-v1 .wg-ex, .wg-article.wg-v1 .wg-box, .wg-article.wg-v1 .wg-warn, .wg-article.wg-v1 tr { break-inside: avoid; }
}
