/* Loaded by every Reference topic, never by indexes, PLAY or the configurator.
 * Named paper margins leave resource sheets' physical-page contract independent. */
@media print {
  @page reference-topic { margin: 16mm; }

  html:has(.reference-topic) {
    color-scheme: light;
    background: #ffffff;
  }

  /* Paper/ink tokens keep role shapes and text useful with backgrounds disabled. */
  body:has(.reference-topic) {
    --text: #111111;
    --muted: #333333;
    --line: #777777;
    --color-text-muted: #333333;
    --color-border: #777777;
    --color-border-strong: #777777;
    --color-divider: #777777;
    --color-text-primary: #111111;
    --color-text-secondary: #333333;
    background: #ffffff;
    color: #111111;
    color-scheme: light;
  }

  body:has(.reference-topic) :is(.site-header, .site-footer, .skip-link),
  .reference-main :is(.reference-breadcrumbs, .reference-on-this-page,
    .reference-sequence, .reference-play) {
    display: none;
  }

  .reference-main {
    page: reference-topic;
    padding: 0;
  }

  .reference-main .shell {
    width: 100%;
    max-width: none;
    padding-inline: 0;
  }

  .reference-main .reference-topic-layout {
    display: block;
  }

  .reference-main .reference-article {
    max-width: none;
    overflow: visible;
  }

  .reference-main .reference-topic-header {
    padding-block: 0 1.5rem;
    margin: 0;
  }

  .reference-main :is(h1, h2, h3, h4) {
    color: #111111;
    break-after: avoid;
  }

  .reference-main h1 {
    max-width: none;
    font-size: 2rem;
  }

  .reference-main .reference-article > section + section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }

  .reference-main :is(a, p, dt, dd, th, td, li, .eyebrow) {
    color: #111111;
  }

  .reference-main .reference-authority {
    background: transparent;
    border-color: #777777;
    box-shadow: none;
    break-inside: avoid;
  }

  .reference-main .reference-authority-label {
    color: #111111 !important;
  }

  /* Flow prose freely; only short definitions/figures stay together. */
  .reference-main :is(.reference-topic, .reference-article, .reference-article > section) {
    break-inside: auto;
  }

  .reference-main :is(p, li) {
    orphans: 3;
    widows: 3;
  }

  .reference-main a {
    text-decoration: underline;
    overflow-wrap: anywhere;
  }

  .reference-main table {
    width: 100%;
    border-collapse: collapse;
  }

  .reference-main :is(th, td) {
    border: 1px solid #777777;
    background: transparent;
    overflow-wrap: anywhere;
  }
}
