/**
 * Compuland home categories style – promo pair + campaign banners.
 * Loaded only on the front page. Deactivate the plugin, or set
 * CHCS_ENABLE_BANNERS to false, to remove these rules.
 *
 * Scope: .promo-2.promo-pair and .campaign-rail only.
 * Does not target Black Friday blocks, .offers, or the iTOS kit banner.
 */

/* ----- Promo pair (Apollo + ZKTeco) ----- */
body.home .promo-2.promo-pair {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	width: 100%;
}

body.home .promo-pair a {
	display: block;
	width: 100%;
	margin: 0;
	background: #f7f9fb;
	border: 1px solid #e3e6ec;
	border-radius: 14px;
	overflow: hidden;
	line-height: 0;
	box-shadow: 0 4px 14px rgba(49, 60, 139, 0.08);
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

body.home .promo-pair a:hover,
body.home .promo-pair a:focus-visible {
	transform: translateY(-4px);
	border-color: #cfd5e8;
	box-shadow: 0 12px 28px rgba(49, 60, 139, 0.16);
	outline: none;
}

body.home .promo-pair img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	object-position: center;
	background: #f7f9fb;
}

/* ----- Campaign rail: 3 thin banners, then the 2-up pair ----- */
body.home .campaign-rail {
	position: relative;
	width: 100%;
}

body.home .campaign-track {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 16px;
	width: 100%;
	overflow: visible;
	scroll-behavior: auto;
}

body.home .campaign-track a {
	grid-column: span 2;
	flex: none;
	display: block;
	width: 100%;
	min-width: 0;
	line-height: 0;
	background: #0c0c0c;
	border: 1px solid #e3e6ec;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(49, 60, 139, 0.08);
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

/* Items 4–5 (dahua.jpg + cgate): full-width 2-up row. */
body.home .campaign-track a:nth-child(n+4) {
	grid-column: span 3;
}

body.home .campaign-track a:hover,
body.home .campaign-track a:focus-visible {
	transform: translateY(-4px);
	border-color: #cfd5e8;
	box-shadow: 0 12px 28px rgba(49, 60, 139, 0.16);
	outline: none;
}

body.home .campaign-track img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	object-position: center;
	background: #111218;
}

/*
 * Thin banner row (dahua-half, globalsim, cabling): tile ratio matches
 * the 555×85 art so the two slim banners fill the cell. Cabling is
 * taller (1024×248); contain on a near-black edge colour keeps the
 * title and “ΔΕΙΤΕ ΠΕΡΙΣΣΟΤΕΡΑ” button uncropped, with only narrow
 * side bars instead of 16:9 letterboxing.
 */
body.home .campaign-track img[src*="dahua-half"],
body.home .campaign-track img[src*="globalsim"],
body.home .campaign-track img[src*="cabling"] {
	aspect-ratio: 555 / 85;
	object-fit: cover;
	object-position: center;
	background: #0c0c0c;
}

body.home .campaign-track img[src*="cabling"] {
	object-fit: contain;
	background: #0c0c0c; /* sampled from cabling top/bottom/right edges */
}

/* All banners are visible in the grid, so the next-arrow is unused. */
body.home .campaign-rail .campaign-next {
	display: none;
}

@media (max-width: 900px) {
	body.home .promo-2.promo-pair {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	body.home .promo-pair img {
		aspect-ratio: 16 / 9;
	}
}

/* Stack campaign banners on mobile: 1 column, each tile uses its own art ratio. */
@media (max-width: 700px) {
	body.home .campaign-track {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	body.home .campaign-track a,
	body.home .campaign-track a:nth-child(n+4) {
		grid-column: auto;
	}

	body.home .campaign-track img[src*="cabling"] {
		aspect-ratio: 1024 / 248;
		object-fit: cover;
		object-position: center;
	}
}

@media (max-width: 600px) {
	body.home .promo-2.promo-pair {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	body.home .promo-pair img {
		aspect-ratio: 16 / 9;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.home .promo-pair a,
	body.home .campaign-track a {
		transition: none;
	}

	body.home .promo-pair a:hover,
	body.home .promo-pair a:focus-visible,
	body.home .campaign-track a:hover,
	body.home .campaign-track a:focus-visible {
		transform: none;
	}
}
