/* TikTok Video Feed · mobile first
   Móvil: < 768 px · Tablet: 768–1024 px · Escritorio: ≥ 1025 px (mismos cortes que Elementor) */

.tdf {
	--tdf-cols: var(--tdf-cols-m, 1.4);
	--tdf-gcols: var(--tdf-gcols-m, 1);
	--tdf-gap: var(--tdf-gap-m, 12px);
	--tdf-shadow-space: 0px;
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--tdf-max, none);
	margin-inline: auto;
	padding: var(--tdf-pad, 0);
	background: var(--tdf-bg, transparent);
}
.tdf *, .tdf *::before, .tdf *::after { box-sizing: border-box; }

@media (min-width: 768px) {
	.tdf { --tdf-cols: var(--tdf-cols-t, 3); --tdf-gcols: var(--tdf-gcols-t, 3); }
}
@media (min-width: 1025px) {
	.tdf { --tdf-cols: var(--tdf-cols-d, 4); --tdf-gcols: var(--tdf-gcols-d, 4); --tdf-gap: var(--tdf-gap-d, 20px); }
}

/* ---------- Cabecera (opcional) ---------- */
.tdf-head { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.tdf .tdf-title {
	margin: 0;
	font-size: var(--tdf-h-size, 32px);
	line-height: 1;
	color: var(--tdf-h-c, inherit);
}
.tdf .tdf-sub { margin: 0; color: var(--tdf-h-c, inherit); opacity: .85; }
.tdf--head-center .tdf-head { align-items: center; text-align: center; }
@media (min-width: 1025px) {
	.tdf .tdf-title { font-size: var(--tdf-h-size-d, 56px); }
	.tdf-head { margin-bottom: 24px; }
	.tdf--head-split .tdf-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
	.tdf--head-split .tdf-sub { text-align: right; max-width: 40ch; }
}

/* ---------- Carril ---------- */
.tdf-stage { position: relative; }
.tdf .tdf-track {
	list-style: none;
	margin: 0;
	padding: 0 var(--tdf-shadow-space) var(--tdf-shadow-space) 0;
	gap: var(--tdf-gap);
}
.tdf--carousel .tdf-track {
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	outline: none;
}
.tdf--carousel .tdf-track::-webkit-scrollbar { display: none; }
.tdf--carousel .tdf-track:focus-visible { outline: 2px solid var(--tdf-arrow-bg, #d8392b); outline-offset: 4px; }

.tdf--grid .tdf-track {
	display: grid;
	grid-template-columns: repeat(var(--tdf-gcols), minmax(0, 1fr));
}

.tdf .tdf-card {
	margin: 0;
	padding: 0;
	list-style: none;
	min-width: 0;
	animation: tdf-in .45s cubic-bezier(.2, .7, .2, 1) both;
}
.tdf .tdf-card::before, .tdf .tdf-card::marker { content: none; }
.tdf--carousel .tdf-card {
	flex: 0 0 calc((100% - (var(--tdf-cols) - 1) * var(--tdf-gap)) / var(--tdf-cols));
	scroll-snap-align: start;
}
@keyframes tdf-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Tarjeta ---------- */
.tdf-card-inner {
	position: relative;
	aspect-ratio: var(--tdf-aspect, 9/16);
	border-radius: var(--tdf-radius, 16px);
	background: var(--tdf-card-bg, #111);
	overflow: hidden;
	isolation: isolate;
	transform: translateZ(0); /* Safari: recorte del radio con overflow */
}
.tdf--shadow-soft .tdf-card-inner { box-shadow: 0 10px 28px -12px var(--tdf-shadow-c, #000); }
.tdf--shadow-solid { --tdf-shadow-space: 8px; }
.tdf--shadow-solid .tdf-card-inner { box-shadow: 6px 6px 0 var(--tdf-shadow-c, #000); }
.tdf--shadow-soft { --tdf-shadow-space: 14px; }

.tdf-media { position: absolute; inset: 0; z-index: 0; }
/* !important: los temas y Elementor fuerzan height:auto en las imágenes */
.tdf .tdf-card img.tdf-cover {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	object-fit: cover;
	display: block;
	transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.tdf--overlay .tdf-media::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(180deg, rgba(0,0,0,.45) 0, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 60%, rgba(0,0,0,.5) 100%);
}
@media (hover: hover) {
	.tdf--zoom .tdf-card:hover img.tdf-cover { transform: scale(1.04); }
}
.tdf-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 4; background: #000; }

/* Toda la tarjeta es clicable (mejor en móvil) */
.tdf .tdf-hit {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	cursor: pointer;
	text-decoration: none;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}
.tdf .tdf-hit:focus-visible { outline: 3px solid var(--tdf-arrow-bg, #d8392b); outline-offset: -3px; }
.tdf .tdf-play {
	display: grid;
	place-items: center;
	width: var(--tdf-play-size, 56px);
	height: var(--tdf-play-size, 56px);
	border-radius: 50%;
	background: var(--tdf-play-bg, #fff);
	color: var(--tdf-play-c, #111);
	opacity: var(--tdf-play-op, .92);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
	transition: transform .2s ease, opacity .2s ease;
}
.tdf .tdf-play svg { width: 38%; height: 38%; margin-left: 6%; }
@media (hover: hover) {
	.tdf .tdf-hit:hover .tdf-play { transform: scale(1.08); opacity: 1; }
}

/* Extras opcionales */
.tdf .tdf-tag, .tdf .tdf-dur {
	position: absolute;
	top: 10px;
	z-index: 3;
	pointer-events: none;
	border-radius: 999px;
	line-height: 1;
	white-space: nowrap;
	font-size: 11px;
	letter-spacing: .1em;
	text-transform: uppercase;
	padding: 6px 10px;
}
.tdf .tdf-tag { left: 10px; max-width: calc(100% - 80px); overflow: hidden; text-overflow: ellipsis; background: var(--tdf-tag-bg, #d8392b); color: var(--tdf-tag-c, #fff); }
.tdf .tdf-dur { right: 10px; background: rgba(0, 0, 0, .6); color: #fff; }
.tdf .tdf-caption {
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 10px;
	z-index: 3;
	pointer-events: none;
	border-radius: calc(var(--tdf-radius, 16px) * .6);
	padding: 10px 12px;
	background: var(--tdf-cap-bg, #fff);
	color: var(--tdf-cap-c, #111);
}
.tdf .tdf-caption p { margin: 0; color: inherit; font-size: 14px; line-height: 1.3; }
.tdf .tdf-caption .tdf-cap-title { font-weight: 700; text-transform: uppercase; }
.tdf .tdf-caption .tdf-cap-title + .tdf-cap-quote { margin-top: 4px; }
@media (min-width: 1025px) {
	.tdf .tdf-tag, .tdf .tdf-dur { top: 16px; font-size: 13px; padding: 7px 12px; }
	.tdf .tdf-tag { left: 16px; }
	.tdf .tdf-dur { right: 16px; }
	.tdf .tdf-caption { left: 16px; right: 16px; bottom: 16px; padding: 12px 14px; }
	.tdf .tdf-caption p { font-size: 16px; }
}
.tdf--fonts .tdf-title, .tdf--fonts .tdf-cap-title { font-family: "Anton", Impact, sans-serif; font-weight: 400; }
.tdf--fonts .tdf-sub, .tdf--fonts .tdf-cap-quote { font-family: "Fraunces", Georgia, serif; }
.tdf--fonts .tdf-tag, .tdf--fonts .tdf-dur { font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* Cerrar vídeo (modo en tarjeta) */
.tdf .tdf-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 5;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: var(--tdf-arrow-bg, #d8392b) !important;
	color: var(--tdf-arrow-c, #fff) !important;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
}
.tdf .tdf-close svg { width: 16px; height: 16px; }
.tdf-card.is-playing .tdf-hit,
.tdf-card.is-playing .tdf-tag,
.tdf-card.is-playing .tdf-dur,
.tdf-card.is-playing .tdf-caption { opacity: 0; pointer-events: none; }
.tdf-card.is-playing .tdf-close { opacity: 1; pointer-events: auto; }

/* ---------- Flechas y progreso ---------- */
.tdf-nav {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 14px;
}
.tdf-progress {
	flex: 1 1 120px;
	height: 3px;
	border-radius: 3px;
	background: var(--tdf-prog-track, #e6e1d8);
	overflow: hidden;
}
.tdf-progress span {
	display: block;
	height: 100%;
	background: var(--tdf-prog, #d8392b);
	transform-origin: left center;
	transform: scaleX(.25);
	transition: transform .35s ease;
}
.tdf-arrows { display: flex; gap: 10px; margin-left: auto; }
.tdf--arrows-below-center .tdf-nav { justify-content: center; }
.tdf--arrows-below-center .tdf-progress { flex-basis: 100%; }
.tdf--arrows-below-center .tdf-arrows { margin: 0 auto; }
.tdf--arrows-below-left .tdf-arrows { order: -1; margin-left: 0; }

.tdf .tdf-arrow {
	flex: none;
	display: grid;
	place-items: center;
	width: var(--tdf-arrow-size, 44px);
	height: var(--tdf-arrow-size, 44px);
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: var(--tdf-arrow-bg, #d8392b) !important;
	color: var(--tdf-arrow-c, #fff) !important;
	cursor: pointer;
	box-shadow: none;
	transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
	-webkit-tap-highlight-color: transparent;
}
.tdf--arrow-rounded .tdf-arrow { border-radius: 12px !important; }
.tdf--arrow-square .tdf-arrow { border-radius: 0 !important; }
.tdf .tdf-arrow svg { width: 45%; height: 45%; }
.tdf--arrow-shadow .tdf-arrow { box-shadow: 3px 3px 0 var(--tdf-shadow-c, #000); }
@media (hover: hover) {
	.tdf .tdf-arrow:hover:not(:disabled) { transform: translateY(-2px); }
	.tdf--arrow-shadow .tdf-arrow:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--tdf-shadow-c, #000); }
}
.tdf .tdf-arrow:active:not(:disabled) { transform: scale(.94); }
.tdf .tdf-arrow:focus-visible { outline: 2px solid var(--tdf-arrow-bg, #d8392b); outline-offset: 3px; }
.tdf .tdf-arrow:disabled { opacity: .3; cursor: default; }
.tdf.is-loading .tdf-next svg { animation: tdf-nudge .8s ease-in-out infinite; }
@keyframes tdf-nudge { 50% { transform: translateX(3px); } }

/* Flechas a los lados */
.tdf--arrows-sides .tdf-stage > .tdf-arrow {
	position: absolute;
	top: 50%;
	z-index: 6;
	transform: translateY(-50%);
}
.tdf--arrows-sides .tdf-stage > .tdf-prev { left: 8px; }
.tdf--arrows-sides .tdf-stage > .tdf-next { right: calc(8px + var(--tdf-shadow-space)); }
.tdf--arrows-sides .tdf-stage > .tdf-arrow:hover:not(:disabled) { transform: translateY(-50%) scale(1.06); }
.tdf--arrows-sides .tdf-stage > .tdf-arrow:disabled { opacity: 0; pointer-events: none; }

@media (max-width: 767px) {
	.tdf--no-arrows-mobile .tdf-arrow { display: none; }
}

/* Botón "Ver más" (cuadrícula) */
.tdf-more-wrap { display: flex; justify-content: center; margin-top: 20px; }
.tdf-more-wrap[hidden] { display: none; }
.tdf .tdf-more {
	padding: 12px 24px !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: var(--tdf-arrow-bg, #d8392b) !important;
	color: var(--tdf-arrow-c, #fff) !important;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.tdf.is-loading .tdf-more { opacity: .6; }

/* ---------- Ventana emergente ---------- */
.tdf-lb {
	width: min(92vw, calc(88vh * 9 / 16));
	max-width: 420px;
	padding: 0;
	border: 0;
	border-radius: 16px;
	background: #000;
	overflow: visible;
}
.tdf-lb::backdrop { background: rgba(0, 0, 0, .8); }
.tdf-lb iframe { display: block; width: 100%; aspect-ratio: 9/16; max-height: 88vh; border: 0; border-radius: 16px; }
.tdf-lb-close {
	position: absolute;
	top: -14px;
	right: -14px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #111;
	cursor: pointer;
}
.tdf-lb-close svg { width: 18px; height: 18px; }
@media (max-width: 767px) { .tdf-lb-close { top: 8px; right: 8px; } }

@media (prefers-reduced-motion: reduce) {
	.tdf--carousel .tdf-track { scroll-behavior: auto; }
	.tdf .tdf-card, .tdf.is-loading .tdf-next svg { animation: none; }
	.tdf .tdf-card img.tdf-cover, .tdf .tdf-arrow, .tdf .tdf-play, .tdf-progress span { transition: none; }
}
