/*
 * RahkarTheme — rahkar/brands-slider (frontend + editor).
 *
 * The rail itself (.rps-frame / .rps-track / .rps-arrow + column widths from
 * the --rps-* vars) is reused verbatim from blocks/products-slider/style.css —
 * this file only owns the header row and the brand-card visuals. All values
 * come from theme.json tokens.
 */

.wp-block-rahkar-brands-slider { margin-block: 0; }

/* ─── Header: title + «مشاهده همه» ──────────────────────────────────── */
.rbs-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 12px;
}
.rbs-head__title {
	margin: 0;
	font-size: 1.1rem;
	font-weight: var(--wp--custom--fw--strong);
	line-height: 1.4;
	color: var(--wp--preset--color--contrast, #0f1115);
}
.rbs-head__all {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 0.9rem;
	font-weight: var(--wp--custom--fw--strong);
	color: var(--wp--preset--color--primary, #0a66c2);
	text-decoration: none;
}
.rbs-head__all:hover { text-decoration: underline; }
.rbs-head__all svg { width: 16px; height: 16px; }

/* ─── Cards ─────────────────────────────────────────────────────────────
 * Minimal on purpose, and deliberately different from the product card: NO
 * card border/background. The only frame is a clean bordered tile around the
 * logo image; the name sits plainly underneath.
 *
 * box-sizing is forced to border-box on every part: the theme isn't globally
 * border-box, and a content-box tile with width:100% + padding + border ends
 * up WIDER than its column and overlaps its neighbours. border-box makes the
 * tile fill its column exactly.
 *
 * The <li> is the rail flex item (sized by .rps-track > *); the <a> fills it. */
.rbs-item,
.rbs-card,
.rbs-card__logo,
.rbs-card__name { box-sizing: border-box; }

.rbs-item { min-width: 0; }

/* Block flow — NOT a nested flex column. A flex-item logo tile gets
 * min-height:auto, so the <img> forces the tile to grow and its aspect-ratio
 * is ignored (that's what overflowed the logos). Plain block flow keeps the
 * tile fixed and the image contained, same as the brands-index grid. */
.rbs-card {
	display: block;
	width: 100%;
	color: inherit;
	text-decoration: none;
	text-align: center;
}

.rbs-card__logo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	/* Short landscape tile (not a tall square) — logo sits in a low band with
	   the name underneath. */
	aspect-ratio: 16 / 10;
	padding: 14px 18px;
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: var(--rps-radius, var(--wp--custom--radius--lg, 12px));
	/* Soft fill so each tile reads as a separate block against the white gaps —
	   plain white tiles + white gaps made the row look like one connected band.
	   Pops to clean white on hover. */
	background: var(--wp--preset--color--surface, #f7f7f8);
	overflow: hidden;
	transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.rbs-card:hover .rbs-card__logo {
	background: var(--wp--preset--color--base, #fff);
	border-color: color-mix(in srgb, var(--wp--preset--color--primary, #0a66c2) 45%, var(--wp--preset--color--border, #e2e4e9));
	box-shadow: var(--wp--preset--shadow--sm, 0 2px 6px rgba(15, 17, 21, 0.08));
	transform: translateY(-2px);
}
.rbs-card__img {
	/* Cap BOTH dimensions so logos read as one uniform band — without the cap,
	   wide logos with their own background fill the whole tile while narrow ones
	   look tiny. Centered with breathing room around them. */
	max-width: 82%;
	max-height: 62%;
	width: auto;
	height: auto;
	object-fit: contain; /* show the whole logo, never crop */
}
.rbs-card__logo--mono {
	padding: 0;
	font-size: clamp(1.5rem, 5vw, 2.25rem);
	font-weight: var(--wp--custom--fw--strong);
	color: var(--wp--preset--color--primary, #0a66c2);
}

.rbs-card__name {
	width: 100%;
	margin-top: 10px;
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	font-weight: var(--wp--custom--fw--strong);
	line-height: 1.6;
	color: var(--wp--preset--color--text, #1a1d23);
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.rbs-card:hover .rbs-card__name { color: var(--wp--preset--color--primary, #0a66c2); }

@media (prefers-reduced-motion: reduce) {
	.rbs-card__logo { transition: none; }
	.rbs-card:hover .rbs-card__logo { transform: none; }
}
