/*
 * Handball-Galerien: front-end styles.
 * Mobile first. Font and colors come from the theme; all rules use the
 * hbgal- prefix and touch no foreign elements.
 */

.hbgal-page {
	box-sizing: border-box;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 1.25rem 16px 3rem;
}

.hbgal {
	--hbgal-gap: 0.75rem;
	--hbgal-radius: 6px;
	--hbgal-line: rgba(127, 127, 127, 0.35);
	--hbgal-fill: rgba(127, 127, 127, 0.15);
	box-sizing: border-box;
	color: inherit;
	font: inherit;
}

.hbgal *,
.hbgal *::before,
.hbgal *::after {
	box-sizing: inherit;
}

.hbgal-heading {
	margin: 0 0 1rem;
}

.hbgal ul[role="list"] {
	list-style: none;
	margin: 0;
	padding: 0;
}

.hbgal-empty {
	margin: 1.5rem 0;
}

.hbgal-more {
	margin: 1.25rem 0 0;
}

/* Filter form */

.hbgal-filter {
	display: flex;
	flex-direction: column;
	gap: var(--hbgal-gap);
	margin: 0 0 1.25rem;
}

.hbgal-filter__field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.hbgal-filter__field select {
	width: 100%;
	min-height: 44px;
	font: inherit;
}

.hbgal-filter__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
}

.hbgal-button {
	min-height: 44px;
	padding: 0 1.25rem;
	border: 1px solid currentcolor;
	border-radius: var(--hbgal-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.hbgal-button:hover {
	background: var(--hbgal-fill);
}

@media (min-width: 600px) {
	.hbgal-filter {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-end;
	}

	.hbgal-filter__field {
		min-width: 12rem;
	}

	.hbgal-filter__field select {
		width: auto;
	}
}

/* Gallery tiles */

.hbgal-cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

@media (min-width: 480px) {
	.hbgal-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 900px) {
	.hbgal-cards {
		grid-template-columns: repeat(3, 1fr);
	}
}

.hbgal-card {
	height: 100%;
	border: 1px solid var(--hbgal-line);
	border-radius: var(--hbgal-radius);
	overflow: hidden;
}

.hbgal-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.hbgal-card__media {
	position: relative;
	display: block;
	aspect-ratio: 3 / 2;
	background: var(--hbgal-fill);
	overflow: hidden;
}

.hbgal-card__image {
	position: absolute;
	inset: 0;
	display: block;
	/* !important: WordPress and themes add inline width/height styles to images that appear inside post content (shortcodes). */
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
}

.hbgal-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	opacity: 0.6;
}

.hbgal-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.75rem;
}

.hbgal-card__team {
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	opacity: 0.8;
}

.hbgal-card__title {
	font-size: 1.1em;
	font-weight: 600;
	line-height: 1.3;
}

.hbgal-card__date {
	font-size: 0.9em;
	opacity: 0.8;
}

.hbgal-card__link:hover .hbgal-card__title,
.hbgal-card__link:focus-visible .hbgal-card__title {
	text-decoration: underline;
}

.hbgal-card__link:focus-visible,
.hbgal-grid__link:focus-visible,
.hbgal-lightbox button:focus-visible {
	outline: 3px solid currentcolor;
	outline-offset: -3px;
}

/* Pager */

.hbgal-pagination {
	margin: 1.5rem 0 0;
}

.hbgal-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hbgal-pagination a.page-numbers,
.hbgal-pagination span.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 0.75rem;
	border: 1px solid var(--hbgal-line);
	border-radius: var(--hbgal-radius);
	color: inherit;
	text-decoration: none;
}

.hbgal-pagination span.page-numbers.current {
	border-color: currentcolor;
	font-weight: 700;
}

/* Single gallery */

.hbgal-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.5rem;
	margin: 0 0 1rem;
}

.hbgal-facts__label {
	font-weight: 600;
}

.hbgal-count {
	margin: 0 0 0.75rem;
	opacity: 0.8;
}

.hbgal-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.5rem;
}

@media (min-width: 600px) {
	.hbgal-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: var(--hbgal-gap);
	}
}

@media (min-width: 900px) {
	.hbgal-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

.hbgal-grid__link {
	position: relative;
	display: block;
	aspect-ratio: 3 / 2;
	background: var(--hbgal-fill);
	border-radius: var(--hbgal-radius);
	overflow: hidden;
}

.hbgal-grid__image {
	position: absolute;
	inset: 0;
	display: block;
	/* !important: WordPress and themes add inline width/height styles to images that appear inside post content (shortcodes). */
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
}

/* Lightbox (built by hbgal-lightbox.js) */

html.hbgal-lightbox-open {
	overflow: hidden;
}

.hbgal-lightbox {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.94);
	color: #fff;
	overflow: hidden;
}

@supports (height: 100dvh) {
	.hbgal-lightbox {
		height: 100dvh;
	}
}

.hbgal-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.94);
}

.hbgal-lightbox__stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3.5rem 0.5rem 2.5rem;
	touch-action: pan-y;
}

.hbgal-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.hbgal-lightbox__image.is-loading {
	opacity: 0.4;
}

.hbgal-lightbox__button {
	position: absolute;
	z-index: 1;
	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-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.hbgal-lightbox__button[hidden] {
	display: none;
}

.hbgal-lightbox__button:hover {
	background: rgba(255, 255, 255, 0.25);
}

.hbgal-lightbox__close {
	top: 0.5rem;
	right: 0.5rem;
}

.hbgal-lightbox__prev,
.hbgal-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}

.hbgal-lightbox__prev {
	left: 0.5rem;
}

.hbgal-lightbox__next {
	right: 0.5rem;
}

.hbgal-lightbox__counter {
	position: absolute;
	right: 0;
	bottom: 0.5rem;
	left: 0;
	margin: 0;
	text-align: center;
	font-size: 0.9rem;
	opacity: 0.85;
}

@media (min-width: 900px) {
	.hbgal-lightbox__stage {
		padding: 3.5rem 5rem 2.5rem;
	}
}
