/* Gallery grid + lightbox overlay. */
/*
 * The element's own DEFAULTS live in `loom.base`, the lowest cascade layer, so anything the
 * architect sets on the element (compiled into `loom.elements`) wins. Unlayered they would not:
 * unlayered CSS beats EVERY layer, which is why an icon's colour and size could be set in the
 * inspector, compiled correctly, and still never take effect. Only the element's own baseline
 * rule moves — the widget's internal machinery below stays unlayered so it keeps winning.
 */
@layer loom.base { .lm-gallery { display: grid; gap: 10px; grid-template-columns: repeat(var(--lm-gcols, 3), 1fr); } }
.lm-gallery[data-cols="1"]{--lm-gcols:1}.lm-gallery[data-cols="2"]{--lm-gcols:2}.lm-gallery[data-cols="3"]{--lm-gcols:3}
.lm-gallery[data-cols="4"]{--lm-gcols:4}.lm-gallery[data-cols="5"]{--lm-gcols:5}.lm-gallery[data-cols="6"]{--lm-gcols:6}
.lm-gallery-item { display: block; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.lm-gallery-item img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1/1; border-radius: 8px; object-position: var(--lm-focal, 50% 50%); }
/* Non-destructive aspect presets (E003): enumerable → no per-instance CSS. */
.lm-gallery-item[data-aspect="1-1"] img{aspect-ratio:1/1}
.lm-gallery-item[data-aspect="4-3"] img{aspect-ratio:4/3}
.lm-gallery-item[data-aspect="3-2"] img{aspect-ratio:3/2}
.lm-gallery-item[data-aspect="16-9"] img{aspect-ratio:16/9}
.lm-gallery-item[data-aspect="3-4"] img{aspect-ratio:3/4}
/* Column span ("resize"): a hero image occupies two columns at desktop. */
.lm-gallery-item[data-span="2"]{grid-column:span 2}
.lm-lightbox { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(2,6,23,.85); padding: 24px; }
.lm-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
.lm-lightbox-close { position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border: 0; border-radius: 999px; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; cursor: pointer; }
@media(max-width:640px){.lm-gallery{grid-template-columns:repeat(2,1fr)}.lm-gallery-item[data-span="2"]{grid-column:1/-1}}
