:root {
	--galleryBodyHeight: 200px;
	--galleryEdgeFadeWidth: 80px;
	--galleryMediaGap: 20px;
}

.gallery-title {
	color: var(--textColor);
}

@media (max-width: 768px) {
	.gallery-title {
		text-align: center;
	}
}

.gallery-body {
	max-width: var(--desktopSize);
	width: 100%;
	margin: 0 auto;
}

.gallery-track {
	position: relative;
}

.gallery-scroll {
	display: flex;
	align-items: center;
	gap: var(--galleryMediaGap);
	height: calc(var(--galleryBodyHeight) + 4px);
	overflow-x: auto;
	overflow-y: hidden;
	padding: 2px var(--galleryEdgeFadeWidth);
	scrollbar-width: none;
	touch-action: pan-y;
	cursor: grab;
	user-select: none;
}

.gallery-scroll::-webkit-scrollbar {
	display: none;
}

.gallery-scroll.is-dragging {
	cursor: grabbing;
}

.gallery-item {
	position: relative;
	flex: 0 0 auto;
	height: var(--galleryBodyHeight);
	width: calc(var(--galleryBodyHeight) * 16 / 9); /* width = height * 16/9 to keep aspect ratio */
}

.gallery-item:not(:last-child)::after {
	content: "";
	position: absolute;
	top: 50%;
	left: calc(100% + ((var(--galleryMediaGap) - 1px) / 2));
	transform: translateY(-50%);
	width: 1px;
	height: 100%;
	background: linear-gradient(to bottom, transparent 0%, var(--textColor) 50%, transparent 100%);
}

.gallery-media {
	position: relative;
	display: block;
	box-sizing: border-box;
	appearance: none;
	height: 100%;
	width: 100%;
	border: 1px solid transparent;
	border-radius: 4px;
	background: transparent;
	padding: 0;
	cursor: pointer;
	overflow: hidden;
	transform: translate(0, 0);
	transition: transform 200ms ease, border-color 200ms ease;
	will-change: transform;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	outline: none;
}

.gallery-media:hover,
.gallery-media:focus-visible {
	transform: translate(-2px, -2px);
	border-color: var(--accentColor);
}

.gallery-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 4px;
	image-rendering: auto;
	transform: translateZ(0);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	-webkit-user-drag: none;
	user-select: none;
	pointer-events: none;
}

.gallery-edge {
	position: absolute;
	top: 0;
	bottom: 0;
	width: var(--galleryEdgeFadeWidth);
	pointer-events: none;
	z-index: 2;
}

.gallery-edge-left {
	left: 0;
	background: linear-gradient(to right, var(--fontColor), transparent);
}

.gallery-edge-right {
	right: 0;
	background: linear-gradient(to left, var(--fontColor), transparent);
}

.gallery-viewer {
	position: fixed;
	inset: 0;
	background: transparent;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
}

.gallery-viewer[hidden] {
	display: none;
}

.gallery-viewer-image {
	/* max-width: min(90vw, 1400px); */
	max-width: min(90vw, var(--desktopSize));
	max-height: 86vh;
	width: auto;
	height: auto;
/*	border: 2px solid var(--textColor); */
}

.gallery-viewer-close {
	position: absolute;
	top: 24px;
	right: 24px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--textColor);
	background: rgba(0, 0, 0, 0.4);
	color: var(--textColor);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	line-height: 1;
	font-family: inherit;
	cursor: pointer;
}

.gallery-viewer-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 64px;
	border: 1px solid var(--textColor);
	background: rgba(0, 0, 0, 0.4);
	color: var(--textColor);
	font-size: 34px;
	line-height: 1;
	cursor: pointer;
}

.gallery-viewer-prev {
	left: 24px;
}

.gallery-viewer-next {
	right: 24px;
}

body.gallery-viewer-open {
	overflow: hidden;
}
