/* ==========================================================================
   divorcd free tools and data pages
   Cost calculator, timeline calculator (js/calculators.js) and the charts on
   the statistics and waiting times pages. Uses the brand tokens from
   css/styles.css and the form controls from Get matched.
   ========================================================================== */

/* ---------- Tool card ---------- */
.tool-embed { margin: 32px 0 40px; }
.tool-embed:not(.tool-ready) { min-height: 120px; }
.tool-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 28px;
  padding: 36px; color: var(--charcoal);
}
.tool-head { margin-bottom: 8px; }
.tool-title { font-size: 1.45rem !important; letter-spacing: -0.02em; margin: 0 0 .35em !important; }
.tool-sub { color: var(--slate); font-size: 15px; margin: 0 0 18px; }

/* ---------- Questions (Get matched controls) ---------- */
.tool-q { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.tool-q legend, .tool-q > label {
  display: block; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--ink); margin: 0 0 10px; padding: 0;
}
.tool-hint { font-size: 14px; color: var(--slate); margin: -4px 0 10px; }
.tool-choices { margin-bottom: 0; gap: 10px; }
.tool-choices .choice span { padding: 13px 16px; font-size: 15.5px; line-height: 1.35; }
.tool-choices .choice span small { font-size: 13.5px; }
.tool-choices .choice input:checked + span { background: var(--sun-tint); border-color: var(--ink); }
.tool-choices .choice input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.tool-q input[type="date"] {
  width: 100%; max-width: 320px; font: 600 16px var(--font); color: var(--charcoal);
  background: var(--white); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  min-height: 50px; transition: border-color .15s ease;
}
.tool-q input[type="date"]:focus { border-color: var(--charcoal); outline: none; }
.tool-q input[aria-invalid="true"] { border-color: #B3261E; }

/* ---------- Result ---------- */
.tool-result { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 26px; }
.tool-summary {
  background: var(--ink); color: var(--cream); border-radius: 20px; padding: 20px 22px;
  font-size: 1.05rem; line-height: 1.55; margin: 0 0 22px;
}
.tool-summary strong { color: var(--gold) !important; font-weight: 800; }
.tool-embed:not(.has-result) .tool-summary { background: var(--cream); color: var(--slate); font-size: 15px; }
.tool-detail h3, .tool-detail h4 { font-size: 1.1rem !important; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: var(--ink); margin: 26px 0 8px !important; }
.tool-detail h3:first-child, .tool-detail h4:first-child { margin-top: 0 !important; }
.tool-table { margin: 6px 0 14px; font-size: 15.5px; }
.tool-table td small { display: block; font-size: 13px; color: var(--slate); font-weight: 500; margin-top: 3px; line-height: 1.45; }
.tool-table td small a { font-weight: 600; }
.tool-table td:last-child { text-align: right; }
.tool-table th:last-child { text-align: right; }
.tool-table .tool-total td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 800; color: var(--ink); }
.tool-compare td:last-child { white-space: normal; max-width: 50%; }
.tool-small { font-size: 14px !important; line-height: 1.6 !important; color: var(--slate); margin: 0 0 12px; }
.tool-note { font-size: 15px !important; line-height: 1.6 !important; background: var(--cream); border-radius: 14px; padding: 14px 16px; margin: 6px 0 14px; }
.tool-list { padding-left: 20px !important; margin: 0 0 14px; font-size: 15.5px; line-height: 1.6; }
.tool-list li { margin-bottom: 6px; }
.tool-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; }
.tool-cta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  background: var(--sun-tint); border-radius: 20px; padding: 20px 22px; margin: 22px 0 12px;
}
.tool-cta p { flex: 1 1 260px; margin: 0; font-size: 15.5px; line-height: 1.55 !important; color: var(--ink); }
.tool-cta .btn { flex: none; }
/* Article links are ember; keep button text ink so it reads on amber */
.guide-body .article .tool-cta .btn, .guide-body .article .article-cta .btn--primary { color: var(--ink); }
.tool-more { font-size: 15px; font-weight: 700; color: var(--gold-deep); }
.tool-disclaimer { font-size: 13px !important; color: var(--slate); margin: 6px 0 0; line-height: 1.5 !important; }

/* Timeline output */
.tool-timeline { list-style: none; padding: 0 !important; margin: 0 0 20px; position: relative; }
.tool-timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tool-timeline li { position: relative; padding: 0 0 20px 32px; margin: 0; }
.tool-timeline li::before {
  content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--stone);
}
.tool-timeline li.is-key::before { background: var(--gold); border-color: var(--gold); }
.tool-timeline .tool-when { font-size: 15px !important; font-weight: 800; color: var(--gold-deep); margin: 0 0 2px; letter-spacing: -0.01em; }
.tool-timeline h3, .tool-timeline h4 { font-size: 1.05rem !important; margin: 0 0 4px !important; }
.tool-timeline p { font-size: 15px !important; line-height: 1.55 !important; color: var(--slate); margin: 0; }
.tool-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 4px 0 8px; }
.tool-figures > div { background: var(--ink); color: var(--cream); border-radius: 20px; padding: 18px 20px; }
.tool-figures b { display: block; font-size: 1.8rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; color: var(--gold); }
.tool-figures span { display: block; font-size: 14px; line-height: 1.45; margin-top: 8px; color: #CFC9C0; }

/* ---------- Data pages: dated table, cite box, bar charts ---------- */
/* Let wide tables scroll inside their wrapper instead of widening the page grid */
.article-wrap > .article, .article-wrap > .toc { min-width: 0; }
.data-table-wrap { overflow-x: auto; margin: 18px 0 8px; -webkit-overflow-scrolling: touch; }
.data-table-wrap .guide-table { margin: 0; min-width: 560px; }
.data-table-wrap .guide-table td:last-child { white-space: normal; font-weight: 500; color: inherit; }
.data-table-wrap .guide-table td.num:last-child { white-space: nowrap; }
.guide-table td.num, .guide-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.guide-table td.num strong { color: var(--ink); }
.guide-table td small { display: block; font-size: 13px; color: var(--slate); margin-top: 3px; line-height: 1.45; }
.guide-table tr.group th { background: var(--cream); color: var(--ink); font-size: 14px; padding: 10px 14px; }
.table-note { font-size: 14px !important; color: var(--slate); line-height: 1.6 !important; }

.cite-box {
  background: color-mix(in srgb, #FFFFFF 60%, var(--page, var(--cream))); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 20px; margin: 28px 0; font-size: 15px;
}
.cite-box p { margin: 0 0 6px; line-height: 1.6 !important; }
.cite-box p:last-child { margin: 0; }
.cite-box code { font-family: var(--font); font-size: 14.5px; background: var(--cream); padding: 2px 6px; border-radius: 6px; color: var(--ink); }

.bar-chart { margin: 24px 0 30px; }
.bar-chart figcaption { font-size: 14px; color: var(--slate); margin-top: 10px; line-height: 1.5; }
.bar-chart h3 { margin-top: 0 !important; }
.bars { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: 92px minmax(0, 1fr) 76px; align-items: center; gap: 12px; margin: 0 !important; font-size: 15px; }
.bars .bar-label { color: var(--slate); font-weight: 600; }
.bars .bar-track { height: 22px; background: var(--cream); border-radius: 0 6px 6px 0; overflow: hidden; }
.bars .bar-fill { display: block; height: 100%; width: var(--w, 0%); background: var(--gold); border-radius: 0 4px 4px 0; }
.bars li.is-latest .bar-fill { background: var(--gold-deep); }
.bars li.is-muted .bar-fill { background: var(--stone); }
.bars .bar-value { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.bars--wide li { grid-template-columns: 150px minmax(0, 1fr) 86px; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .tool-card { padding: 24px 18px; border-radius: 22px; }
  .tool-cols, .tool-figures { grid-template-columns: 1fr; }
  .tool-summary { padding: 16px 18px; font-size: 1rem; }
  .tool-table { font-size: 15px; }
  .tool-table th, .tool-table td { padding: 11px 8px; }
  .tool-table td:last-child { white-space: normal; min-width: 92px; }
  .tool-cta .btn { width: 100%; }
  .bars li, .bars--wide li { grid-template-columns: 70px minmax(0, 1fr) 64px; gap: 8px; font-size: 14px; }
  .bars--wide li { grid-template-columns: 96px minmax(0, 1fr) 64px; }
}
@media (max-width: 380px) {
  .tool-card { padding: 22px 14px; }
  .tool-choices .choice span { padding: 12px 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-choices .choice span { transition: none; }
}
