/* YT Canal Carousel — frontend
   Todas as cores são variáveis: dá para sobrescrever no CSS do tema. */

.ytcc {
	--ytcc-slides: 4;
	--ytcc-slides-tablet: 2;
	--ytcc-slides-mobile: 1;
	--ytcc-gap: 20px;
	--ytcc-radius: 14px;
	--ytcc-accent: #ff0033;

	--ytcc-bg: transparent;
	--ytcc-card: #ffffff;
	--ytcc-card-borda: rgba(15, 18, 25, 0.08);
	--ytcc-titulo: #10131a;
	--ytcc-meta: #6b7280;
	--ytcc-sombra: 0 1px 2px rgba(15, 18, 25, 0.06), 0 8px 24px rgba(15, 18, 25, 0.08);
	--ytcc-sombra-hover: 0 2px 4px rgba(15, 18, 25, 0.08), 0 18px 40px rgba(15, 18, 25, 0.16);
	--ytcc-seta-bg: #ffffff;
	--ytcc-seta-cor: #10131a;
	--ytcc-ponto: rgba(16, 19, 26, 0.2);

	--ytcc-n: var(--ytcc-slides-mobile);
	--ytcc-capa-h: 60%; /* substituído por px via JS */

	position: relative;
	background: var(--ytcc-bg);
	box-sizing: border-box;
}

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

.ytcc--tema-escuro {
	--ytcc-card: #14171f;
	--ytcc-card-borda: rgba(255, 255, 255, 0.09);
	--ytcc-titulo: #f2f4f8;
	--ytcc-meta: #98a1b3;
	--ytcc-sombra: 0 1px 2px rgba(0, 0, 0, 0.4);
	--ytcc-sombra-hover: 0 18px 40px rgba(0, 0, 0, 0.55);
	--ytcc-seta-bg: #1c2029;
	--ytcc-seta-cor: #f2f4f8;
	--ytcc-ponto: rgba(255, 255, 255, 0.25);
}

@media (prefers-color-scheme: dark) {
	.ytcc--tema-auto {
		--ytcc-card: #14171f;
		--ytcc-card-borda: rgba(255, 255, 255, 0.09);
		--ytcc-titulo: #f2f4f8;
		--ytcc-meta: #98a1b3;
		--ytcc-sombra: 0 1px 2px rgba(0, 0, 0, 0.4);
		--ytcc-sombra-hover: 0 18px 40px rgba(0, 0, 0, 0.55);
		--ytcc-seta-bg: #1c2029;
		--ytcc-seta-cor: #f2f4f8;
		--ytcc-ponto: rgba(255, 255, 255, 0.25);
	}
}

@media (min-width: 600px) {
	.ytcc {
		--ytcc-n: var(--ytcc-slides-tablet);
	}
}

@media (min-width: 1000px) {
	.ytcc {
		--ytcc-n: var(--ytcc-slides);
	}
}

/* ---------- trilha ---------- */

.ytcc__janela {
	overflow: hidden;
	padding: 4px;
	margin: -4px;
}

.ytcc__trilha {
	display: flex;
	gap: var(--ytcc-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	transition: transform 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
}

.ytcc.is-arrastando .ytcc__trilha {
	transition: none;
	cursor: grabbing;
}

.ytcc__slide {
	flex: 0 0 calc((100% - (var(--ytcc-gap) * (var(--ytcc-n) - 1))) / var(--ytcc-n));
	max-width: calc((100% - (var(--ytcc-gap) * (var(--ytcc-n) - 1))) / var(--ytcc-n));
	margin: 0;
	padding: 0;
	list-style: none;
}

.ytcc__slide::before,
.ytcc__slide::marker {
	content: none;
}

/* ---------- card ---------- */

.ytcc__card {
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--ytcc-card);
	border: 1px solid var(--ytcc-card-borda);
	border-radius: var(--ytcc-radius);
	box-shadow: var(--ytcc-sombra);
	overflow: hidden;
	transition: transform 220ms ease, box-shadow 220ms ease;
}

.ytcc__card:hover,
.ytcc__card:focus-within {
	transform: translateY(-3px);
	box-shadow: var(--ytcc-sombra-hover);
}

.ytcc__capa {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: #0b0d12;
	aspect-ratio: 16 / 9;
	cursor: pointer;
	overflow: hidden;
	line-height: 0;
	text-decoration: none;
}

.ytcc__capa:focus-visible {
	outline: 3px solid var(--ytcc-accent);
	outline-offset: -3px;
}

.ytcc__thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 500ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 220ms ease;
}

.ytcc__card:hover .ytcc__thumb {
	transform: scale(1.045);
	opacity: 0.92;
}

.ytcc__play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 62px;
	height: 44px;
	display: grid;
	place-items: center;
	pointer-events: none;
}

.ytcc__play svg {
	width: 100%;
	height: 100%;
	filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.ytcc__play-fundo {
	fill: rgba(20, 22, 28, 0.78);
	transition: fill 200ms ease;
}

.ytcc__card:hover .ytcc__play-fundo,
.ytcc__capa:focus-visible .ytcc__play-fundo {
	fill: var(--ytcc-accent);
}

.ytcc__duracao {
	position: absolute;
	right: 8px;
	bottom: 8px;
	padding: 2px 6px;
	border-radius: 5px;
	background: rgba(10, 12, 16, 0.85);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.01em;
	font-variant-numeric: tabular-nums;
}

.ytcc__selo {
	position: absolute;
	left: 8px;
	top: 8px;
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--ytcc-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ytcc__leitor-tela {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.ytcc__texto {
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ytcc__titulo {
	margin: 0;
	font-size: 15px;
	line-height: 1.35;
	font-weight: 600;
	color: var(--ytcc-titulo);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ytcc__titulo a {
	color: inherit;
	text-decoration: none;
}

.ytcc__titulo a:hover,
.ytcc__titulo a:focus-visible {
	color: var(--ytcc-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ytcc__descricao {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ytcc-meta);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ytcc__meta {
	margin: 0;
	font-size: 12.5px;
	color: var(--ytcc-meta);
	display: flex;
	flex-wrap: wrap;
	gap: 4px 10px;
}

/* vídeo tocando dentro do card */

.ytcc__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 0;
	display: block;
	background: #000;
}

/* ---------- setas ---------- */

.ytcc__seta {
	position: absolute;
	/* JS mede a altura da miniatura e alinha as setas no centro dela. */
	top: calc(var(--ytcc-capa-h) / 2);
	transform: translateY(-50%);
	z-index: 3;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 1px solid var(--ytcc-card-borda);
	border-radius: 50%;
	background: var(--ytcc-seta-bg);
	color: var(--ytcc-seta-cor);
	box-shadow: 0 6px 20px rgba(15, 18, 25, 0.18);
	cursor: pointer;
	opacity: 0;
	transition: opacity 200ms ease, transform 200ms ease, background 200ms ease;
}

.ytcc:hover .ytcc__seta,
.ytcc:focus-within .ytcc__seta {
	opacity: 1;
}

.ytcc__seta svg {
	width: 22px;
	height: 22px;
}

.ytcc__seta:hover {
	background: var(--ytcc-accent);
	border-color: var(--ytcc-accent);
	color: #fff;
}

.ytcc__seta:focus-visible {
	opacity: 1;
	outline: 3px solid var(--ytcc-accent);
	outline-offset: 2px;
}

.ytcc__seta[disabled] {
	opacity: 0;
	pointer-events: none;
}

.ytcc__seta--ant {
	left: -18px;
}

.ytcc__seta--prox {
	right: -18px;
}

@media (max-width: 782px) {
	.ytcc__seta {
		opacity: 1;
		width: 38px;
		height: 38px;
	}

	.ytcc__seta--ant {
		left: 2px;
	}

	.ytcc__seta--prox {
		right: 2px;
	}
}

/* ---------- pontos ---------- */

.ytcc__pontos {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 18px;
	min-height: 10px;
}

.ytcc__ponto {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--ytcc-ponto);
	cursor: pointer;
	transition: width 220ms ease, background 220ms ease;
}

.ytcc__ponto.is-ativo {
	width: 24px;
	background: var(--ytcc-accent);
}

.ytcc__ponto:focus-visible {
	outline: 2px solid var(--ytcc-accent);
	outline-offset: 3px;
}

/* ---------- modal ---------- */

.ytcc-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	place-items: center;
	padding: 24px;
	background: rgba(8, 10, 14, 0.88);
	opacity: 0;
	transition: opacity 200ms ease;
}

.ytcc-modal.is-aberto {
	opacity: 1;
}

.ytcc-modal__caixa {
	position: relative;
	width: min(1100px, 100%);
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.ytcc-modal__caixa iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.ytcc-modal__fechar {
	position: absolute;
	top: -46px;
	right: 0;
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.ytcc-modal__fechar:hover {
	background: rgba(255, 255, 255, 0.24);
}

@media (max-width: 600px) {
	.ytcc-modal__fechar {
		top: -44px;
	}
}

/* ---------- aviso para editores ---------- */

.ytcc-aviso {
	padding: 14px 16px;
	border: 1px dashed #d9a441;
	border-radius: 10px;
	background: #fff8e6;
	color: #6b4e12;
	font-size: 14px;
	line-height: 1.5;
}

/* ---------- acessibilidade ---------- */

@media (prefers-reduced-motion: reduce) {
	.ytcc__trilha,
	.ytcc__card,
	.ytcc__thumb,
	.ytcc__seta,
	.ytcc__ponto {
		transition: none !important;
	}

	.ytcc__card:hover {
		transform: none;
	}

	.ytcc__card:hover .ytcc__thumb {
		transform: none;
	}
}
