/* Google Photos Album Gallery */
.gpag { --gpag-cols: 4; --gpag-gap: 10px; --gpag-radius: 8px; margin: 1.5em 0; }
.gpag__title { margin: 0 0 .75em; }
.gpag__item { display: block; overflow: hidden; border-radius: var(--gpag-radius); background: #eee; position: relative; cursor: zoom-in; }
.gpag__item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease, filter .4s ease; margin: 0; max-width: none; }
.gpag__item:hover img, .gpag__item:focus-visible img { transform: scale(1.05); filter: brightness(1.05); }
.gpag__item:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }
.gpag__more { margin-top: 1em; text-align: center; font-size: .95em; }

/* Grid: even square tiles */
.gpag--grid .gpag__items { display: grid; grid-template-columns: repeat(var(--gpag-cols), 1fr); gap: var(--gpag-gap); }
.gpag--grid .gpag__item { aspect-ratio: 1 / 1; }

/* Masonry: natural proportions in columns */
.gpag--masonry .gpag__items { column-count: var(--gpag-cols); column-gap: var(--gpag-gap); }
.gpag--masonry .gpag__item { break-inside: avoid; margin-bottom: var(--gpag-gap); }
.gpag--masonry .gpag__item img { height: auto; }

/* Justified: rows of equal height, like Google Photos */
.gpag--justified .gpag__items { display: flex; flex-wrap: wrap; gap: var(--gpag-gap); }
.gpag--justified .gpag__items::after { content: ""; flex-grow: 999; }
.gpag--justified .gpag__item { height: 220px; flex-grow: calc(var(--gpag-ratio) * 100); flex-basis: calc(var(--gpag-ratio) * 220px); }

@media (max-width: 900px) {
	.gpag--grid .gpag__items { grid-template-columns: repeat(min(var(--gpag-cols), 3), 1fr); }
	.gpag--masonry .gpag__items { column-count: min(var(--gpag-cols), 3); }
	.gpag--justified .gpag__item { height: 160px; flex-basis: calc(var(--gpag-ratio) * 160px); }
}
@media (max-width: 520px) {
	.gpag--grid .gpag__items { grid-template-columns: repeat(2, 1fr); }
	.gpag--masonry .gpag__items { column-count: 2; }
	.gpag--justified .gpag__item { height: 120px; flex-basis: calc(var(--gpag-ratio) * 120px); }
}

/* Lightbox */
.gpag-lb { position: fixed; inset: 0; z-index: 999999; background: rgba(10,10,12,.94); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity .25s ease; touch-action: pan-y; }
.gpag-lb.is-open { opacity: 1; visibility: visible; }
.gpag-lb__img { max-width: 92vw; max-height: 86vh; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); border-radius: 4px; transition: opacity .2s ease; }
.gpag-lb__img.is-loading { opacity: .3; }
.gpag-lb button { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0; cursor: pointer; border-radius: 50%; width: 48px; height: 48px; font-size: 26px; line-height: 48px; padding: 0; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.gpag-lb button:hover, .gpag-lb button:focus-visible { background: rgba(255,255,255,.25); outline: none; }
.gpag-lb__close { top: 16px; right: 16px; }
.gpag-lb__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.gpag-lb__next { right: 16px; top: 50%; transform: translateY(-50%); }
.gpag-lb__count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.75); font: 14px/1.4 system-ui, sans-serif; }
@media (max-width: 600px) { .gpag-lb__prev, .gpag-lb__next { top: auto; bottom: 8px; transform: none; } }
body.gpag-lb-open { overflow: hidden; }
