/**
 * Вкладки «Видеоконтент / Публикации» и лента роликов.
 * Путь: modules/hilbert-video/assets/hbv.css
 */

/* --- Полоса вкладок (рисуется шаблоном страницы) ----------------------- */

.hbv-tabs {
	position: relative;
	z-index: 2;
	display: flex;
	justify-content: center;
	gap: 48px;
	/* поднимаем полосу на тёмную шапку, под кружки историй */
	margin: -86px 0 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.hbv-tabs::-webkit-scrollbar {
	display: none;
}

.hbv-tabs__btn {
	position: relative;
	flex: 0 0 auto;
	padding: 0 2px 12px;
	border: 0;
	background: none;
	font: inherit;
	font-size: 19px;
	letter-spacing: .01em;
	color: rgba(255, 255, 255, .62);
	text-shadow: 0 1px 14px rgba(0, 0, 0, .55);
	cursor: pointer;
	transition: color .18s ease;
}

.hbv-tabs__btn:hover,
.hbv-tabs__btn:focus-visible {
	color: #fff;
}

.hbv-tabs__btn.is-active {
	color: #fff;
}

.hbv-tabs__btn.is-active::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	/* черта ближе к надписи и не ложится на край фоновой картинки */
	bottom: 11px;
	height: 2px;
	background: #af0b0b;
}

.hbv-panel[hidden] {
	display: none;
}

.hbv-panel {
	padding: 16px 0 76px;
}

/* Лента публикаций чуть наезжает на фоновую картинку */
.hbv-panel [id="hb-feed"] {
	margin-top: 0;
}

/* Ролики начинаются ниже шапки: чипы фильтров не должны попадать на тёмный фон */
[data-hbv-panel="video"] {
	padding-top: 92px;
}

/* Контейнер под вкладками — та же геометрия, что у шапки [ig_header]:
   1480px по центру, а на узких экранах 16px от краёв */
main.hb-feed-wrap {
	width: min(1480px, calc(100% - 32px));
}

/* --- Лента роликов ----------------------------------------------------- */

.hbv {
	--hbv-accent: #af0b0b;
	--hbv-ink: #111;
	--hbv-muted: #6f6f6f;
	--hbv-line: rgba(17, 17, 17, .16);
	--hbv-cols: 4;

	color: var(--hbv-ink);
}

.hbv *,
.hbv *::before,
.hbv *::after {
	box-sizing: border-box;
}

.hbv img {
	display: block;
	max-width: 100%;
}

.hbv-empty {
	padding: 40px 0;
	color: var(--hbv-muted);
}

.hbv-dot {
	display: inline-block;
	width: 3px;
	height: 3px;
	margin: 0 8px;
	vertical-align: middle;
	background: currentColor;
	opacity: .5;
}

.hbv-filters {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0 30px;
	overflow-x: auto;
	scrollbar-width: none;
}

.hbv-filters::-webkit-scrollbar {
	display: none;
}

.hbv-filters__sep {
	flex: 0 0 auto;
	width: 1px;
	height: 20px;
	margin: 0 6px;
	background: var(--hbv-line);
}

.hbv-chip {
	flex: 0 0 auto;
	padding: 8px 16px;
	border: 1px solid var(--hbv-line);
	background: none;
	font: inherit;
	font-size: 13px;
	color: var(--hbv-muted);
	cursor: pointer;
	white-space: nowrap;
	transition: border-color .18s ease, color .18s ease;
}

.hbv-chip:hover,
.hbv-chip:focus-visible {
	border-color: var(--hbv-ink);
	color: var(--hbv-ink);
}

.hbv-chip.is-active {
	border-color: var(--hbv-accent);
	color: var(--hbv-accent);
}

.hbv-grid {
	display: grid;
	grid-template-columns: repeat(var(--hbv-cols), minmax(0, 1fr));
	gap: 34px 12px;
}

.hbv-card[hidden] {
	display: none;
}

.hbv-card__thumb {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #f1f1f3;
	cursor: pointer;
}

.hbv-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hbv-card__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 1px solid transparent;
	pointer-events: none;
	transition: border-color .18s ease;
}

.hbv-card__thumb:hover::after,
.hbv-card__thumb:focus-visible::after {
	border-color: var(--hbv-accent);
}

.hbv-play {
	position: absolute;
	left: 50%;
	top: 50%;
	margin: -29px 0 0 -29px;
	width: 58px;
	height: 58px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(14, 14, 18, .5);
	color: #fff;
	transition: background-color .18s ease;
}

.hbv-play svg {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	margin-left: 3px;
}

.hbv-card__thumb:hover .hbv-play {
	background: var(--hbv-accent);
}

.hbv-dur {
	position: absolute;
	right: 8px;
	bottom: 8px;
	padding: 3px 7px;
	background: rgba(14, 14, 18, .88);
	color: #fff;
	font-size: 12px;
	line-height: 1.3;
}

.hbv-card__body {
	padding: 13px 0 0;
}

.hbv-card__title {
	margin: 0;
	font-size: 15px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.hbv-card__meta {
	margin: 7px 0 0;
	font-size: 13px;
	color: var(--hbv-muted);
}

/* --- Плеер ------------------------------------------------------------- */

.hbv-modal {
	--hbv-accent: #af0b0b;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	opacity: 0;
	visibility: hidden;
	transition: opacity .22s ease, visibility .22s ease;
}

.hbv-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.hbv-modal__scrim {
	position: absolute;
	inset: 0;
	background: rgba(8, 8, 10, .94);
}

.hbv-modal__stage {
	position: relative;
	width: min(1180px, 100%);
}

.hbv-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 0 0 14px;
	border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.hbv-modal__title {
	margin: 0;
	color: #fff;
	font-size: 15px;
	line-height: 1.4;
}

.hbv-round {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	/* тема задаёт кнопкам padding — он съедал ширину иконки */
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(255, 255, 255, .4);
	border-radius: 50%;
	background: none;
	color: #fff;
	cursor: pointer;
	transition: border-color .18s ease, color .18s ease;
}

.hbv-round svg {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	max-width: none;
}

.hbv-round--sm svg {
	width: 16px;
	height: 16px;
}

.hbv-round:hover,
.hbv-round:focus-visible {
	border-color: var(--hbv-accent);
	color: var(--hbv-accent);
}

.hbv-modal__frame {
	position: relative;
	margin: 18px 0 0;
	aspect-ratio: 16 / 9;
	background: #000 center / cover no-repeat;
}

/* пока плеер не готов — видна обложка, а не чёрный прямоугольник */
.hbv-modal__frame.is-loading iframe,
.hbv-modal__frame.is-loading video {
	opacity: 0;
}

.hbv-modal__frame iframe,
.hbv-modal__frame video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: contain;
	background: #000;
}

.hbv-modal__loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	flex-direction: column;
	gap: 14px;
	justify-content: center;
	margin: 0;
	background: rgba(0, 0, 0, .45);
	color: rgba(255, 255, 255, .85);
	font-size: 13px;
	text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}

.hbv-spinner {
	width: 34px;
	height: 34px;
	border: 2px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: hbv-spin .8s linear infinite;
}

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

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

.hbv-modal__foot {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 16px 0 0;
}

.hbv-round--sm {
	width: 36px;
	height: 36px;
}

.hbv-round[hidden] {
	display: none;
}

.hbv-modal__counter {
	min-width: 62px;
	color: rgba(255, 255, 255, .6);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.hbv-modal__link {
	margin-left: auto;
	padding: 0 0 2px;
	border-bottom: 1px solid rgba(255, 255, 255, .35);
	color: rgba(255, 255, 255, .75);
	font-size: 13px;
	text-decoration: none;
	transition: color .18s ease, border-color .18s ease;
}

.hbv-modal__link:hover,
.hbv-modal__link:focus-visible {
	color: #fff;
	border-color: var(--hbv-accent);
}

.hbv-modal__link[hidden] {
	display: none;
}

/* --- Полки: Shorts и «Ещё видео» ------------------------------------- */

.hbv-shelf {
	margin: 60px 0 0;
	padding: 30px 0 0;
	border-top: 1px solid var(--hbv-line);
}

.hbv-shelf[hidden] {
	display: none;
}

.hbv-shelf__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin: 0 0 22px;
}

.hbv-shelf__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 22px;
	line-height: 1.2;
	color: var(--hbv-ink);
}

.hbv-shelf__icon {
	display: inline-flex;
	color: var(--hbv-accent);
}

.hbv-shelf__icon svg {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	max-width: none;
}

.hbv-shelf__nav {
	display: flex;
	gap: 10px;
}

.hbv-shelf.is-static .hbv-shelf__nav {
	visibility: hidden;
}

.hbv-round--line {
	border-color: var(--hbv-line);
	color: var(--hbv-ink);
}

.hbv-round--line:hover,
.hbv-round--line:focus-visible {
	border-color: var(--hbv-accent);
	color: var(--hbv-accent);
}

.hbv-round[disabled] {
	opacity: .3;
	cursor: default;
	pointer-events: none;
}

.hbv-shorts {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.hbv-shorts::-webkit-scrollbar {
	display: none;
}

.hbv-short {
	flex: 0 0 calc((100% - 60px) / 6);
	min-width: 0;
	scroll-snap-align: start;
}

.hbv-short__thumb {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	aspect-ratio: 9 / 16;
	overflow: hidden;
	background: #f1f1f3;
	cursor: pointer;
}

.hbv-short__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hbv-short__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 1px solid transparent;
	pointer-events: none;
	transition: border-color .18s ease;
}

.hbv-short__thumb:hover::after,
.hbv-short__thumb:focus-visible::after {
	border-color: var(--hbv-accent);
}

.hbv-short__title {
	margin: 12px 0 0;
	font-size: 15px;
	line-height: 1.4;
	color: var(--hbv-ink);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.hbv-short__meta {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--hbv-muted);
}

/* --- Плеер: вертикальный режим для Shorts ------------------------------ */

.hbv-modal.is-vertical .hbv-modal__stage {
	/* ширина сцены = ширине вертикального кадра, чтобы шапка и подвал шли по его краям */
	width: min(100%, calc(72vh * 9 / 16));
	min-width: 280px;
}

.hbv-modal.is-vertical .hbv-modal__frame {
	width: 100%;
	aspect-ratio: 9 / 16;
	margin: 16px 0 0;
}

.hbv-modal.is-vertical .hbv-modal__foot {
	flex-wrap: wrap;
	row-gap: 12px;
}

.hbv-modal.is-vertical .hbv-modal__link {
	margin-left: 0;
}

/* --- Адаптив ----------------------------------------------------------- */

@media (max-width: 1280px) {
	.hbv-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	/* шапка здесь ниже — поднимаем вкладки слабее */
	.hbv-tabs {
		margin-top: -44px;
	}

	[data-hbv-panel="video"] {
		padding-top: 62px;
	}

	.hbv-short {
		flex-basis: calc((100% - 48px) / 5);
	}
}

@media (max-width: 860px) {
	.hbv-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.hbv-tabs {
		gap: 30px;
		margin-top: -43px;
	}

	.hbv-tabs__btn {
		font-size: 17px;
	}

	[data-hbv-panel="video"] {
		padding-top: 74px;
	}

	.hbv-short {
		flex-basis: 30%;
	}

	/* лента Shorts начинается по линии контента, а листается до края экрана */
	.hbv-shorts {
		margin: 0 -16px;
		padding: 0 16px;
		scroll-padding-inline: 16px;
	}

	.hbv-shelf {
		margin-top: 48px;
		padding-top: 26px;
	}
}

@media (max-width: 600px) {
	.hbv-grid {
		grid-template-columns: 1fr;
	}

	.hbv-tabs {
		gap: 24px;
		margin-top: -38px;
	}

	.hbv-tabs__btn {
		font-size: 16px;
	}

	[data-hbv-panel="video"] {
		padding-top: 26px;
	}

	/* в шапке на телефоне — только число публикаций */
	.ig-header-wrap .ig-h__stat--video {
		display: none;
	}

	.hbv-panel {
		padding-bottom: 48px;
	}

	.hbv-grid {
		gap: 28px 0;
	}

	.hbv-modal {
		padding: 14px;
	}

	.hbv-modal__title {
		font-size: 13px;
	}

	.hbv-modal__foot {
		flex-wrap: wrap;
		column-gap: 12px;
		row-gap: 6px;
		margin-top: 14px;
	}

	/* перенос строки: стрелки со счётчиком сверху, ссылка под ними */
	.hbv-modal__foot::before {
		content: "";
		order: 2;
		flex-basis: 100%;
		height: 0;
	}

	.hbv-modal__foot > * {
		order: 1;
	}

	.hbv-modal__counter {
		min-width: 0;
	}

	.hbv-modal__foot > .hbv-modal__link {
		order: 3;
		flex: 0 0 auto;
		margin-left: 0;
	}

	.hbv-short {
		flex-basis: 44%;
	}

	.hbv-shelf__title {
		font-size: 19px;
	}

	.hbv-round {
		width: 38px;
		height: 38px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hbv *,
	.hbv-modal,
	.hbv-modal * {
		transition-duration: .01ms !important;
	}
}
