@page {
  size: A4 landscape;
  margin: 8mm;
}

@media print {
  :root {
    --client-width: 250mm !important;
  }

  html,
  body {
    width: 250mm;
    margin-inline: auto;
    background: #fff !important;
    color: rgb(31, 31, 31) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  main,
  .page {
    overflow: visible !important;
  }

  [data-pattern-id="P1-section-heading"],
  [data-pattern-id="P2-c3-figure"],
  [data-pattern-id="P4-c6-figure"],
  [data-pattern-id="P7-three-way-nav"] {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  [data-pattern-row="true"] {
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: flex-start !important;
    width: 100% !important;
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  [data-pattern-row="true"] > [data-pattern-id="P2-c3-figure"],
  [data-pattern-row="true"] > [data-pattern-id="P4-c6-figure"] {
    display: flow-root !important;
    float: none !important;
    flex: none !important;
  }

  [data-pattern-row="true"] > .c0 {
    display: none !important;
  }

  /* Keep TE20 and the captured measure, but use an 85% print scale so a
     complete caption remains with its figure on one landscape sheet. */
  [data-pattern-figure] .txt > span {
    font-size: calc(0.015612205 * var(--client-width)) !important;
    line-height: calc(0.017346935 * var(--client-width)) !important;
  }

  /* The Guide Conventions intro is a prose pattern rather than a figure
     caption. Keep its complete second column on the opening sheet. */
  [data-pattern-row="intro-prose"] .txt > span {
    font-size: calc(0.016326531 * var(--client-width)) !important;
    line-height: calc(0.018367347 * var(--client-width)) !important;
  }

  [data-pattern-id="P1-section-heading"] {
    break-after: avoid-page;
  }

  /* The captured 80-unit browser tail is screen cadence, not printable
     content. Omitting it prevents a trailing blank landscape sheet. */
  .page > .box:last-child {
    display: none !important;
  }

  #song-and-save + .box.adt20x > [data-pattern-id="P6-captured-spacing"]:last-child,
  .page > [data-pattern-id="P6-captured-spacing"]:has(+ [data-pattern-id="P7-three-way-nav"]),
  [data-pattern-id="P7-three-way-nav"] {
    display: none !important;
  }

  a {
    color: inherit !important;
    text-decoration: none !important;
  }
}
