/* One piece becomes... (site/snippets/blocks/fanout.php,
   public/assets/js/fanout.js; the Content plans page): one sample article
   card with lines out to the smaller posts cut from it, and one panel per
   post with a small drawing of it. Linked by the block itself
   (peanut_page_css). Every selector names a fanout class. Tokens only.

   Below 60rem: the article card, then the posts on a rail under it. From
   60rem: the posts in two columns either side of the card, each with a line
   into it. Finished by default (no script, reduced motion, print): the posts
   are plain labels and every panel stands one under the other. The script
   adds .is-live: the posts are buttons, the panels share one cell (the
   tallest sets the height), the others data-off (visibility hidden). */

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

  .fanout__title {
    margin: 0;
  }

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

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

  @media (min-width: 60rem) {
    .fanout__demo {
      padding: var(--space-4);
    }
  }

  .fanout__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin-block-end: var(--space-3);
  }

  .fanout__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;
  }

  /* ---------- the map: the article, the posts on a rail under it ---------- */
  .fanout__map {
    display: grid;
  }

  .fanout__article {
    display: grid;
    align-content: center;
    gap: 0.375rem;
    padding: var(--space-3);
    background: var(--color-brand);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

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

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

  .fanout__articlemeta {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .fanout__pieces {
    display: grid;
    margin: 0;
    padding: 0 0 0 2.75rem;
    list-style: none;
  }

  .fanout__pieces--a {
    padding-block-start: 0.5rem;
  }

  .fanout__item {
    position: relative;
    padding-block: 0.25rem;
  }

  /* the rail down from the card, and the elbow out to each post */
  .fanout__item::before,
  .fanout__item::after {
    content: "";
    position: absolute;
    inset-inline-start: -1.75rem;
  }

  .fanout__item::before {
    top: 0;
    bottom: 0;
    border-inline-start: 1px solid var(--color-ink);
  }

  .fanout__pieces--a .fanout__item:first-child::before {
    top: -0.5rem;
  }

  .fanout__map > .fanout__pieces:last-child .fanout__item:last-child::before {
    bottom: 50%;
  }

  .fanout__item::after {
    top: 50%;
    width: 1.75rem;
    border-block-start: 1px solid var(--color-ink);
  }

  .fanout__piece {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    width: 100%;
    max-width: 24rem;
    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);
    text-align: start;
  }

  .fanout__piecename {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
  }

  .fanout__piecenote {
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.35;
  }

  /* the post as a button (the script) */
  button.fanout__piece {
    cursor: pointer;
  }

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

  button.fanout__piece[aria-pressed="true"] {
    background: var(--color-brand);
  }

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

  /* wide: the posts either side of the card, a line from each into it */
  @media (min-width: 60rem) {
    .fanout__map {
      grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem) minmax(0, 1fr);
      column-gap: var(--space-5);
      align-items: center;
    }

    .fanout__article {
      grid-column: 2;
      grid-row: 1;
      align-self: stretch;
      text-align: center;
    }

    .fanout__pieces,
    .fanout__pieces--a {
      grid-row: 1;
      gap: var(--space-1);
      padding: 0;
    }

    .fanout__pieces--a {
      grid-column: 1;
    }

    .fanout__pieces--b {
      grid-column: 3;
    }

    .fanout__item {
      padding: 0;
    }

    .fanout__item::before {
      content: none;
    }

    .fanout__item::after {
      width: var(--space-5);
    }

    .fanout__pieces--a .fanout__item::after {
      inset-inline-start: 100%;
    }

    .fanout__pieces--b .fanout__item::after {
      inset-inline-start: auto;
      inset-inline-end: 100%;
    }

    .fanout__pieces--a .fanout__piece {
      margin-inline-start: auto;
    }

    .fanout__piece {
      max-width: none;
    }
  }

  /* ---------- the panels ---------- */
  .fanout__panels {
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-4);
    border-block-start: var(--border);
  }

  .fanout__panel {
    display: grid;
    gap: var(--space-3);
    align-content: start;
  }

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

  .fanout__demo:not(.is-live) .fanout__panel + .fanout__panel {
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--color-ink-line-faint);
  }

  .fanout__demo.is-live .fanout__panels {
    display: grid;
  }

  .fanout__demo.is-live .fanout__panel {
    grid-area: 1 / 1;
  }

  .fanout__demo.is-live .fanout__panel[data-off] {
    visibility: hidden;
  }

  @media screen and (max-width: 59.99rem) {
    .fanout__demo.is-live.is-free .fanout__panel[data-off] {
      display: none;
    }
  }

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

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

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

  .fanout__progress {
    margin-block-start: var(--space-3);
  }

  /* ---------- the drawings ---------- */
  .fanout__sample {
    container-type: inline-size;
    min-width: 0;
    padding: var(--space-3);
    background: var(--color-paper);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

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

  .fanout__chip {
    display: inline-block;
    padding: 0 0.375rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.5;
  }

  .fanout__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: 0.75rem 0 0;
  }

  .fanout__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 business profile post */
  .fanout__post,
  .fanout__email {
    max-width: 26rem;
    padding: 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .fanout__by {
    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;
  }

  .fanout__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%;
  }

  .fanout__image {
    height: 5rem;
    margin-block-end: 0.625rem;
    background: var(--gradient-home-wash);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  /* the carousel: its frames in a grid */
  .fanout__frames {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .fanout__frame {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    aspect-ratio: 4 / 5;
    min-width: 0;
    padding: 0.5rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .fanout__frame--cover {
    background: var(--color-brand);
  }

  .fanout__framenum {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.4;
  }

  .fanout__frametext {
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: break-word;
  }

  .fanout__frame--cover .fanout__frametext {
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: var(--weight-heading);
  }

  /* the two graphics */
  .fanout__square {
    display: grid;
    align-content: space-between;
    gap: var(--space-2);
    max-width: 17rem;
    aspect-ratio: 1;
    margin: 0;
    padding: 1.25rem;
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .fanout__square--quote {
    background: var(--color-butter);
  }

  .fanout__square--tip {
    align-content: start;
    background: var(--color-brand);
  }

  .fanout__quote {
    margin: 0;
  }

  .fanout__quote p,
  .fanout__tip {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .fanout__who,
  .fanout__tiplabel {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.5;
    text-transform: uppercase;
  }

  /* the short video: a phone frame beside its script */
  .fanout__video {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: var(--space-2);
    align-items: start;
  }

  .fanout__phone {
    display: grid;
    place-items: center;
    aspect-ratio: 9 / 16;
    background: var(--color-ink);
    border: var(--border);
    border-radius: 0.625rem;
  }

  .fanout__play {
    width: 0;
    height: 0;
    border-block: 0.5rem solid transparent;
    border-inline-start: 0.75rem solid var(--color-white);
    margin-inline-start: 0.1875rem;
  }

  .fanout__cues {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .fanout__cue {
    display: grid;
    gap: 0.125rem;
    padding: 0.5rem 0.625rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .fanout__at {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.4;
    text-transform: uppercase;
  }

  .fanout__say {
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  .fanout__caption {
    margin: 0.625rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  /* the email block */
  .fanout__subject,
  .fanout__from {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: baseline;
    margin: 0;
    padding-block: 0.375rem;
    border-block-end: 1px solid var(--color-ink-line-faint);
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .fanout__subject {
    padding-block-start: 0;
    font-weight: 600;
  }

  .fanout__from + .fanout__body {
    margin-block-start: 0.625rem;
  }

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

  /* the captions, one card a place */
  .fanout__captions {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

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

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

  .fanout__closing {
    max-width: var(--measure);
    margin: var(--space-5) 0 0;
  }

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

  /* ---------- print: every post, one under the other ---------- */
  @media print {
    .fanout__hint,
    .fanout__progress {
      display: none;
    }

    .fanout__demo.is-live .fanout__panels {
      display: block;
    }

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

    .fanout__demo.is-live .fanout__panel + .fanout__panel {
      margin-block-start: var(--space-4);
      padding-block-start: var(--space-4);
      border-block-start: 1px solid var(--color-ink-line-faint);
    }

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

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

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

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

/* Bulk fixes, 2026-11-29 (added brief 1.5): the infographic in the Full
   campaign set, and A1 (from 64rem the head is centered over its demo and
   the demo sits in the middle of the container). */
@layer blocks {
  .fanout__info {
    display: grid;
    gap: 0.75rem;
    max-width: 15rem;
    aspect-ratio: 2 / 3;
    align-content: start;
    padding: 1rem;
    background: linear-gradient(180deg, var(--color-butter) 0 6.5rem, var(--color-white) 6.5rem);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .fanout__infotitle {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: 1.25;
    overflow-wrap: break-word;
  }

  .fanout__infosteps {
    display: grid;
    gap: 0.625rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .fanout__infostep {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr);
    align-items: start;
    gap: 0.5rem;
  }

  .fanout__infonum {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .fanout__infotext {
    padding-block-start: 0.125rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
  }

  .fanout__infowho {
    margin: 0;
    padding-block-start: 0.5rem;
    border-block-start: 1px solid var(--color-ink-line-faint);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  @media (min-width: 64rem) {
    .fanout__head {
      max-width: 48rem;
      margin-inline: auto;
      text-align: center;
    }

    .fanout__head > * {
      margin-inline: auto;
    }

    .fanout__head > .block-head__long {
      text-align: start;
    }

    .fanout__demo,
    .fanout__closing {
      margin-inline: auto;
    }

    .fanout__closing {
      text-align: center;
    }
  }
}
