/*
  Paper. The layout links this for print only and after every page's own stylesheets, so it never
  reaches the screen and wins over them. Any page prints black on white without the site's chrome.
  The encounter page prints its name and its cards, a result page its card alone and the stat block
  page its stat block alone. A card's own Print button prints that card alone.
  A card never splits across pages; at this size two usually share one.
*/
@page { margin: 12mm; }

/* Black on white in either theme, through the tokens every screen styles itself with. */
:root, .dark {
  color-scheme: light;
  --ui-page: #fff; --ui-card: #fff; --ui-inset: #fff; --ui-field: #fff;
  --ui-text: #000; --ui-muted: #000; --ui-keyword: #000; --ui-accent: #000; --ui-accent-soft: #fff;
  --ui-line: #999; --ui-card-line: #000; --ui-line-strong: #000; --ui-rule: #000; --ui-brass: #000;
  --ui-danger: #000; --ui-success: #000; --ui-shadow-card: none; --ui-shadow-pop: none;
}
html { font-size: 12px; }
/* Print buttons never print themselves. */
.skip-link, .site-header, .section-bar, .site-footer, main > .wrap:has(> .callout--success[role="status"]), [data-controller~="print"] { display: none; }
.wrap { max-width: none; padding-inline: 0; }

/* Cards */
.artifact, .encounter-block { break-inside: avoid; }
.artifact { font-size: 1rem; }
.artifact a { color: inherit; text-decoration: none; }

/* One card: its Print button marks it (print_controller.js), so nothing else on the page goes on paper.
   Its features print unfolded and its buttons stay off. */
main:has([data-print-card]) :not(:has([data-print-card]), [data-print-card], [data-print-card] *) { display: none; }
.artifact-grid:has(> [data-print-card]) { display: block; }
[data-print-card] :is(.artifact__actions, .artifact-fold__toggle) { display: none; }

/* Encounter: the name, then every card, without the list, the budget or anything to press. */
.encounter:not(.run) > :not(.page-head, .encounter-sheet),
.encounter:not(.run) .page-head :is(.eyebrow, .page-head__meta, .page-head__actions),
.encounter-cards > .section-title, .encounter-card__foot:not(:has(b)) { display: none; }
.encounter:not(.run) { padding: 0; }
.encounter .page-head { padding: 0 0 4mm; }
.encounter .page-head h1 { font-size: 18pt; }
.encounter-sheet, .encounter-cards { margin: 0; column-count: auto; }
.encounter-sheet .artifact-grid, .encounter-cards__blocks { display: block; }
.encounter-sheet .artifact, .encounter-block { margin: 0 0 5mm; }
/* Of the card's foot, only how many of it the encounter has. */
.encounter-card__foot { margin-top: 0; padding-top: 0; border: 0; font-size: 0; }
.encounter-card__foot b { font-size: 1rem; }

/* Result page: the card, without the brief, the chat, the copy buttons or the links below. */
.generation-page > :not(:has(.generation-results)),
.generation-page :has(> .generation-results) > :not(.generation-results),
.generation-card :is(.artifact__actions, .balance) { display: none; }
.generation-page :has(> .generation-results), .generation-results { display: block; max-width: none; }
/* Paper shows the card as it is now, without what the latest change did or the editor's pencil, whether
   or not the screen shows the marks. */
.artifact-was, .artifact-before, .artifact-tag--changed, .artifact-stat-link::after { display: none !important; }

/* Stat block page: the stat block alone, without the pictures, the exports or anything to press, even
   while the correction fields have taken its place. */
.workspace:has(.ocr-result-content .stat-block) :not(:has(.stat-block), .stat-block, .stat-block *) { display: none; }
/* One column whatever the paper's width, and the result even while a phone shows the pictures instead. */
.workspace .ocr-review { display: block; margin: 0; }
.workspace:has(.ocr-result-content .stat-block) .ocr-result-content[hidden] { display: block !important; }
/* As a size container the result could not break across pages, and its lines were cut at the page's edge. */
.workspace .ocr-result-content { container-type: normal; }
.workspace .ocr-result-content .stat-block-container { display: block; }
.ocr-result-content .stat-block:not(.wide) { max-width: 44rem; }

/* D&D stat blocks keep their rules and small capitals in black, without the parchment, at the cards'
   text size. A long one runs on to the next page instead of being cut off, and a wide one flows down two
   columns like a printed book's. */
.stat-block-container { text-align: left; }
.stat-block-container .stat-block { display: block; padding: 0; background: none; box-shadow: none; }
.stat-block-container .stat-block :is(.creature-heading, .property-line, .abilities, .actions) :is(h2, h3, h4, p) { border-color: #000; color: #000; }
.stat-block-container .stat-block :is(.property-line, .property-block) :is(h4, p) { font-size: 12px; }
.stat-block-container .stat-block .tapered-rule { background: #000; }
.stat-block-container .stat-block .orange-border { height: 1px; margin: 0 0 2mm; padding: 0; border: solid #000; border-width: 1px 0; background: none; }
.stat-block-container .stat-block .orange-border.bottom { margin: 3mm 0 0; }
.stat-block-container .stat-block.wide { column-count: 2; column-gap: 6mm; }
.stat-block-container .stat-block.wide .orange-border { column-span: all; }
.stat-block-container .stat-block.wide :is(.section-left, .section-right) { display: block; width: auto; margin: 0; }
.stat-block .property-block { break-inside: avoid; }
/* A section's title stays with its first entry, and has room for its capitals when it starts a page. */
.stat-block-container .stat-block .actions h3 { padding-top: .25em; break-after: avoid; }
