/*
 * Cost chapter figures (+ the pregnancy-loss mekko). Ported from the live
 * report's component CSS; colours are tokens only.
 *   .ca-*  cost-architecture table        .pv-*  Parvati estimator + select menus
 *   .tl-*  cost-tail S-curve              .sd-*  sublimit-divergence
 *   .lc-*  loss-coverage mekko
 */

/* ---- cost architecture table --------------------------------------------- */
.ca-wrap { width: 100%; overflow-x: auto; }
.ca-table { border-collapse: collapse; width: 100%; font-family: var(--font-mono); font-size: 14px; color: var(--ink); }
.ca-table thead th {
  padding: 0 12px 10px;
  font-size: 13px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase;
  text-align: left; color: var(--muted);
  border-bottom: 1px solid var(--fig-line);
}
.ca-table thead th.ca-num { text-align: right; }
.ca-table tbody { border-bottom: 1px solid var(--fig-line); transition: background-color .22s var(--rv-ease); }
.ca-table tbody.on { background: rgba(var(--ink-rgb), .035); }
.ca-table th, .ca-table td { vertical-align: top; padding: 12px; }
.ca-table tr:not(.first) > th.ca-geo, .ca-table tr:not(.first) > td { border-top: 1px solid rgba(var(--ink-rgb), .07); }
.ca-path { width: 300px; text-align: left; vertical-align: top; font-weight: 400; }
.ca-path-head { display: block; white-space: nowrap; }
.ca-path-name { font-size: 14px; color: var(--ink); }
.ca-path-share { margin-left: 8px; font-size: 12px; letter-spacing: -.02em; color: var(--muted); }
.ca-path-note { display: block; max-width: 36ch; margin-top: 6px; font-size: 13px; font-weight: 300; line-height: 1.45; letter-spacing: -.02em; color: var(--muted); }
.ca-table .ca-geo { width: 118px; text-align: left; font-size: 13px; font-weight: 300; letter-spacing: -.02em; color: var(--muted); }
.ca-table td.ca-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
.ca-foot { margin: 14px 0 0; font-family: var(--font-mono); font-size: 13px; font-weight: 300; line-height: 1.55; letter-spacing: -.02em; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .ca-table tbody { transition: none; } }

@container (width <= 720px) {
  .ca-path { width: 200px; }
  .ca-path-note { display: none; }
  .ca-table th, .ca-table td { padding: 9px 8px; }
}
@container (width <= 640px) {
  .ca-table, .ca-table tbody, .ca-table tr, .ca-table th, .ca-table td { display: block; }
  .ca-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ca-table tbody { padding: 12px 0 10px; }
  .ca-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 8px; padding: 6px 0; }
  .ca-table tr:not(.first) { border-top: 1px solid rgba(var(--ink-rgb), .07); }
  .ca-table tr:not(.first) > th.ca-geo, .ca-table tr:not(.first) > td { border-top: none; }
  .ca-table th.ca-path { grid-column: 1 / -1; width: auto; padding: 0 0 8px; }
  .ca-path-name { font-size: 13px; }
  .ca-table th.ca-geo { grid-column: 1 / -1; width: auto; padding: 0 0 4px; font-size: 12px; }
  .ca-table td.ca-num { min-width: 0; padding: 0; text-align: left; font-size: 13px; }
  .ca-table td.ca-num::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
}
@container (width <= 400px) {
  .ca-table tr { column-gap: 4px; }
  .ca-table td.ca-num { font-size: 12px; letter-spacing: -.03em; }
}

/* ---- Parvati estimator ------------------------------------------------------ */
.pv { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--fig-line); }
.pv-title { margin: 0 0 18px; font-family: var(--font-display); font-size: 22px; font-weight: 550; line-height: 1.2; color: var(--ink); }
.pv-sentence { margin: 0 0 16px; font-family: var(--font-sans); font-size: 17px; line-height: 2; color: var(--ink); }
.pv-field { position: relative; display: inline-flex; align-items: baseline; max-width: 100%; }
.pv-field input {
  appearance: none; -moz-appearance: textfield;
  padding: 1px 2px; font-family: var(--font-mono); font-size: 15px; text-align: center;
  color: var(--cat-emph); background: none;
  border: 0; border-bottom: 1px solid rgba(var(--ink-rgb), .35); border-radius: 0;
  width: 4ch; cursor: text; transition: border-color .14s;
}
.pv-field input::-webkit-inner-spin-button, .pv-field input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pv-field input:hover, .pv-field input:focus { border-bottom-color: var(--cat-emph); outline: none; }
.pv-field .pv-sublimit { width: 7ch; text-align: left; }
.pv-currency { font-family: var(--font-mono); font-size: 15px; color: var(--cat-emph); }
.pv-sentence select.pv-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; }
.pv-sub[hidden] { display: none; }
.pv-profile { margin: 0 0 4px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pv-radar { width: 100%; max-width: 560px; margin: 0 auto; }
.pv-radar svg { display: block; width: 100%; height: auto; overflow: visible; }
.pv-ring { fill: rgba(var(--ink-rgb), .006); stroke: rgba(var(--ink-rgb), .045); stroke-width: .5px; }
.pv-spoke { fill: none; stroke: rgba(var(--ink-rgb), .32); stroke-width: 1.25px; stroke-linecap: round; }
.pv-ring-lbl { font-family: var(--font-mono); font-size: 12px; fill: var(--muted); }
.pv-cov-bound { fill: none; stroke: var(--cat-emph); stroke-opacity: .36; stroke-width: 1px; stroke-dasharray: 2 4; stroke-linejoin: round; }
.pv-cov-mid { fill: var(--cat-emph); fill-opacity: .1; stroke: var(--cat-emph); stroke-width: 1.6px; stroke-dasharray: 5 4; stroke-linejoin: round; }
.pv-total { fill: var(--cat-emph); fill-opacity: .12; stroke: var(--cat-emph); stroke-width: 2.2px; stroke-linejoin: round; transition: fill-opacity .2s; }
.pv-total.insured { fill-opacity: .04; }
.pv-dot { fill: var(--cat-emph); stroke: var(--bg); stroke-width: 1.6px; }
.pv-v-lbl { font-family: var(--font-mono); }
.pv-v-type { font-size: 14px; font-weight: 600; }
.pv-v-total { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; fill: var(--ink); }
.pv-v-oop { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; fill: var(--cat-alarm); }
.pv-legend text { font-family: var(--font-mono); font-size: 13px; fill: rgba(var(--ink-rgb), .72); }
.pv-legend .pv-lg-gap { font-weight: 600; fill: var(--cat-alarm); }
.pv-legend line { stroke: var(--cat-emph); }
.pv-legend .pv-lg-total { stroke-width: 2.2px; }
.pv-legend .pv-lg-cov { stroke-width: 1.6px; stroke-dasharray: 5 4; }
.pv-note { max-width: 60ch; margin: 14px auto 0; font-family: var(--font-mono); font-size: 11.5px; font-weight: 300; line-height: 1.6; text-align: center; color: var(--muted); }
.pv-note strong { font-weight: 500; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .pv-total { transition: none; } }
/* narrow radar (< 480px, set by kit/cost-estimator.js): the SVG scales to
   ~0.65, so its text grows 1.3× (label offsets and legend spacing follow) */
.pv-radar.big { margin-top: 18px; }
.pv-radar.big :is(.pv-ring-lbl, .pv-v-total, .pv-v-oop, .pv-legend) { display: none; }
.pv-radar.big .pv-v-type { font-size: 22px; }
/* the radar's numbers as a table, on a narrow radar only */
.pv-read { display: none; margin: 14px 0 0; }
.pv-radar.big + .pv-read { display: grid; gap: 8px; }
.pv-read div { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; padding-top: 8px; border-top: 1px solid var(--fig-line); }
.pv-read dt { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.pv-read dd { margin: 0; font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.pv-read dd span { display: block; color: var(--cat-alarm); }
.pv-read small { font-size: 11px; color: var(--muted); }

/* custom menus for the sentence's selects (kit/select-menu.js) */
.pv-trigger {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 1px 2px 2px;
  font-family: var(--font-mono); font-size: 15px; line-height: 1.4; color: var(--cat-emph);
  background: none; border: 0; border-bottom: 1px solid rgba(var(--ink-rgb), .35); border-radius: 0;
  cursor: pointer;
}
.pv-trigger:hover, .pv-trigger[aria-expanded="true"] { border-bottom-color: var(--cat-emph); }
.pv-trigger:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; }
.pv-caret { display: inline-block; width: 5px; height: 5px; margin-top: -2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.pv-trigger[aria-expanded="true"] .pv-caret { margin-top: 2px; transform: rotate(225deg); }
.pv-field.wide .pv-trigger { max-width: min(22ch, 70vw); }
.pv-field.wider .pv-trigger { max-width: min(32ch, 78vw); }
.pv-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  min-width: max(100%, 12.5rem); max-height: min(320px, 46vh); overflow: auto;
  margin: 0; padding: 6px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.35;
  color: var(--tooltip-ink); background: var(--tooltip-bg);
  border: 1px solid var(--tooltip-line); border-radius: 10px;
  box-shadow: var(--shadow-pop);
}
.pv-menu[hidden] { display: none; }
.pv-opt {
  display: block; width: 100%; padding: 8px 12px;
  font: inherit; color: inherit; text-align: left; white-space: nowrap;
  background: none; border: 0; border-radius: 6px; cursor: pointer;
}
.pv-opt:hover, .pv-opt:focus-visible { background: rgba(var(--ink-rgb), .08); outline: none; }
.pv-opt[aria-selected="true"] { font-weight: 600; color: var(--cat-emph); }

/* ---- cost-tail S-curve ------------------------------------------------------- */
/* title and view pills share one row, as in the live figure */
.fig-frame:has(.tl-chart) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 18px; padding-top: 8px; }
.fig-frame:has(.tl-chart) > .fig-head { flex: 1 1 auto; width: auto; min-width: 0; }
.fig-frame:has(.tl-chart) > .fig-controls { flex: 0 1 auto; min-width: 0; margin-top: 0; }
.fig-frame:has(.tl-chart) > :is(.fig-plot, .fig-note, .fig-foot, .fig-rule) { flex: 1 0 100%; }
.fig-frame:has(.tl-chart) > .fig-plot { margin-top: 8px; }
.tl-views { gap: 8px; }
.tl-views .pill { padding: 5px 13px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-color: var(--fig-line); }
.tl-views .pill:hover:not([aria-pressed="true"]) { color: var(--ink); border-color: var(--fig-line); }
.tl-views .pill[aria-pressed="true"] { font-weight: 600; color: var(--ink); background: transparent; border-color: var(--cat-emph); }
.tl-views .pill:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

.tl-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin: 0 0 6px; font-family: var(--font-mono); font-size: 11px; color: rgba(var(--ink-rgb), .62); }
.tl-hint { flex: 1 0 100%; margin: 0; font-size: 10.5px; color: var(--muted); }
.tl-col { display: flex; flex: 0 1 auto; min-width: 0; flex-flow: row wrap; align-items: center; gap: 1px 12px; }
.tl-head { margin: 0 8px 0 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tl-head.sp { margin: 0 2px 0 12px; }
.tl-note { color: rgba(var(--ink-rgb), .62); }
.tl-row {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 1px 4px 1px 0;
  font: inherit; color: inherit; text-align: left;
  background: none; border: 0; cursor: pointer; transition: opacity .14s;
}
.tl-row.static { cursor: default; }
.tl-row.on { font-weight: 600; }
.tl-row.dim { opacity: .35; }
.tl-row:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.tl-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.tl-glyph { flex: none; width: 12px; font-size: 11px; text-align: center; }
.tl-swatch { flex: none; width: 26px; height: 2px; }
.chart.tl-chart > svg { width: auto; max-width: 100%; max-height: calc(100vh - 300px); max-height: calc(100dvh - 300px); margin-inline: auto; }
.tl-grid { stroke: rgba(var(--ink-rgb), .1); stroke-width: 1px; }
.tl-grid.vert { stroke: rgba(var(--ink-rgb), .06); }
.tl-grid.zero { stroke: rgba(var(--ink-rgb), .4); stroke-width: 1.4px; }
.tl-tick { font-family: var(--font-mono); font-size: 17.5px; font-weight: 300; letter-spacing: -.02em; fill: var(--muted); }
.tl-tick.tl-zero { font-size: 17.5px; }
/* compact (phones): the chart draws 1:1 in screen pixels, so the text takes its real size */
.tl-compact .tl-tick, .tl-compact .tl-tick.tl-zero { font-size: 11px; font-weight: 400; letter-spacing: 0; }
.tl-curve { fill: none; stroke-width: 1.5px; stroke-opacity: .55; stroke-linecap: round; transition: opacity .24s; }
.tl-curve.dash { stroke-width: 1.35px; stroke-opacity: .5; stroke-dasharray: 5 3.5; }
.tl-curve.off { opacity: 0; pointer-events: none; }
.tl-mark { transition: opacity .22s; }
.tl-shape { transition: scale .14s var(--rv-ease), opacity .22s; }
.tl-mark.off { opacity: 0; pointer-events: none; }
.tl-mark.hot .tl-shape { scale: 2.1; }
.tl-dots.has-hot .tl-mark:not(.hot):not(.off) { opacity: .18; }
@media (prefers-reduced-motion: reduce) { .tl-mark, .tl-shape, .tl-curve { transition: none; } }

/* ---- sublimit divergence ------------------------------------------------------ */
.sd-marker { stroke: rgba(var(--ink-rgb), .35); stroke-width: 1px; stroke-dasharray: 3 4; }
.sd-cross { stroke: rgba(var(--ink-rgb), .25); stroke-width: 1px; pointer-events: none; }
.sd-line { fill: none; stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; }
.sd-area { pointer-events: none; }
.sd-marker-lbl { fill: rgba(var(--ink-rgb), .6); }
.sd-band { transition: fill .15s; }
.sd-band.hot { font-weight: 400; fill: var(--ink); }
.sd-end { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sd-dot { transition: scale .15s, opacity .15s; }
.sd-dot.hot { scale: 1.5; }
@container (width <= 820px) {
  .sd-chart .c-lbl { font-size: 15px; }
  .sd-end { font-size: 16px; }
}
.sd-compact .c-lbl.sd-band { font-size: 11px; }

/* ---- loss coverage mekko ------------------------------------------------------ */
.lc-ghost { fill: var(--cat-ghost); fill-opacity: .1; }
.lc-col { transition: opacity .15s; }
.lc-col.hot .c-val { font-weight: 700; }
.lc-col.hot .c-cat { font-weight: 600; }
.lc-col.hot .lc-ghost { fill-opacity: .16; }
.lc-baseline { stroke: rgba(var(--ink-rgb), .42); stroke-width: 1px; stroke-dasharray: 5 4; }
.lc-leader { stroke: rgba(var(--ink-rgb), .28); stroke-width: 1px; }
.c-lbl.lc-base-lbl { fill: rgba(var(--ink-rgb), .62); }
@container (width <= 820px) { .lc-chart .c-lbl { font-size: 15px; } }
.lc-compact .c-val { font-size: 12px; }
.lc-compact .c-lbl.lc-base-lbl, .lc-compact .c-lbl.lc-small { font-size: 11px; }
