/* Gallery mosaic. ONE file for the public site and the live preview in the panel (which loads it
   from the site), so both always look the same. Only .mosaic* and .m-* classes: nothing else is touched.
   Columns follow the width of the container, not of the screen: 2 in the phone column, 3 or 4 when wider. */
.mosaic-wrap { container: mosaic / inline-size; }
.mosaic { --cols: 2; --gap: 6px; list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: 180px;   /* browsers without container units */
  grid-auto-rows: calc((100cqi - (var(--cols) - 1) * var(--gap)) / var(--cols));   /* square cells */
  grid-auto-flow: dense; }   /* later photos fill the holes left by wide or tall ones */
@container mosaic (min-width: 560px) { .mosaic { --cols: 3; } }
@container mosaic (min-width: 740px) { .mosaic { --cols: 4; } }

/* Cell sizes: normal 1×1, wide 2×1, tall 1×2, large 2×2 */
.m-wide { grid-column: span 2; }
.m-tall { grid-row: span 2; }
.m-large { grid-column: span 2; grid-row: span 2; }

/* The blurred preview (a tiny data URI in the style attribute) fills the cell while the photo loads */
.m-item { position: relative; overflow: hidden; border-radius: 10px; background: #d9d4cb center / cover no-repeat; }
.m-item::before { content: ""; position: absolute; inset: -12px; background: inherit; filter: blur(10px); }
.m-item img { position: relative; display: block; width: 100%; height: 100%; object-fit: cover;
  transition: opacity .45s ease, transform .6s ease; }
.m-item img.wait { opacity: 0; }   /* set by the page only on photos not loaded yet: they fade in */
@media (hover: hover) { .m-item:hover img { transform: scale(1.05); } }   /* soft zoom inside the cell */

/* On the home page each thumbnail opens the gallery page at that photo */
.m-item a { position: relative; display: block; width: 100%; height: 100%; }
.m-item a:focus-visible { outline: 3px solid #c8913a; outline-offset: -3px; border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
  .m-item img { transition: none; }
  .m-item:hover img { transform: none; }
}
