/* Eleanore — carrousel vidéos (mu-plugin, persistant) */

:root {
	--kb-card-width: 280px;
	--kb-card-height: 480px;
	--kb-gap: 15px;
}

#kb-app-root {
	all: initial;
	font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
	box-sizing: border-box;
	display: block;
	width: 100%;
	background: transparent;
	padding: 20px 0;
}

#kb-app-root * {
	box-sizing: border-box;
}

.kb-loading {
	color: #666;
	padding: 20px;
	margin: 0;
}

.kb-carousel-container {
	width: 100%;
	overflow-x: auto;
	white-space: nowrap;
	padding: 20px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.kb-carousel-container::-webkit-scrollbar {
	display: none;
}

.kb-card {
	display: inline-block;
	width: var(--kb-card-width);
	height: var(--kb-card-height);
	margin-right: var(--kb-gap);
	border-radius: 12px;
	overflow: hidden;
	position: relative;
	cursor: pointer;
	background: #1a1a1a;
	transition: transform 0.3s ease;
	vertical-align: top;
	white-space: normal;
}

.kb-card:hover {
	transform: scale(1.02);
}

.kb-thumb-wrapper {
	width: 100%;
	height: 100%;
	position: absolute;
	inset: 0;
	background-color: #1a1a1a;
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	overflow: hidden;
}

.kb-card .kb-thumb-wrapper {
	position: absolute;
	inset: 0;
}

.kb-thumb-img,
.kb-thumb-poster {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	min-width: 100%;
	min-height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center center;
	opacity: 1;
	transition: opacity 0.3s;
}

.kb-thumb-poster {
	pointer-events: none;
	background: #000;
}

.kb-card[data-is-short="false"] .kb-thumb-img,
.kb-card[data-is-short="true"] .kb-thumb-img {
	object-fit: cover;
}

.kb-preview-frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
	pointer-events: none;
	z-index: 2;
	object-fit: cover;
	object-position: center center;
}

.kb-card[data-is-short="false"] .kb-preview-frame {
	transform: scale(1.3);
}

.kb-card[data-is-short="true"] .kb-preview-frame {
	transform: scale(1);
}

.kb-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 54px;
	height: 54px;
	background: rgba(255, 255, 255, 0.22);
	backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 4;
	transition: all 0.3s ease;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.kb-card:hover .kb-play-icon {
	background: #f3013b;
	transform: translate(-50%, -50%) scale(1.1);
}

.kb-play-icon::after {
	content: '';
	border-left: 14px solid #fff;
	border-top: 9px solid transparent;
	border-bottom: 9px solid transparent;
	margin-left: 4px;
}

.kb-duration {
	position: absolute;
	top: 15px;
	right: 15px;
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	z-index: 3;
}

.kb-tiktok-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: #000;
	z-index: 99990;
}

.kb-tiktok-modal.active {
	display: block;
}

.kb-close-tiktok {
	position: absolute;
	top: 20px;
	left: 20px;
	z-index: 100;
	color: #fff;
	font-size: 28px;
	background: rgba(0, 0, 0, 0.55);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.2);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	backdrop-filter: blur(6px);
}

.kb-close-tiktok:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: rotate(90deg);
}

.kb-tiktok-feed {
	width: 100%;
	height: 100%;
	overflow-y: scroll;
	scroll-snap-type: y mandatory;
	scrollbar-width: none;
}

.kb-tiktok-feed::-webkit-scrollbar {
	display: none;
}

.kb-tiktok-slide {
	width: 100%;
	height: 100vh;
	scroll-snap-align: start;
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	background: #000;
}

.kb-tiktok-video-wrapper {
	position: relative;
	width: min(100vw, 420px);
	max-height: 100vh;
	aspect-ratio: 9 / 16;
	height: auto;
	max-width: min(100vw, calc(100vh * 9 / 16));
	overflow: hidden;
	border-radius: 16px;
	background: #000;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.kb-tiktok-slide[data-is-short="true"] .kb-tiktok-video-wrapper {
	width: min(100vw, 420px);
	aspect-ratio: 9 / 16;
	max-width: min(100vw, calc(100vh * 9 / 16));
}

.kb-tiktok-slide[data-is-short="false"] .kb-tiktok-video-wrapper {
	width: min(100vw, 920px);
	aspect-ratio: 16 / 9;
	max-width: min(100vw, calc(100vh * 16 / 9));
	border-radius: 12px;
}

.kb-tiktok-video-wrapper iframe,
.kb-tiktok-video-wrapper .kb-local-player,
.kb-tiktok-video-wrapper video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
	object-fit: cover;
	background: #000;
}

.kb-nav-btn {
	position: absolute;
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	gap: 20px;
	z-index: 50;
}

.kb-nav-arrow {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	border: none;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 20px;
	transition: all 0.3s ease;
}

.kb-nav-arrow:hover {
	background: rgba(147, 51, 234, 0.8);
}

.kb-preview-video,
.kb-local-player {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: none;
	z-index: 2;
	background: #000;
	pointer-events: none;
}

.kb-local-player {
	position: relative;
	pointer-events: auto;
	object-fit: cover;
}

@media (max-width: 768px) {
	:root {
		--kb-card-width: 160px;
		--kb-card-height: 280px;
	}

	.kb-play-icon {
		width: 40px;
		height: 40px;
	}

	.kb-play-icon::after {
		border-left: 12px solid #fff;
		border-top: 7px solid transparent;
		border-bottom: 7px solid transparent;
	}

	.kb-tiktok-video-wrapper {
		width: min(100vw, 420px) !important;
		max-width: min(100vw, calc(100vh * 9 / 16)) !important;
		border-radius: 0;
	}

	.kb-nav-btn {
		display: none;
	}
}
