/*
 * Banners (kritifm-core slots): the «Υποστηρικτές» strip on the home page, the 300×250 beside an article,
 * the 728×90 / 320×100 in the news list. Every image box has its size before the image arrives (width/height plus
 * aspect-ratio), so nothing moves. Quiet on purpose: no orange (orange is for live things). The one motion is the home
 * ribbon when there are more sponsors than places: a slow steady scroll that stops on hover/focus and with reduced motion.
 */

.kfm-ads__list { list-style: none; margin: 0; padding: 0; }
.kfm-ads__label {
	margin: 0;
	color: var(--mute);
	font-family: var(--font-text);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: .06em;
}

.kfm-ad {
	display: block;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--panel);
	box-shadow: inset 0 0 0 1px var(--line);
	transition: box-shadow .15s ease;
}
a.kfm-ad:hover { box-shadow: inset 0 0 0 1px var(--mute); }
a.kfm-ad:focus-visible { box-shadow: var(--focus); }
.kfm-ad__img { display: block; width: 100%; height: auto; object-fit: contain; }
.kfm-ad picture { display: block; }

/* ---------- Home: «Υποστηρικτές», up to 4 logos of 240×120 ---------- */
.kfm-ads--home_strip { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px 32px; }
.kfm-ads--home_strip .kfm-ads__list { display: grid; grid-template-columns: repeat(4, minmax(0, 240px)); gap: 16px; }
.kfm-ads--home_strip .kfm-ad__img { aspect-ratio: 2 / 1; }

@media (max-width: 899px) {
	.kfm-ads--home_strip { grid-template-columns: minmax(0, 1fr); }
	.kfm-ads--home_strip .kfm-ads__list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 599px) {
	.kfm-ads--home_strip { gap: 12px; }
	.kfm-ads--home_strip .kfm-ads__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Home ribbon: more sponsors than places, so they scroll by (ads.js adds the copy and the class) ---------- */
.kfm-ads--ribbon .kfm-ads__viewport {
	overflow: hidden;
	min-width: 0;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent);
	mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent);
}
.kfm-ads--ribbon .kfm-ads__list {
	display: flex;
	gap: 0;
	width: max-content;
	animation: kfm-ribbon var(--kfm-ribbon, 32s) linear infinite;
}
/* The gap is a right margin on every item (copies included), so half the track is exactly one full set. */
.kfm-ads--ribbon .kfm-ads__item { flex: 0 0 240px; width: 240px; margin-right: 16px; }
/* Stops under the mouse, and while a banner has keyboard focus. Not :focus-within: a mouse click leaves focus on the
   link, so after a visit to the sponsor's page the ribbon would stay stopped until a click elsewhere. */
.kfm-ads--ribbon:hover .kfm-ads__list,
.kfm-ads--ribbon:has(:focus-visible) .kfm-ads__list { animation-play-state: paused; }
@keyframes kfm-ribbon { to { transform: translateX(-50%); } }

@media (max-width: 899px) {
	.kfm-ads--ribbon .kfm-ads__item { flex-basis: 180px; width: 180px; margin-right: 12px; }
}
@media (max-width: 599px) {
	.kfm-ads--ribbon .kfm-ads__item { flex-basis: 150px; width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
	.kfm-ads--ribbon .kfm-ads__viewport { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
	.kfm-ads--ribbon .kfm-ads__list { animation: none; }
	.kfm-ads--ribbon [data-kfm-copy] { display: none; }
}

/* ---------- Article: 300×250 in the side column (shown from 1024 px, see news.css) ---------- */
.kfm-ads--article_side { width: 300px; }
.kfm-ads--article_side .kfm-ads__label { margin-bottom: 8px; }
.kfm-ads--article_side .kfm-ad__img { aspect-ratio: 300 / 250; }

/* ---------- News list: 728×90 after the 6th card; 320×100 under 640 px when there is a mobile image ---------- */
.kfm-grid__ad { padding-block: 16px; }
.kfm-ads--list_inline { width: 100%; max-width: 728px; }
.kfm-ads--list_inline .kfm-ads__label { margin-bottom: 8px; }
.kfm-ads--list_inline .kfm-ad__img { aspect-ratio: 728 / 90; }

@media (max-width: 639px) {
	.kfm-ads--list_inline picture .kfm-ad__img { aspect-ratio: 320 / 100; }
}

@media (prefers-reduced-motion: reduce) {
	.kfm-ad { transition: none; }
}
