.apg-gallery,
.apg-gallery * {
	box-sizing: border-box;
}

.apg-gallery {
	--apg-gap: 8px;
	--apg-radius: 8px;
	--apg-height: clamp(320px, 54vw, 620px);
	--apg-surface: #f6f4ef;
	--apg-line: rgba(36, 34, 30, 0.12);
	--apg-text: #24221e;
	--apg-muted: #6f6a60;
	--apg-button: #ffffff;
	--apg-button-hover: #f6f4ef;
	--apg-focus: #7b6a49;
	width: 100%;
	max-width: 100%;
	color: var(--apg-text);
}

.apg-gallery a {
	color: inherit;
	text-decoration: none;
}

.apg-gallery__desktop {
	position: relative;
	display: grid;
	gap: var(--apg-gap);
	width: 100%;
	min-height: 240px;
	height: var(--apg-height);
	overflow: hidden;
	border-radius: var(--apg-radius);
	background: var(--apg-surface);
}

.apg-gallery--mosaic .apg-gallery__desktop {
	grid-template-columns: 2fr 1fr 1fr;
	grid-template-rows: 1fr 1fr;
}

.apg-gallery--split .apg-gallery__desktop {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-template-rows: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.apg-gallery--grid .apg-gallery__desktop {
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	grid-auto-rows: minmax(160px, 1fr);
	height: auto;
	min-height: 0;
}

.apg-gallery__tile {
	position: relative;
	display: block;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	background: var(--apg-surface);
	outline: 0;
}

.apg-gallery--mosaic .apg-gallery__tile--main {
	grid-row: 1 / -1;
}

.apg-gallery--split .apg-gallery__tile--main {
	grid-column: 1 / 3;
	grid-row: 1 / 3;
}

.apg-gallery--split .apg-gallery__tile--wide {
	grid-column: 3 / 5;
	grid-row: 1;
}

.apg-gallery--split .apg-gallery__tile--small:nth-of-type(3) {
	grid-column: 3;
	grid-row: 2;
}

.apg-gallery--split .apg-gallery__tile--small:nth-of-type(4) {
	grid-column: 4;
	grid-row: 2;
}

.apg-gallery__tile--grid {
	aspect-ratio: 4 / 3;
	border-radius: var(--apg-radius);
}

.apg-gallery__img,
.apg-gallery__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
	object-position: center;
	background: var(--apg-surface);
	transition: opacity 180ms ease, transform 220ms ease, filter 220ms ease;
}

.apg-gallery__tile:hover .apg-gallery__img,
.apg-gallery__slide:hover .apg-gallery__img {
	transform: scale(1.018);
	filter: saturate(1.02);
}

.apg-gallery__tile:focus-visible,
.apg-gallery__slide:focus-visible,
.apg-gallery__thumb:focus-visible,
.apg-gallery__seeall:focus-visible {
	outline: 2px solid var(--apg-focus);
	outline-offset: 3px;
}

.apg-gallery__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(20, 18, 15, 0.52);
	color: #ffffff;
	font-size: 17px;
	font-weight: 700;
	text-align: center;
}

.apg-gallery__seeall {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	min-height: 42px;
	padding: 10px 14px;
	border: 1px solid var(--apg-line);
	border-radius: 8px;
	background: var(--apg-button);
	color: var(--apg-text);
	box-shadow: 0 2px 8px rgba(20, 18, 15, 0.12);
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
	transition: background 160ms ease, border-color 160ms ease;
}

.apg-gallery__seeall:hover {
	background: var(--apg-button-hover);
	border-color: rgba(36, 34, 30, 0.22);
}

.apg-gallery__sources {
	display: none;
}

.apg-gallery__mobile {
	display: none;
}

.apg-gallery-placeholder {
	padding: 28px 20px;
	border: 1px dashed rgba(36, 34, 30, 0.24);
	border-radius: 8px;
	background: #fbfaf7;
	color: #6f6a60;
	font-size: 14px;
	line-height: 1.45;
	text-align: center;
}

.apg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	background: rgba(12, 11, 10, 0.92);
	color: #ffffff;
}

.apg-lightbox.is-open {
	display: block;
}

.apg-lightbox__stage {
	position: absolute;
	inset: 56px 72px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.apg-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.apg-lightbox__button {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
	cursor: pointer;
	font-size: 24px;
	line-height: 1;
	transition: background 160ms ease, border-color 160ms ease;
}

.apg-lightbox__button:hover {
	background: rgba(255, 255, 255, 0.18);
	border-color: rgba(255, 255, 255, 0.32);
}

.apg-lightbox__button:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 3px;
}

.apg-lightbox__close {
	top: 18px;
	right: 18px;
}

.apg-lightbox__prev {
	top: 50%;
	left: 18px;
	transform: translateY(-50%);
}

.apg-lightbox__next {
	top: 50%;
	right: 18px;
	transform: translateY(-50%);
}

.apg-lightbox__counter {
	position: absolute;
	left: 18px;
	bottom: 18px;
	color: rgba(255, 255, 255, 0.78);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
	.apg-gallery__desktop {
		display: none;
	}

	.apg-gallery__mobile {
		display: block;
	}

	.apg-gallery__viewport {
		position: relative;
		overflow: hidden;
		border-radius: var(--apg-radius);
		background: var(--apg-surface);
	}

	.apg-gallery__track {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.apg-gallery__track::-webkit-scrollbar {
		display: none;
	}

	.apg-gallery__slide {
		flex: 0 0 100%;
		display: block;
		aspect-ratio: 4 / 3;
		scroll-snap-align: center;
		background: var(--apg-surface);
	}

	.apg-gallery__dots {
		position: absolute;
		left: 50%;
		bottom: 12px;
		display: flex;
		max-width: calc(100% - 32px);
		gap: 7px;
		justify-content: center;
		padding: 8px 10px;
		border: 1px solid rgba(255, 255, 255, 0.42);
		border-radius: 8px;
		background: rgba(255, 255, 255, 0.86);
		transform: translateX(-50%);
	}

	.apg-gallery__dot {
		width: 7px;
		height: 7px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: rgba(36, 34, 30, 0.28);
		cursor: pointer;
	}

	.apg-gallery__dot.is-active {
		background: var(--apg-text);
	}

	.apg-gallery__dot:nth-child(n+8) {
		display: none;
	}

	.apg-gallery__thumbs {
		display: flex;
		gap: 8px;
		margin-top: 10px;
		padding: 2px 0;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.apg-gallery__thumbs::-webkit-scrollbar {
		display: none;
	}

	.apg-gallery__thumb {
		flex: 0 0 auto;
		width: 72px;
		height: 54px;
		overflow: hidden;
		border: 1px solid transparent;
		border-radius: 7px;
		background: var(--apg-surface);
		opacity: 0.62;
		scroll-snap-align: start;
		transition: opacity 160ms ease, border-color 160ms ease;
	}

	.apg-gallery__thumb.is-active {
		border-color: var(--apg-text);
		opacity: 1;
	}

	.apg-lightbox__stage {
		inset: 64px 12px 72px;
	}

	.apg-lightbox__prev,
	.apg-lightbox__next {
		top: auto;
		bottom: 14px;
		transform: none;
	}

	.apg-lightbox__prev {
		left: 14px;
	}

	.apg-lightbox__next {
		right: 14px;
	}

	.apg-lightbox__counter {
		left: 50%;
		bottom: 27px;
		transform: translateX(-50%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.apg-gallery__img,
	.apg-gallery__thumb-img,
	.apg-gallery__seeall,
	.apg-lightbox__button {
		transition: none;
	}

	.apg-gallery__tile:hover .apg-gallery__img,
	.apg-gallery__slide:hover .apg-gallery__img {
		transform: none;
	}
}
