/* Stepper (site/snippets/blocks/stepper.php, public/assets/js/stepper.js):
   numbered steps as tabs over one panel area, each panel a step's heading,
   its text and a drawn sample of what it produces, with a "Sample" label.
   The inventory, redirect and comparison samples reuse the move demo's
   classes (movedemo.css, linked by the block when it needs them); the rules
   here only adjust them inside a stepper. Linked by the block itself
   (peanut_page_css). Every selector names a stepper class. Tokens only.

   Finished by default (no script, reduced motion, print): tabs and hint
   hidden, every step one under the other with its sample. The script adds
   .is-live: the panels share one cell, the tallest sets the height, the
   others are data-off (visibility hidden), so a switch never moves the page;
   on narrow screens, after the reader's first press (.is-free), the shown
   step takes its own height. */

@layer blocks {
  .stepper__head {
    max-width: 44rem;
    margin-block-end: var(--space-5);
  }

  .stepper__title {
    margin: 0;
  }

  .stepper__intro {
    margin: var(--space-3) 0 0;
  }

  /* ---------- the frame ---------- */
  .stepper__demo {
    max-width: 68rem;
    padding: var(--space-3);
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
  }

  /* ---------- the steps (shown by the script) ---------- */
  .stepper__nav[hidden] {
    display: none;
  }

  .stepper__nav {
    display: grid;
    gap: var(--space-2);
    margin-block-end: var(--space-4);
  }

  /* phones: a column of steps */
  .stepper__tabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
  }

  .stepper__tab {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.375rem 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: start;
    cursor: pointer;
  }

  .stepper__tab:hover {
    background: var(--color-paper);
  }

  .stepper__tab[aria-selected="true"] {
    background: var(--color-brand);
  }

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

  .stepper__tabname {
    min-width: 0;
    overflow-wrap: break-word;
  }

  .stepper__num {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
  }

  @media (min-width: 40rem) {
    .stepper__tabs {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  /* wide: one row of steps */
  @media (min-width: 60rem) {
    .stepper__demo {
      padding: var(--space-4);
    }

    .stepper__tabs {
      grid-template-columns: repeat(var(--count, 6), minmax(0, 1fr));
    }

    .stepper__tab {
      flex-direction: column;
      align-items: flex-start;
      gap: 0.375rem;
      padding: 0.5rem 0.625rem;
    }
  }

  /* ---------- the panels: without the script, one under the other ---------- */
  .stepper__panel {
    display: grid;
    gap: var(--space-3);
    align-content: start;
  }

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

  .stepper__demo:not(.is-live) .stepper__panel + .stepper__panel {
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-4);
    border-block-start: var(--border);
  }

  .stepper__demo.is-live .stepper__panels {
    display: grid;
  }

  .stepper__demo.is-live .stepper__panel {
    grid-area: 1 / 1;
  }

  .stepper__demo.is-live .stepper__panel[data-off] {
    visibility: hidden;
  }

  /* after the reader's first press, narrow screens let the shown step set the height */
  @media screen and (max-width: 59.99rem) {
    .stepper__demo.is-live.is-free .stepper__panel[data-off] {
      display: none;
    }
  }

  /* the step's number and name over its copy, only where the tabs do not show */
  .stepper__kicker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 var(--space-2);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .stepper__demo.is-live .stepper__kicker {
    display: none;
  }

  .stepper__steptitle {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .stepper__steptext {
    margin: var(--space-1) 0 0;
  }

  @media (min-width: 60rem) {
    .stepper__panel {
      grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
      gap: var(--space-5);
    }
  }

  /* ---------- the sample: a paper card with its label ---------- */
  .stepper__sample {
    container-type: inline-size;
    min-width: 0;
    padding: var(--space-3);
    background: var(--color-paper);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__sampletop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 var(--space-3);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
  }

  .stepper__label {
    flex: none;
    padding: 0.0625rem 0.5rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .stepper__samplenote {
    margin: var(--space-2) 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  .stepper__tick {
    flex: none;
  }

  /* the move demo's card and list inside a stepper: white on the paper sample */
  .stepper__card {
    max-width: none;
    background: var(--color-white);
  }

  .stepper__card .movedemo__fact:first-child {
    border-block-start: 0;
    padding-block-start: 0;
  }

  .stepper__card .stepper__valtext {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .stepper__list .movedemo__old {
    background: var(--color-white);
  }

  /* ---------- schema and comparison tables ---------- */
  .stepper__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .stepper__table th,
  .stepper__table td {
    padding: 0.5rem 0.375rem;
    border-block-end: 1px solid var(--color-ink-line-faint);
    text-align: start;
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  .stepper__table thead th {
    border-block-end: var(--border);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .stepper__table tbody th {
    font-weight: 600;
  }

  .stepper__table tbody tr:last-child > * {
    border-block-end: 0;
  }

  .stepper__table--schema {
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    border-collapse: separate;
    border-spacing: 0;
  }

  .stepper__table--schema th:first-child,
  .stepper__table--schema td:first-child {
    padding-inline-start: 0.625rem;
  }

  .stepper__table--compare td {
    font-variant-numeric: tabular-nums;
  }

  .stepper__table--compare td:last-child {
    font-weight: 600;
  }

  .stepper__missing {
    display: inline-block;
    padding: 0 0.375rem;
    border: 1px dashed var(--color-ink);
    border-radius: var(--radius-sm);
  }

  .stepper__added {
    display: inline-block;
    padding: 0 0.375rem;
    background: var(--color-brand);
    border-radius: var(--radius-sm);
  }

  /* ---------- parity: three pages, the paragraph restored ---------- */
  .stepper__parity {
    display: grid;
    gap: var(--space-2);
  }

  .stepper__page {
    padding: 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__pagelabel {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .stepper__bars {
    display: grid;
    gap: 0.375rem;
    margin-block-end: 0.5rem;
  }

  .stepper__bars > span {
    display: block;
    height: 0.375rem;
    background: var(--color-ink-line-faint);
    border-radius: var(--radius-pill);
  }

  .stepper__bars > span + span {
    width: 70%;
  }

  .stepper__para,
  .stepper__gap {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  .stepper__gap {
    padding: 0.5rem;
    border: 1px dashed var(--color-ink);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
  }

  .stepper__para--back {
    padding: 0.5rem;
    background: var(--color-brand);
    border-radius: var(--radius-sm);
  }

  .stepper__tag {
    display: inline-block;
    margin-inline-end: 0.25rem;
    padding: 0 0.375rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  /* ---------- the launch-week watch list ---------- */
  .stepper__watch {
    display: grid;
    margin: 0;
    padding: 0;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    list-style: none;
  }

  .stepper__watchrow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.625rem;
    row-gap: 0.125rem;
    align-items: start;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  .stepper__watchrow + .stepper__watchrow {
    border-block-start: 1px solid var(--color-ink-line-faint);
  }

  .stepper__watchrow .stepper__tick {
    grid-row: span 2;
    margin-block-start: 0.0625rem;
  }

  .stepper__watchname {
    font-weight: 600;
  }

  .stepper__watchword {
    display: inline-block;
    margin-inline-end: 0.25rem;
    padding: 0 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .stepper__watchrow--ok .stepper__watchword,
  .stepper__watchrow--fixed .stepper__watchword {
    background: var(--color-brand);
  }

  .stepper__watchrow--watch .stepper__watchword {
    background: var(--color-butter);
  }

  @container (min-width: 30rem) {
    .stepper__watchrow {
      grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.3fr);
    }

    .stepper__watchrow .stepper__tick {
      grid-row: auto;
    }
  }

  /* ---------- the interview ---------- */
  .stepper__qs {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .stepper__q {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__qnum {
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: 1.1;
  }

  .stepper__qtext {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.45;
  }

  .stepper__answer {
    grid-column: 2;
    margin: 0.375rem 0 0;
    padding-inline-start: 0.625rem;
    border-inline-start: 2px solid var(--color-brand);
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  /* ---------- the draft, its notes in the margin ---------- */
  .stepper__doc {
    padding: 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__doctitle {
    margin: 0 0 0.75rem;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .stepper__docrow {
    display: grid;
    gap: 0.5rem;
  }

  .stepper__docrow + .stepper__docrow {
    margin-block-start: 0.75rem;
  }

  .stepper__docpara {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
  }

  .stepper__margin {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    margin: 0;
    padding: 0.375rem 0.5rem;
    background: var(--color-butter);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.45;
  }

  .stepper__ref {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 1.125rem;
    height: 1.125rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1;
    vertical-align: 0.0625rem;
  }

  .stepper__margin .stepper__ref {
    background: var(--color-white);
  }

  @container (min-width: 30rem) {
    .stepper__docrow {
      grid-template-columns: minmax(0, 1fr) 10rem;
      align-items: start;
    }
  }

  /* ---------- your review ---------- */
  .stepper__notes {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .stepper__notecard {
    padding: 0.625rem 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__notetext {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
  }

  .stepper__resolved {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    margin: 0.375rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
  }

  .stepper__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: var(--space-3) 0 0;
  }

  .stepper__btn {
    display: inline-block;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: var(--tracking-caps);
    line-height: 1.4;
    text-transform: uppercase;
  }

  /* ---------- the published page ---------- */
  .stepper__pagecard {
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__url {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.375rem 0.625rem;
    border-block-end: var(--border);
    font-size: 0.75rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .stepper__dots {
    display: flex;
    flex: none;
    gap: 0.25rem;
  }

  .stepper__dots > span {
    width: 0.5rem;
    height: 0.5rem;
    border: var(--border);
    border-radius: 50%;
  }

  .stepper__pagebody {
    padding: 0.75rem;
  }

  .stepper__pagetitle {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .stepper__excerpt {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .stepper__date {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
  }

  /* ---------- the business profile post ---------- */
  .stepper__post {
    max-width: 26rem;
    padding: 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__postby {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
  }

  .stepper__initial {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: 50%;
    font-size: 0.8125rem;
  }

  .stepper__postkind {
    padding: 0 0.375rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 500;
  }

  .stepper__postimage {
    display: grid;
    align-items: end;
    min-height: 6rem;
    margin: 0 0 0.625rem;
    padding: 0.625rem;
    background: var(--gradient-home-wash);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .stepper__posttext {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .stepper__post .stepper__actions {
    margin-block-start: 0.75rem;
  }

  /* ---------- the report line ---------- */
  .stepper__report {
    display: grid;
    margin: 0;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .stepper__reportrow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--space-2);
    align-items: baseline;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  .stepper__reportrow + .stepper__reportrow {
    border-block-start: 1px solid var(--color-ink-line-faint);
  }

  .stepper__reportrow dd {
    margin: 0;
    text-align: end;
  }

  .stepper__reportrow--piece {
    grid-template-columns: minmax(0, 1fr);
    background: var(--color-mint-pale);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

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

  .stepper__reportrow--piece dd {
    font-weight: 600;
    text-align: start;
  }

  .stepper__num-value {
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: var(--weight-heading);
    line-height: 1.1;
  }

  /* ---------- under the demo ---------- */
  .stepper__closing {
    max-width: var(--measure);
    margin: var(--space-5) 0 0;
  }

  .stepper__closing > :last-child {
    margin-block-end: 0;
  }

  /* ---------- print: every step, one under the other ---------- */
  @media print {
    .stepper__nav {
      display: none;
    }

    .stepper__demo.is-live .stepper__panels {
      display: block;
    }

    .stepper__demo.is-live .stepper__panel[data-off] {
      display: grid;
      visibility: visible;
    }

    .stepper__demo.is-live .stepper__kicker {
      display: flex;
    }

    .stepper__demo.is-live .stepper__panel + .stepper__panel {
      margin-block-start: var(--space-4);
      padding-block-start: var(--space-4);
      border-block-start: var(--border);
    }

    .stepper__panel {
      break-inside: avoid;
    }
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    html[data-fx~="diagrams"] .stepper__demo.is-live .stepper__panel:not([data-off]) .stepper__sample {
      animation: stepper-in 400ms var(--ease) both;
    }
  }

  @keyframes stepper-in {
    from {
      opacity: 0;
      transform: translateY(0.375rem);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }
}
