/* © 2026 MEK.txt. All rights reserved. Part of the MEK design system; not licensed for reuse. */
/* MEK design system · part: Illumination (boutique)
   A book's ornament in cells of the mono face, as a scribe's in a manuscript: a headpiece over a title, a large
   initial at the start of the text, a mark between parts, a tailpiece at the end, a frame studded in gilt. Cell art is
   a picture's rows as text and an ink for each cell (js/illumination.js colours it; the .cells format, DESIGN.md "Cell
   art"), drawn on the TUI grid (css/parts/tui.css), so its box drawing, block and shade glyphs join cell to cell and
   row to row.
   <pre class="tui cell-art center" aria-hidden="true" data-inks="g gilt" data-ink="ggg">░▒▓</pre>
   <p class="illuminated"><span class="tui drop-initial" aria-hidden="true" data-inks="r rubric" data-ink="…">…</span>Text…</p>
   <div class="ill-book tui"><pre class="ill-frame" aria-hidden="true"></pre>…the page…</div>   framed by mekIllum.frame
   Inks: .gilt and .rubric (tokens.css "Illumination"), and the TUI's .strong and .dim. Cell art is always in a .tui
   (pre.tui.cell-art, or a .cell-art inside a .tui block). Nothing moves.
   Opt-in: link it after mek.css and tui.css. In the mek.parts layer, so a project's own CSS wins over it. */

@layer mek.parts {

/* ---------- The inks ----------
   Gilt for ornament, rubric for a book's red: a part's name (.rubric on its words) and an initial's letter. Ornament
   only: never a control, a status or a link. */
.tui .gilt { color: var(--gilt); }
.rubric { color: var(--rubric); }   /* .strong and .dim are the TUI part's */

/* ---------- Cell art ----------
   As written, a cell a character, at its true size before the script colours it. Wider than its block (a headpiece
   past 51 cells on a 390px screen): cropped, centred, never scrolled or scaled. .center centres it in its block (its
   rows are padded to one width, so they keep in line). A <pre> inside a .tui block takes the block's cells. */
.cell-art { display: block; margin: 0; white-space: pre; overflow: hidden; break-inside: avoid; }
pre.tui.cell-art { overflow-x: hidden; }
.tui .cell-art { font: inherit; line-height: inherit; }
.cell-art.center { text-align: center; }

/* ---------- Drop initial ----------
   Its text's first letter drawn large: the drawing floats at the start of .illuminated, a cell's gap after it, on its
   own field (--gilt-ground), so the half blocks read against it; the text wraps beside it and runs on under it. In a
   .tui block it's a .drop-initial; in other text a .tui itself (class="tui drop-initial": the TUI grid, its rows never
   stretched, or the blocks part). Either way the script makes the float whole lines of its text tall, as laid out
   (a line box can round past a row), the drawing at the top and the field under the rest. Never selected or copied: the text
   keeps its letter (.drop-initial-letter, hidden from sight). */
.illuminated { display: flow-root; break-inside: avoid; }
.tui .illuminated, .tui.illuminated { white-space: pre-wrap; }
.drop-initial { float: left; margin-right: 1ch; white-space: pre; background: var(--gilt-ground);
  user-select: none; -webkit-user-select: none; }
.drop-initial-letter { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- A book page ----------
   A page of a book: 37 cells wide (fewer on a narrow screen, always whole cells, so the frame fits), its content two
   cells and a row in from the edge, on the theme's ground. mekIllum.frame(book) draws its double frame in the
   .ill-frame (--tui-edge, the theme's muted ink) and studs it in gilt, to its size, again when it changes size. */
.ill-book { position: relative; width: 37ch; max-width: 100%; width: round(down, min(37ch, 100%), 1ch);
  box-sizing: border-box; padding: 1lh 2ch; white-space: normal;
  background: var(--bg); color: var(--text); --tui-edge: var(--text-muted); }
.ill-book > :not(.ill-frame) { position: relative; }
.ill-book .ill-frame { position: absolute; inset: 0; margin: 0; font: inherit; line-height: inherit; color: var(--tui-edge); pointer-events: none; }
.ill-book .center { text-align: center; }
.ill-book .illuminated, .ill-book .rubric { margin-top: 1lh; }

} /* @layer mek.parts */
