/* Print: the Document on paper (spec §5 "Print").

   Linked by the page shell with media="print", so it is read only when a page is printed. It
   stands on the Document's rules (styles/site/20-document.css), which are not held under any
   mark of the root element; the Stage's rules are inside a screen media query and do not
   apply here, whatever form was in force when the Visitor pressed print.

   The page is printed in ink on white, in either theme: paper is outlined instead of
   shadowed, strings and turns are left out, the Companion and its Thread are a small mark at
   the top right, there are no controls, and no Entry is broken across pages. */

/* Ink on white, whichever theme is in force. Text set on the ground takes the colours of
   text set on paper, which are ink in both themes. */
:root:root {
  color-scheme: light;
  --label: var(--ink);
  --label-2: var(--ink-2);
  --label-3: var(--ink-3);
  --accent-text: var(--ink-accent);
  --accent: var(--ink-accent);
  --pencil: var(--ink-3);
  /* What shows through a punched hole is the sheet under it. */
  --hole: var(--paper-shade);
}

html,
body {
  background: none;
}

body {
  min-height: 0;
}

/* No controls, and nothing that only leads somewhere on a screen. */
button,
[data-needs-script],
[data-pull-cord],
[data-skip],
[data-soon] {
  display: none !important;
}

main {
  max-width: none;
  padding: 0;
}

[data-identity] {
  padding-top: 0;
  /* The name does not run under the mark at the top right. */
  padding-right: 110px;
}

[data-contact] a {
  min-height: 28px;
}

/* The Companion on a short piece of its Thread: a small mark at the top right. */
[data-perch] {
  position: absolute;
  right: 0;
  top: 0;
  width: 96px;
  height: 80px;
  margin: 0;
}

/* Wherever the scripts last moved it, and whichever way it faced: the drawing is moved, turned
   and mirrored by `translate`, `rotate` and `scale`, which `transform` does not reach, and by
   inline styles, which only `!important` overrides. */
[data-perch] [data-companion] {
  left: auto;
  right: 0;
  top: 0;
  width: 96px;
  height: 80px;
  transform: none !important;
  translate: none !important;
  rotate: none !important;
  scale: none !important;
  filter: none !important;
}

/* The Thread passes under its feet, which stand 76 down. */
[data-perch] [data-thread] {
  inset: auto;
  left: -12px;
  top: 0;
  width: 120px;
  height: 96px;
}

[data-perch] [data-thread] path {
  stroke-width: 1px;
}

/* Paper is outlined: no shadow, no turn, no cut edge, no string. The scripts move and turn a
   Slip and a Flag by inline `translate` and `rotate`: those are reset as well. */
[data-flag],
[data-slip],
[data-ribbon],
[data-contact] svg {
  filter: none;
  transform: none !important;
  translate: none !important;
  rotate: none !important;
  scale: none !important;
}

[data-slip] > article,
[data-ribbon] > div,
[data-flag] > * {
  border: var(--stroke-hairline) solid var(--string);
  background: none;
  clip-path: none;
}

[data-slips]::before,
[data-slip]::before,
[data-ribbon]::before {
  display: none;
}

[data-collection] {
  margin-top: var(--space-5);
}

[data-flag] {
  margin-left: 0;
  margin-bottom: var(--space-5);
}

/* An Entry is never broken across two pages. */
[data-slip] {
  margin: 0 0 20px;
  break-inside: avoid;
  page-break-inside: avoid;
}

[data-slip-inside]::before {
  display: none;
}

/* A heading stays with what it heads. */
h2,
h3 {
  break-after: avoid;
  page-break-after: avoid;
}

/* Ribbons four to a row, their rows as tall as their writing. */
:where(#skills) > div {
  grid-template-columns: repeat(4, 1fr);
  gap: 26px 10px;
  padding-top: 0;
}

:where(#skills, #about) > h2 {
  margin-left: 0;
}

[data-ribbon] {
  break-inside: avoid;
  page-break-inside: avoid;
}

[data-skill] {
  min-height: 24px;
}

[data-facts] {
  margin-left: 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

[data-closing] {
  margin: 24px 0 0;
}

/* The page for a missing address is not something to print well; it prints readable. */
main[data-not-found] {
  min-height: 0;
  background: none;
}
