.mesto-stories {
	position: relative;
	overflow: hidden;
	background:
		radial-gradient(circle at 74% 30%, rgba(210, 168, 92, .14), transparent 28%),
		radial-gradient(circle at 32% 82%, rgba(184, 231, 206, .08), transparent 26%),
		#0b0e0d;
}

.mesto-stories-layout {
	display: grid;
	grid-template-columns: minmax(260px, .72fr) minmax(620px, 1.28fr);
	gap: clamp(32px, 6vw, 84px);
	align-items: center;
}

.mesto-stories-copy {
	position: relative;
	z-index: 5;
}

.mesto-stories-copy p {
	max-width: 540px;
	margin: 0;
	color: var(--muted);
	font-size: 18px;
}

.mesto-stories-hint {
	display: inline-flex;
	margin-top: 24px;
	color: var(--mint);
	font-size: 12px;
	font-weight: 850;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.mesto-stories-deck {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-height: 530px;
	padding: 42px 26px 42px 82px;
	perspective: 1300px;
}

.mesto-story-card {
	position: relative;
	width: clamp(176px, 15vw, 220px);
	aspect-ratio: 9 / 16;
	margin: 0 0 0 clamp(-104px, -7vw, -72px);
	padding: 0;
	overflow: hidden;
	border: 1px solid rgba(244, 240, 231, .26);
	border-radius: 25px;
	background: #171c19;
	box-shadow: -18px 26px 70px rgba(0, 0, 0, .54);
	cursor: pointer;
	transform: translateY(var(--story-y, 0)) rotate(var(--story-r, 0deg));
	transform-origin: 50% 82%;
	transition: transform .32s cubic-bezier(.2, .75, .25, 1), border-color .2s ease, box-shadow .32s ease;
}

.mesto-story-card:first-child { margin-left: 0; --story-y: 18px; --story-r: -6deg; z-index: 1; }
.mesto-story-card:nth-child(2) { --story-y: -20px; --story-r: -2deg; z-index: 2; }
.mesto-story-card:nth-child(3) { --story-y: 12px; --story-r: 3deg; z-index: 3; }
.mesto-story-card:nth-child(4) { --story-y: -10px; --story-r: 6deg; z-index: 4; }
.mesto-story-card:nth-child(5) { --story-y: 18px; --story-r: 10deg; z-index: 5; }

.mesto-story-card img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	object-fit: cover;
}

.mesto-story-card::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(180deg, transparent 66%, rgba(0, 0, 0, .74));
	pointer-events: none;
}

.mesto-story-card span {
	position: absolute;
	right: 14px;
	bottom: 15px;
	left: 14px;
	z-index: 2;
	color: #fff;
	font-size: 12px;
	font-weight: 850;
	letter-spacing: .1em;
	text-align: left;
	text-transform: uppercase;
}

.mesto-story-card-video > i {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	display: grid;
	width: 58px;
	height: 58px;
	place-items: center;
	padding-left: 4px;
	border: 1px solid rgba(255, 255, 255, .58);
	border-radius: 50%;
	background: rgba(10, 18, 14, .68);
	box-shadow: 0 14px 34px rgba(0, 0, 0, .34);
	color: #b7ff21;
	font-style: normal;
	font-size: 21px;
	transform: translate(-50%, -50%);
	backdrop-filter: blur(8px);
}

.mesto-story-card:hover,
.mesto-story-card:focus-visible {
	z-index: 8;
	border-color: var(--mint);
	box-shadow: 0 28px 86px rgba(0, 0, 0, .66), 0 0 0 5px rgba(184, 231, 206, .12);
	transform: translateY(-26px) rotate(0deg) scale(1.055);
}

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

.mesto-story-viewer {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: grid;
	place-items: center;
	padding: 16px;
}

.mesto-story-viewer-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(4, 6, 5, .92);
	backdrop-filter: blur(14px);
}

.mesto-story-viewer-frame {
	position: relative;
	z-index: 1;
	height: min(92dvh, 900px);
	aspect-ratio: 9 / 16;
	max-width: calc(100vw - 32px);
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 26px;
	background: #0b0e0d;
	box-shadow: 0 30px 110px rgba(0, 0, 0, .72);
}

.mesto-story-viewer-image,
.mesto-story-viewer-video {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 0;
	object-fit: cover;
}

.mesto-story-viewer-video[hidden],
.mesto-story-viewer-image[hidden] { display: none; }

.mesto-story-progress {
	position: absolute;
	top: 12px;
	right: 52px;
	left: 12px;
	z-index: 5;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 5px;
}

.mesto-story-progress i {
	display: block;
	height: 3px;
	overflow: hidden;
	border-radius: 99px;
	background: rgba(255, 255, 255, .34);
}

.mesto-story-progress i::after {
	content: "";
	display: block;
	width: 0;
	height: 100%;
	background: #fff;
}

.mesto-story-progress i.is-done::after { width: 100%; }
.mesto-story-progress i.is-active::after { width: var(--story-progress, 0%); }

.mesto-story-close {
	position: absolute;
	top: 22px;
	right: 12px;
	z-index: 7;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .48);
	color: #fff;
	font: 300 28px/1 Arial, sans-serif;
	cursor: pointer;
}

.mesto-story-sound {
	position: absolute;
	top: 22px;
	left: 12px;
	z-index: 7;
	display: inline-flex;
	min-height: 36px;
	align-items: center;
	gap: 7px;
	padding: 0 12px;
	border: 1px solid rgba(255, 255, 255, .32);
	border-radius: 999px;
	background: rgba(0, 0, 0, .58);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .32);
	color: #fff;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	backdrop-filter: blur(10px);
}

.mesto-story-sound[hidden] { display: none; }
.mesto-story-sound b { font-weight: 800; }
.mesto-story-sound:hover,
.mesto-story-sound:focus-visible {
	border-color: var(--mint);
	background: rgba(16, 36, 29, .88);
	box-shadow: 0 0 0 2px rgba(141, 242, 189, .2), 0 0 24px rgba(141, 242, 189, .24);
}
.mesto-story-sound:active { transform: scale(.97); }

.mesto-story-zone {
	position: absolute;
	top: 52px;
	bottom: 86px;
	z-index: 4;
	width: 38%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.mesto-story-prev { left: 0; }
.mesto-story-next { right: 0; }

.mesto-story-prev:hover,
.mesto-story-prev:focus-visible { background: linear-gradient(90deg, rgba(141, 242, 189, .11), transparent); }
.mesto-story-next:hover,
.mesto-story-next:focus-visible { background: linear-gradient(270deg, rgba(141, 242, 189, .11), transparent); }

.mesto-story-viewer-footer {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 36px 16px 16px;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .88));
}

.mesto-story-viewer-label {
	color: #fff;
	font-size: 12px;
	font-weight: 850;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.mesto-story-viewer-cta {
	min-height: 42px;
	padding: 0 17px;
	white-space: nowrap;
}

body.mesto-story-open { overflow: hidden; }

@media (max-width: 980px) {
	.mesto-stories-layout { grid-template-columns: 1fr; gap: 26px; }
	.mesto-stories-copy { max-width: 720px; }
	.mesto-stories-deck { justify-content: center; min-height: 500px; padding-left: 76px; }
	.mesto-story-card { width: clamp(178px, 26vw, 230px); margin-left: -74px; }
}

@media (max-width: 640px) {
	.mesto-stories { padding-bottom: 58px; }
	.mesto-stories-copy p { font-size: 16px; }
	.mesto-stories-hint { margin-top: 16px; }
	.mesto-stories-deck {
		justify-content: flex-start;
		min-height: 390px;
		margin-right: -11px;
		padding: 26px 36px 28px 10px;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-padding-left: 10px;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
	}
	.mesto-stories-deck::-webkit-scrollbar { display: none; }
	.mesto-story-card,
	.mesto-story-card:first-child,
	.mesto-story-card:nth-child(2),
	.mesto-story-card:nth-child(3),
	.mesto-story-card:nth-child(4),
	.mesto-story-card:nth-child(5) {
		flex: 0 0 196px;
		width: 196px;
		margin-left: -20px;
		scroll-snap-align: start;
		transform: translateY(var(--story-y, 0)) rotate(var(--story-r, 0deg));
	}
	.mesto-story-card:first-child { margin-left: 0; }
	.mesto-story-card:hover,
	.mesto-story-card:focus-visible { transform: translateY(-8px) rotate(0deg) scale(1.015); }
	.mesto-story-viewer { padding: 0; }
	.mesto-story-viewer-frame {
		width: 100vw;
		height: 100dvh;
		max-width: none;
		border: 0;
		border-radius: 0;
	}
	.mesto-story-sound { top: 20px; left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.mesto-story-card { transition: none; }
}
