/*
 * Brand Shortcode Navigator - frontend styles
 *
 * Mobile first, scoped under .bsn-wrapper so it never bleeds into
 * other Elementor widgets. Uses CSS variables and inherits the
 * parent typography (font family, color) by default.
 */

.bsn-wrapper {
	--bsn-cols: 4;
	--bsn-gap: 18px;
	--bsn-radius: 14px;
	--bsn-border: rgba(0, 0, 0, 0.08);
	--bsn-bg: #ffffff;
	--bsn-bg-alt: #f7f8fa;
	--bsn-text: inherit;
	--bsn-muted: rgba(0, 0, 0, 0.55);
	--bsn-accent: #111111;
	--bsn-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	--bsn-shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.10);
	--bsn-transition: 220ms cubic-bezier(0.2, 0.7, 0.2, 1);

	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
	color: var(--bsn-text);
}

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

/* Search field */
.bsn-search {
	margin: 0 0 var(--bsn-gap);
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bsn-search-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.bsn-search-input {
	width: 100%;
	padding: 12px 16px;
	font-size: 15px;
	font-family: inherit;
	line-height: 1.4;
	color: inherit;
	background: var(--bsn-bg);
	border: 1px solid var(--bsn-border);
	border-radius: 999px;
	outline: none;
	transition: border-color var(--bsn-transition), box-shadow var(--bsn-transition);
}

.bsn-search-input:focus {
	border-color: var(--bsn-accent);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

/* Grid */
.bsn-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--bsn-gap);
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Tablet */
@media (min-width: 600px) {
	.bsn-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* Desktop honours the chosen column count via the inline custom property. */
@media (min-width: 960px) {
	.bsn-grid {
		grid-template-columns: repeat(var(--bsn-cols), minmax(0, 1fr));
	}
}

/* Card */
.bsn-card {
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--bsn-bg);
	border: 1px solid var(--bsn-border);
	border-radius: var(--bsn-radius);
	overflow: hidden;
	box-shadow: var(--bsn-shadow);
	transition: transform var(--bsn-transition), box-shadow var(--bsn-transition), border-color var(--bsn-transition);
	will-change: transform;
}

.bsn-card:hover,
.bsn-card:focus-within {
	transform: translateY(-3px);
	box-shadow: var(--bsn-shadow-hover);
	border-color: rgba(0, 0, 0, 0.14);
}

.bsn-card-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 10px;
	padding: 18px 14px;
	text-decoration: none;
	color: inherit;
	height: 100%;
	transition: background var(--bsn-transition);
}

.bsn-card-link:hover,
.bsn-card-link:focus {
	text-decoration: none;
	background: var(--bsn-bg-alt);
	color: inherit;
}

/* Media area */
.bsn-card-media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: calc(var(--bsn-radius) - 6px);
	background: var(--bsn-bg-alt);
}

.bsn-card-media img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	transition: transform var(--bsn-transition);
}

.bsn-card:hover .bsn-card-media img,
.bsn-card:focus-within .bsn-card-media img {
	transform: scale(1.05);
}

/* Fallback when there is no logo */
.bsn-card-media-fallback {
	background: linear-gradient(135deg, #f4f5f7 0%, #e9ecef 100%);
}

.bsn-card-initial {
	font-size: clamp(28px, 4vw, 44px);
	font-weight: 700;
	color: var(--bsn-muted);
	font-family: inherit;
	line-height: 1;
}

/* Text */
.bsn-card-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	align-items: center;
}

.bsn-card-name {
	font-weight: 600;
	font-size: clamp(14px, 1.6vw, 16px);
	font-family: inherit;
	line-height: 1.3;
	color: inherit;
	word-break: break-word;
}

.bsn-card-count {
	font-size: 12px;
	color: var(--bsn-muted);
	font-family: inherit;
	line-height: 1.4;
}

/* Empty and no results states */
.bsn-empty,
.bsn-no-results {
	margin: 12px 0;
	padding: 18px;
	text-align: center;
	color: var(--bsn-muted);
	background: var(--bsn-bg-alt);
	border-radius: var(--bsn-radius);
	font-family: inherit;
}

/* Hidden state used by the search filter */
.bsn-card.is-hidden {
	display: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.bsn-card,
	.bsn-card-media img,
	.bsn-search-input {
		transition: none;
	}
	.bsn-card:hover,
	.bsn-card:focus-within {
		transform: none;
	}
}

/* Dark mode awareness when the theme opts in */
@media (prefers-color-scheme: dark) {
	.bsn-wrapper {
		--bsn-bg: rgba(255, 255, 255, 0.04);
		--bsn-bg-alt: rgba(255, 255, 255, 0.07);
		--bsn-border: rgba(255, 255, 255, 0.12);
		--bsn-muted: rgba(255, 255, 255, 0.6);
		--bsn-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
		--bsn-shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.45);
	}
	.bsn-card-media-fallback {
		background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.10));
	}
}

/*
 * Inline layout
 *
 * Flowing text style brand list with thin top and bottom rules,
 * centered uppercase names separated by whitespace and a bold
 * highlight for the currently viewed brand. Matches the luxury
 * fashion site reference design.
 */
.bsn-layout-inline {
	--bsn-inline-rule: rgba(0, 0, 0, 0.12);
	--bsn-inline-color: #000;
	--bsn-inline-active: #000;
	--bsn-inline-gap: 1.4em;
}

.bsn-layout-inline .bsn-inline-list {
	margin: 0;
	padding: 22px 8px;
	border-top: 1px solid var(--bsn-inline-rule);
	border-bottom: 1px solid var(--bsn-inline-rule);
	text-align: center;
	line-height: 2.1;
	font-family: inherit;
	font-size: clamp(12px, 1.05vw, 14px);
	letter-spacing: 0.06em;
	color: var(--bsn-inline-color);
	word-spacing: 0.6em;
}

.bsn-layout-inline .bsn-inline-list.is-uppercase {
	text-transform: uppercase;
}

.bsn-layout-inline .bsn-inline-item {
	display: inline;
	color: var(--bsn-inline-color);
	text-decoration: none;
	font-weight: 400;
	white-space: nowrap;
	transition: text-decoration-color 160ms ease;
}

.bsn-layout-inline .bsn-inline-item:hover,
.bsn-layout-inline .bsn-inline-item:focus {
	color: var(--bsn-inline-color);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	outline: none;
}

.bsn-layout-inline .bsn-inline-item.is-current {
	color: var(--bsn-inline-active);
	font-weight: 700;
}

/* When a brand is hidden by the search filter in inline mode, suppress its
   trailing space too so the layout closes up cleanly. */
.bsn-layout-inline .bsn-inline-item.is-hidden {
	display: none;
}

/* Tighter padding on small screens so the rules sit close to the names. */
@media (max-width: 600px) {
	.bsn-layout-inline .bsn-inline-list {
		padding: 16px 4px;
		line-height: 2;
		word-spacing: 0.4em;
		font-size: 12px;
	}
}

/* Inline layout, dark mode */
@media (prefers-color-scheme: dark) {
	.bsn-layout-inline {
		--bsn-inline-rule: rgba(255, 255, 255, 0.18);
		--bsn-inline-color: #fff;
		--bsn-inline-active: #fff;
	}
}
