/* ============================================================================
   print.css — paper rules for the archive

   Two jobs. It makes any article view printable from the browser's own Print
   dialog, and it is what build/make-article-pdf.js drives headless Chrome
   against, so the downloadable PDF and the page are the same document rather
   than two texts that drift apart.

   Everything here sits inside @media print. Nothing in this file can affect
   the screen.
   ============================================================================ */
@media print {

  /* ---- page furniture ---- */
  @page { size: A4; margin: 20mm 18mm 22mm; }
  @page :first { margin-top: 16mm; }

  html, body {
    background: #fff !important;
    /* paper is not a screen: fixed light tokens whatever the reader's theme */
    color-scheme: light !important;
  }

  /* No compositing on paper.
     Every blur, blend, shadow and promoted layer forces Chrome to rasterise
     that element and, for anything page-sized, to emit a full-page soft mask
     per page. Left alone this article printed at 24 MB across 26 pages: 25 of
     those pages carried an 846x1241 greyscale alpha mask of their own. Vector
     text and vector figures cost almost nothing, so the whole lot comes off
     and the PDF stays a vector document. */
  *, *::before, *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    mix-blend-mode: normal !important;
    filter: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    will-change: auto !important;
    animation: none !important;
    transition: none !important;
  }

  /* ---- fixed overlays come off first ----
     A position:fixed element is painted on EVERY printed page. The page
     transition veil (#oaVeil) is viewport-sized and carries a gradient, so
     it printed as one full-page alpha mask per page: 25 masks, 18 MB. Kill
     the whole class of them, not just the veil. */
  .oa-grain,
  #oaVeil,
  #readingProgress,
  .oatoc-scrim, .oatoc-sheet, .oatoc-fab, .oatoc-spine, .oatoc-hit,
  .gl-toast, .yu-toast, .yu-scrim, .yu-drawer { display: none !important; }

  /* ---- site chrome comes off ---- */
  nav[data-site-header],
  #footer,
  .oa-mobmenu,
  .oa-mobmenu-nav,
  .dc-view:not(.active),
  .oa-share-row,
  .oa-toc,
  .oa-ctawrap,
  .dl-lang,
  .oa-dl,
  #oaInstallStrip,
  .oa-tip { display: none !important; }

  /* ---- the article itself ---- */
  .oa-artview {
    background: #fff !important;
    color: #14110f !important;
    --bg:#fff; --surf:#fff; --surf2:#f7f5f1;
    --ink:#14110f; --ink2:#26221e; --ink3:#3a3531; --mut:#5d564e;
    --bd:#d8d2c7; --bds:#c6bfb2;
  }
  .oa-artview main { max-width: none; }

  /* reveal everything: the IntersectionObserver never fires off-screen, and a
     printed page has no scroll for it to fire on */
  .oa-artview [data-reveal],
  .oa-artview .oa-chap,
  .sf-fig, .sj-fig {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .a-fade, .a-rise, .a-pop, .a-draw, .a-gx, .a-gy, .a-grow,
  .sf-fig .a-fade, .sf-fig .a-rise, .sf-fig .a-pop, .sf-fig .a-draw {
    opacity: 1 !important; transform: none !important;
    stroke-dashoffset: 0 !important; transition: none !important;
  }

  /* ---- the hero becomes a title block, not a screen-height panel ---- */
  .oa-hero { min-height: 0 !important; padding: 0 0 8mm !important; }
  .oa-hero-bg { display: none !important; }
  .oa-hero-h1 { font-size: 30pt !important; line-height: 1.12 !important; }
  .oa-hero-lede { font-size: 12pt !important; }
  .oa-byline { font-size: 9pt !important; }

  /* ---- typography for paper ---- */
  .oa-art { font-size: 10.5pt; line-height: 1.5; }
  .oa-h2 { font-size: 16pt; break-after: avoid; }
  .oa-h3 { font-size: 12pt; break-after: avoid; }
  .oa-chaphd { break-after: avoid; }
  .oa-chap { break-before: auto; }
  p { orphans: 3; widows: 3; }

  /* things that must not be torn across a page boundary */
  figure, .oa-thesis, .oa-epi, .oa-summary, .oa-widget,
  .oa-table tr, .sf-panel, .oa-srcs li { break-inside: avoid; }

  figure img, figure svg { max-width: 100% !important; }

  /* ---- links: keep them readable, drop the app-only ones ---- */
  a { color: inherit !important; text-decoration: none !important; }
  sup.oa-fn a { font-weight: 700; }

  /* ---- sources set tighter, they are the longest tail ---- */
  .oa-srcs { columns: 2 !important; font-size: 7.6pt !important; line-height: 1.4 !important; }

  /* ==========================================================================
     the shenfa instruments on paper
     Each one prints in its current state. The controls come off, because a
     printed slider is furniture; the readouts stay, because they carry the
     reading the figure is currently showing.
     ========================================================================== */
  #view-shenfa .sf-ctl-row:not(.sf-ctl-out) { display: none !important; }
  #view-shenfa .sf-fire { display: none !important; }
  #view-shenfa .sf-pulse { display: block !important; }
  #view-shenfa .sf-scrub { opacity: 1 !important; }
  #view-shenfa .sf-panel { background: #f7f5f1 !important; }

  #view-shenfa .sf-stage { min-height: 0 !important; }
}
