/* Album Gallery for Flickr: front end. Mobile first; the columns come from CSS variables set per gallery. */

.agff-gallery {
	--agff-cols: 4;
	--agff-cols-t: 3;
	--agff-cols-m: 2;
	--agff-gap: 16px;
	--agff-current: var(--agff-cols-m);
	--agff-tint: rgba(127, 127, 127, 0.12);
}

.agff-gallery *,
.agff-gallery *::before,
.agff-gallery *::after {
	box-sizing: border-box;
}

@media (min-width: 600px) {
	.agff-gallery {
		--agff-current: var(--agff-cols-t);
	}
}

@media (min-width: 1024px) {
	.agff-gallery {
		--agff-current: var(--agff-cols);
	}
}

.agff-gallery ul.agff-albums,
.agff-gallery ul.agff-photos {
	display: grid;
	grid-template-columns: repeat(var(--agff-current), minmax(0, 1fr));
	gap: var(--agff-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

.agff-gallery .agff-album,
.agff-gallery .agff-photo {
	list-style: none;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.agff-gallery img {
	display: block;
	max-width: 100%;
	height: auto;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* Album cards */

.agff-album__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.agff-album__cover {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 6px;
	background: var(--agff-tint);
}

.agff-gallery .agff-album__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top;
	transition: transform 0.25s ease;
}

.agff-album__link:hover img,
.agff-album__link:focus-visible img {
	transform: scale(1.04);
}

.agff-album__title {
	display: block;
	margin-top: 0.6em;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.agff-album__count {
	display: block;
	margin-top: 0.15em;
	font-size: 0.875em;
	opacity: 0.7;
}

/* Photos */

.agff-photo__link {
	display: block;
	overflow: hidden;
	border-radius: 4px;
	background: var(--agff-tint);
	cursor: zoom-in;
}

.agff-photo__link:focus-visible,
.agff-album__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.agff-layout-fit .agff-photo__link,
.agff-layout-crop .agff-photo__link {
	aspect-ratio: 1;
}

.agff-gallery.agff-layout-fit .agff-photo img,
.agff-gallery.agff-layout-crop .agff-photo img {
	width: 100%;
	height: 100%;
}

.agff-gallery.agff-layout-fit .agff-photo img {
	object-fit: contain;
}

.agff-gallery.agff-layout-crop .agff-photo img {
	object-fit: cover;
}

.agff-gallery.agff-layout-masonry ul.agff-photos {
	display: block;
	columns: var(--agff-current);
	column-gap: var(--agff-gap);
}

.agff-layout-masonry .agff-photo {
	break-inside: avoid;
	margin-bottom: var(--agff-gap);
}

.agff-gallery.agff-layout-masonry .agff-photo img {
	width: 100%;
}

/* Text and paging */

.agff-heading {
	margin: 0 0 0.4em;
}

.agff-description {
	margin: 0 0 1em;
}

.agff-back {
	margin: 0 0 0.75em;
}

.agff-pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75em;
	margin-top: 1.5em;
}

.agff-button {
	display: inline-block;
	padding: 0.6em 1.4em;
	border: 1px solid currentColor;
	border-radius: 4px;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.agff-button:hover {
	background: var(--agff-tint);
}

.agff-button[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

.agff-status {
	margin: 0.75em 0 0;
	min-height: 1.4em;
	text-align: center;
	font-size: 0.875em;
}

.agff-credit {
	margin: 1em 0 0;
	font-size: 0.75em;
	opacity: 0.65;
	text-align: center;
}

.agff-message {
	padding: 0.75em 1em;
	border-radius: 4px;
	background: var(--agff-tint, rgba(127, 127, 127, 0.12));
}

/* Lightbox */

html.agff-locked {
	overflow: hidden;
}

.agff-lightbox {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.92);
	color: #fff;
	overflow: hidden;
}

.agff-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.92);
}

.agff-lightbox__stage {
	position: absolute;
	inset: 0 0 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.agff-lightbox__image {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: opacity 0.15s ease;
}

.agff-lightbox__image.is-loading {
	opacity: 0.25;
}

.agff-lightbox__bar {
	position: absolute;
	inset: auto 0 0;
	display: flex;
	align-items: center;
	gap: 1em;
	height: 72px;
	padding: 0 16px;
	font-size: 14px;
	line-height: 1.3;
}

.agff-lightbox__caption {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.agff-lightbox__count,
.agff-lightbox__flickr {
	flex: none;
	white-space: nowrap;
}

.agff-lightbox__flickr,
.agff-lightbox__flickr:hover,
.agff-lightbox__flickr:visited {
	color: #fff;
	text-decoration: underline;
}

.agff-lightbox button {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font: 400 28px/1 sans-serif;
	cursor: pointer;
	box-shadow: none;
}

.agff-lightbox button[hidden] {
	display: none;
}

.agff-lightbox button:hover,
.agff-lightbox button:focus-visible {
	background: rgba(255, 255, 255, 0.25);
	color: #fff;
}

.agff-lightbox button:focus-visible,
.agff-lightbox__flickr:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.agff-lightbox__close {
	top: 12px;
	right: 12px;
}

.agff-lightbox__prev,
.agff-lightbox__next {
	top: calc(50% - 60px);
}

.agff-lightbox__prev {
	left: 12px;
}

.agff-lightbox__next {
	right: 12px;
}

@media (max-width: 599px) {
	.agff-lightbox__stage {
		padding: 8px;
	}

	.agff-lightbox__prev,
	.agff-lightbox__next {
		width: 40px;
		height: 40px;
		font-size: 22px;
	}

	.agff-lightbox__prev {
		left: 4px;
	}

	.agff-lightbox__next {
		right: 4px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.agff-gallery .agff-album__cover img,
	.agff-lightbox__image {
		transition: none;
	}
}
