/* Brand ("Ražotājs") two-choice popover — product page meta, catalog cards
   and the Saistītie produkti swiper. */

.wdm-brand-link {
	position: relative;
	display: inline-block;
}

.wdm-brand-link__trigger {
	cursor: pointer;
}

.wdm-brand-popover {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 30;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 232px;
	padding: 8px;
	border: 1px solid #e9e9e9;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
	text-transform: none;
}

/* Bridges the 6px gap under the trigger so moving the pointer from the name
   into the panel never counts as leaving the brand link — which would close it
   mid-reach on the product page, where the link itself is the hover boundary. */
.wdm-brand-popover::before {
	content: "";
	position: absolute;
	top: -8px;
	left: 0;
	right: 0;
	height: 8px;
}

/* Flipped by the script when the panel would run past the viewport edge. */
.wdm-brand-popover.is-flipped {
	left: auto;
	right: 0;
}

.wdm-brand-popover[hidden] {
	display: none;
}

/* Two classes deep on purpose: `.product-card__meta li a` (0-1-2) otherwise
   wins and repaints these as uppercase underlined blue card-meta links —
   which made the solid-blue button blue-on-blue and unreadable. */
.wdm-brand-popover .wdm-brand-popover__btn {
	display: block;
	padding: 9px 12px;
	border-radius: 6px;
	line-height: 18px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	white-space: normal;
}

.wdm-brand-popover .wdm-brand-popover__btn--site,
.wdm-brand-popover .wdm-brand-popover__btn--site:hover {
	border: 1px solid #005ca9;
	color: #005ca9;
	text-decoration: none;
}

.wdm-brand-popover .wdm-brand-popover__btn--site {
	background: #fff;
}

.wdm-brand-popover .wdm-brand-popover__btn--site:hover {
	background: #e8f4ff;
}

.wdm-brand-popover .wdm-brand-popover__btn--products,
.wdm-brand-popover .wdm-brand-popover__btn--products:hover {
	border: 1px solid #005ca9;
	background: #005ca9;
	color: #fff;
	text-decoration: none;
}

.wdm-brand-popover .wdm-brand-popover__btn--products:hover {
	background: #004b8a;
	border-color: #004b8a;
}

.product-card:has(.wdm-brand-link.is-open) {
	position: relative;
	z-index: 40;
}

/* The card clips its own overflow; the panel has to escape it to be readable. */
.product-card__meta .wdm-brand-link.is-open,
.product-card .wdm-brand-link.is-open {
	position: static;
}

.product-card__meta .wdm-brand-link.is-open .wdm-brand-popover,
.product-card .wdm-brand-link.is-open .wdm-brand-popover {
	left: 12px;
	right: 12px;
	min-width: 0;
}

.product-card__meta .wdm-brand-link.is-open .wdm-brand-popover.is-flipped,
.product-card .wdm-brand-link.is-open .wdm-brand-popover.is-flipped {
	left: 12px;
	right: 12px;
}

@media screen and (max-width: 480px) {
	.wdm-brand-popover {
		min-width: 0;
		width: max-content;
		max-width: min(280px, calc(100vw - 32px));
	}
}
