/*
 * Family bar on single product pages (see product-family-bar.php).
 */

/*
 * The theme clips #main-container with overflow: hidden, which would stop position: sticky from
 * working. Use overflow: visible there (NOT overflow-x: clip: WebKit/Safari then positions the sticky
 * bar unstably and it jitters while scrolling) and stop horizontal overflow at the viewport instead.
 */
body.sonuscore-has-family-bar #main-container {
	overflow: visible;
}

html:has(body.sonuscore-has-family-bar) {
	overflow-x: hidden;
}

/* Anchor jumps (e.g. #upgrade-options) must not end up below the sticky bar */
html:has(body.sonuscore-has-family-bar) {
	scroll-padding-top: 100px;
}

.sonuscore-family-bar {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: 999;
	width: 100%;
	background: #86754d;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
	font-family: 'Roboto Condensed', sans-serif;
}

/* Logged-in admins: keep the bar below WordPress' admin bar (32px; 46px on tablets; on phones
   up to 600px the admin bar scrolls away, so no offset). */
body.admin-bar .sonuscore-family-bar {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .sonuscore-family-bar {
		top: 46px;
	}
}

@media (max-width: 600px) {
	body.admin-bar .sonuscore-family-bar {
		top: 0;
	}
}

.sonuscore-family-bar__inner {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 20px;
	box-sizing: border-box;
	padding: 8px 12px;
}

.sonuscore-family-bar__title {
	color: #fff;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	white-space: nowrap;
}

.sonuscore-family-bar__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sonuscore-family-bar__list > li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sonuscore-family-bar__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	box-sizing: border-box;
	height: 100%;
	min-width: 94px;
	padding: 6px 18px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 2px;
	background: transparent;
	color: rgba(255, 255, 255, 0.8);
	text-align: center;
	text-decoration: none;
	line-height: 1.2;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sonuscore-family-bar__item:hover,
.sonuscore-family-bar__item:focus-visible {
	border-color: #fff;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
}

.sonuscore-family-bar__item:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sonuscore-family-bar__item.is-current,
.sonuscore-family-bar__item.is-current:hover {
	border-color: #fff;
	background: #fff;
	color: #1a1a1a;
	cursor: default;
}

.sonuscore-family-bar__label {
	font-size: 13px;
	font-weight: 400;
	text-transform: none; /* the theme uppercases links */
	white-space: nowrap;
}

.sonuscore-family-bar__item.is-current .sonuscore-family-bar__label {
	font-weight: 700;
}

.sonuscore-family-bar__price {
	font-size: 13px;
	white-space: nowrap;
}

.sonuscore-family-bar__price .amount,
.sonuscore-family-bar__price .woocommerce-Price-currencySymbol,
.sonuscore-family-bar__price bdi {
	color: inherit;
	font: inherit;
}

.sonuscore-family-bar__price del {
	margin-right: 4px;
	font-size: 11px;
	opacity: 0.7;
	text-decoration: line-through;
}

.sonuscore-family-bar__price ins {
	background: none;
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}

/* Dropdown (mobile only) */
.sonuscore-family-bar__dropdown {
	display: none;
	padding: 10px 0;
}

.sonuscore-family-bar__select {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 40px 0 14px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 4px;
	background-color: #171717;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23dfc68a' stroke-width='2'/%3E%3C/svg%3E");
	background-position: right 14px center;
	background-repeat: no-repeat;
	color: #dfc68a;
	font: inherit;
	font-size: 16px; /* 16px keeps iOS from zooming in on focus */
	font-weight: 700;
	-webkit-appearance: none;
	appearance: none;
	text-overflow: ellipsis;
}

@media (max-width: 768px) {
	.sonuscore-family-bar__inner {
		display: block;
		padding: 0 12px;
	}

	.sonuscore-family-bar__title,
	.sonuscore-family-bar__list {
		display: none;
	}

	.sonuscore-family-bar__dropdown {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sonuscore-family-bar__item {
		transition: none;
	}
}
