/*!
 * dym58 Video Player — самописный HTML5-плеер для видео, размещённого на своём сервере.
 * Без зависимостей. Тёмная тема, акцент берётся из --dym58-accent.
 */

.dym58-player {
	--dym58-accent: #71be00;
	--dym58-bg: #0e1013;
	--dym58-fg: #ffffff;
	--dym58-ctrl-h: 44px;

	position: relative;
	display: block;
	width: 100%;
	background: var(--dym58-bg);
	border-radius: 6px;
	overflow: hidden;
	color: var(--dym58-fg);
	font-family: inherit;
	line-height: normal;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

/* Плеер, вставленный вместо iframe в блок темы (там padding-bottom 56.25%) */
.video-container > .dym58-player {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 0;
}

/* Самостоятельный плеер (вне .video-container) держит пропорции сам */
.dym58-player:not(.video-container > .dym58-player) .dym58-video {
	aspect-ratio: 16 / 9;
}

.dym58-player .dym58-video {
	display: block;
	width: 100%;
	height: 100%;
	background: #000;
	outline: none;
}

.dym58-player.is-fitted .dym58-video {
	object-fit: contain;
}

/* ---------- Большая кнопка «play» поверх постера ---------- */

.dym58-big {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	cursor: pointer;
	transition: opacity .2s ease;
	z-index: 3;
}

.dym58-big::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, .15) 0%, rgba(0, 0, 0, .45) 100%);
}

.dym58-big i {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 74px;
	height: 74px;
	border-radius: 50%;
	background: var(--dym58-accent);
	box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
	transition: transform .18s ease, background-color .18s ease;
}

.dym58-big i svg {
	width: 30px;
	height: 30px;
	margin-left: 4px;
	fill: #fff;
}

.dym58-big:hover i,
.dym58-big:focus-visible i {
	transform: scale(1.08);
}

.dym58-player.is-started .dym58-big {
	opacity: 0;
	pointer-events: none;
}

/* ---------- Панель управления ---------- */

.dym58-ctrl {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 24px 8px 6px;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .78) 60%);
	opacity: 1;
	transform: translateY(0);
	transition: opacity .2s ease, transform .2s ease;
	z-index: 4;
}

.dym58-player.is-idle .dym58-ctrl {
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}

.dym58-player.is-idle {
	cursor: none;
}

.dym58-row {
	display: flex;
	align-items: center;
	gap: 2px;
	height: var(--dym58-ctrl-h);
}

.dym58-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background-color .15s ease, opacity .15s ease;
}

.dym58-btn svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
	pointer-events: none;
}

.dym58-btn:hover,
.dym58-btn:focus-visible {
	background: rgba(255, 255, 255, .14);
}

.dym58-btn:focus-visible {
	outline: 2px solid var(--dym58-accent);
	outline-offset: -2px;
}

.dym58-btn[hidden] {
	display: none;
}

.dym58-time {
	flex: 0 0 auto;
	padding: 0 8px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: rgba(255, 255, 255, .92);
}

.dym58-time b {
	font-weight: 600;
}

.dym58-time span {
	opacity: .6;
}

.dym58-spacer {
	flex: 1 1 auto;
}

/* ---------- Громкость ---------- */

.dym58-volume {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.dym58-volume-slider {
	width: 0;
	overflow: hidden;
	transition: width .18s ease, margin .18s ease;
}

.dym58-volume:hover .dym58-volume-slider,
.dym58-volume.is-open .dym58-volume-slider {
	width: 74px;
	margin-right: 6px;
}

.dym58-volume-bar {
	position: relative;
	width: 68px;
	height: 20px;
	display: flex;
	align-items: center;
	cursor: pointer;
}

.dym58-volume-bar::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, .3);
}

.dym58-volume-fill {
	position: relative;
	height: 4px;
	border-radius: 2px;
	background: #fff;
	pointer-events: none;
}

/* ---------- Полоса перемотки ---------- */

.dym58-seek {
	position: relative;
	height: 18px;
	margin: 0 6px 2px;
	display: flex;
	align-items: center;
	cursor: pointer;
	touch-action: none;
}

.dym58-seek-track {
	position: relative;
	width: 100%;
	height: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, .28);
	transition: height .12s ease;
}

.dym58-seek:hover .dym58-seek-track,
.dym58-seek.is-scrubbing .dym58-seek-track {
	height: 6px;
}

.dym58-seek-buffer,
.dym58-seek-played {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	border-radius: 2px;
}

.dym58-seek-buffer {
	background: rgba(255, 255, 255, .35);
}

.dym58-seek-played {
	background: var(--dym58-accent);
}

.dym58-seek-handle {
	position: absolute;
	top: 50%;
	width: 13px;
	height: 13px;
	margin-left: -6.5px;
	border-radius: 50%;
	background: var(--dym58-accent);
	transform: translateY(-50%) scale(0);
	transition: transform .12s ease;
	pointer-events: none;
}

.dym58-seek:hover .dym58-seek-handle,
.dym58-seek.is-scrubbing .dym58-seek-handle {
	transform: translateY(-50%) scale(1);
}

.dym58-seek-tip {
	position: absolute;
	bottom: 22px;
	transform: translateX(-50%);
	padding: 3px 7px;
	border-radius: 4px;
	background: rgba(0, 0, 0, .85);
	color: #fff;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .12s ease;
}

.dym58-seek:hover .dym58-seek-tip,
.dym58-seek.is-scrubbing .dym58-seek-tip {
	opacity: 1;
}

/* ---------- Меню скорости ---------- */

.dym58-menu-wrap {
	position: relative;
	flex: 0 0 auto;
}

.dym58-menu {
	position: absolute;
	right: 0;
	bottom: 46px;
	min-width: 92px;
	padding: 4px;
	border-radius: 6px;
	background: rgba(20, 22, 26, .96);
	box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
	display: none;
	z-index: 6;
}

.dym58-menu.is-open {
	display: block;
}

.dym58-menu--share {
	min-width: 224px;
}

.dym58-menu button {
	display: block;
	width: 100%;
	padding: 7px 12px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
}

.dym58-menu button:hover,
.dym58-menu button:focus-visible {
	background: rgba(255, 255, 255, .14);
}

.dym58-menu button.is-active {
	color: var(--dym58-accent);
	font-weight: 600;
}

.dym58-rate-badge {
	position: absolute;
	right: 2px;
	bottom: 2px;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	color: var(--dym58-accent);
}

/* ---------- Служебные слои ---------- */

.dym58-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 46px;
	height: 46px;
	margin: -23px 0 0 -23px;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: dym58-spin .8s linear infinite;
	display: none;
	z-index: 2;
}

.dym58-player.is-loading .dym58-spinner {
	display: block;
}

@keyframes dym58-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dym58-spinner {
		animation-duration: 2s;
	}

	.dym58-player * {
		transition-duration: .01ms !important;
	}
}

.dym58-toast {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	padding: 10px 16px;
	border-radius: 22px;
	background: rgba(0, 0, 0, .72);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease;
	z-index: 5;
}

.dym58-toast.is-show {
	opacity: 1;
}

.dym58-error {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 20px;
	text-align: center;
	background: rgba(6, 8, 10, .92);
	font-size: 14px;
	z-index: 7;
}

.dym58-player.is-error .dym58-error {
	display: flex;
}

.dym58-error a {
	color: var(--dym58-accent);
	text-decoration: underline;
}

.dym58-title {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	padding: 12px 14px 26px;
	background: linear-gradient(180deg, rgba(0, 0, 0, .6) 0%, rgba(0, 0, 0, 0) 100%);
	font-size: 14px;
	font-weight: 600;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
	opacity: 0;
	transition: opacity .2s ease;
	pointer-events: none;
	z-index: 2;
}

.dym58-player.is-started:not(.is-idle) .dym58-title {
	opacity: 1;
}

/* ---------- Мобильные ---------- */

@media (max-width: 575px) {
	.dym58-player {
		--dym58-ctrl-h: 40px;
	}

	.dym58-big i {
		width: 60px;
		height: 60px;
	}

	.dym58-big i svg {
		width: 24px;
		height: 24px;
	}

	.dym58-btn {
		width: 36px;
		height: 36px;
	}

	.dym58-time {
		padding: 0 4px;
		font-size: 12px;
	}

	.dym58-volume-slider {
		display: none;
	}
}

/* ---------- Лайтбокс ---------- */

.dym58-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, .88);
	z-index: 100000;
	opacity: 0;
	transition: opacity .18s ease;
}

.dym58-lightbox.is-open {
	opacity: 1;
}

.dym58-lightbox-inner {
	position: relative;
	width: 100%;
	max-width: 1100px;
}

.dym58-lightbox .dym58-player {
	box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

.dym58-lightbox-close {
	position: absolute;
	top: -44px;
	right: 0;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	cursor: pointer;
}

.dym58-lightbox-close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.dym58-lightbox-close:hover {
	background: rgba(255, 255, 255, .28);
}

body.dym58-lightbox-open {
	overflow: hidden;
}

@media (max-width: 575px) {
	.dym58-lightbox {
		padding: 12px;
	}

	.dym58-lightbox-close {
		top: -40px;
	}
}

/* Иконка «play» на превью-видео в галерее товара */
.dym58-video-open {
	cursor: pointer;
}

/* ---------- Автономный блок «Видео» ---------- */

.dym58-video-list {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

.dym58-video-item {
	flex: 1 1 480px;
	max-width: 640px;
}

.dym58-video-item .video-container {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	overflow: hidden;
}

.dym58-video-item .video-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* На узком экране панель из восьми кнопок не помещается: убираем то,
   что на телефоне и так делается жестами или не нужно */
@media (max-width: 575px) {
	.dym58-btn-skip,
	.dym58-btn-pip {
		display: none;
	}
}

@media (max-width: 400px) {
	.dym58-btn-rate {
		display: none;
	}
}
