/*
 * OverlandEurope Magazine Shelf
 * Deliberately dependency-free.
 */

.oe-magazine-shelf {
	--oe-shelf-cover-width: clamp(8.5rem, 17vw, 13.75rem);
	--oe-shelf-gap: clamp(0.85rem, 2.4vw, 2rem);
	--oe-shelf-text: currentColor;
	--oe-shelf-muted: color-mix(in srgb, currentColor 62%, transparent);
	--oe-shelf-line: color-mix(in srgb, currentColor 18%, transparent);
	--oe-shelf-surface: color-mix(in srgb, currentColor 4%, transparent);
	--oe-shelf-shadow: 0 1.25rem 2.8rem rgb(0 0 0 / 0.24);
	overflow: hidden;
	padding-block:
		clamp(1.25rem, 2.5vw, 2.25rem)
		clamp(3rem, 6vw, 5rem);
	border: 0;
	background: transparent;
	color: var(--oe-shelf-text);
}

.oe-magazine-shelf__inner {
	width: min(100%, 100rem);
	margin-inline: auto;
}

.oe-magazine-shelf__details {
	width: min(calc(100% - 2rem), 52rem);
	margin-inline: auto;
	text-align: left;
}


.oe-magazine-shelf__viewport {
	overflow-x: auto;
	overflow-y: visible;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: calc(50% - (var(--oe-shelf-cover-width) / 2));
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	cursor: grab;
	outline: none;
}

.oe-magazine-shelf__viewport:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.oe-magazine-shelf__viewport.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	user-select: none;
}

.oe-magazine-shelf__track {
	display: flex;
	align-items: center;
	gap: var(--oe-shelf-gap);
	width: max-content;
	min-width: 100%;
	margin: 0;
	padding:
		clamp(1rem, 2vw, 1.5rem)
		max(1rem, calc(50vw - (var(--oe-shelf-cover-width) / 2)))
		clamp(2rem, 4vw, 3rem);
	list-style: none;
}

.oe-magazine-shelf__item {
	flex: 0 0 var(--oe-shelf-cover-width);
	width: var(--oe-shelf-cover-width);
	scroll-snap-align: center;
	scroll-snap-stop: normal;
	opacity: 0.58;
	transform: scale(0.88);
	transform-origin: center;
	transition:
		transform 260ms ease,
		opacity 260ms ease;
}

.oe-magazine-shelf__item.is-active {
	opacity: 1;
	transform: scale(1);
}

.oe-magazine-shelf__cover-link {
	display: block;
	color: inherit;
	text-decoration: none;
	-webkit-user-drag: none;
}

.oe-magazine-shelf__cover {
	position: relative;
	display: block;
	aspect-ratio: 210 / 297;
	background: rgb(0 0 0 / 0.08);
	box-shadow: 0 0.45rem 1.25rem rgb(0 0 0 / 0.12);
	transition:
		box-shadow 260ms ease,
		transform 260ms ease;
}

.oe-magazine-shelf__item.is-active .oe-magazine-shelf__cover {
	box-shadow: var(--oe-shelf-shadow);
}

.oe-magazine-shelf__cover-link:focus-visible .oe-magazine-shelf__cover {
	outline: 3px solid currentColor;
	outline-offset: 5px;
}

.oe-magazine-shelf__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	user-select: none;
	-webkit-user-drag: none;
}

.oe-magazine-shelf__missing-cover {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	padding: 1rem;
	border: 1px solid var(--oe-shelf-line);
	text-align: center;
}

.oe-magazine-shelf__current-label {
	position: absolute;
	z-index: 2;
	top: 0.7rem;
	left: 0;
	padding: 0.42rem 0.72rem;
	background: #fff;
	color: #111;
	font-size: 0.67rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	box-shadow: 0 0.35rem 1rem rgb(0 0 0 / 0.22);
}

.oe-magazine-shelf__details {
	display: grid;
	gap: 0.75rem;
	min-height: 9rem;
	padding-top: clamp(1rem, 2vw, 1.5rem);
	border-top: 1px solid var(--oe-shelf-line);
}

.oe-magazine-shelf__eyebrow {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	text-transform: uppercase;
}

.oe-magazine-shelf__facts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem 1.25rem;
	color: var(--oe-shelf-muted);
	font-size: 0.88rem;
}

.oe-magazine-shelf__facts > span + span::before {
	content: "";
	display: inline-block;
	width: 0.22rem;
	height: 0.22rem;
	margin-right: 1.25rem;
	border-radius: 50%;
	background: currentColor;
	vertical-align: middle;
}

.oe-magazine-shelf__excerpt {
	margin: 0;
	font-family: Inter, sans-serif;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.6;
	text-wrap: pretty;
}

.oe-magazine-shelf__notice {
	padding: 1rem;
	border: 1px dashed currentColor;
}

@media (max-width: 47.99rem) {
	.oe-magazine-shelf {
		--oe-shelf-cover-width: clamp(9.5rem, 48vw, 12.5rem);
		--oe-shelf-gap: 0.75rem;
	}


	.oe-magazine-shelf__details {
		min-height: 10.5rem;
	}
}

@media (hover: hover) {
	.oe-magazine-shelf__item:not(.is-active) .oe-magazine-shelf__cover-link:hover {
		opacity: 0.88;
	}
}

@media (prefers-reduced-motion: reduce) {
	.oe-magazine-shelf__item,
	.oe-magazine-shelf__cover {
		transition: none;
	}

	.oe-magazine-shelf__viewport {
		scroll-behavior: auto;
	}
}
