/**
 * KH Tube Ultimate v1.7 — story discovery, KH ecosystem, sidebar CTA
 */

/* Ecosystem spacing */
.kh-tube-ecosystem-block {
	margin-top: 0;
}

.kh-tube-section--stories-home {
	padding: 0 1.25rem 1.5rem;
}

.kh-tube-section--stories-single {
	padding: 0;
}

.kh-tube-single-discovery .kh-tube-section--stories-single {
	padding-top: 0.25rem;
}

/* Story slider shell */
.kh-tube-stories-slider {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.kh-tube-stories-slider-track {
	display: flex;
	gap: 0.9rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	padding: 0.35rem 0.15rem 0.85rem;
	scrollbar-width: none;
}

.kh-tube-stories-slider-track::-webkit-scrollbar {
	display: none;
}

.kh-tube-stories-slider-item {
	flex: 0 0 min(240px, 78vw);
	scroll-snap-align: start;
}

.kh-tube-stories-slider--single .kh-tube-stories-slider-item {
	flex-basis: min(260px, 82vw);
}

.kh-tube-stories-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 40px;
	border-radius: 999px;
	border: 1px solid var(--kh-border);
	background: var(--kh-surface);
	color: var(--kh-text-strong);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.kh-tube-stories-nav:hover,
.kh-tube-stories-nav:focus-visible {
	background: rgba(255, 255, 255, 0.08);
	transform: translateY(-1px);
	outline: none;
}

/* Story cards */
.kh-tube-story-card {
	height: 100%;
}

.kh-tube-story-card-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	border-radius: 18px;
	overflow: hidden;
	border: 1px solid var(--kh-border);
	background: var(--kh-surface);
	text-decoration: none;
	color: inherit;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
	transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.kh-tube-story-card-link:hover,
.kh-tube-story-card-link:focus-visible {
	transform: translateY(-4px);
	border-color: rgba(236, 72, 153, 0.45);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(236, 72, 153, 0.12);
	outline: none;
}

.kh-tube-story-card-thumb {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.04);
}

.kh-tube-story-card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.kh-tube-story-card-link:hover .kh-tube-story-card-img,
.kh-tube-story-card-link:focus-visible .kh-tube-story-card-img {
	transform: scale(1.08);
}

.kh-tube-story-card-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.55) 100%);
	opacity: 0.85;
	transition: opacity 0.25s ease;
}

.kh-tube-story-card-link:hover .kh-tube-story-card-overlay,
.kh-tube-story-card-link:focus-visible .kh-tube-story-card-overlay {
	opacity: 1;
}

.kh-tube-story-card-glow {
	position: absolute;
	inset: auto 12% -30% 12%;
	height: 40%;
	background: radial-gradient(circle, rgba(236, 72, 153, 0.35), transparent 70%);
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.kh-tube-story-card-link:hover .kh-tube-story-card-glow,
.kh-tube-story-card-link:focus-visible .kh-tube-story-card-glow {
	opacity: 1;
}

.kh-tube-story-card-body {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	padding: 0.95rem 1rem 1.1rem;
}

.kh-tube-story-card-title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 800;
	line-height: 1.35;
	color: var(--kh-text-strong);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.kh-tube-story-read-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	padding: 0.45rem 0.85rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #fff;
	background: linear-gradient(135deg, #ec4899, #a855f7);
	box-shadow: 0 8px 18px rgba(236, 72, 153, 0.28);
	transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.kh-tube-story-card-link:hover .kh-tube-story-read-btn,
.kh-tube-story-card-link:focus-visible .kh-tube-story-read-btn {
	transform: translateY(-1px);
	box-shadow: 0 10px 22px rgba(236, 72, 153, 0.38);
}

/* Sidebar CTA */
.kh-tube-sidebar-cta {
	margin-bottom: 1rem;
}

.kh-tube-sidebar-cta-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	width: 100%;
	padding: 0.95rem 1rem;
	border-radius: 16px;
	text-decoration: none;
	font-size: 0.82rem;
	font-weight: 800;
	line-height: 1.25;
	text-align: center;
	color: #fff;
	background: linear-gradient(135deg, #f97316 0%, #ec4899 45%, #a855f7 100%);
	box-shadow:
		0 10px 28px rgba(236, 72, 153, 0.35),
		0 0 0 1px rgba(255, 255, 255, 0.08) inset;
	transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.2s ease;
	position: relative;
	overflow: hidden;
}

.kh-tube-sidebar-cta-btn::before {
	content: "";
	position: absolute;
	inset: -40%;
	background: radial-gradient(circle at center, rgba(255, 255, 255, 0.22), transparent 55%);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.kh-tube-sidebar-cta-btn:hover,
.kh-tube-sidebar-cta-btn:focus-visible {
	transform: translateY(-2px);
	filter: brightness(1.05);
	box-shadow:
		0 16px 36px rgba(236, 72, 153, 0.45),
		0 0 24px rgba(249, 115, 22, 0.35),
		0 0 0 1px rgba(255, 255, 255, 0.12) inset;
	outline: none;
}

.kh-tube-sidebar-cta-btn:hover::before,
.kh-tube-sidebar-cta-btn:focus-visible::before {
	opacity: 1;
}

.kh-tube-sidebar-cta-icon {
	font-size: 1.1rem;
	line-height: 1;
	flex-shrink: 0;
}

.kh-tube-sidebar-cta-text {
	position: relative;
	z-index: 1;
}

/* Sidebar stories list */
.kh-tube-widget--stories {
	margin-top: 0.25rem;
}

.kh-tube-stories-sidebar-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}

.kh-tube-stories-sidebar-list li a {
	display: block;
	padding: 0.55rem 0.65rem;
	border-radius: 12px;
	border: 1px solid transparent;
	text-decoration: none;
	transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.kh-tube-stories-sidebar-list li a:hover,
.kh-tube-stories-sidebar-list li a:focus-visible {
	background: rgba(255, 255, 255, 0.05);
	border-color: var(--kh-border);
	transform: translateX(2px);
	outline: none;
}

.kh-tube-stories-sidebar-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.82rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--kh-text-strong);
}

.kh-tube-stories-sidebar-more {
	display: inline-flex;
	align-items: center;
	margin-top: 0.75rem;
	font-size: 0.78rem;
	font-weight: 800;
	color: var(--kh-primary, #ec4899);
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.kh-tube-stories-sidebar-more:hover,
.kh-tube-stories-sidebar-more:focus-visible {
	opacity: 0.85;
	outline: none;
}

/* Ecosystem wrapper (reusable) */
.kh-tube-ecosystem {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.kh-tube-ecosystem-live-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.85rem 1.1rem;
	border-radius: 14px;
	border: 1px solid var(--kh-border);
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
	color: var(--kh-text-strong);
	font-size: 0.85rem;
	font-weight: 800;
	text-decoration: none;
	transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.kh-tube-ecosystem-live-link:hover,
.kh-tube-ecosystem-live-link:focus-visible {
	transform: translateY(-2px);
	border-color: rgba(249, 115, 22, 0.45);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
	outline: none;
}

/* Section head polish for story blocks */
.kh-tube-section--stories-home .kh-tube-section-head,
.kh-tube-section--stories-single .kh-tube-section-head {
	margin-bottom: 0.85rem;
}

.kh-tube-section--stories-home .kh-tube-link-more,
.kh-tube-section--stories-single .kh-tube-link-more {
	font-weight: 800;
}

@media (max-width: 991px) {
	.kh-tube-stories-nav {
		display: none;
	}

	.kh-tube-stories-slider {
		gap: 0;
	}

	.kh-tube-stories-slider-track {
		padding-left: 0;
		padding-right: 0;
	}
}

@media (min-width: 992px) {
	.kh-tube-stories-slider-item {
		flex-basis: min(220px, 22%);
	}

	.kh-tube-stories-slider--single .kh-tube-stories-slider-item {
		flex-basis: min(240px, 24%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.kh-tube-story-card-link,
	.kh-tube-story-card-img,
	.kh-tube-sidebar-cta-btn,
	.kh-tube-stories-nav {
		transition: none;
	}
}
