/**
 * Healthcare practice page, final pass (2026-11-21). Loaded for its class
 * prefix (site/plugins/peanut-site/extensions/stylesheets.php).
 *
 * The appointment router (blocks/routebuilder.php with its optional hint,
 * auto-play route and sentence, which add the class p09y-router; its base
 * styles are in ind-p09.css): the place of the shared "Tap one in each
 * column" hint, the shared cursor, the end button while the route is being
 * built ("Book …"), the next column's pulsing number and the sentence under
 * the columns (public/assets/js/routebuilder.js).
 *
 * Contact and search (visuals/p09y-contact.php, in a showcase): two sample
 * demos side by side (stacked on phones), a first contact form the cursor
 * fills and a log of three local searches with their result cards
 * (public/assets/js/p09y-contact.js).
 *
 * Tokens only. Layer blocks for the static state (the finished one), layer
 * motion for what moves. Nothing loops: the next column's number pulses
 * three times. Nothing changes size when the scripts run: the hint and the
 * Replay buttons keep their space while hidden, the end button keeps room
 * for two lines, the sentence for its longest form, typed text sits in
 * boxes of a fixed height and what waits to appear is only faded.
 */

@layer blocks {
  /* ---------- The appointment router ---------- */

  /* "Tap one in each column", over the columns: the shared hint
     (snippets/demo/hint.php, industry.css), placed here */
  .p09y-router__hint {
    margin: 0 0 var(--space-3);
  }

  /* the hint shows with or without the script: the options are real radio
     buttons, so tapping one in each column works either way (the industry
     check wants text of 16 characters or more visible without JavaScript) */

  /* the end button keeps room for two lines, so it never changes height
     while the route is built */
  .p09y-router .routebuilder__btn {
    display: grid;
    align-content: center;
    min-height: calc(2 * 1.3em + 1.75rem);
  }

  /* a route still being built: "Book …", drawn as an outline */
  .p09y-router .routebuilder__btn.is-waiting {
    background: var(--color-white);
    box-shadow: inset 0 0 0 1px var(--color-ink);
    color: var(--color-ink);
  }

  /* the sentence under the columns; room for its longest form */
  .p09y-router__say {
    min-height: calc(3 * 1.5em);
    margin: var(--space-3) 0 0;
    font-size: var(--text-body);
    font-weight: 500;
    line-height: 1.5;
  }

  /* the shared cursor (diagrams/cursor), seen only while auto-play runs;
     the script moves it to each choice */
  .p09y-router .p09y-router__cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 1.25rem;
    height: auto;
    overflow: visible;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform-origin: 0 0;
  }

  .p09y-router.is-playing .p09y-router__cursor {
    opacity: 1;
    visibility: visible;
  }

  @media (min-width: 48rem) {
    .p09y-router__say {
      min-height: calc(2 * 1.5em);
    }
  }

  @media (min-width: 64rem) {
    .p09y-router__say {
      min-height: 1.5em;
    }
  }

  @media print {
    .p09y-router .p09y-router__cursor {
      display: none;
    }
  }

  /* ---------- Contact and search: two sample demos ---------- */

  .p09y-contact {
    display: grid;
    gap: var(--space-5) var(--space-4);
    min-width: 0;
  }

  .p09y-demo {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 0.75rem;
    min-width: 0;
    margin: 0;
    font-size: var(--step--1);
    line-height: 1.5;
  }

  .p09y-demo__head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    justify-content: space-between;
    align-items: center;
  }

  .p09y-demo__name {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  /* Replay keeps its space, out of sight until the script runs; with
     scripting off it is not there */
  .p09y-demo:not(.is-live) .p09y-demo__replay {
    visibility: hidden;
  }

  @media (scripting: none) {
    .p09y-demo__replay {
      display: none;
    }
  }

  .p09y-demo__frame {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .p09y-demo__bar {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0.5rem 0.875rem;
    border-block-end: var(--border);
    font-size: 0.75rem;
  }

  /* three small dots, the browser frame's buttons */
  .p09y-demo__dots {
    flex: none;
    width: 0.375rem;
    height: 0.375rem;
    margin-inline-end: 1.25rem;
    background: var(--color-ink);
    border-radius: 50%;
    box-shadow: 0.625rem 0 0 var(--color-ink), 1.25rem 0 0 var(--color-ink);
    opacity: 0.45;
  }

  .p09y-demo__tag {
    flex: none;
    padding: 0.0625rem 0.5rem;
    background: var(--color-brand);
    border-radius: var(--radius-pill);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .p09y-demo__url {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .p09y-demo__cap {
    margin: 0;
    font-size: 0.75rem;
  }

  /* the typing caret, while a value or a search types itself: a line drawn
     by a shadow at the end of the typed text, so it takes no space */
  .p09y-form__row.is-at .p09y-type,
  .p09y-search__step.is-typing .p09y-type {
    box-shadow: 1.5px 0 0 var(--color-ink);
  }

  /* The form */

  .p09y-form {
    position: relative;
    display: grid;
    gap: 0.875rem;
    align-content: start;
    padding: var(--space-3);
  }

  .p09y-form__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading-sm);
    line-height: var(--leading-heading);
  }

  .p09y-form__fields {
    display: grid;
    gap: 0.75rem;
    margin: 0;
  }

  .p09y-form__row {
    display: grid;
    gap: 0.25rem;
  }

  .p09y-form__label {
    font-size: 0.75rem;
    font-weight: 500;
  }

  /* a drawn field: a fixed height, one line */
  .p09y-form__box {
    position: relative;
    display: flex;
    align-items: center;
    height: 2.25rem;
    margin: 0;
    padding: 0 0.75rem;
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: 0.5rem;
    white-space: nowrap;
  }

  .p09y-form__row.is-at .p09y-form__box {
    box-shadow: 0 0 0 3px var(--color-brand);
  }

  /* the field that does not belong: dashed, its label and box struck through */
  .p09y-form__box--no {
    border-style: dashed;
  }

  .p09y-form__row--no .p09y-form__label {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
  }

  .p09y-form__box--no::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.75rem;
    left: 0.75rem;
    height: 1.5px;
    background: var(--color-ink);
    transform-origin: 0 50%;
  }

  .p09y-form__note {
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: 0.5rem;
  }

  /* the drawn Send button: a picture, not a control */
  .p09y-form__send {
    justify-self: start;
    padding: 0.4375rem 0.875rem;
    background: var(--color-ink);
    border-radius: var(--radius-pill);
    color: var(--color-white);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  /* while it plays: the field not yet crossed out, the note not yet there */
  .p09y-demo.is-ready:not(.is-no) .p09y-form__row--no .p09y-form__label {
    text-decoration-color: transparent;
  }

  .p09y-demo.is-ready:not(.is-no) .p09y-form__box--no::after {
    transform: scaleX(0);
  }

  .p09y-demo.is-ready:not(.is-note) .p09y-form__note {
    opacity: 0;
  }

  /* the shared cursor (diagrams/cursor), seen only while the form plays */
  .p09y-demo .p09y-demo__cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 1.25rem;
    height: auto;
    overflow: visible;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform-origin: 0 0;
  }

  .p09y-demo.is-playing .p09y-demo__cursor {
    opacity: 1;
    visibility: visible;
  }

  /* The search */

  .p09y-search {
    display: grid;
    gap: 0.875rem;
    margin: 0;
    padding: var(--space-2);
    list-style: none;
  }

  .p09y-search__step {
    display: grid;
    gap: 0.5rem;
  }

  .p09y-search__box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    height: 2.25rem;
    margin: 0;
    padding: 0 0.875rem;
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    white-space: nowrap;
  }

  .p09y-search__glass {
    flex: none;
    fill: none;
    stroke: var(--color-ink);
    stroke-width: 1.5;
    stroke-linecap: round;
  }

  .p09y-search__card {
    display: grid;
    gap: 0.375rem;
    padding: 0.75rem 0.875rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: 0.5rem;
  }

  .p09y-search__practice {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.5rem;
    align-items: baseline;
    margin: 0;
  }

  .p09y-search__practice strong {
    font-weight: 600;
  }

  .p09y-search__kind {
    font-size: 0.75rem;
  }

  .p09y-search__treats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0;
  }

  .p09y-search__chip {
    padding: 0 0.5rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
  }

  .p09y-search__offices {
    display: grid;
    gap: 0.125rem;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    list-style: none;
  }

  .p09y-search__office {
    display: flex;
    gap: 0.375rem;
    align-items: center;
  }

  .p09y-search__pin {
    flex: none;
    fill: var(--color-white);
    stroke: var(--color-ink);
    stroke-width: 1.2;
  }

  /* while it plays: a search waits unseen until it types, its card until it
     is found (faded only, so it keeps its space and stays readable) */
  .p09y-demo.is-ready .p09y-search__step:not(.is-shown, .is-typing) {
    opacity: 0;
  }

  .p09y-demo.is-ready .p09y-search__step:not(.is-shown) .p09y-search__card {
    opacity: 0;
  }

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

    /* in a wide showcase, the two explanations sit over their two demos */
    .showcase--wide:has(.p09y-contact) .showcase__items {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: var(--space-4);
    }
  }

  @media print {
    .p09y-demo__replay,
    .p09y-demo .p09y-demo__cursor {
      display: none;
    }

    .p09y-demo.is-ready :is(.p09y-search__step, .p09y-search__card, .p09y-form__note) {
      opacity: 1;
    }
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    /* the router: the cursor travels from choice to choice and taps */
    .p09y-router .p09y-router__cursor {
      transition: transform 600ms var(--ease-out), opacity 300ms var(--ease-out), visibility 0s linear 300ms;
    }

    .p09y-router.is-playing .p09y-router__cursor {
      transition: transform 600ms var(--ease-out), opacity 300ms var(--ease-out), visibility 0s linear 0s;
    }

    .p09y-router.is-playing.is-tap .p09y-router__cursor,
    .p09y-demo.is-playing.is-tap .p09y-demo__cursor {
      animation: p09y-press 420ms var(--ease) both;
    }

    /* the number of the next column to choose pulses, three times */
    .p09y-router.is-seen .routebuilder__col.is-next .routebuilder__num {
      animation: p09y-next 1400ms var(--ease) 3;
    }

    .p09y-router .routebuilder__btn {
      transition: background-color 300ms var(--ease-out), color 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
    }

    /* the finished button pulses once */
    .p09y-router .routebuilder__btn.is-done {
      animation: p09y-done 900ms var(--ease-out) both;
    }

    /* the form: the cursor, the strike and the note */
    .p09y-demo .p09y-demo__cursor {
      transition: transform 550ms var(--ease-out), opacity 300ms var(--ease-out), visibility 0s linear 300ms;
    }

    .p09y-demo.is-playing .p09y-demo__cursor {
      transition: transform 550ms var(--ease-out), opacity 300ms var(--ease-out), visibility 0s linear 0s;
    }

    .p09y-form__box {
      transition: box-shadow 200ms var(--ease-out);
    }

    .p09y-form__row--no .p09y-form__label {
      transition: text-decoration-color 300ms var(--ease-out) 200ms;
    }

    .p09y-form__box--no::after {
      transition: transform 450ms var(--ease-out);
    }

    .p09y-form__note {
      transition: opacity 400ms var(--ease-out), translate 400ms var(--ease-out);
    }

    .p09y-demo.is-ready:not(.is-note) .p09y-form__note {
      translate: 0 0.375rem;
    }

    /* the search: each search fades in as it types, its card rises in */
    .p09y-search__step,
    .p09y-search__card {
      transition: opacity 400ms var(--ease-out), translate 400ms var(--ease-out);
    }

    .p09y-demo.is-ready .p09y-search__step:not(.is-shown) .p09y-search__card {
      translate: 0 0.5rem;
    }
  }

  @keyframes p09y-press {
    0%,
    100% {
      scale: 1;
    }

    40% {
      scale: 0.82;
    }
  }

  @keyframes p09y-next {
    0%,
    100% {
      box-shadow: 0 0 0 0 var(--color-brand-clear);
      scale: 1;
    }

    45% {
      box-shadow: 0 0 0 0.375rem var(--color-brand-glow-strong);
      scale: 1.15;
    }
  }

  @keyframes p09y-done {
    0% {
      scale: 1;
    }

    35% {
      scale: 1.04;
    }

    100% {
      scale: 1;
    }
  }
}
