/*
 * escape. · shared photo viewer (assets/js/photo-viewer.js).
 * Photo on top, caption and description below, then the action row.
 * Mobile-first: on a phone the actions sit at the thumb, main button
 * full width, call / Telegram / MAX in one row under it.
 */

html.esc-pv-lock,
html.esc-pv-lock body {
	overflow: hidden;
}

.esc-pv {
	position: fixed;
	inset: 0;
	z-index: 10400;
	display: flex;
	flex-direction: column;
	background: #0f0f0f;
	color: #b3b3b3;
	font-family: 'Ubuntu', Arial, sans-serif;
	opacity: 0;
	transition: opacity .3s ease-in-out;
	padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}

.esc-pv[hidden] {
	display: none;
}

.esc-pv.is-open {
	opacity: 1;
}

.esc-pv__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px 0 24px;
	min-height: 56px;
}

.esc-pv__count {
	font-size: 14px;
	color: #7d7d7d;
	font-variant-numeric: tabular-nums;
}

.esc-pv__btn {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .16);
	border-radius: 999px;
	background: rgba(36, 36, 36, .8);
	color: #ffffff;
	cursor: pointer;
	transition: background .2s ease-in-out, border-color .2s ease-in-out;
}

.esc-pv__btn:hover {
	background: #ff0004;
	border-color: #ff0004;
}

.esc-pv__btn:focus-visible,
.esc-pv__act:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.esc-pv__btn svg {
	width: 22px;
	height: 22px;
}

.esc-pv__btn[hidden] {
	display: none;
}

.esc-pv__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px 12px;
}

.esc-pv__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 14px;
	user-select: none;
	-webkit-user-select: none;
}

/* Next photo on the way: the spinner (.esc-vwait, style.css) instead of the previous one. */
.esc-pv__stage.is-buffering .esc-pv__img {
	opacity: 0;
}

.esc-pv__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}

.esc-pv__prev {
	left: 12px;
}

.esc-pv__next {
	right: 12px;
}

.esc-pv__panel {
	flex: 0 0 auto;
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	box-sizing: border-box;
	padding: 12px 24px calc(16px + env(safe-area-inset-bottom, 0px));
}

.esc-pv__text {
	min-height: 0;
	margin-bottom: 14px;
}

.esc-pv__cap {
	margin: 0;
	color: #ffffff;
	font-size: 17px;
	font-weight: 500;
	line-height: 1.35;
}

.esc-pv__desc {
	margin: 4px 0 0;
	font-size: 14px;
	line-height: 1.5;
	color: #b3b3b3;
}

.esc-pv__desc[hidden] {
	display: none;
}

.esc-pv__cta {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.esc-pv__act {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 12px;
	border: 1px solid rgba(255, 255, 255, .16);
	border-radius: 6px;
	background: #242424;
	color: #ffffff;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background .2s ease-in-out, border-color .2s ease-in-out, transform .3s ease-in-out;
}

.esc-pv__act:hover {
	color: #ffffff;
	border-color: rgba(255, 255, 255, .32);
	transform: translateY(-2px);
}

.esc-pv__act:active {
	transform: scale(.975);
}

.esc-pv__act[hidden] {
	display: none;
}

.esc-pv__act svg {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
}

.esc-pv__act span {
	overflow: hidden;
	text-overflow: ellipsis;
}

.esc-pv__act--main {
	grid-column: 1 / -1;
	background: #ff0004;
	border-color: #ff0004;
	font-size: 16px;
}

.esc-pv__act--main:hover {
	background: #d40c10;
	border-color: #d40c10;
}

/* Narrow phones: icons over labels, so three buttons still fit. */
@media (max-width: 400px) {
	.esc-pv__act:not(.esc-pv__act--main) {
		flex-direction: column;
		gap: 4px;
		min-height: 56px;
		font-size: 13px;
	}
}

/* Phones: arrows would cover the photo — swipe instead. */
@media (max-width: 640px) {
	.esc-pv__nav {
		display: none;
	}

	.esc-pv__stage {
		padding: 4px 0;
	}

	.esc-pv__img {
		border-radius: 0;
	}
}

/* Desktop: one row — main button first, the rest after it. */
@media (min-width: 900px) {
	.esc-pv__bar {
		padding: 16px 24px 0 32px;
	}

	.esc-pv__stage {
		padding: 8px 88px;
	}

	.esc-pv__prev {
		left: 24px;
	}

	.esc-pv__next {
		right: 24px;
	}

	.esc-pv__panel {
		display: flex;
		align-items: center;
		gap: 24px;
		padding-top: 16px;
		padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	}

	.esc-pv__text {
		flex: 1 1 auto;
		margin-bottom: 0;
	}

	.esc-pv__cta {
		flex: 0 0 auto;
		display: flex;
		gap: 8px;
	}

	.esc-pv__act--main {
		padding: 0 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.esc-pv,
	.esc-pv__act,
	.esc-pv__btn {
		transition: none;
	}

	.esc-pv__act:hover,
	.esc-pv__act:active {
		transform: none;
	}
}
