/* Tools: shared styles for /tools/ and every tool page under it.
 *
 * Load after styles.css. Site components cover the rest: .eyebrow for step
 * labels, .btn for actions, .glossary-list for definitions, and the global
 * field style for inputs. A tool page is built from:
 *   .tool-page       on <main>; left-aligns card headings
 *   .tool-crumb      "Tools / <name>" link row above the eyebrow
 *   .tool-lede       intro paragraph under the h1
 *   .tool-card       panel for the form, results, and explainers
 *   .tool-row        two-column field grid (one column on phones)
 *   .tool-field      label + input + optional .tool-help
 *   .tool-money      wrap a money input to show a "$" prefix (the picked
 *                    currency's symbol on pages with .tool-currency)
 *   .tool-currency   currency picker above a pure-math tool's form
 *   .tool-percent    wrap a rate input to show a "%" suffix
 *   .tool-modes      pill-style radio group
 *   .tool-hint       live "add X to see your result" message
 *   .tool-results    result panel; set data-tone="caution|good|great"
 *   .tool-band       big italic verdict word, coloured by data-tone
 *   .tool-gauge      three-zone meter with a moving .tool-marker
 *   .tool-stats      row of four .tool-stat figures
 *   .tool-callout    boxed aside inside results
 *   .tool-next       pill links to assessments and guides
 *   .tool-formula    centred formula callout
 *   .tool-funnel     "money is one dimension" card leading to the Wealth Score
 *   .tools-finder    search box + dimension chips on /tools/ (js/tools-finder.js)
 * Tool-specific pieces stay in the page's own <style> block.
 */

/* ---------- Tool page ---------- */
/* Tools toggle panels with the hidden attribute; never let a display rule win. */
.tool-page [hidden] { display: none !important; }

/* .page-content centers its header; tool pages read left like articles. */
.tool-page > header { text-align: left; }
.tool-page > header h1,
.tool-page > header p { margin-left: 0; margin-right: 0; }
/* Section labels are h2s for the outline but look like the site eyebrow. */
.tool-page h2.eyebrow { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 2.6px; line-height: 1.6; }

.tool-page .tool-card .section-heading { text-align: left; margin-top: 0; }
.tool-page .tool-results .section-heading { margin-top: 26px; }

.tool-crumb { font-size: 13px; font-weight: 600; color: var(--ink-subtle); margin: 0 0 8px; }
.page-content .tool-crumb a { color: var(--ink-subtle); }
.page-content .tool-crumb a:hover { color: var(--ink); }

.tool-lede { font-size: 18px; color: var(--ink-soft); max-width: 58ch; margin-bottom: 26px; }

.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  padding: 26px;
  margin-bottom: 26px;
}

/* Form */
.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.tool-help { display: block; font-size: 12px; color: var(--ink-subtle); margin-top: 5px; }
.tool-money { position: relative; display: block; }
.tool-money::before {
  content: var(--tool-currency-symbol, "$"); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-subtle); font-size: 16px; pointer-events: none;
}
.tool-money input[type="text"] { padding-left: var(--tool-currency-pad, 28px); }
.tool-currency { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; margin: 0 0 12px; font-size: 14px; color: var(--ink-subtle); }
.tool-currency[hidden] { display: none; }
.tool-currency label { display: inline; margin: 0; font-weight: 600; color: var(--ink); }
.tool-currency select { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--line, #d7d2c8); border-radius: 8px; background: var(--paper, #fff); color: var(--ink); width: auto; max-width: 100%; }
.tool-currency-note { flex-basis: 100%; text-align: right; font-size: 13px; }
.tool-percent { position: relative; display: block; }
.tool-percent::after {
  content: "%"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-subtle); font-size: 16px; pointer-events: none;
}
.tool-percent input[type="text"] { padding-right: 32px; }
.tool-field input[type="text"] { font-variant-numeric: tabular-nums; }
.tool-modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; border: 0; padding: 0; }
.tool-modes legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.tool-modes input { position: absolute; opacity: 0; pointer-events: none; }
.tool-modes label {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--paper);
  font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.tool-modes input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tool-modes input:focus-visible + label { outline: 2px solid var(--dim); outline-offset: 2px; }
.tool-hint { font-size: 14px; color: var(--ink-subtle); margin: 14px 0 0; min-height: 1.4em; }
.tool-submit { margin-top: 18px; }
.tool-privacy { font-size: 13px; color: var(--ink-subtle); }

/* Results */
.tool-results { --tone: var(--ink); }
.tool-results[data-tone="caution"] { --tone: var(--band-mixed); }
.tool-results[data-tone="good"] { --tone: var(--d-financial); }
.tool-results[data-tone="great"] { --tone: var(--d-security); }
.tool-verdict { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.tool-band { font-family: var(--serif); font-size: clamp(30px, 6vw, 42px); font-style: italic; font-weight: 600; letter-spacing: -0.8px; color: var(--tone); }
.tool-ratio { font-size: 15px; color: var(--ink-soft); }
.tool-ratio strong { font-family: var(--serif); font-size: 22px; color: var(--ink); }
.tool-summary { color: var(--ink-soft); margin: 10px 0 22px; }

/* Three-zone gauge. Set the zone widths with --zones on .tool-gauge
   (default 1fr 3fr 2fr) and move .tool-marker with style.left = "NN%". */
.tool-gauge { --zones: 1fr 3fr 2fr; position: relative; margin: 8px 0 34px; }
.tool-gauge-track { display: grid; grid-template-columns: var(--zones); height: 14px; border-radius: var(--r-pill); overflow: hidden; }
.tool-gauge-track span:nth-child(1) { background: color-mix(in srgb, var(--band-mixed) 30%, var(--paper)); }
.tool-gauge-track span:nth-child(2) { background: color-mix(in srgb, var(--d-financial) 30%, var(--paper)); }
.tool-gauge-track span:nth-child(3) { background: color-mix(in srgb, var(--d-security) 30%, var(--paper)); }
.tool-marker {
  position: absolute; top: -5px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%;
  background: var(--ink); border: 4px solid var(--card); box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: left .35s ease;
}
.tool-gauge-labels { display: grid; grid-template-columns: var(--zones); font-size: 12px; font-weight: 600; color: var(--ink-subtle); margin-top: 8px; }
.tool-gauge-labels span:nth-child(2) { text-align: center; }
.tool-gauge-labels span:nth-child(3) { text-align: right; }

.tool-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.tool-stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.tool-stat span { display: block; font-size: 12px; color: var(--ink-subtle); }
.tool-stat strong { font-family: var(--serif); font-size: 20px; font-variant-numeric: tabular-nums; }
.tool-note { font-size: 14px; color: var(--ink-soft); }
.tool-callout {
  font-size: 14px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; margin: 14px 0 0;
}
.tool-steps { padding-left: 20px; }
.tool-steps li { margin-bottom: 6px; }
.tool-next { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.page-content .tool-next a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none;
}
.page-content .tool-next a:hover { border-color: var(--dim); }

.tool-funnel {
  border-color: color-mix(in srgb, var(--m-accent) 35%, var(--line));
  background: color-mix(in srgb, var(--m-accent) 6%, var(--card));
}
.tool-page .tool-funnel .section-heading { font-size: clamp(22px, 4.6vw, 28px); line-height: 1.25; }
.tool-page .tool-funnel__dims { display: flex; flex-wrap: wrap; gap: 6px 8px; list-style: none; padding: 0; margin: 14px 0 18px; }
.tool-page .tool-funnel__dims li {
  padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--paper); font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.tool-funnel .btn { width: 100%; max-width: 360px; justify-content: center; }
.tool-funnel__more { margin: 14px 0 0; font-size: 14px; color: var(--ink-subtle); }

.tool-formula {
  font-family: var(--serif); font-size: 20px; text-align: center; padding: 16px;
  border: 1px dashed var(--line); border-radius: var(--r-md); margin: 12px 0 16px;
}

@media (max-width: 640px) {
  .tool-card { padding: 20px 16px; }
  .tool-row { grid-template-columns: 1fr; }
  .tool-stats { grid-template-columns: 1fr 1fr; }
  .tool-submit { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-marker { transition: none; }
}

/* ---------- /tools/ landing page ---------- */
/* The landing page is a grid of tiles, not a reading column: it spans the
   masthead frame like the home page and guides library. Tool pages keep
   --measure-read. */
.site-layout__main > .page-content.tools-index {
  max-width: calc(var(--measure-wide) + 2 * var(--page-gutter));
  margin: 0 auto;
}
.tools-promises { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.page-content .tools-promises { margin: 0; }
.tools-promises li {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.tools-promises svg { color: var(--m-accent); flex-shrink: 0; }

/* Finder on /tools/: search box (shares .lib-search with /guides/) and
   dimension chips. js/tools-finder.js filters the tiles and unhides it. */
.tools-finder { margin: 0 0 22px; }
.tools-finder[hidden] { display: none; }
.tools-finder .lib-search { margin: 0 0 14px; }
/* The section heading above already says what this is; keep the label for screen readers. */
.tools-finder .lib-search__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tools-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tools-chip {
  --chip: var(--m-accent);
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.tools-chip[data-dim]:not([data-dim="all"])::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip);
}
.tools-chip:hover { border-color: var(--chip); color: var(--ink); }
.tools-chip:focus-visible { outline: 2px solid var(--chip); outline-offset: 2px; }
.tools-chip[aria-pressed="true"] {
  color: var(--ink); border-color: var(--chip);
  background: color-mix(in srgb, var(--chip) 12%, var(--card));
}
.tools-chip--financial { --chip: var(--d-financial); }
.tools-chip--retirement { --chip: var(--d-retirement); }
.tools-chip--security { --chip: var(--d-security); }
.tools-chip--medical { --chip: var(--d-medical); }
.tools-chip--physical { --chip: var(--d-physical); }
.tools-chip--mental { --chip: var(--d-mental); }
.tools-chip--social { --chip: var(--d-social); }
.tools-chip--time { --chip: var(--d-time); }
.tools-finder__status { margin-top: 12px; }
.tools-grid > .tool-tile[hidden] { display: none; }
.tools-empty { padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--ink-soft); }
.tools-empty[hidden] { display: none; }
.tools-empty p { margin: 0 0 14px; }
@media (max-width: 640px) {
  .tools-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .tools-chips::-webkit-scrollbar { display: none; }
  .tools-chip { flex-shrink: 0; }
}
@media (prefers-reduced-motion: reduce) { .tools-chip { transition: none; } }

.tools-section { margin: 0 0 40px; }
.tools-section > .eyebrow { margin-bottom: 14px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }

.tool-tile {
  --tile: var(--m-accent);
  position: relative; display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  padding: 22px 22px 22px 26px; border-radius: var(--r-lg); background: var(--card);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tile); }
.page-content a.tool-tile { color: var(--ink); }
.page-content a.tool-tile:hover, .page-content a.tool-tile:focus-visible {
  transform: translateY(-2px); box-shadow: var(--card-shadow); border-color: var(--tile); text-decoration: none;
}
.tool-tile-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tool-tile-dim { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--tile); }
.tool-tile-time { font-size: 12px; color: var(--ink-subtle); }
.page-content .tool-tile-title { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin: 2px 0 0; }
.page-content .tool-tile-question { font-style: italic; color: var(--ink-soft); margin: 0; }
.page-content .tool-tile-desc { font-size: 14px; color: var(--ink-soft); margin: 0; flex: 1; }
.tool-tile-cta { margin-top: 10px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tile); }

.tool-tile--featured { padding: 28px 28px 28px 32px; background: color-mix(in srgb, var(--tile) 7%, var(--card)); }
.page-content .tool-tile--featured .tool-tile-title { font-size: clamp(26px, 4vw, 32px); }
@media (min-width: 641px) {
  .tool-tile--featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; column-gap: 40px; row-gap: 6px; align-items: start; }
  .tool-tile--featured > .tool-tile-meta,
  .tool-tile--featured > .tool-tile-title,
  .tool-tile--featured > .tool-tile-question,
  .tool-tile--featured > .tool-tile-cta { grid-column: 1; }
  .tool-tile--featured > .tool-tile-desc { grid-column: 2; grid-row: 1 / span 2; }
  .tool-tile--featured > .tool-peek { grid-column: 2; grid-row: 3 / span 2; align-self: end; margin: 0; }
}

/* "Example result" peek above each tile's CTA: the headline number and
   verdict the tool gives back, plus a small glyph of its chart, with
   made-up numbers. Decorative, so aria-hidden in the markup. */
.tool-peek {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 8px; padding: 12px 14px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--tile) 6%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--tile) 18%, var(--line));
  transition: border-color .15s;
}
.page-content a.tool-tile:hover .tool-peek, .page-content a.tool-tile:focus-visible .tool-peek { border-color: color-mix(in srgb, var(--tile) 50%, var(--line)); }
.tool-peek-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.tool-peek-label { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-subtle); white-space: nowrap; }
.tool-peek-value { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.1; letter-spacing: -0.3px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool-peek-band {
  font-size: 11px; font-weight: 700; color: var(--tile); padding: 2px 8px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--tile) 13%, transparent);
}
.tool-peek-glyph { flex: 0 0 auto; width: 112px; height: auto; overflow: visible; }
.tool-tile--featured .tool-peek-value { font-size: 28px; }
@media (min-width: 641px) { .tool-tile--featured .tool-peek-glyph { width: 150px; } }
@media (prefers-reduced-motion: reduce) { .tool-peek { transition: none; } }
.tool-peek {
  --viz-s1: #2a78d6; --viz-s2: #eb6834; --viz-s3: #1baf7a; --viz-s4: #eda100; --viz-muted: #cfc8be;
}
[data-theme="dark"] .tool-peek { --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70; --viz-s4: #c98500; --viz-muted: #4a433c; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .tool-peek { --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70; --viz-s4: #c98500; --viz-muted: #4a433c; }
}
.tool-peek .pv-z1 { fill: color-mix(in srgb, var(--band-mixed) 30%, var(--paper)); }
.tool-peek .pv-z2 { fill: color-mix(in srgb, var(--d-financial) 30%, var(--paper)); }
.tool-peek .pv-z3 { fill: color-mix(in srgb, var(--d-security) 30%, var(--paper)); }
.tool-peek .pv-marker { fill: var(--ink); stroke: var(--paper); stroke-width: 3; }
.tool-peek .pv-accent { fill: var(--tile); }
.tool-peek .pv-muted { fill: var(--viz-muted); }
.tool-peek .pv-s1 { fill: var(--viz-s1); }
.tool-peek .pv-s2 { fill: var(--viz-s2); }
.tool-peek .pv-s3 { fill: var(--viz-s3); }
.tool-peek .pv-s4 { fill: var(--viz-s4); }
.tool-peek .pv-line { fill: none; stroke: var(--tile); stroke-width: 2.5; stroke-linecap: round; }
.tool-peek .pv-line--s2 { stroke: var(--viz-s2); stroke-dasharray: 5 4; }
.tool-peek .pv-line--muted { stroke: var(--viz-muted); stroke-width: 2.5; }
.tool-peek .pv-area { fill: var(--tile); opacity: .1; }
.tool-peek .pv-dot { fill: var(--tile); stroke: var(--paper); stroke-width: 2; }
.tool-peek .pv-ref { stroke: var(--ink-subtle); stroke-width: 1; stroke-dasharray: 3 3; }
.tool-peek .pv-grid { stroke: var(--line); stroke-width: 1; }

.tool-tile--soon { background: transparent; border-style: dashed; }
.tool-tile--soon::before { opacity: .45; }
.tool-tile-soon-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--ink-subtle);
}

.tools-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.page-content .tools-how h3 { font-family: var(--serif); font-size: 18px; margin: 0 0 6px; }
.page-content .tools-how p { font-size: 14px; color: var(--ink-soft); margin: 0; }
@media (max-width: 640px) { .tools-how { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .tool-tile { transition: none; } }

/* Tile accent per wealth dimension: add tool-tile--<dimension>. */
.tool-tile--financial { --tile: var(--d-financial); }
.tool-tile--retirement { --tile: var(--d-retirement); }
.tool-tile--security { --tile: var(--d-security); }
.tool-tile--medical { --tile: var(--d-medical); }
.tool-tile--physical { --tile: var(--d-physical); }
.tool-tile--mental { --tile: var(--d-mental); }
.tool-tile--social { --tile: var(--d-social); }
.tool-tile--time { --tile: var(--d-time); }

/* ---------- Result charts (tool-charts.js) ----------
   Categorical slots s1–s4 are the validated reference order (blue, orange,
   aqua, yellow): adjacent CVD ΔE ≥ 9.1 light / 8.4 dark, normal-vision
   ΔE ≥ 22.9 / 19.8 on this site's card surfaces; s1–s3 also pass all-pairs.
   Aqua and yellow sit under 3:1 on the light card, so every chart carries
   direct labels and a table view. accent = the page's dimension color for
   the one emphasized mark; muted = context. Text never wears a series color. */
.viz {
  --viz-s1: #2a78d6; --viz-s2: #eb6834; --viz-s3: #1baf7a; --viz-s4: #eda100;
  --viz-muted: #cfc8be;
  --viz-grid: var(--grid-line);
  --viz-axis: var(--line);
  margin: 26px 0 8px;
}
[data-theme="dark"] .viz {
  --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70; --viz-s4: #c98500;
  --viz-muted: #4a433c;
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .viz {
    --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70; --viz-s4: #c98500;
    --viz-muted: #4a433c;
  }
}
.viz-c-s1 { --c: var(--viz-s1); }
.viz-c-s2 { --c: var(--viz-s2); }
.viz-c-s3 { --c: var(--viz-s3); }
.viz-c-s4 { --c: var(--viz-s4); }
.viz-c-accent { --c: var(--dim); }
.viz-c-muted { --c: var(--viz-muted); }

.viz-figure { margin: 0; }
.viz-title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); margin: 0 0 2px; }
.page-content .viz-subtitle { font-size: 13px; color: var(--ink-subtle); margin: 0 0 10px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-key { display: inline-block; flex-shrink: 0; background: var(--c); }
.viz-key--line { width: 14px; height: 2px; border-radius: 1px; }
.viz-key--rect { width: 10px; height: 10px; border-radius: 3px; }

.viz-plot { position: relative; }
.viz-svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-axis { stroke: var(--viz-axis); stroke-width: 1; }
.viz-tick { font-size: 11px; fill: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.viz-axis-title { font-size: 11px; fill: var(--ink-subtle); }
.viz-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-area { fill: var(--c); opacity: .1; stroke: none; }
.viz-dot { fill: var(--c); stroke: var(--card); stroke-width: 2; }
.viz-ref { stroke: var(--ink-subtle); stroke-width: 1; }
.viz-ref-label { font-size: 12px; font-weight: 600; fill: var(--ink-soft); paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.viz-end-value { font-size: 12px; font-weight: 700; fill: var(--ink); }
.viz-end-name { font-size: 11px; fill: var(--ink-subtle); }
.viz-cross { stroke: var(--ink-subtle); stroke-width: 1; pointer-events: none; }
.viz-hit { fill: transparent; cursor: crosshair; }
.viz-hit:focus { outline: none; }
.viz-hit:focus-visible { outline: none; stroke: var(--dim); stroke-width: 2; }

.viz-bar { fill: var(--c); transition: opacity .15s; }
.viz-bar-hit { fill: transparent; }
.viz-bar-row { cursor: default; outline: none; }
.viz-bar-row:hover .viz-bar, .viz-bar-row:focus .viz-bar { opacity: .8; }
.viz-bar-row:focus-visible .viz-bar-hit { stroke: var(--dim); stroke-width: 2; }
.viz-bar-label { font-size: 13px; fill: var(--ink-soft); }
.viz-bar-label--em { font-weight: 700; fill: var(--ink); }
.viz-bar-value { font-size: 13px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.viz-bar-value--em { font-weight: 700; fill: var(--ink); }
.viz-seg-label { font-size: 12px; font-weight: 700; fill: #fff; pointer-events: none; }
.viz-seg-label--ink { fill: #1c1917; }

.viz-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 120px; max-width: 240px;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--card-shadow); font-size: 13px; color: var(--ink-soft);
}
.viz-tip[hidden] { display: none; }
.viz-tip-title { font-size: 12px; color: var(--ink-subtle); margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.viz-tip-row strong { color: var(--ink); font-size: 14px; }
.viz-tip-name { color: var(--ink-subtle); }

.viz-table { margin-top: 10px; font-size: 13px; }
.viz-table summary { cursor: pointer; color: var(--ink-subtle); font-weight: 600; width: max-content; }
.viz-table summary:hover { color: var(--ink); }
.viz-table-wrap { overflow-x: auto; margin-top: 8px; }
.viz-table table { border-collapse: collapse; width: 100%; }
.viz-table caption { text-align: left; font-size: 12px; color: var(--ink-subtle); padding-bottom: 6px; }
.viz-table th, .viz-table td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; color: var(--ink-soft); }
.viz-table thead th { font-weight: 700; color: var(--ink); }
.viz-table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .viz-bar { transition: none; } }
@media print { .viz-table { display: none; } }

.tool-optional { font-weight: 400; color: var(--ink-subtle); }

/* ---------- Tools carousel on /guides/ (scripts/tool-links.js) ----------
   Every live tile from /tools/, trimmed to title, question and example
   result, in a scroll-snapping row. Works without JS; tool-carousel.js adds
   the previous/next buttons. */
/* inline-size containment keeps the long track from widening the page
   (its min-content would otherwise stretch the flex column it sits in). */
.tool-carousel { contain: inline-size; }
.tool-carousel__bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.tool-carousel__count { margin: 0; font-size: 13px; color: var(--ink-soft); }
.tool-carousel__count b { color: var(--ink); }
.tool-carousel__nav { display: flex; gap: 8px; flex-shrink: 0; }
.tool-carousel__nav[hidden] { display: none; }
.tool-carousel__btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  transition: border-color .15s, color .15s, opacity .15s;
}
.tool-carousel__btn:hover:not(:disabled) { border-color: var(--m-accent); color: var(--m-accent); }
.tool-carousel__btn:disabled { opacity: .35; cursor: default; }
.tool-carousel__track {
  list-style: none; margin: 0 -6px; padding: 6px 6px 16px;
  display: grid; grid-auto-flow: column; grid-auto-columns: 268px; gap: 16px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: 6px; scrollbar-width: thin;
}
.tool-carousel__track:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 2px; border-radius: var(--r-lg); }
.tool-carousel__item { display: flex; scroll-snap-align: start; }
.tool-carousel .tool-tile { width: 100%; padding: 18px 18px 18px 22px; gap: 5px; color: var(--ink); }
.tool-carousel .tool-tile:hover, .tool-carousel .tool-tile:focus-visible {
  transform: translateY(-2px); box-shadow: var(--card-shadow); border-color: var(--tile);
}
.tool-carousel .tool-tile:hover .tool-peek, .tool-carousel .tool-tile:focus-visible .tool-peek { border-color: color-mix(in srgb, var(--tile) 50%, var(--line)); }
.tool-carousel .tool-tile-title { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.25; letter-spacing: -0.2px; margin-top: 2px; }
.tool-carousel .tool-tile-question { font-size: 14px; font-style: italic; line-height: 1.45; color: var(--ink-soft); flex: 1; }
.tool-carousel .tool-peek { margin-top: 10px; padding: 10px 12px; gap: 10px; }
.tool-carousel .tool-peek-value { font-size: 19px; }
.tool-carousel .tool-peek-glyph { width: 84px; }
.tool-carousel .tool-tile-cta { margin-top: 8px; }
.tool-carousel__all {
  width: 100%; display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 22px; border-radius: var(--r-lg); text-align: left;
  border: 1px dashed color-mix(in srgb, var(--m-accent) 45%, var(--line));
  background: var(--m-accent-soft); color: var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.tool-carousel__all:hover, .tool-carousel__all:focus-visible { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.tool-carousel__all-num { font-family: var(--serif); font-size: 48px; font-weight: 600; line-height: 1; letter-spacing: -1px; color: var(--m-accent); }
.tool-carousel__all-title { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.25; }
.tool-carousel__all-cta { margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--m-accent); }
@media (max-width: 640px) {
  .tool-carousel__track { grid-auto-columns: 78%; }
  .tool-carousel__count { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-carousel .tool-tile, .tool-carousel__all, .tool-carousel__btn { transition: none; }
  .tool-carousel .tool-tile:hover, .tool-carousel__all:hover { transform: none; }
}
