/* Home page only (loaded by css('@auto') in header.php). The canvas rules apply in
   canvas mode only: they all hang on .home-canvas, drawn by site/snippets/home-canvas.php */

/* One column unit, from the screen width; the column counts come from HomePage (site/models/home.php) */
.home-canvas { --col: calc(100vw / var(--columns-phone)); }
@media (min-width: 768px) { .home-canvas { --col: calc(100vw / var(--columns-desktop)); } }
/* A phone turned sideways (short and wide): the column follows the height, with the phone's count,
   so the photos keep the size they have upright (iPhone: 393 / 1.667 = 236 px both ways) */
@media (orientation: landscape) and (max-height: 500px) { .home-canvas { --col: calc(100vh / var(--columns-phone)); } }

/* Prints and posters bring their own top and bottom margin and a width ceiling in px (inline style);
   on the canvas only its gaps count, and the column sets the width, on big screens too */
.home-canvas figure { margin-top: 0; margin-bottom: 0; max-width: none !important; }

/* The canvas cannot scroll by itself: a Tab press on an off-screen item would shift it (spec, drag point 14) */
.home-canvas { overflow: clip; }

/* Set by assets/js/home-canvas.js, so without JavaScript the page keeps its usual touch and selection.
   Touch goes to the drag (no browser panning, no pinch zoom); no text selection or ghost images while dragging */
.home-canvas.is-draggable { touch-action: none; user-select: none; -webkit-user-select: none; }
.home-canvas.is-draggable a,
.home-canvas.is-draggable img { -webkit-user-drag: none; }
/* Header and footer stay transparent above the canvas; only their links catch clicks */
body:has(.home-canvas) > header,
body:has(.home-canvas) > footer { position: relative; z-index: 10; pointer-events: none; }
body:has(.home-canvas) > header a,
body:has(.home-canvas) > footer a { pointer-events: auto; }

/* Page and Link posters (site/snippets/canvas-poster.php). "En exergue" draws the poster bigger around
   its center (--exergue, from HomePage::CANVAS_EXERGUE); its place on the desk does not change, so the space around it is tighter, on purpose */
.home-canvas .is-exergue > a { transform: scale(var(--exergue)); }
/* The caption hangs in the gap under the image, so the desk does not change; under an exergue
   poster it starts at the bigger image's bottom left corner */
.home-canvas figcaption { position: absolute; top: 100%; left: 0; }
.home-canvas .is-exergue > figcaption {
  top: calc(100% + (var(--exergue) - 1) / 2 * 100%);
  left: calc((1 - var(--exergue)) / 2 * 100%);
}
/* Dev mode (?grid, debug on only): each item's spot on the desk, A1 to E7, on its top-left corner (site/snippets/home-canvas.php) */
.home-canvas .canvas-spot { position: absolute; top: 0; z-index: 1; pointer-events: none; padding: 2px 4px; color: var(--color-red-500); font: 700 13px/1 ui-monospace, monospace; }
