/**
 * MAS: блок «Видеоролики» (shortcode mas_videos), модалка, [mas_videos_catalog].
 * Шапка — не здесь (см. mas-internal-header.css + mas-global-header.php). Общие правила: MAS_SAFEGUARDS.md.
 */

/* ===== ВИДЕО — coverflow ===== */
.mas-videos-section {
	background: #f1e0c7;
	padding: 68px 0 72px;
}
.mas-videos-heading {
	font-family: "Montserrat Alternates", Montserrat, sans-serif;
	font-size: clamp(28px, 4vw, 40px);
	font-weight: 700;
	color: #3c2f2f;
	text-align: center;
	margin: 0 0 36px;
	letter-spacing: 0.02em;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 0 20px;
}
.mas-yt-badge {
	display: inline-flex;
	flex-shrink: 0;
}
.mas-videos-empty {
	text-align: center;
	color: #7a6a6a;
	font-family: Montserrat, sans-serif;
	padding: 24px;
}
.mas-vids-cf-outer {
	position: relative;
	width: 100%;
	overflow: hidden;
	min-height: 360px;
	padding: 12px 0 28px;
}
.mas-vids-cf-track {
	position: relative;
	width: 100%;
	height: 100%;
	min-height: 340px;
}
.mas-vid-cf-card {
	position: absolute;
	left: 50%;
	top: 50%;
	width: min(520px, 44vw);
	transform: translate(-50%, -50%);
	transition: transform 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.42s ease;
	will-change: transform, opacity;
}
.mas-vid-cf-btn {
	display: flex;
	flex-direction: column;
	width: 100%;
	border: none !important;
	outline: none;
	cursor: pointer;
	text-align: left;
	background: #fff !important;
	color: inherit !important;
	border-radius: 22px;
	padding: 16px 16px 20px;
	box-shadow: 0 12px 48px rgba(60, 47, 47, 0.15), 0 4px 16px rgba(60, 47, 47, 0.07);
	transition: box-shadow 0.3s ease;
}
.mas-vid-cf-btn:hover,
.mas-vid-cf-btn:focus {
	background: #fff !important;
	color: inherit !important;
	border: none !important;
}
.mas-vid-cf-card.active .mas-vid-cf-btn:hover {
	box-shadow: 0 20px 64px rgba(60, 47, 47, 0.2), 0 6px 24px rgba(60, 47, 47, 0.1);
}
.mas-vid-cf-thumb {
	position: relative;
	display: block;
	width: 100%;
	border-radius: 14px;
	overflow: hidden;
	background: #3c2f2f;
	aspect-ratio: 16 / 9;
}
.mas-vid-cf-thumb img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block;
}
.mas-vid-cf-play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba(251, 248, 244, 0.28);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 2px solid rgba(255, 255, 255, 0.85);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding-left: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	transition: transform 0.25s ease, background 0.25s ease;
}
.mas-vid-cf-card.active .mas-vid-cf-btn:hover .mas-vid-cf-play {
	transform: translate(-50%, -50%) scale(1.1);
	background: rgba(200, 122, 69, 0.5);
}
.mas-vid-cf-title {
	margin-top: 14px;
	font-family: Montserrat, sans-serif;
	font-size: 16px;
	font-weight: 600;
	color: #3c2f2f;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.mas-vids-cf-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 28px;
	padding: 8px 20px 0;
}
.mas-vids-nav-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-family: Montserrat, sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: #3c2f2f;
	padding: 8px 4px;
	transition: color 0.2s, opacity 0.2s;
	letter-spacing: 0.01em;
	flex-shrink: 0;
}
.mas-vids-nav-btn:hover {
	color: #c87a45;
}
.mas-vids-cf-dots {
	display: flex;
	align-items: center;
	gap: 8px;
}
.mas-vid-cf-dot {
	width: 28px;
	height: 5px;
	border-radius: 3px;
	background: rgba(60, 47, 47, 0.2);
	cursor: pointer;
	transition: all 0.3s ease;
}
.mas-vid-cf-dot.active {
	background: #c87a45;
	width: 38px;
}
.mas-videos-footer {
	text-align: center;
	margin-top: 32px;
	padding: 0 20px;
}
.mas-videos-all-btn {
	display: block;
	max-width: 960px;
	margin: 0 auto;
	background: #8b3a2a;
	color: #fff;
	border-radius: 14px;
	padding: 18px 40px;
	font-family: Montserrat, sans-serif;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	transition: background 0.22s ease;
}
.mas-videos-all-btn:hover {
	background: #a34432;
	color: #fff;
}

/* Модалка */
.mas-video-modal[hidden] {
	display: none !important;
}
.mas-video-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom))
		max(10px, env(safe-area-inset-left));
	box-sizing: border-box;
}
.mas-video-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(30, 22, 20, 0.72);
	backdrop-filter: blur(4px);
}
.mas-video-modal-dialog {
	position: relative;
	width: min(960px, calc(100vw - 20px));
	max-width: 100%;
	max-height: min(100vh - 24px, 920px);
	max-height: min(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px, 920px);
	z-index: 1;
	border-radius: clamp(12px, 2vw, 16px);
	overflow: hidden;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
	display: flex;
	flex-direction: column;
	min-height: 0;
}
.mas-video-modal-close {
	position: absolute;
	top: max(8px, env(safe-area-inset-top));
	right: max(8px, env(safe-area-inset-right));
	z-index: 3;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba(251, 248, 244, 0.95);
	color: #3c2f2f;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	touch-action: manipulation;
}
.mas-video-modal-inner {
	position: relative;
	width: 100%;
	max-width: 960px;
	max-height: inherit;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	gap: 0;
	min-height: 0;
	flex: 1 1 auto;
}
.mas-video-modal-ratio {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%;
	height: 0;
	background: #000;
	flex-shrink: 0;
}
.mas-video-modal-ratio iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.mas-video-modal-ratio.mas-video-modal-ratio--tg {
	padding-bottom: 0;
	height: min(72vh, 720px);
	min-height: min(420px, 50svh);
	max-height: min(85svh, 800px);
}
.mas-video-modal-ratio.mas-video-modal-ratio--tg iframe {
	height: 100%;
}
.mas-video-modal-ratio.mas-video-modal-ratio--ig {
	padding-bottom: 0;
	height: min(72vh, 720px);
	min-height: min(420px, 55svh);
	max-height: min(85svh, 820px);
}
.mas-video-modal-ratio.mas-video-modal-ratio--ig iframe {
	height: 100%;
}
.mas-video-modal-caption {
	font-family: Montserrat, sans-serif;
	font-size: 14px;
	line-height: 1.55;
	color: #f8f4ef;
	background: #2a2220;
	padding: 16px 18px 20px;
	max-height: min(28vh, 220px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	white-space: pre-wrap;
	word-break: break-word;
	border-radius: 0 0 clamp(12px, 2vw, 16px) clamp(12px, 2vw, 16px);
	margin-top: -1px;
	flex-shrink: 0;
}
.mas-video-html5 {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: #000;
	display: none;
	object-fit: contain;
}
.mas-vid-cf-thumb-fallback {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 160px;
	background: linear-gradient(145deg, #5a4540 0%, #3c2f2f 100%);
}

@media (max-width: 899px) {
	.mas-videos-section {
		padding: 44px 0 52px;
	}
	.mas-videos-heading {
		font-size: clamp(24px, 6vw, 32px);
		margin-bottom: 24px;
	}
	.mas-vid-cf-card {
		width: min(380px, 88vw);
	}
	.mas-vid-cf-btn {
		padding: 12px 12px 16px;
		border-radius: 18px;
	}
	.mas-vid-cf-thumb {
		border-radius: 10px;
	}
	.mas-vid-cf-play {
		width: 52px;
		height: 52px;
	}
	.mas-vid-cf-play svg {
		width: 24px;
		height: 24px;
	}
	.mas-vid-cf-title {
		font-size: 14px;
		margin-top: 10px;
	}
	.mas-vids-cf-nav {
		gap: 16px;
	}
	.mas-vids-nav-btn {
		font-size: 13px;
	}
	.mas-videos-all-btn {
		border-radius: 12px;
		padding: 15px 24px;
		font-size: 15px;
	}
	.mas-vids-cf-outer {
		min-height: 260px;
	}
}
@media (max-width: 600px) {
	.mas-video-modal-dialog {
		width: min(960px, calc(100vw - 12px));
		border-radius: 12px;
	}
	.mas-video-modal-ratio.mas-video-modal-ratio--ig,
	.mas-video-modal-ratio.mas-video-modal-ratio--tg {
		min-height: 260px;
		height: min(68svh, 620px);
		max-height: calc(100vh - 88px);
		max-height: calc(100dvh - 88px);
	}
	.mas-video-modal-caption {
		font-size: 13px;
		padding: 12px 14px 16px;
		max-height: min(32vh, 200px);
	}
}
@media (max-height: 520px) and (orientation: landscape) {
	.mas-video-modal-ratio.mas-video-modal-ratio--ig,
	.mas-video-modal-ratio.mas-video-modal-ratio--tg {
		min-height: 180px;
		height: min(72vh, 520px);
		max-height: calc(100vh - 56px);
		max-height: calc(100dvh - 56px);
	}
}
@media (prefers-reduced-motion: reduce) {
	.mas-vid-cf-card {
		transition: none;
	}
}

/* ===== Страница всех видео — каталог ===== */
.mas-vc-wrap {
	max-width: 1200px;
	margin: 0 auto;
	padding: clamp(40px, 6vw, 60px) clamp(14px, 4vw, 20px) clamp(56px, 8vw, 80px);
}
.mas-vc-heading {
	font-family: "Montserrat Alternates", Montserrat, sans-serif;
	font-size: clamp(26px, 4vw, 40px);
	font-weight: 700;
	color: #3c2f2f;
	text-align: center;
	margin: 0 0 8px;
}
.mas-vc-sub {
	text-align: center;
	color: #7a6a6a;
	font-family: Montserrat, sans-serif;
	font-size: 15px;
	margin: 0 0 44px;
}
.mas-vc-empty {
	text-align: center;
	color: #7a6a6a;
	font-family: Montserrat, sans-serif;
	padding: 24px;
}
.mas-vc-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}
.mas-vc-item {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
@media (max-width: 900px) {
	.mas-vc-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}
}
@media (max-width: 560px) {
	.mas-vc-grid {
		grid-template-columns: 1fr;
		gap: 14px;
	}
}
.mas-vc-card {
	display: flex;
	flex-direction: column;
	border: none !important;
	outline: none;
	cursor: pointer;
	text-align: left;
	background: #fff !important;
	color: inherit !important;
	border-radius: 18px;
	padding: 0;
	box-shadow: 0 4px 20px rgba(60, 47, 47, 0.1);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	overflow: hidden;
}
.mas-vc-card:hover,
.mas-vc-card:focus {
	background: #fff !important;
	color: inherit !important;
	border: none !important;
	transform: translateY(-4px);
	box-shadow: 0 10px 36px rgba(60, 47, 47, 0.18);
}
.mas-vc-thumb {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #3c2f2f;
	overflow: hidden;
}
.mas-vc-thumb img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block;
	transition: transform 0.35s ease;
}
.mas-vc-card:hover .mas-vc-thumb img {
	transform: scale(1.05);
}
.mas-vc-thumb-fallback {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 120px;
	background: linear-gradient(145deg, #5a4540 0%, #3c2f2f 100%);
}
.mas-vc-play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: rgba(200, 122, 69, 0.88);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.25s ease, background 0.25s ease;
}
.mas-vc-card:hover .mas-vc-play {
	transform: translate(-50%, -50%) scale(1.1);
	background: #c87a45;
}
.mas-vc-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	padding: 14px 16px 16px;
	font-family: Montserrat, sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: #3c2f2f;
	line-height: 1.4;
	word-break: break-word;
}
