/* progress_model.css — Progress around the unified body model
 * (docs/round-12/PROGRESS-MODEL-DESIGN.md; js/progress_model.js). Prefix pm-.
 *
 * Built on base.css's Lumen x Calibre tokens: the hero is the face's one
 * glass (blurred) card; everything else is a surface with the rim and a
 * hairline. The person's accent paints only their own estimates; water
 * layers, prints and comparisons are greys; fat and lean are the fixed
 * tissue colours. Nothing here is red: nothing on this tab is a limit passed.
 * No text under 13 px (--t-cap-size is the floor). */

/* The water layers: three steps of ink over the chart's ground. Greys, never
 * an accent and never a hue: they are categories (base.css palette law).
 * Defined once, on the containers that set their own --chart-ground: a
 * custom property's var() resolves where it is DEFINED, so a :root copy
 * would mix against the page's ground, not the card's. */
.pm-face, .pm-screen, .pm-chapter, .pm-hero, .pm-card, .pm-next-item, .pm-pane, .pm-sect {
  --pm-w-creatine: color-mix(in srgb, var(--ink) 20%, var(--chart-ground));
  --pm-w-slow: color-mix(in srgb, var(--ink) 38%, var(--chart-ground));
  --pm-w-fast: color-mix(in srgb, var(--ink) 58%, var(--chart-ground));
}

.pm-face { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }

/* ------------------------------------------------------------------ type -- */
.pm-label { font: var(--t-label); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.pm-label.is-dim { color: var(--ink-3); white-space: nowrap; }
.pm-unit { font: var(--t-label); letter-spacing: 0; color: var(--ink-2); margin-left: 4px; white-space: nowrap; }
.pm-pm { font: var(--t-label); color: var(--ink-2); letter-spacing: 0; white-space: nowrap; }
.pm-h2 { font: var(--t-head); letter-spacing: -.01em; color: var(--ink); margin: 0; }
.pm-h3 { font: 600 calc(16 * var(--fz))/1.3 var(--font); color: var(--ink); margin: 26px 0 4px; }
.pm-lede { font: var(--t-sub); color: var(--ink-2); max-width: 62ch; margin: 4px 0 0; text-wrap: pretty; }
.pm-lede b, .pm-legend b, .pm-note b { color: var(--ink); font-weight: 560; }
.pm-foot { font: var(--t-cap); color: var(--ink-3); margin: 8px 0 0; max-width: 64ch; text-wrap: pretty; }
.pm-rule { font: var(--t-label); color: var(--ink-3); margin: 8px 0 0; line-height: 1.4; }
.pm-rule-t { white-space: nowrap; }

/* ------------------------------------------------------------------ hero -- */
.pm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 16px 18px 14px;
  margin-top: var(--s-2, 8px);
  border-radius: var(--r-hero);
  --chart-ground: var(--surface);
}
.pm-hero-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; min-height: 24px; }
.pm-hero-kw { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.pm-hero-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 8px; }
.pm-big {
  font: 200 calc(64 * var(--fz-lg))/.92 var(--font);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  min-width: 0;
}
.pm-rate-w { display: flex; align-items: flex-start; gap: 2px; justify-content: flex-end; min-width: 0; }
.pm-rate { display: grid; gap: 4px; justify-items: end; text-align: right; border-radius: var(--r-tile); }
.pm-rate.is-tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pm-rate.is-tappable:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 4px; }
.pm-rate-v { font: 200 calc(40 * var(--fz-lg))/1 var(--font); letter-spacing: -.04em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm-rate-s { font: var(--t-cap); color: var(--ink-2); }
.pm-hero-pm { margin-top: 8px; white-space: normal; }
.pm-ruler { margin: 10px -4px 0; }
.pm-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); margin-top: 10px; }
.pm-cell { padding: 10px 10px 2px; border-left: 1px solid var(--line); min-width: 0; }
.pm-cell:first-child { border-left: 0; padding-left: 0; }
.pm-cell-v { font: 300 calc(24 * var(--fz-lg))/1.1 var(--font); letter-spacing: -.03em; margin-top: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm-cell-v .pm-unit { font-size: var(--t-cap-size); }
.pm-cell-s { font: var(--t-cap); color: var(--ink-2); margin-top: 3px; }
.pm-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-tile);
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}
.pm-strip p { font: var(--t-sub); color: var(--ink-2); margin: 0; }
.pm-strip p b { color: var(--ink); font-weight: 560; }
.pm-tag-prov {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); font: var(--t-label); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--edge); white-space: nowrap;
}
.pm-hero.is-empty { padding: 20px 18px; gap: 8px; }
.pm-empty-v { font: 300 calc(24 * var(--fz-lg))/1.15 var(--font); color: var(--ink-2); margin: 4px 0 0; letter-spacing: -.02em; }
.pm-hero.is-empty .pm-weigh { justify-self: start; margin-top: 8px; }

/* --------------------------------------------------------------- sections -- */
.pm-sect { margin-top: 30px; min-width: 0; }
.pm-sect-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 6px; }
.pm-card {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--lift, var(--rim), inset 0 0 0 1px var(--line));
  --chart-ground: var(--surface);
  min-width: 0;
}
.pm-chart { position: relative; margin-top: 8px; min-width: 0; }
.pm-chart.pm-gap { margin-top: 24px; }
.pm-plot { position: relative; }
.pm-chart svg, .pm-plot svg { display: block; overflow: visible; max-width: 100%; }
.pm-hit { fill: transparent; cursor: crosshair; outline: none; }
.pm-hit:focus-visible { stroke: var(--accent-ink); stroke-width: 2; }
.pm-chart .chart-tip { min-width: 150px; max-width: 220px; white-space: normal; transform: none; }
.pm-tip-h { font-weight: 600; color: var(--ink); }
.pm-tip-k { color: var(--ink-2); }
.pm-seg { flex: none; }
.pm-seg .segmented-btn { white-space: nowrap; text-wrap: nowrap; }
.pm-card > .pm-seg { margin-bottom: 4px; }

.pm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font: var(--t-cap); color: var(--ink-2); }
.pm-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.pm-key { flex: none; display: block; }
.pm-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

.pm-numbers-wrap { margin-top: 4px; }
.pm-numbers-btn {
  font: var(--t-label); color: var(--ink-2); padding: 8px 0; min-height: 36px;
  background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.pm-numbers-btn:hover { color: var(--ink); }
.pm-numbers { max-height: 280px; overflow: auto; }

/* ---------------------------------------------------------------- figures -- */
/* A row of figures shares three tracks (label, readout, line) through
 * subgrid, so the numerals sit on one baseline however a label wraps. */
.pm-figrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-auto-rows: auto; gap: 0 18px; margin-top: 14px; }
.pm-figrow.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.pm-fig { min-width: 0; display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; align-content: start; padding-bottom: 12px; }
.pm-fig > .pm-label { align-self: end; }
.pm-fig-v { font: 200 calc(40 * var(--fz-lg))/1 var(--font); letter-spacing: -.04em; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--ink); align-self: start; }
.pm-fig-v > :first-child { white-space: nowrap; }
.pm-fig-u { display: inline-block; white-space: nowrap; letter-spacing: 0; }
.pm-figrow.is-three .pm-fig-v { font-size: calc(30 * var(--fz-lg)); }
.pm-fig-pm { margin-left: 6px; }
.pm-fig-s { font: var(--t-cap); color: var(--ink-2); margin-top: 4px; }

/* -------------------------------------------------------------- waterfall -- */
.pm-wf { display: grid; grid-template-columns: minmax(0, 1fr); }
.pm-wf-row {
  display: grid;
  grid-template-columns: minmax(96px, 42%) minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}
.pm-wf-l { font: var(--t-sub); color: var(--ink-2); padding: 4px 0; min-width: 0; }
.pm-wf-ls { display: block; font: var(--t-cap); color: var(--ink-3); margin-top: 1px; }
.pm-wf-r { font: 400 var(--t-sub-size)/1 var(--font); text-align: right; white-space: nowrap; color: var(--ink); }
.pm-wf-row.is-total .pm-wf-l, .pm-wf-row.is-total .pm-wf-r { color: var(--ink); font-weight: 560; }
.pm-wf-row.is-zero .pm-wf-l, .pm-wf-row.is-zero .pm-wf-r { color: var(--ink-3); }
.pm-wf-track { position: relative; display: block; height: 22px; }
.pm-wf-bar {
  position: absolute; top: 5px; height: 12px; min-width: 2px; border-radius: 2px;
  transform-origin: left center;
}
.pm-wf-bar.is-neg { transform-origin: right center; }
.pm-wf-bar.is-accent { background: var(--accent-mark); }
.pm-wf-bar.is-grey { background: var(--ink-2); }
.pm-wf-bar.is-hatch {
  background: repeating-linear-gradient(-45deg, var(--ink-2) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 0 1px var(--ink-2);
}
.pm-wf-total { position: absolute; top: 1px; bottom: 1px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.pm-wf-zero { position: absolute; top: 6px; height: 10px; width: 1.5px; margin-left: -.75px; background: var(--ink-3); }
.pm-wf-join { position: absolute; top: 17px; height: 22px; width: 1px; margin-left: -.5px; background: var(--line-strong); }
.pm-wf-row:last-child .pm-wf-join { display: none; }
.pm-wf.is-entering .pm-wf-bar { animation: pm-grow var(--dur-settle) var(--ease-settle) both; }
@keyframes pm-grow { from { transform: scaleX(0); } }

/* ----------------------------------------------------------------- motion -- */
.pm-draw { stroke-dasharray: var(--pm-len); stroke-dashoffset: var(--pm-len); animation: pm-draw var(--dur-draw) var(--ease-settle) forwards; }
@keyframes pm-draw { to { stroke-dashoffset: 0; } }
.pm-settle { animation: pm-settle var(--dur-settle) var(--ease-settle) both; }
@keyframes pm-settle { from { opacity: 0; transform: translateY(6px); } }
.pm-chip, .pm-row { transition: transform var(--dur-move) var(--ease-spring), background var(--dur-tap); }
.pm-chip:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) {
  .pm-draw, .pm-settle, .pm-wf.is-entering .pm-wf-bar { animation: none; stroke-dasharray: none; }
  .pm-chip, .pm-row { transition: none; }
}

/* ---------------------------------------------------------------- tonight -- */
.pm-tonight-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font: var(--t-body); color: var(--ink-2); }
.pm-read-v { font: 300 calc(24 * var(--fz-lg))/1.1 var(--font); letter-spacing: -.03em; color: var(--ink); }
.pm-slider { width: 100%; margin: 6px 0 0; accent-color: var(--accent-mark); height: 32px; }

/* ------------------------------------------------------------ chapter rows -- */
.pm-rows { margin-top: 6px; }
.pm-row .nav-row-sub b { color: var(--ink); font-weight: 560; }
/* A chapter row says its lead figure and one sentence: never clipped, at
 * any width (the shell's two-line clamp would cut it at 195). */
.pm-row .nav-row-sub { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
.pm-glyph { flex: none; display: block; margin-left: 4px; }
.pm-row.is-disabled { cursor: default; }
.pm-row.is-disabled .nav-row-label { color: var(--ink-2); }
.pm-row.is-disabled::before { display: none; }
.pm-tag { flex: none; }

/* ------------------------------------------------------------- the pane -- */
.pm-pane { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; --chart-ground: var(--pane); }
.pm-pane-head {
  position: sticky;
  top: -18px;
  z-index: 3;
  margin: -18px -32px 0;
  padding: 18px 32px 12px;
  background: color-mix(in srgb, var(--pane) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.pm-pane-title { font: var(--t-title); letter-spacing: -.02em; color: var(--ink); margin: 0; }
.pm-pane-sub { font: var(--t-sub); color: var(--ink-2); margin: 4px 0 0; }
.pm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.pm-chip {
  height: 32px; padding: 0 9px; border: 0; border-radius: var(--r-pill);
  font: 500 var(--t-cap-size)/1 var(--font); letter-spacing: 0; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  background: var(--quiet-bg); box-shadow: inset 0 0 0 1px var(--line);
}
.pm-chip:hover { color: var(--ink); }
.pm-chip[aria-pressed="true"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent-mark);
}
.pm-chapter { padding-top: 28px; scroll-margin-top: 130px; min-width: 0; }
.pm-chapter + .pm-chapter { border-top: 1px solid var(--line); margin-top: 34px; }
.pm-ch-title { font: 620 calc(26 * var(--fz-lg))/1.15 var(--font); letter-spacing: -.02em; color: var(--ink); margin: 0; }
.pm-chapter .pm-card { --chart-ground: var(--surface); }
.pm-chapter > .nav-list { margin-top: 18px; }

/* ------------------------------------------------------- lists and tables -- */
.pm-dq { margin-top: 10px; border-top: 1px solid var(--line); }
.pm-card .pm-dq { margin-top: 12px; }
.pm-dq-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.pm-dq-t { font: 500 var(--t-body-size)/1.3 var(--font); color: var(--ink); min-width: 0; }
.pm-dq-v { font: 400 var(--t-body-size)/1.2 var(--font); text-align: right; white-space: nowrap; color: var(--ink); }
.pm-dq-d { font: var(--t-cap); color: var(--ink-2); grid-column: 1 / -1; }
.pm-meter { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.pm-meter i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; }
.pm-note { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font: var(--t-sub); color: var(--ink-2); }
.pm-note > span:last-child { flex: 1 1 220px; min-width: 0; }
.pm-next { display: grid; gap: 10px; margin-top: 10px; }
.pm-next-item { padding: 12px 14px; border-radius: var(--r-tile); background: var(--surface); box-shadow: var(--lift, inset 0 0 0 1px var(--line)); --chart-ground: var(--surface); }
.pm-next-t { font: 560 calc(16 * var(--fz))/1.3 var(--font); color: var(--ink); }
.pm-next-d { font: var(--t-sub); color: var(--ink-2); margin-top: 2px; }
.pm-steps { margin: 14px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: pm-step; }
.pm-steps li { list-style: none; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; font: var(--t-sub); color: var(--ink-2); }
.pm-steps li::before {
  counter-increment: pm-step; content: counter(pm-step);
  font: var(--t-label); color: var(--ink-2);
  display: grid; place-items: center;
  border-radius: 50%; box-shadow: inset 0 0 0 1px var(--edge); height: 24px;
}
.pm-ztable { width: 100%; border-collapse: collapse; margin-top: 14px; font: var(--t-sub); }
.pm-ztable th { font: var(--t-label); color: var(--ink-2); text-align: left; padding: 0 6px 6px 0; border-bottom: 1px solid var(--line); }
.pm-ztable td { padding: 9px 6px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.pm-ztable th.pm-z-p, .pm-ztable td.pm-z-p, .pm-ztable td.pm-z-p.is-outline { text-align: right; width: 30%; padding-left: 10px; padding-right: 0; }
.pm-ztable td.pm-z-p { color: var(--ink); font-variant-numeric: tabular-nums; }
/* The chance as a bar the column's width at 100 %: tall enough to compare
 * 25 % with 45 % at a glance. */
.pm-ztable td.pm-z-p i { display: block; height: 7px; border-radius: 3.5px; margin: 6px 0 0 auto; background: var(--ink-2); }
.pm-ztable td.pm-z-p.is-outline i { background: none; box-shadow: inset 0 0 0 1px var(--ink-2); }
.pm-z-w { display: block; color: var(--ink); font-weight: 560; }
.pm-z-a { display: block; color: var(--ink-2); font-size: var(--t-cap-size); margin-top: 2px; }
/* A graded scan (DEXA n, graded): the zone it fell in carries an ink bar
 * down its edge and a "The scan" mark; its decision is the table's one
 * filled pill, and it wraps rather than clip at any width. */
.pm-ztable tr.is-hit td { color: var(--ink); border-bottom-color: var(--line-strong); }
.pm-ztable tr.is-hit td:first-child { box-shadow: inset 2px 0 0 var(--ink); padding-left: 10px; }
.pm-z-hit {
  display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: var(--r-pill);
  font: var(--t-label); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); white-space: nowrap;
}
.pm-decision {
  display: inline-block; max-width: 100%; margin-top: 6px; padding: 4px 10px; border-radius: var(--r-pill);
  font: var(--t-label); color: var(--ink); white-space: normal; overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent-mark);
}

/* ----------------------------------------------------------- the pane wide -- */
@container (min-width: 560px) {
  .pm-chapter .pm-figrow.is-three .pm-fig-v { font-size: calc(36 * var(--fz-lg)); }
}

/* ------------------------------------------------ narrow (a phone under 360,
 * down to 195): container widths, the column's content box (16 px gutters). */
@container (max-width: 327px) {
  .pm-big { font-size: calc(48 * var(--fz-lg)); }
  .pm-rate-v { font-size: calc(32 * var(--fz-lg)); }
  .pm-cells { grid-template-columns: minmax(0, 1fr); }
  .pm-cell { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .pm-cell:first-child { border-top: 0; }
  .pm-wf-row { grid-template-columns: minmax(0, 1fr) 46px; }
  .pm-wf-track { grid-column: 1 / -1; grid-row: 2; }
  .pm-wf-join { display: none; }
  .pm-figrow.is-three { grid-template-columns: minmax(0, 1fr); }
  .pm-glyph { display: none; }
}
@container (max-width: 208px) {
  .pm-dq-row { grid-template-columns: minmax(0, 1fr); }
  .pm-dq-v { text-align: left; white-space: normal; }
  .pm-sect-head .pm-seg { flex: 1 1 100%; }
  .pm-seg .segmented-btn { white-space: normal; text-wrap: balance; }
  .pm-strip { grid-template-columns: minmax(0, 1fr); }
  .pm-hero .pm-pm { white-space: normal; }
  .pm-hero, .pm-card { padding-left: 12px; padding-right: 12px; }
  .pm-figrow { grid-template-columns: minmax(0, 1fr); }
  .pm-fig-u { white-space: normal; }
  .pm-hero-main { grid-template-columns: minmax(0, 1fr); }
  .pm-rate-w { justify-content: flex-start; }
  .pm-rate { justify-items: start; text-align: left; }
  .pm-big { font-size: calc(40 * var(--fz-lg)); }
  .pm-row .pm-tag { display: none; }
  .pm-ztable thead { display: none; }
  .pm-ztable, .pm-ztable tbody, .pm-ztable tr { display: block; }
  .pm-ztable td { display: block; border: 0; padding: 4px 0 0; }
  .pm-ztable tr { border-bottom: 1px solid var(--line); padding: 6px 0 8px; }
  .pm-ztable td.pm-z-p, .pm-ztable td.pm-z-p.is-outline { display: inline-block; width: 50%; text-align: left; padding: 4px 0 0; }
  .pm-ztable td.pm-z-p::before { content: attr(data-l) " "; color: var(--ink-2); font-size: var(--t-cap-size); }
  .pm-ztable td.pm-z-p i { margin: 4px 0 0; }
  .pm-ztable tr.is-hit { box-shadow: inset 2px 0 0 var(--ink); padding-left: 10px; }
  .pm-ztable tr.is-hit td:first-child { box-shadow: none; padding-left: 0; }
  .pm-z-hit { margin: 4px 0 0; }
}

/* The catching-up card's note: inside the card, one line of words. */
.pm-strip.pm-strip-note { grid-template-columns: minmax(0, 1fr); align-items: center; }
.pm-strip-note p { font: var(--t-sub); color: var(--ink-2); margin: 0; }
