/**
 * Healthcare practice page, final pass (2026-11-21). Loaded for its class
 * prefix (site/plugins/peanut-site/extensions/stylesheets.php).
 *
 * Its parts: the data strip's cards (blocks/datastrip, layout "cards";
 * public/assets/js/p09s-stats.js; also the nonprofit page's giving
 * figures, with the phone and desktop pair) and the hero's live card
 * practice-new-patient (site/snippets/livecards/), whose older rules stay
 * in ind-p09.css. Layer blocks, then motion. Tokens only.
 */

@layer blocks {
  /* ---------- Data strip, cards: a card per figure (the number, ten
     people filled to match, the sentence), the takeaway as a mint band,
     the source under it. --p on the card (0 to 1) sets the fill; each
     person takes its share of it (--f). ---------- */

  .datastrip.p09s-stats {
    /* a full section: not the strip's trimmed padding */
    margin-block: 0;
  }

  .p09s-stats__defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
  }

  .p09s-stats__cards {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .p09s-stats__card {
    display: grid;
    gap: var(--space-2);
    align-content: start;
    padding: var(--space-3);
    background: var(--color-paper);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .section--paper .p09s-stats__card {
    background: var(--color-white);
  }

  .p09s-stats__figure {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--step-6);
    font-weight: var(--weight-display);
    line-height: 1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
  }

  .p09s-stats__people {
    display: flex;
    gap: clamp(0.25rem, 1.2vw, 0.5rem);
    max-width: 22rem;
  }

  .p09s-stats__person {
    --f: clamp(0, calc(var(--p, 1) * 10 - var(--i, 0)), 1);
    position: relative;
    flex: 1 1 0;
    max-width: 1.75rem;
    aspect-ratio: 20 / 32;
  }

  .p09s-stats__person svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
  }

  .p09s-stats__ghost {
    fill: none;
    stroke: var(--color-ink);
    stroke-width: 1.25;
  }

  .p09s-stats__fill {
    fill: var(--color-ink);
    stroke: var(--color-ink);
    stroke-width: 1.25;
    /* the share of this person that is filled, from the left; the figure
       spans 10% to 90% of its box, so a tenth still shows */
    clip-path: inset(-2px calc(90% - 80% * var(--f)) -2px -2px);
  }

  .p09s-stats__text {
    max-width: 30rem;
    line-height: 1.55;
  }

  .p09s-stats__text strong {
    font-weight: 600;
  }

  .p09s-stats__takeaway {
    margin: var(--space-3) 0 0;
    padding: var(--space-3);
    background: var(--color-brand);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-weight: var(--weight-heading);
    line-height: 1.25;
    text-wrap: balance;
  }

  .p09s-stats__source {
    max-width: 52rem;
  }

  /* A figure's phone and desktop pair (item Drawing "devices", the
     nonprofit page): an icon, its name, a bar and the value, one row each.
     The bars stand at their lengths (--w, the larger value the full bar);
     --t on the card (0 to 1, p09s-stats.js) grows them with the count-up */
  .p09s-stats__devices {
    display: grid;
    gap: 0.5rem;
    max-width: 22rem;
  }

  .p09s-stats__device {
    display: grid;
    grid-template-columns: 1.5rem 4.25rem minmax(0, 1fr) 2.75rem;
    gap: 0.5rem;
    align-items: center;
  }

  .p09s-stats__icon {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: var(--color-ink);
    stroke-width: 1.25;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .p09s-stats__dlabel {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .p09s-stats__bar {
    display: block;
    height: 0.75rem;
    overflow: hidden;
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .p09s-stats__barfill {
    display: block;
    height: 100%;
    background: var(--color-ink);
    transform: scaleX(calc(var(--w, 1) * var(--t, 1)));
    transform-origin: left;
  }

  .p09s-stats__device--phone .p09s-stats__barfill {
    background: var(--color-brand);
  }

  .p09s-stats__dvalue {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: end;
  }

  @media (min-width: 48rem) {
    .p09s-stats__cards--n2,
    .p09s-stats__cards--n3 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p09s-stats__card {
      padding: var(--space-4);
    }

    .p09s-stats__takeaway {
      padding: var(--space-4);
      text-align: center;
    }
  }

  @media (min-width: 60rem) {
    .p09s-stats__cards--n3 {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* a figure, a drawing and its line in each card: the three cards share
       their rows, so the drawings and the lines start level; a card without
       a drawing keeps its line in the third row (bulk fixes A2) */
    .p09s-stats__cards--n3 {
      grid-template-rows: repeat(3, auto);
      row-gap: var(--space-2);
    }

    .p09s-stats__cards--n3 > .p09s-stats__card {
      grid-row: span 3;
      grid-template-rows: subgrid;
    }

    .p09s-stats__cards--n3 > .p09s-stats__card > :is(.p09s-stats__people, .p09s-stats__devices) {
      align-self: center;
    }

    .p09s-stats__cards--n3 > .p09s-stats__card > .p09s-stats__text {
      grid-row: 3;
    }
  }

  /* ---------- Live card practice-new-patient: "Who's booking?" with the
     two choices side by side; the chosen one is mint and its next steps
     show under it, so the card is never empty. Plays once: rest on New
     patient, tap Current patient, tap New patient again. The static card
     (no script, reduced motion, print) is New patient chosen. The
     highlights and panels are livecard.js parts (data-at); they change
     when the cursor's tap lands, not when it sets off. ---------- */

  .p09s-lcard .lcard__title {
    margin-block-end: var(--space-1);
  }

  /* side by side when the card has room for both, stacked on a phone */
  .p09s-lcard__choices {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    margin-block-end: var(--space-2);
  }

  .p09s-lcard__choice {
    position: relative;
    isolation: isolate;
    padding: 0.5rem 0.5rem;
    white-space: nowrap;
  }

  /* the mint fill behind the chosen choice */
  .p09s-lcard__on {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--color-brand);
    border-radius: inherit;
  }

  .p09s-lcard__rows {
    gap: 0.3125rem;
  }

  .p09s-lcard__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .p09s-lcard__row::before {
    content: "";
    flex: none;
    width: 0.375rem;
    height: 0.375rem;
    background: var(--color-ink);
    border-radius: 50%;
  }

  .p09s-lcard__row.lcard__row--next {
    justify-content: space-between;
    font-weight: 500;
  }

  .p09s-lcard__row.lcard__row--next::before {
    display: none;
  }

  .p09s-lcard__arrow {
    flex: none;
    width: 0.875rem;
    height: 0.875rem;
  }

  .p09s-lcard.is-live [data-at].p09s-lcard__part {
    transition-delay: 560ms;
  }

  /* the fill fades in place; only the steps rise */
  .p09s-lcard.is-live [data-at].p09s-lcard__on:not(.is-on) {
    translate: none;
  }
}

@layer motion {
  @media print {
    /* printed mid-play: New patient chosen, as in the static card */
    .p09s-lcard.is-live [data-at].p09s-lcard__end {
      visibility: visible;
      opacity: 1;
      translate: none;
    }

    .p09s-lcard.is-live [data-at].p09s-lcard__part:not(.p09s-lcard__end) {
      visibility: hidden;
      opacity: 0;
    }
  }
}
