/* =========================================================================
   Cabinhub News — the article, on paper.

   Printed straight from the browser today, a story carries the site around
   it: the masthead, the market band, the nav row and its filter chips, the
   footer's link list, the Ember companion and its island, the "back" link, the
   share/save/print buttons and the related shelf. And the kicker's time reads
   "3 hours ago" — a page with no date is not a document. This file makes the
   printed page a document: the story, its headline, its credit and its cited
   source, in one column, in absolute time, on white paper.

   Assimilation (see docs/OSS_PORT_PRINT.md for the full ten-pattern table):
     · HTML5 Boilerplate `@media print` block — MIT, verified against
       h5bp/html5-boilerplate v9.0.1. We take its mechanics: black ink on white,
       `a[href]::after { content: " (" attr(href) ")" }` for external links,
       and break-inside/orphans/widows page rules. Rewritten in our tokens and
       scoped to the story; no third-party bytes ship.
     · Mozilla Readability / Reader Mode — Apache-2.0. We take the principle
       only (the reader surface is the article, the chrome is not), not code:
       we already own our DOM, so the "strip" is a list of selectors, not an
       extractor.
   Everything is `@media print`, so not one screen pixel moves.
   ========================================================================= */

/* A fixed page margin and a paper-first type scale. `pt` on paper, not `rem`,
   so the reading size does not ride the reader's screen font preference. */
@page { margin: 16mm; }

@media print {
  /* ---- the reader surface: the story, not the site --------------------- */
  .skip-link,
  .masthead,
  .rail,
  .mk-slot,
  .mk-strip,
  .toolbar,
  .filters,
  .colophon,
  .saved,
  .reading-progress,
  .detail__back,
  .detail__notice,
  .detail__actions,
  .act,
  .related,
  .storyline,
  .mascot,
  #ember-companion,
  #ember-island,
  .ember-island-host,
  [data-ember-island],
  .pwa-strip,
  .update-toast,
  .live-pill,
  .breaking,
  .boot,
  .toc,
  [data-toc] {
    display: none !important;
  }

  /* ---- paper and ink --------------------------------------------------- */
  /* The reader may have chosen the dark theme; a printed dark page is a wet
     black sheet. Force light-on-paper regardless of data-theme. */
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  .detail,
  .detail * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* One column: the aside (market/entities/compliance) and the Reference
     panel stack under the story instead of sitting in a side track a printer
     clips at the margin. */
  .detail {
    max-width: none;
    margin: 0;
    animation: none !important;
  }
  .detail__body {
    display: block;
  }
  .detail__aside {
    margin-top: 1.4rem;
    padding-top: 0.8rem;
    border-top: 1px solid #000;
  }

  .detail__head,
  .sheet,
  .sheet__section {
    max-width: none;
  }
  .detail__title {
    font-size: 20pt;
    line-height: 1.25;
  }
  .detail__deck,
  .prose,
  .prose p,
  .claim__text,
  .claim__span {
    font-size: 11pt;
    line-height: 1.55;
    color: #000;
  }

  /* ---- the date, absolutely ------------------------------------------- */
  /* The kicker prints "3 hours ago" on screen. app.js already writes the
     absolute stamp into the <time title> (absoluteTime, UTC), so on paper the
     relative word is collapsed to nothing and the title is what prints. No
     DOM change, no second formatter to drift from the screen's. */
  .detail__kicker time {
    font-size: 0;
    line-height: 0;
  }
  .detail__kicker time::after {
    content: attr(title);
    font-size: var(--fs-label, 11pt);
    line-height: 1.4;
  }

  /* ---- the source address, in full ----------------------------------- */
  /* A printed link is a dead link unless the address is on the page. The
     story's cited source is the fact a reader takes to the desk; print it. */
  .detail a[href^="http"]::after,
  .attribution__link::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #444;
    overflow-wrap: anywhere;
    word-break: break-all;
  }
  .attribution {
    font-size: 10pt;
    color: #000;
  }
  .attribution__link {
    color: #000;
  }

  /* ---- nothing clipped, nothing split across a sheet ------------------ */
  img,
  .thumb__img,
  figure {
    max-width: 100% !important;
    height: auto !important;
  }
  figure,
  blockquote,
  .claim,
  .signoff,
  tr {
    break-inside: avoid;
  }
  h1, h2, h3,
  .detail__title,
  .section-label {
    break-after: avoid;
  }
  .prose p,
  .claim__text {
    orphans: 3;
    widows: 3;
  }
  pre,
  .claim__span {
    white-space: pre-wrap !important;
  }

  /* ---- Chinese on paper ---------------------------------------------- */
  /* cjk.css is scoped to html[lang="zh-Hans"]. A zh story opened through an en
     shell (a deep link into the other edition) carries lang on the <article>,
     not the root, so without this a printed Chinese article loses its 1.8
     leading and its anywhere-wrapping and clips at the page edge. */
  .detail[lang="zh-Hans"] .detail__title,
  .detail[lang="zh-Hans"] .detail__deck,
  .detail[lang="zh-Hans"] .prose,
  .detail[lang="zh-Hans"] .prose p,
  .detail[lang="zh-Hans"] .claim__text,
  .detail[lang="zh-Hans"] .claim__span {
    word-break: normal;
    overflow-wrap: anywhere;
  }
  .detail[lang="zh-Hans"] .prose,
  .detail[lang="zh-Hans"] .prose p,
  .detail[lang="zh-Hans"] .claim__text {
    line-height: 1.8;
  }
  .detail[lang="zh-Hans"] .detail__title {
    line-height: 1.4;
  }
}
