/**
 * Card + carousel styling, including the mirror/reflection effect
 * (locked requirement — see media.png reference).
 * Colors/spacing exposed as CSS custom properties for easy theme tuning.
 */

.tmc-carousel {
	--tmc-card-width: 200px;
	--tmc-gap: 14px;
	--tmc-radius: 10px;
	--tmc-title-color: #fff;
	--tmc-scrim: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.25) 45%, transparent 70%);

	position: relative;
	display: flex;
	align-items: center;
	gap: var(--tmc-gap);
	padding: 0 48px;
	box-sizing: border-box;
}

.tmc-carousel__track {
	display: flex;
	gap: var(--tmc-gap);
	overflow-x: auto;
	scroll-behavior: smooth;
	padding-bottom: 4px; /* room for reflection */
	scrollbar-width: none;
}

.tmc-carousel__track::-webkit-scrollbar {
	display: none;
}

.tmc-carousel__arrow {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: transparent;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.2s ease, color 0.2s ease;
	z-index: 2;
}

.tmc-carousel__arrow:hover {
	border-color: #d4a24e;
	color: #d4a24e;
}

.tmc-carousel__arrow:disabled {
	opacity: 0.3;
	cursor: default;
}

/* ---- Card ---- */

.tmc-card {
	position: relative;
	flex: 0 0 auto;
	width: var(--tmc-card-width);
	cursor: pointer;
}

.tmc-card:focus-visible .tmc-card__thumb-wrap {
	outline: 2px solid #d4a24e;
	outline-offset: 2px;
}

.tmc-card__thumb-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9; /* matches native YouTube hi-res thumb, no forced crop */
	border-radius: var(--tmc-radius);
	border: 2px solid rgba(255, 255, 255, 0.35);
	box-sizing: border-box;
	overflow: hidden;
	background: #111;
}

.tmc-card__thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.tmc-card:hover .tmc-card__thumb {
	transform: scale(1.05);
}

.tmc-card__thumb-wrap::after {
	content: '';
	position: absolute;
	inset: 0;
	background: var(--tmc-scrim, linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.25) 45%, transparent 70%));
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.tmc-card:hover .tmc-card__thumb-wrap::after,
.tmc-card:focus-visible .tmc-card__thumb-wrap::after {
	opacity: 1;
}

.tmc-card__play {
	position: absolute;
	top: 10px;
	left: 50%;
	transform: translateX(-50%);
	width: 46px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 2;
}

.tmc-card:hover .tmc-card__play,
.tmc-card:focus-visible .tmc-card__play {
	opacity: 1;
	transform: translateX(-50%) scale(1.08);
}

.tmc-card__title {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 12px;
	color: var(--tmc-title-color, #fff);
	font-weight: 700;
	font-size: 14px;
	line-height: 1.3;
	z-index: 2;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.tmc-card:hover .tmc-card__title,
.tmc-card:focus-visible .tmc-card__title {
	opacity: 1;
	transform: translateY(0);
}

/* ---- Mirror / reflection (locked requirement) ---- */

.tmc-card__reflection {
	display: block;
	width: 100%;
	height: calc(var(--tmc-card-width) * 0.045); /* ~8% of the 16:9 thumb height */
	object-fit: cover;
	object-position: center top;
	border-radius: 0 0 var(--tmc-radius) var(--tmc-radius);
	border: 2px solid rgba(255, 255, 255, 0.35);
	box-sizing: border-box;
	margin-top: 5px;
	transform: scaleY(-1);
	/* gradient is defined pre-flip: local-bottom opaque, local-top transparent —
	   scaleY(-1) flips it so the box's *top* edge (against the thumbnail) ends
	   up strong, fading to transparent at the far/outside edge. */
	-webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 90%);
	mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 90%);
	opacity: 0.28;
	pointer-events: none;
	user-select: none;
}

@media (max-width: 640px) {
	.tmc-carousel {
		padding: 0 32px;
		--tmc-card-width: 150px;
	}
}
