/**
 * kd-sponsoren – Frontend styles.
 * Layout and look are driven by CSS custom properties set inline per wall,
 * so the same stylesheet adapts to grid, carousel and marquee layouts and can
 * be overridden by the Elementor widget (global colors/fonts).
 */

.kdsp {
	--kdsp-cols: 4;
	--kdsp-cols-tablet: 2;
	--kdsp-cols-mobile: 2;
	--kdsp-gap: 24px;
	--kdsp-ratio: 3 / 2;
	--kdsp-pad: 16px;
	--kdsp-bg: #ffffff;
	--kdsp-radius: 8px;
	--kdsp-accent: #1a73e8;
	--kdsp-marquee-speed: 30s;
	box-sizing: border-box;
}

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

.kdsp ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Item & frame ---------------------------------------------------------- */

.kdsp__item {
	min-width: 0;
}

.kdsp__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.kdsp__frame {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: var(--kdsp-ratio, 3 / 2);
	background: var(--kdsp-bg, #ffffff);
	padding: var(--kdsp-pad, 16px);
	border-radius: var(--kdsp-radius, 8px);
	overflow: hidden;
}

.kdsp--ratio-free .kdsp__frame {
	aspect-ratio: auto;
	min-height: 80px;
}

.kdsp__logo {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.kdsp__placeholder {
	font-weight: 600;
	text-align: center;
	color: #555;
}

.kdsp--border .kdsp__frame {
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.kdsp__name {
	display: block;
	text-align: center;
	margin-top: 8px;
	font-size: 0.9em;
	line-height: 1.3;
}

/* Black & white look ---------------------------------------------------- */

.kdsp--gray .kdsp__logo {
	filter: grayscale(1);
	opacity: 0.85;
	transition: filter 0.3s ease, opacity 0.3s ease;
}

.kdsp--gray.kdsp--reveal .kdsp__item:hover .kdsp__logo,
.kdsp--gray.kdsp--reveal .kdsp__item:focus-within .kdsp__logo,
.kdsp--gray.kdsp--reveal .kdsp__item:active .kdsp__logo,
.kdsp--gray.kdsp--reveal .kdsp__item.is-revealed .kdsp__logo {
	filter: none;
	opacity: 1;
}

/* On touch devices without hover, optionally show colour right away. */
@media (hover: none) {
	.kdsp--gray.kdsp--touch-color .kdsp__logo {
		filter: none;
		opacity: 1;
	}
}

/* Grid ------------------------------------------------------------------ */

.kdsp--grid {
	display: grid;
	grid-template-columns: repeat(var(--kdsp-cols, 4), minmax(0, 1fr));
	gap: var(--kdsp-gap, 24px);
	align-items: center;
}

@media (max-width: 1024px) {
	.kdsp--grid {
		grid-template-columns: repeat(var(--kdsp-cols-tablet, 2), minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.kdsp--grid {
		grid-template-columns: repeat(var(--kdsp-cols-mobile, 2), minmax(0, 1fr));
	}
}

/* Carousel (Splide) ----------------------------------------------------- */

.kdsp--carousel {
	width: 100%;
}

.kdsp--carousel .splide__slide {
	display: flex;
	align-items: center;
	height: auto;
}

.kdsp--carousel .kdsp__item.splide__slide > .kdsp__frame,
.kdsp--carousel .kdsp__item.splide__slide > .kdsp__link {
	width: 100%;
}

.kdsp--carousel .splide__arrow {
	background: var(--kdsp-accent, #1a73e8);
	opacity: 0.92;
}

.kdsp--carousel .splide__arrow:hover {
	opacity: 1;
}

.kdsp--carousel .splide__arrow svg {
	fill: #ffffff;
}

.kdsp--carousel .splide__pagination__page.is-active {
	background: var(--kdsp-accent, #1a73e8);
}

/* Marquee --------------------------------------------------------------- */

.kdsp--marquee {
	overflow: hidden;
	position: relative;
}

.kdsp__marquee-track {
	display: flex;
	width: max-content;
	animation: kdsp-marquee var(--kdsp-marquee-speed, 30s) linear infinite;
	will-change: transform;
}

.kdsp--marquee-right .kdsp__marquee-track {
	animation-direction: reverse;
}

.kdsp--marquee-pause:hover .kdsp__marquee-track,
.kdsp--marquee-pause:focus-within .kdsp__marquee-track {
	animation-play-state: paused;
}

.kdsp__marquee-list {
	display: flex;
	align-items: center;
	gap: var(--kdsp-gap, 24px);
	padding-right: var(--kdsp-gap, 24px);
}

.kdsp--marquee .kdsp__item {
	flex: 0 0 auto;
	width: 160px;
}

@keyframes kdsp-marquee {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

/* Reduced motion -------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.kdsp__marquee-track {
		animation: none;
	}
	.kdsp__logo {
		transition: none;
	}
}

/* Elementor editor hint ------------------------------------------------- */

.kdsp-editor-note {
	margin: 0 0 10px;
	padding: 6px 10px;
	font-size: 12px;
	line-height: 1.4;
	color: #555;
	background: #f3f4f6;
	border-radius: 4px;
}
