/*
 * Midwife page (2026-11-20): the hero card, Every kind of care and the other midwife blocks. Loaded for the class prefix p07y-
 * (site/plugins/peanut-site/extensions/stylesheets.php).
 *
 * Final pass (owner, 2026-11-20): the live card's two answers (Home birth:
 * where I attend births and Book a consultation; Birth center: tour the
 * rooms and Request a tour) in one cell, the static card showing Birth
 * center chosen; and the care cards (visuals/p07y-care): a fan of seven
 * buttons from 60rem, four to a row at mid widths, two columns on phones,
 * the chosen card lifted and its search and who is searching under the
 * fan. Tokens only. Layer blocks for the static state, layer motion for
 * what moves. Nothing here loops.
 */

@layer blocks {
  /* ---------- Live card midwife-credentials: after a choice, its answer
     (the badges and buttons keep their look from ind-p07.css) ---------- */

  .lcard.p07y-card .p07-card__choices {
    margin-block-end: var(--space-2);
  }

  /* the finished card has Birth center chosen; the script taps it itself */
  .lcard.p07y-card:not(.is-live) .p07y-card__choice--chosen {
    background: var(--color-brand);
  }

  /* the two answers share one cell, so the card never changes height */
  .p07y-card__panels {
    display: grid;
  }

  .p07y-card__panel {
    display: grid;
    grid-area: 1 / 1;
    gap: 0.5rem;
    align-content: start;
  }

  .p07y-card__where {
    display: flex;
    gap: 0.4375rem;
    align-items: center;
    margin: 0;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }

  .p07y-card__icon {
    position: relative;
    flex: none;
    width: 0.875rem;
    height: 0.875rem;
    border: 1.5px solid var(--color-ink);
  }

  /* a map pin: a circle with a point */
  .p07y-card__icon--pin {
    border-radius: 50% 50% 50% 0;
    rotate: -45deg;
  }

  .p07y-card__icon--pin::after {
    content: "";
    position: absolute;
    inset: 0.1875rem;
    background: var(--color-ink);
    border-radius: 50%;
  }

  /* a door: an arch with a knob */
  .p07y-card__icon--door {
    border-radius: 0.4375rem 0.4375rem 0 0;
  }

  .p07y-card__icon--door::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.125rem;
    width: 0.1875rem;
    height: 0.1875rem;
    background: var(--color-ink);
    border-radius: 50%;
  }

  /* a drawn button: the sample site's, not a control */
  .p07y-card__btn {
    display: block;
    padding: 0.625rem 0.5rem;
    background: var(--color-ink);
    color: var(--color-white);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: var(--tracking-caps);
    text-align: center;
    text-transform: uppercase;
  }

  /* Print: the finished card, whatever step it was on */
  @media print {
    .lcard.p07y-card.is-live [data-at]:not(.is-on) {
      visibility: visible;
      opacity: 1;
      translate: none;
    }

    .lcard.p07y-card.is-live .p07y-card__panels .p07y-card__panel--home[data-at] {
      visibility: hidden;
    }

    .lcard.p07y-card .lcard__choice.p07y-card__choice--chosen {
      background: var(--color-brand);
    }

    .lcard.p07y-card .lcard__choice.is-tapped:not(.p07y-card__choice--chosen) {
      background: transparent;
    }

    .lcard.p07y-card .lcard__cursor {
      display: none;
    }
  }

  /* ---------- Every kind of care (visuals/p07y-care, blocks/showcase):
     the cards, then the answer under them. Phones: two columns. ---------- */

  .showcase__visual:has(.p07y-care) {
    min-width: 0;
  }

  .p07y-care {
    display: grid;
    gap: var(--space-3);
  }

  /* the hint and its mark are the shared ones (snippets/demo/hint.php,
     industry.css); here only its place */
  .p07y-care__hint {
    justify-self: center;
  }

  .p07y-care__fan {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    line-height: 1.3;
  }

  .p07y-care__slot {
    position: relative;
    display: grid;
  }

  /* the seventh card, alone on its row, sits in the middle */
  .p07y-care__slot:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - var(--space-2) / 2);
  }

  .p07y-care__card {
    display: grid;
    gap: 0.25rem;
    align-content: start;
    margin: 0;
    padding: 0.625rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 0.625rem;
    color: var(--color-ink);
    font: inherit;
    text-align: start;
  }

  .p07y-care.is-live .p07y-care__card {
    cursor: pointer;
  }

  .p07y-care__card[aria-pressed="true"] {
    box-shadow: var(--shadow-hard);
    translate: 0 -0.375rem;
  }

  .p07y-care__card:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
  }

  .p07y-care__photo {
    display: block;
    height: 2.5rem;
    border: 1px solid var(--color-ink);
    border-radius: 0.375rem;
  }

  .p07y-care__card--mint .p07y-care__photo {
    background: var(--color-brand);
  }

  .p07y-care__card--butter .p07y-care__photo {
    background: var(--color-butter);
  }

  .p07y-care__card--peach .p07y-care__photo {
    background: var(--color-accent-2);
  }

  .p07y-care__card--paper .p07y-care__photo {
    background: var(--color-paper);
  }

  /* every title whole: it wraps, never cut (the body face at 500, so a
     small title on a small card stays easy to read) */
  .p07y-care__title {
    display: block;
    margin: 0.375rem 0 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
    overflow-wrap: break-word;
  }

  .p07y-care__line {
    display: block;
    width: 80%;
    height: 0.3125rem;
    background: var(--color-ink);
    border-radius: var(--radius-pill);
    opacity: 0.22;
  }

  .p07y-care__line--short {
    width: 55%;
  }

  .p07y-care__btn {
    justify-self: start;
    margin-block-start: 0.375rem;
    padding: 0.3125rem 0.5rem;
    background: var(--color-ink);
    color: var(--color-white);
    font-size: 0.5625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  /* the answer: the search the chosen page answers, and who is searching */
  .p07y-care__answers {
    display: grid;
    gap: var(--space-3);
    justify-self: center;
    width: 100%;
    max-width: 50rem;
  }

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

  .p07y-care__name {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: 1.2;
  }

  .p07y-care__part {
    display: grid;
    gap: 0.375rem;
    align-content: start;
  }

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

  .p07y-care__query {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-self: start;
    margin: 0;
    padding: 0.375rem 0.875rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-weight: 500;
  }

  .p07y-care__who {
    margin: 0;
  }

  /* a magnifying glass */
  .p07y-care__glass {
    position: relative;
    flex: none;
    width: 0.75rem;
    height: 0.75rem;
    margin-inline-end: 0.125rem;
    border: 1.5px solid var(--color-ink);
    border-radius: 50%;
  }

  .p07y-care__glass::after {
    content: "";
    position: absolute;
    right: -0.3125rem;
    bottom: -0.25rem;
    width: 0.3125rem;
    height: 1.5px;
    background: var(--color-ink);
    rotate: 45deg;
  }

  /* with the script: the seven answers share one cell */
  .p07y-care.is-live .p07y-care__answers {
    gap: 0;
  }

  .p07y-care.is-live .p07y-care__answer {
    grid-area: 1 / 1;
  }

  .p07y-care.is-live .p07y-care__answer[data-off] {
    visibility: hidden;
  }

  @media (min-width: 40rem) {
    .p07y-care__answer {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: var(--space-2) var(--space-4);
    }

    .p07y-care__name {
      grid-column: 1 / -1;
    }
  }

  /* mid widths: four to a row, the last three centered */
  @media (min-width: 40rem) and (max-width: 59.99rem) {
    .p07y-care__fan {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
    }

    .p07y-care__slot,
    .p07y-care__slot:last-child:nth-child(odd) {
      width: calc((100% - 3 * var(--space-2)) / 4);
    }
  }

  /* the fan: seven cards in a gentle arc, the middle one highest; they
     barely overlap, so every title stays whole, and the side padding holds
     the outer cards' tilt inside the column */
  @media (min-width: 60rem) {
    .p07y-care__fan {
      grid-template-columns: repeat(7, minmax(0, 1fr));
      gap: 0.375rem;
      width: 100%;
      max-width: 66rem;
      margin-inline: auto;
      padding: var(--space-3) 2.25rem var(--space-4);
    }

    .p07y-care__slot,
    .p07y-care__slot:last-child:nth-child(odd) {
      grid-column: auto;
      justify-self: stretch;
      width: auto;
      transform-origin: 50% 100%;
      transform: translateY(var(--y)) rotate(var(--r));
    }

    .p07y-care__slot:has([aria-pressed="true"]) {
      z-index: 1;
    }

    .p07y-care__card {
      height: 100%;
      padding: 0.5rem;
    }

    .p07y-care__card[aria-pressed="true"] {
      translate: 0 -1rem;
    }

    .p07y-care__photo {
      height: 3.25rem;
    }

    .p07y-care__title {
      font-size: clamp(0.6875rem, 0.9vw, 0.8125rem);
    }
  }

  /* Print: the drawings and every answer, one after the other */
  @media print {
    .p07y-care__hint {
      display: none;
    }

    .p07y-care.is-live .p07y-care__answers {
      gap: var(--space-3);
    }

    .p07y-care.is-live .p07y-care__answer {
      grid-area: auto;
    }

    .p07y-care.is-live .p07y-care__answer[data-off] {
      visibility: visible;
    }

    .p07y-care__card[aria-pressed="true"] {
      box-shadow: none;
      translate: none;
    }

    .p07y-care__answer {
      break-inside: avoid;
    }
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    /* the live card: the answer crosses over as the tap lands */
    .lcard.p07y-card.is-live .p07y-card__panel {
      transition-delay: 560ms;
    }

    .p07y-care.is-live .p07y-care__card {
      transition: translate 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
    }

    .p07y-care.is-live .p07y-care__card:hover:not([aria-pressed="true"]) {
      translate: 0 -0.25rem;
    }

    .p07y-care.is-live .p07y-care__answer {
      transition: opacity 400ms var(--ease-out), visibility 0s;
    }

    .p07y-care.is-live .p07y-care__answer[data-off] {
      opacity: 0;
      transition: opacity 250ms var(--ease-out), visibility 0s 250ms;
    }
  }
}
