/* <art> (docs/quill.md §3.12): ASCII art and its painting in one box.
   The <pre> sets the box: one em of padding on every side and lines of
   1.25 em, the grid the paintings were made on (tools/art/splash_art.py:
   16px text, 20px lines, 16px padding), so the picture, stretched over the
   whole box, lies on the ASCII it was traced from. Which one shows: the
   reader's setting (<html data-art>, art.js) and each figure's flip. */
.quill-art {
  position: relative;
  display: inline-block;
  margin: 0;
  vertical-align: top;
  width: max-content;
}
/* the splash drawn over the game window's rows: art shrinks to its width */
.quill-splash {
  container-type: inline-size;
}
.quill-art > .quill-art-ascii {
  margin: 0;
  padding: 1em;
  line-height: 1.25;
  white-space: pre;
  tab-size: 8;
  font-family: var(--font, "JetBrains Mono", monospace);
  /* wide art shrinks to fit its place (a column is about 0.6 em; the
     padding 2 em): the width of the nearest .quill-splash, else the window */
  font-size: min(1em, calc((100cqi - 8px) / (var(--art-cols, 80) * 0.61 + 2)));
  transition: opacity 0.45s ease;
}
.quill-art > .quill-art-picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  pointer-events: none;
  border-radius: 3px;
  transition: opacity 0.45s ease;
}
/* the picture shows: by the setting (the default; a page with no setting
   shows it too), or flipped from the ASCII */
:root:not([data-art="ascii"]) .quill-art:not(.quill-art-flipped):not(.quill-art-nopic) > .quill-art-picture,
:root[data-art="ascii"] .quill-art.quill-art-flipped:not(.quill-art-nopic) > .quill-art-picture {
  opacity: 1;
}
:root:not([data-art="ascii"]) .quill-art:not(.quill-art-flipped):not(.quill-art-nopic) > .quill-art-ascii,
:root[data-art="ascii"] .quill-art.quill-art-flipped:not(.quill-art-nopic) > .quill-art-ascii {
  opacity: 0;
}
.quill-art > .quill-art-flip {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg, #000) 70%, transparent);
  color: var(--gilt, #d4b26a);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.quill-art:hover > .quill-art-flip,
.quill-art > .quill-art-flip:focus-visible {
  opacity: 1;
}
.quill-art.quill-art-nopic > .quill-art-flip {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .quill-art > .quill-art-ascii,
  .quill-art > .quill-art-picture {
    transition: none;
  }
}
/* the splash's rows held back until its painting is ready (splashhold.js):
   they keep their space; the live line below stays */
#lines > .rows > .splash-held,
#tail-lines > .rows > .splash-held,
#lines > .rows > .splash-held *,
#tail-lines > .rows > .splash-held * {
  visibility: hidden !important;
}
