/* Paper-friendly output for the static site; loaded only for print media. */
@page {
  size: A4;
  margin: 16mm;
}

@media print {
  :root,
  [data-bs-theme="dark"] {
    color-scheme: light;
    --bs-body-bg: #fff;
    --bs-body-color: #111;
    --bs-heading-color: #111;
    --bs-secondary-color: #333;
    --bs-emphasis-color: #111;
    --bs-border-color: #777;
    --bs-link-color: #111;
    --bs-primary: #111;
  }

  *,
  *::before,
  *::after {
    color: #111 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  /* Bootstrap text utilities also use !important, so override them explicitly. */
  .text-info,
  .text-primary,
  .text-muted,
  .text-secondary,
  .text-light-emphasis {
    color: #111 !important;
  }

  html,
  body {
    background: #fff !important;
    min-height: 0 !important;
    height: auto !important;
  }

  body {
    display: block !important;
    border: 0;
    font-size: 11pt;
    line-height: 1.5;
  }

  body > header,
  body > footer,
  nav,
  .portfolio-back,
  .visually-hidden-focusable,
  .portfolio-notice + a {
    display: none !important;
  }

  body > main.container,
  .portfolio-prose,
  .portfolio-opening,
  .portfolio-entry-compact {
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
  }

  main .row {
    display: block;
  }

  main .row > * {
    width: 100%;
  }

  .portfolio-intro {
    padding: 0 0 5mm;
  }

  main h1.display-3,
  main h1.display-5,
  main.portfolio-page h1.display-3,
  main.portfolio-page h1.display-5 {
    font-size: 26pt;
    line-height: 1.15;
  }

  main h2,
  main .portfolio-section-heading h2 {
    font-size: 17pt;
  }

  main h3,
  main .portfolio-entry h3,
  main .portfolio-entry h2 {
    font-size: 14pt;
  }

  .portfolio-body {
    font-size: 11pt;
    line-height: 1.5;
  }

  .portfolio-section {
    margin-top: 6mm;
  }

  .portfolio-section-heading,
  .portfolio-question,
  .portfolio-artefact {
    padding: 3mm 0;
    margin-block: 3mm;
    border-color: #777;
  }

  .portfolio-entry {
    display: block;
    padding-block: 4mm;
  }

  .portfolio-entry > div + div {
    margin-top: 2mm;
  }

  .table-responsive {
    overflow: visible;
  }

  table {
    width: 100%;
    table-layout: fixed;
  }

  th,
  td,
  pre,
  code,
  a {
    overflow-wrap: anywhere;
  }

  pre {
    white-space: pre-wrap;
  }

  h1,
  h2,
  h3,
  caption {
    break-after: avoid;
  }

  tr {
    break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  a {
    text-decoration: underline;
  }

  /* Retain useful destinations when links cannot be clicked on paper. */
  main a[href^="https://"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    font-weight: normal;
  }

  .btn {
    padding: 0;
    min-height: 0;
    border: 0;
  }
}
