/* Brand logo size from theme settings (--sc-brand-logo-* on header) */

header[class*='navbar-v'] .logo,
header[class*='navbar-v'] [class*='__logo'],
header[class*='navbar-v'] [class*='__brand'] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	text-decoration: none;
	box-sizing: border-box;
	width: fit-content;
	max-width: min(100%, calc(var(--sc-brand-logo-width, 60px) + 14px));
	height: fit-content;
	max-height: calc(var(--sc-brand-logo-max-height, 84px) + 14px);
	align-self: center;
	flex: 0 0 auto;
}

header[class*='navbar-v'] .navbar-brand-logo--bordered {
	padding: 5px;
}

header[class*='navbar-v'] .logo img,
header[class*='navbar-v'] [class*='__logo'] img,
header[class*='navbar-v'] [class*='__brand'] img {
	display: block;
	width: auto;
	max-width: var(--sc-brand-logo-width, 60px);
	max-height: var(--sc-brand-logo-max-height, 84px);
	height: auto;
	object-fit: contain;
}

/* Text logos: do not use image-width caps (they truncate the brand name). */
header[class*='navbar-v'] .logo:has(.brand-text-logo),
header[class*='navbar-v'] [class*='__logo']:has(.brand-text-logo),
header[class*='navbar-v'] [class*='__brand']:has(.brand-text-logo) {
	max-width: min(100%, 42vw);
	line-height: 1.1;
}

@media (min-width: 992px) {
	header[class*='navbar-v'] .logo:has(.brand-text-logo),
	header[class*='navbar-v'] [class*='__logo']:has(.brand-text-logo),
	header[class*='navbar-v'] [class*='__brand']:has(.brand-text-logo) {
		max-width: min(100%, 320px);
	}
}

header[class*='navbar-v'] .brand-text-logo,
footer .brand-text-logo,
.logo-preview .brand-text-logo {
	display: inline-block;
	line-height: 1.05;
	white-space: nowrap;
	overflow: visible;
	text-overflow: clip;
	max-width: none;
	font-size: clamp(
		14px,
		calc(var(--sc-brand-logo-width, 60px) * 0.42),
		var(--sc-brand-logo-max-height, 84px)
	);
	vertical-align: middle;
}

header[class*='navbar-v'] .logo .brand-text-logo,
header[class*='navbar-v'] [class*='__logo'] .brand-text-logo {
	line-height: 1.1;
}

footer .brand-text-logo {
	max-width: min(100%, 280px);
}

@media (max-width: 991px) {
	header[class*='navbar-v'] .logo,
	header[class*='navbar-v'] [class*='__logo'],
	header[class*='navbar-v'] [class*='__brand'] {
		width: fit-content;
		height: fit-content;
		flex: 0 0 auto;
		align-self: center;
	}

	header[class*='navbar-v'] .logo img,
	header[class*='navbar-v'] [class*='__logo'] img,
	header[class*='navbar-v'] [class*='__brand'] img {
		max-width: min(
			var(--sc-brand-logo-width, 60px),
			calc(100vw - var(--sc-brand-logo-mobile-gutter, 112px))
		);
	}
}
