/* Offers Popup: front-end styles. All design tokens are CSS variables set from the plugin settings. */

.ofp,
.ofp * {
	box-sizing: border-box;
}

.ofp[hidden] {
	display: none;
}

html.ofp-scroll-lock,
html.ofp-scroll-lock body {
	overflow: hidden;
}

.ofp {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	font-family: var(--ofp-font);
	font-size: var(--ofp-text-size);
	line-height: 1.4;
	color: var(--ofp-text);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ofp.is-open {
	opacity: 1;
}

.ofp__overlay {
	position: absolute;
	inset: 0;
	-webkit-backdrop-filter: blur(var(--ofp-overlay-blur));
	backdrop-filter: blur(var(--ofp-overlay-blur));
}

.ofp__overlay::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ofp-overlay);
	opacity: calc(var(--ofp-overlay-opacity) / 100);
}

.ofp__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: var(--ofp-max-width);
	max-height: 100%;
	overflow: hidden;
	background: var(--ofp-body-bg);
	border-radius: var(--ofp-radius-popup);
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
	outline: none;
	container-type: inline-size;
	transform: translateY(10px);
	transition: transform 0.2s ease;
}

.ofp.is-open .ofp__dialog {
	transform: none;
}

/* Header */

.ofp__header {
	position: relative;
	flex: none;
	padding: 24px 64px 22px 28px;
	background: var(--ofp-header-bg);
}

.ofp .ofp__title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: var(--ofp-title-size);
	font-weight: var(--ofp-heading-weight);
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	color: var(--ofp-header-title);
}

.ofp .ofp__subtitle {
	margin: 6px 0 0;
	padding: 0;
	font-size: var(--ofp-text-size);
	color: var(--ofp-header-subtitle);
}

.ofp .ofp__close {
	position: absolute;
	top: 16px;
	right: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	color: var(--ofp-header-title);
	background: transparent;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	cursor: pointer;
	opacity: 0.8;
}

.ofp .ofp__close:hover,
.ofp .ofp__close:focus-visible {
	color: var(--ofp-header-title);
	background: rgba(127, 127, 127, 0.25);
	opacity: 1;
}

.ofp--locked .ofp__close {
	display: none !important;
}

/* Body */

.ofp__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 16px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.ofp .ofp__grid {
	display: grid;
	grid-template-columns: repeat(var(--ofp-columns), minmax(0, 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@container (max-width: 680px) {
	.ofp .ofp__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Card */

.ofp .ofp-card {
	display: flex;
	gap: 12px;
	margin: 0;
	padding: 18px 20px 20px 16px;
	list-style: none;
	background: var(--ofp-card-bg);
	border: 1px solid var(--ofp-card-border);
	border-radius: var(--ofp-radius-card);
	box-shadow: 0 1px 4px rgba(11, 21, 96, 0.05);
}

.ofp-card__num {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ofp-num-text);
	background: var(--ofp-num-bg);
	border-radius: 50%;
}

.ofp-card__main {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.ofp-card__head {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

.ofp-card__logo {
	flex: none;
	width: 96px;
	height: 64px;
	overflow: hidden;
	background: var(--ofp-logo-bg);
	border-radius: var(--ofp-radius-image);
}

.ofp .ofp-card__logo img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	object-fit: contain;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.ofp-card__info {
	min-width: 0;
}

.ofp-card__name-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
}

.ofp .ofp-card__name {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: var(--ofp-name-size);
	font-weight: var(--ofp-heading-weight);
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	color: var(--ofp-name);
}

.ofp-card__badge {
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ofp-badge-text);
	background: var(--ofp-badge-bg);
	border-radius: 999px;
}

.ofp .ofp-card__sub {
	margin: 6px 0 0;
	padding: 0;
	font-size: calc(var(--ofp-text-size) - 1px);
	color: var(--ofp-sub);
}

.ofp .ofp-card__offer {
	margin: 14px 0 0;
	padding: 0;
	font-size: var(--ofp-offer-size);
	font-weight: var(--ofp-heading-weight);
	line-height: 1.3;
	color: var(--ofp-offer);
}

.ofp .ofp-card__list {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.ofp .ofp-card__list li {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 6px 0 0;
	padding: 0;
	font-size: var(--ofp-text-size);
	color: var(--ofp-text);
	list-style: none;
}

.ofp .ofp-card__list li::before,
.ofp .ofp-card__list li::marker {
	content: none;
}

.ofp-card__list svg {
	flex: none;
	margin-top: 0.15em;
	color: var(--ofp-check);
}

.ofp-card__rating {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 14px;
}

.ofp-stars {
	--ofp-star-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.2l3 6.3 6.9.9-5 4.8 1.2 6.9-6.1-3.3-6.1 3.3 1.2-6.9-5-4.8 6.9-.9z'/%3E%3C/svg%3E");
	display: block;
	flex: none;
	width: 90px;
	height: 18px;
	background: linear-gradient(90deg, var(--ofp-star) var(--ofp-rating-pct), var(--ofp-star-empty) var(--ofp-rating-pct));
	-webkit-mask: var(--ofp-star-mask) left center / 20% 100% repeat-x;
	mask: var(--ofp-star-mask) left center / 20% 100% repeat-x;
}

.ofp-card__score {
	font-size: var(--ofp-text-size);
	font-weight: 500;
	color: var(--ofp-rating-text);
}

.ofp .ofp-card__btn,
.ofp .ofp-card__btn:visited {
	display: block;
	margin-top: auto;
	padding: 11px 16px 13px;
	font-family: inherit;
	font-size: var(--ofp-btn-size);
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	text-transform: var(--ofp-btn-transform);
	color: var(--ofp-btn-text);
	background: var(--ofp-btn-bg);
	border: 0;
	border-radius: var(--ofp-radius-btn);
	box-shadow: inset 0 -3px 0 var(--ofp-btn-shadow);
	transition: background-color 0.15s ease;
}

.ofp-card__main > :nth-last-child(2) {
	margin-bottom: 16px;
}

.ofp .ofp-card__btn:hover,
.ofp .ofp-card__btn:focus-visible {
	color: var(--ofp-btn-text);
	text-decoration: none;
	background: var(--ofp-btn-hover);
}

.ofp .ofp-card__btn:focus-visible,
.ofp .ofp__close:focus-visible {
	outline: 2px solid var(--ofp-offer);
	outline-offset: 2px;
}

/* Footer */

.ofp__footer {
	flex: none;
	padding: 12px 20px;
	font-size: calc(var(--ofp-text-size) - 2px);
	text-align: center;
	color: var(--ofp-footer-text);
	background: var(--ofp-footer-bg);
	border-top: 1px solid var(--ofp-card-border);
}

/* Small screens */

@media (max-width: 560px) {
	.ofp {
		padding: 10px;
	}

	.ofp__header {
		padding: 18px 52px 16px 18px;
	}

	.ofp .ofp__close {
		top: 10px;
		right: 10px;
	}

	.ofp__body {
		padding: 10px;
	}

	.ofp .ofp__grid {
		gap: 10px;
	}

	.ofp .ofp-card {
		padding: 14px;
	}

	.ofp-card__logo {
		width: 76px;
		height: 52px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ofp,
	.ofp__dialog {
		transition: none;
	}
}
