/*
 * Print and PDF for the research article pages. Load on every article page (with or without media="print").
 * The margins suit both A4 and US Letter; the reader's paper choice decides the size.
 * On paper: title, the publisher, date and address line, the standfirst and the article with its three section
 * dividers. Header, side rails, share and subscribe blocks, the review bar and every on-screen control are left
 * out; colours are forced light; figures, tables, code and display formulas are kept whole on one page where
 * they fit; link addresses are printed only in the reference list.
 */

@page {
  margin: 17mm 16mm 19mm;

  @bottom-left {
    content: "Oraclizer Research";
    color: #59677b;
    font: 600 7.5pt "Manrope Variable", "Manrope", sans-serif;
  }
  @bottom-right {
    content: counter(page) " / " counter(pages);
    color: #59677b;
    font: 600 7.5pt "Manrope Variable", "Manrope", sans-serif;
  }
}

@media print {
  :root,
  html[data-theme="dark"] {
    color-scheme: light;
    --ink: #07101d;
    --ink-soft: #1d2838;
    --muted: #4c596b;
    --line: #cfd8e5;
    --line-soft: #e2e8f1;
    --line-strong: #b9c6d9;
    --paper: #f4f6fa;
    --page: #fff;
    --panel: #fff;
    --white: #fff;
    --blue-text: #0549b0;
    --link-line: transparent;
    --mark-bg: transparent;
    --code-bg: #eef2f8;
    --code-border: #d5deeb;
    --code-text: #0a2f6b;
    --code-line: #d5deeb;
    --codeblock-bg: #f4f6fa;
  }
  html,
  body {
    background: #fff !important;
    color: #07101d !important;
  }

  /* Page furniture and on-screen controls. */
  .site-header,
  .site-footer,
  [data-rs-header],
  [data-company-footer],
  .docs__sidebar,
  .docs__aside,
  .docs__footer,
  .docs__pager,
  .rs-section,
  .rs-after,
  #subscribe,
  .rs-resources,
  .rs-figure-note,
  .rs-meta-inline,
  .rs-react,
  .rs-tools,
  .skip-link,
  .orz-zoom-btn,
  .orz-zoom-placeholder,
  .orz-card,
  .orz-article-toast,
  .orz-share-toast,
  .ref-back,
  dialog,
  [data-cite-open],
  [data-copy-ai],
  [data-print-hide] {
    display: none !important;
  }

  .docs,
  .docs.rs-article,
  main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .docs__article {
    max-width: none !important;
    padding: 0 !important;
  }

  /* First page: section label, title, publisher line, standfirst. */
  .docs__header {
    margin: 0 0 7mm !important;
    padding: 0 0 5mm !important;
    border-bottom: 1px solid #cfd8e5 !important;
  }
  .docs__section {
    color: #4c596b !important;
  }
  .docs__header h1 {
    color: #07101d !important;
    font-size: 22pt !important;
    line-height: 1.12 !important;
  }
  .orz-print-meta {
    display: block !important;
    margin: 3mm 0 0 !important;
    color: #4c596b !important;
    font: 600 8.5pt/1.5 var(--body) !important;
    overflow-wrap: anywhere;
  }
  .rs-standfirst {
    max-width: none !important;
    margin-top: 4mm !important;
    color: #1d2838 !important;
    font-size: 11pt !important;
    line-height: 1.55 !important;
  }

  /* Body. */
  .docs-prose {
    max-width: none !important;
    color: #1d2838 !important;
    font-size: 10pt !important;
    line-height: 1.6 !important;
  }
  .docs-prose h2 {
    margin: 8mm 0 3mm !important;
    padding-top: 0 !important;
    border-top: 0 !important;
    font-size: 15pt !important;
    break-after: avoid;
    page-break-after: avoid;
  }
  .docs-prose > h2:first-child {
    margin-top: 0 !important;
  }
  /* The three section dividers (after the TL;DR block, before the conclusion, before the references). */
  .docs-prose hr.orz-rule {
    height: 0 !important;
    margin: 7mm 0 0 !important;
    border: 0 !important;
    border-top: 1px solid #cfd8e5 !important;
    break-after: avoid;
    page-break-after: avoid;
  }
  .docs-prose hr.orz-rule + * {
    margin-top: 5mm !important;
  }
  .docs-prose h3 {
    margin: 6mm 0 2mm !important;
    font-size: 12pt !important;
    break-after: avoid;
    page-break-after: avoid;
  }
  .docs-prose h4 {
    break-after: avoid;
    page-break-after: avoid;
  }
  .docs-prose p,
  .docs-prose li {
    orphans: 3;
    widows: 3;
  }

  /* Keep these whole on one page when they fit. A code block keeps its own frame whole, but the code inside it
     may break, so a block taller than a page continues on the next page with its bar on the first lines and no
     page holds only the bar (2026-10-17, Core: 60 and 71 line blocks). */
  .docs-prose figure,
  .docs-prose .rfig,
  .docs-prose .orz-zoomable,
  .docs-prose table,
  .docs-prose .code-block,
  .docs-prose > pre,
  .docs-prose blockquote,
  .docs-prose .math--display,
  .docs-prose .wp-block-group,
  .docs-prose img,
  .docs-prose p.has-text-align-center {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .docs-prose .orz-code__bar {
    break-after: avoid;
    page-break-after: avoid;
  }
  /* The disclaimer box sits after the article body (site.js, outside .docs-prose) and split across two pages of a
     long Economy article (W7 writer report 2026-10-18). */
  .rs-disclaimer {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* A figure taller than a page has to break; it breaks between rungs and boxes, never through one (a ladder split
     inside its last rung, W7 writer report 2026-10-18). */
  .docs-prose .rfig-rung,
  .docs-prose .rfig-node {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* A figure that has to break (taller than a page at paper width) kept its sheet on one page and pushed only the
     caption to the next; the caption stays with the end of its figure (W7 writer reports 2026-10-18). */
  .docs-prose .rfig-cap,
  .docs-prose figure > figcaption {
    break-before: avoid;
    page-break-before: avoid;
  }
  /* Taller than a page: it would start on a fresh page anyway and leave an almost empty page before it, so it
     continues from where it stands (code.js marks blocks over 55 lines). */
  .docs-prose .code-block[data-tall] {
    break-inside: auto;
    page-break-inside: auto;
  }
  /* A tall block's lines break across the page, never leaving one or two lines alone on either side. */
  .docs-prose .code-block[data-tall] pre {
    orphans: 4;
    widows: 4;
  }
  /* Halo labels of figure drawings: the white stroke behind the letters becomes a second text run in PDF text,
     so copying from a PDF doubled every letter. Paper needs no halo. */
  .docs-prose .rfig-svg .s-cond,
  .docs-prose .rfig-svg .s-halo,
  .docs-prose .rfig svg text {
    stroke: none !important;
    paint-order: normal !important;
  }
  .docs-prose .orz-zoomable + p.has-text-align-center,
  .docs-prose figure + p.has-text-align-center {
    break-before: avoid;
    page-break-before: avoid;
  }
  .docs-prose thead {
    display: table-header-group;
  }
  .docs-prose tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .docs-prose figure.wp-block-table {
    overflow: visible !important;
  }

  /* Older live diagrams come in a desktop drawing and a phone copy: paper gets the drawing. */
  .docs-prose [class$="-desktop"] {
    display: block !important;
  }
  .docs-prose [class$="-mobile"] {
    display: none !important;
  }
  .docs-prose svg,
  .docs-prose img {
    max-width: 100% !important;
    height: auto;
  }

  /* Code: light ground, dark text, wrapped lines. */
  .docs-prose .code-block {
    border-color: #d5deeb !important;
    background: #f4f6fa !important;
  }
  .docs-prose .code-block::before {
    border-color: #d5deeb !important;
    color: #4c596b !important;
  }
  .docs-prose .code-block pre,
  .docs-prose pre {
    overflow: visible !important;
    background: transparent !important;
    color: #07101d !important;
    font-size: 8.3pt !important;
    line-height: 1.55 !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere;
  }
  .docs-prose .code-block pre span {
    color: #07101d !important;
  }

  /* Formulas print whole. */
  .docs-prose .math--display {
    overflow: visible !important;
  }

  /* Links read as text; only the reference list prints addresses. */
  .docs-prose a {
    color: inherit !important;
    font-weight: inherit !important;
    text-decoration: none !important;
  }
  .docs-prose a.ref {
    color: #0549b0 !important;
    font-weight: 600 !important;
  }
  .docs-prose .orz-ref-entry a {
    color: #0549b0 !important;
    overflow-wrap: anywhere;
  }
  .docs-prose .orz-ref-entry a[data-print-href]::after {
    content: " <" attr(data-print-href) ">";
    color: #4c596b;
    overflow-wrap: anywhere;
  }
}
