/*
 * Post gallery reference. The original theme draws the same looks with the post template's settings and rtthemes-blocks'
 * stylesheets (blocks/post-gallery: style.css, layouts/, effects/); this file serves Studio and the HTML baseline only.
 */
.rt-post-gallery {
	--rt-post-gallery-columns: 3;
	--rt-post-gallery-gap: var(--rt-spacing-40);
	display: flex;
	flex-direction: column;
	gap: var(--rt-spacing-40);
}

.rt-post-gallery [hidden] {
	display: none !important;
}

/* Filter */
.rt-post-gallery__filter {
	display: flex;
	flex-wrap: wrap;
	gap: var(--rt-spacing-20) var(--rt-spacing-40);
	font-size: var(--rt-font-size-small);
}

.rt-post-gallery__filter-link {
	padding-block: 0.25em;
	color: inherit;
	text-decoration: none;
	border-bottom: 2px solid transparent;
}

.rt-post-gallery__filter-link[aria-current] {
	border-bottom-color: var(--rt-color-accent);
}

.rt-post-gallery__arrows {
	display: flex;
	justify-content: flex-end;
	gap: var(--rt-spacing-20);
}

.rt-post-gallery__arrow {
	display: grid;
	place-content: center;
	width: 2.5rem;
	aspect-ratio: 1;
	padding: 0;
	color: var(--rt-color-contrast);
	background: none;
	border: 0;
	cursor: pointer;
}

/* Cards */
.rt-post-gallery__items {
	display: grid;
	grid-template-columns: repeat(var(--rt-post-gallery-columns), minmax(0, 1fr));
	gap: var(--rt-post-gallery-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.rt-post-gallery__item {
	min-width: 0;
}

@keyframes rt-post-gallery-enter {
	from {
		opacity: 0;
	}
}

.rt-post-gallery__item.rt-post-gallery__item--entering {
	animation: rt-post-gallery-enter 0.4s ease both;
}

@media (prefers-reduced-motion: reduce) {
	.rt-post-gallery__item.rt-post-gallery__item--entering {
		animation: none;
	}
}

.rt-post-gallery__image {
	margin: 0;
}

.rt-post-gallery__image img {
	display: block;
	width: 100%;
	height: auto;
}

.rt-post-gallery--grid .rt-post-gallery__image img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.rt-post-gallery__caption {
	display: flex;
	flex-direction: column;
	gap: var(--rt-spacing-20);
	padding: var(--rt-spacing-30);
}

.rt-post-gallery--grid .rt-post-gallery__caption {
	padding: var(--rt-spacing-30) 0 0;
}

.rt-post-gallery__title {
	margin: 0;
	font-size: var(--rt-font-size-medium);
}

.rt-post-gallery__title a,
.rt-post-gallery__terms a {
	color: inherit;
	text-decoration: none;
}

.rt-post-gallery__terms {
	font-size: var(--rt-font-size-small);
}

.rt-post-gallery__more {
	display: flex;
	justify-content: center;
}

.rt-post-gallery__more-link {
	padding: var(--rt-spacing-20) var(--rt-spacing-40);
	color: inherit;
	border: 1px solid currentColor;
}

@media (width <= 64rem) {
	.rt-post-gallery {
		--rt-post-gallery-columns: 2;
	}
}

@media (width <= 37.5rem) {
	.rt-post-gallery {
		--rt-post-gallery-columns: 1;
	}
}

/* Metro: square tiles, the first of every six spans two columns and two rows. */
.rt-post-gallery--metro {
	--rt-post-gallery-gap: var(--rt-spacing-20);
}

.rt-post-gallery--metro .rt-post-gallery__items {
	grid-auto-flow: dense;
}

.rt-post-gallery--metro .rt-post-gallery__item {
	display: flex;
	flex-direction: column;
	aspect-ratio: 1;
}

.rt-post-gallery--metro .rt-post-gallery__image {
	flex: 1 1 auto;
	min-height: 0;
}

.rt-post-gallery--metro .rt-post-gallery__image a {
	height: 100%;
}

.rt-post-gallery--metro .rt-post-gallery__image img {
	height: 100%;
	object-fit: cover;
}

@media (width > 37.5rem) {
	.rt-post-gallery--metro .rt-post-gallery__item:nth-child(6n + 1 of :not([hidden])) {
		grid-column: span 2;
		grid-row: span 2;
	}
}

/* Masonry */
@supports (display: grid-lanes) {
	.rt-post-gallery--masonry .rt-post-gallery__items {
		display: grid-lanes;
	}
}

@supports not (display: grid-lanes) {
	.rt-post-gallery--masonry .rt-post-gallery__items {
		grid-auto-rows: 1px;
		align-items: start;
	}
}

/* Carousel: one scrolling row, the visible cards are the columns. */
.rt-post-gallery--carousel .rt-post-gallery__items {
	grid-template-columns: none;
	grid-auto-columns: calc((100% - (var(--rt-post-gallery-columns) - 1) * var(--rt-post-gallery-gap)) / var(--rt-post-gallery-columns));
	grid-auto-flow: column;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.rt-post-gallery--carousel .rt-post-gallery__item {
	scroll-snap-align: start;
}

.rt-post-gallery--carousel .rt-post-gallery__image img {
	aspect-ratio: 1;
	object-fit: cover;
}

/* Hover: Zoom */
.rt-post-gallery--hover-zoom .rt-post-gallery__image {
	overflow: clip;
}

.rt-post-gallery--hover-zoom .rt-post-gallery__image img {
	transition: scale 0.6s cubic-bezier(0.2, 0, 0, 1);
}

.rt-post-gallery--hover-zoom .rt-post-gallery__item:is(:hover, :focus-within) .rt-post-gallery__image img {
	scale: 1.06;
}

/* Overlay hovers: the image and the caption share one grid cell. */
:is(.rt-post-gallery--hover-dark-fade, .rt-post-gallery--hover-slide-panel, .rt-post-gallery--hover-edge-title) .rt-post-gallery__item {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
}

:is(.rt-post-gallery--hover-dark-fade, .rt-post-gallery--hover-slide-panel, .rt-post-gallery--hover-edge-title) :is(.rt-post-gallery__image, .rt-post-gallery__caption) {
	grid-area: 1 / 1;
}

:is(.rt-post-gallery--hover-dark-fade, .rt-post-gallery--hover-slide-panel, .rt-post-gallery--hover-edge-title) .rt-post-gallery__caption {
	z-index: 1;
}

.rt-post-gallery--hover-dark-fade .rt-post-gallery__caption {
	align-items: center;
	justify-content: center;
	text-align: center;
	color: var(--rt-color-base);
	background-color: color-mix(in srgb, var(--rt-color-contrast) 70%, transparent);
	opacity: 0;
	transition: opacity 0.35s ease;
}

.rt-post-gallery--hover-dark-fade .rt-post-gallery__item:is(:hover, :focus-within) .rt-post-gallery__caption {
	opacity: 1;
}

.rt-post-gallery--hover-slide-panel .rt-post-gallery__caption {
	align-self: end;
	color: var(--rt-color-contrast);
	background-color: var(--rt-color-base);
	clip-path: inset(100% 0 0);
	translate: 0 0.75rem;
	transition: clip-path 0.4s cubic-bezier(0.2, 0, 0, 1), translate 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.rt-post-gallery--hover-slide-panel .rt-post-gallery__item:is(:hover, :focus-within) .rt-post-gallery__caption {
	clip-path: inset(0);
	translate: 0 0;
}

.rt-post-gallery--hover-edge-title .rt-post-gallery__caption {
	align-self: end;
	justify-self: start;
	max-width: 100%;
	color: var(--rt-color-base);
	background-color: color-mix(in srgb, var(--rt-color-contrast) 85%, transparent);
}

@media (hover: hover) {
	.rt-post-gallery--hover-edge-title .rt-post-gallery__item:not(:hover, :focus-within) .rt-post-gallery__caption > :not(:first-child) {
		display: none;
	}
}

@media (hover: none) {
	.rt-post-gallery--hover-dark-fade .rt-post-gallery__caption {
		align-self: end;
		justify-content: end;
		background: linear-gradient(transparent, color-mix(in srgb, var(--rt-color-contrast) 80%, transparent));
		opacity: 1;
	}

	.rt-post-gallery--hover-slide-panel .rt-post-gallery__caption {
		clip-path: none;
		translate: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rt-post-gallery--hover-zoom .rt-post-gallery__item:is(:hover, :focus-within) .rt-post-gallery__image img {
		scale: none;
	}

	.rt-post-gallery--hover-slide-panel .rt-post-gallery__caption {
		translate: none;
	}
}
