/**
 * The Gram — frontend gallery
 */

.the-gram {
	--the-gram-bg: #ffffff;
	--the-gram-gap: 8px;
	--the-gram-columns: 6;
	--the-gram-handle: #8a8f98;
	--the-gram-handle-hover: #1d2327;
	--the-gram-title: #1d2327;
	--the-gram-arrow: #1d2327;
	--the-gram-arrow-hover: #000000;
	--the-gram-arrow-bg: #e8e8ea;
	--the-gram-arrow-bg-hover: #dcdcde;
	--the-gram-dot: #c3c4c7;
	--the-gram-dot-hover: #1d2327;
	background-color: var(--the-gram-bg);
	padding: 48px 0;
	position: relative;
}

.the-gram--has-bg {
	isolation: isolate;
}

.the-gram__bg {
	height: 100%;
	inset: 0;
	object-fit: cover;
	object-position: center;
	pointer-events: none;
	position: absolute;
	width: 100%;
	z-index: 0;
}

.the-gram--has-bg .the-gram__inner {
	position: relative;
	z-index: 1;
}

.the-gram .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.the-gram__inner {
	width: 100%;
}

.the-gram__header {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 12px 24px;
	justify-content: space-between;
	margin-bottom: 24px;
}

.the-gram__heading {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.the-gram--layout-stacked .the-gram__header {
	justify-content: center;
	text-align: center;
}

.the-gram--layout-stacked .the-gram__heading {
	align-items: center;
	width: 100%;
}

.the-gram--layout-stacked .the-gram__title {
	width: 100%;
}

.the-gram--layout-stacked.the-gram--align-left .the-gram__header,
.the-gram--layout-stacked.the-gram--align-left .the-gram__footer {
	justify-content: flex-start;
	text-align: left;
}

.the-gram--layout-stacked.the-gram--align-left .the-gram__heading {
	align-items: flex-start;
}

.the-gram--layout-stacked.the-gram--align-right .the-gram__header,
.the-gram--layout-stacked.the-gram--align-right .the-gram__footer {
	justify-content: flex-end;
	text-align: right;
}

.the-gram--layout-stacked.the-gram--align-right .the-gram__heading {
	align-items: flex-end;
}

.the-gram--layout-stacked.the-gram--align-center .the-gram__header,
.the-gram--layout-stacked.the-gram--align-center .the-gram__footer {
	justify-content: center;
	text-align: center;
}

.the-gram--layout-stacked.the-gram--align-center .the-gram__heading {
	align-items: center;
}

.the-gram__handle {
	align-items: baseline;
	color: var(--the-gram-handle);
	display: inline-flex;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.2;
	margin: 0;
	text-decoration: none;
	text-transform: lowercase;
	transition: color 0.2s ease;
	width: fit-content;
}

a.the-gram__handle:hover,
a.the-gram__handle:focus {
	color: var(--the-gram-handle-hover);
	text-decoration: none;
}

.the-gram__handle-at {
	color: inherit;
	font-weight: 500;
	margin-right: 0.05em;
	opacity: 0.75;
}

.the-gram__footer {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}

.the-gram__title {
	color: var(--the-gram-title);
	font-size: clamp(1.35rem, 2vw, 1.75rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.2;
	margin: 0;
}

.the-gram__cta {
	--the-gram-cta-bg: #1d2327;
	--the-gram-cta-bg-hover: #000000;
	--the-gram-cta-text: #ffffff;
	--the-gram-cta-text-hover: #ffffff;
	align-items: center;
	background: var(--the-gram-cta-bg);
	border: 1px solid var(--the-gram-cta-bg);
	border-radius: 999px;
	color: var(--the-gram-cta-text);
	display: inline-flex;
	font-size: 0.95rem;
	font-weight: 600;
	justify-content: center;
	line-height: 1.2;
	padding: 10px 18px;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.the-gram__cta:hover,
.the-gram__cta:focus {
	background: var(--the-gram-cta-bg-hover);
	border-color: var(--the-gram-cta-bg-hover);
	color: var(--the-gram-cta-text-hover);
	text-decoration: none;
}

.the-gram__grid {
	display: grid;
	gap: var(--the-gram-gap);
	grid-template-columns: repeat(var(--the-gram-columns), minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.the-gram__carousel {
	width: 100%;
}

.the-gram--mobile-carousel .the-gram__track {
	display: grid;
	gap: var(--the-gram-gap);
	grid-template-columns: repeat(var(--the-gram-columns), minmax(0, 1fr));
}

@media (min-width: 769px) {
	.the-gram--mobile-carousel .the-gram__slide:not(.the-gram__slide--clone) {
		display: contents;
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.the-gram--mobile-carousel .the-gram__slide--clone {
		display: none;
	}
}

.the-gram__nav {
	align-items: center;
	display: none;
	gap: 8px;
	justify-content: center;
	margin-top: 12px;
}

.the-gram__dots {
	align-items: center;
	display: flex;
	flex: 1 1 auto;
	gap: 8px;
	justify-content: center;
	list-style: none;
	margin: 0;
	min-width: 0;
	padding: 0;
}

.the-gram__dot {
	appearance: none;
	background: var(--the-gram-dot);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	height: 8px;
	padding: 0;
	transition: background 0.15s ease;
	width: 8px;
}

.the-gram__dot:hover,
.the-gram__dot:focus-visible,
.the-gram__dot.is-active {
	background: var(--the-gram-dot-hover);
}

.the-gram__arrow {
	align-items: center;
	appearance: none;
	background: color-mix(in srgb, var(--the-gram-arrow-bg) 85%, transparent);
	border: 0;
	border-radius: 50%;
	color: var(--the-gram-arrow);
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 auto;
	height: 44px;
	justify-content: center;
	padding: 0;
	transition: background 0.15s ease, color 0.15s ease;
	width: 44px;
}

.the-gram__arrow .dashicons {
	font-size: 22px;
	height: 22px;
	line-height: 1;
	width: 22px;
}

.the-gram__arrow:hover,
.the-gram__arrow:focus-visible {
	background: color-mix(in srgb, var(--the-gram-arrow-bg-hover) 92%, transparent);
	color: var(--the-gram-arrow-hover);
}

.the-gram__arrow:focus-visible {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--the-gram-arrow-bg-hover) 40%, transparent);
	outline: none;
}

.the-gram__item {
	isolation: isolate;
	margin: 0;
	padding: 0;
	position: relative;
}

.the-gram__link {
	color: inherit;
	container-type: inline-size;
	display: block;
	position: relative;
	text-decoration: none;
}

.the-gram__media {
	aspect-ratio: 1 / 1;
	background: #f0f0f1;
	display: block;
	overflow: hidden;
	position: relative;
	width: 100%;
}

.the-gram--square .the-gram__media {
	aspect-ratio: 1 / 1;
}

.the-gram--vertical .the-gram__media {
	aspect-ratio: 4 / 5;
}

.the-gram img,
.the-gram__image {
	display: block;
	height: 100%;
	margin: 0;
	object-fit: cover;
	width: 100%;
}

.the-gram__item--pos-center .the-gram__image {
	object-position: center center;
}

.the-gram__item--pos-top .the-gram__image {
	object-position: center top;
}

.the-gram__item--pos-bottom .the-gram__image {
	object-position: center bottom;
}

.the-gram__item--pos-left .the-gram__image {
	object-position: left center;
}

.the-gram__item--pos-right .the-gram__image {
	object-position: right center;
}

.the-gram__hover-label {
	align-items: center;
	/* Semi-transparent overlay on the same element as the text (contrast + see-through). */
	background-color: rgba(0, 0, 0, 0.85);
	color: #ffffff;
	display: flex;
	flex-direction: column;
	font-size: clamp(0.625rem, 9.5cqi, 1.5rem);
	font-weight: 600;
	gap: 0.1em;
	inset: 0;
	justify-content: center;
	letter-spacing: 0.01em;
	line-height: 1.2;
	opacity: 0;
	padding: clamp(6px, 5cqi, 16px);
	pointer-events: none;
	position: absolute;
	text-align: center;
	transition: opacity 0.2s ease;
	z-index: 2;
}

.the-gram__hover-label-line,
.the-gram__hover-label-brand {
	display: block;
}

.the-gram__hover-label-icon {
	display: block;
	font-size: 1.15em;
	height: 1em;
	line-height: 1;
	margin-top: 0.2em;
	text-shadow: none;
	width: 1em;
}

.the-gram__type {
	align-items: center;
	backdrop-filter: blur(4px);
	background: rgba(0, 0, 0, 0.48);
	border-radius: 50%;
	color: #fff;
	display: inline-flex;
	height: 36px;
	justify-content: center;
	pointer-events: none;
	position: absolute;
	right: 10px;
	top: 10px;
	width: 36px;
	z-index: 3;
}

.the-gram__type .dashicons {
	font-size: 20px;
	height: 20px;
	line-height: 1;
	width: 20px;
}

@media (hover: hover) {
	.the-gram__link:hover .the-gram__hover-label {
		opacity: 1;
	}
}

.the-gram__link:focus-visible .the-gram__hover-label {
	opacity: 1;
}

@media (max-width: 768px) {
	.the-gram {
		padding: 32px 0;
	}

	.the-gram__grid {
		grid-template-columns: repeat(var(--the-gram-mobile-columns, 2), minmax(0, 1fr));
	}

	.the-gram--mobile-carousel .the-gram__track {
		-webkit-overflow-scrolling: touch;
		display: flex;
		gap: 0;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}

	.the-gram--mobile-carousel .the-gram__track::-webkit-scrollbar {
		display: none;
	}

	.the-gram--mobile-carousel .the-gram__slide,
	.the-gram--mobile-carousel .the-gram__slide--clone {
		display: grid;
		flex: 0 0 100%;
		gap: var(--the-gram-gap);
		grid-template-columns: repeat(var(--the-gram-mobile-columns, 2), minmax(0, 1fr));
		list-style: none;
		margin: 0;
		min-width: 100%;
		padding: 0;
		scroll-snap-align: start;
		scroll-snap-stop: always;
	}

	.the-gram--mobile-carousel .the-gram__slide--partial {
		display: flex;
		justify-content: center;
	}

	.the-gram--mobile-carousel .the-gram__slide--partial .the-gram__item {
		flex: 0 0 calc(
			(100% - (var(--the-gram-mobile-columns, 2) - 1) * var(--the-gram-gap)) /
				var(--the-gram-mobile-columns, 2)
		);
		max-width: calc(
			(100% - (var(--the-gram-mobile-columns, 2) - 1) * var(--the-gram-gap)) /
				var(--the-gram-mobile-columns, 2)
		);
	}

	.the-gram--mobile-carousel .the-gram__nav {
		display: flex;
	}
}
