/* BetterChecked promo code bell and its dialog. Markup: theme-functions/bc-codes.php
   The dialog follows the newsletter dialog: same backdrop, card, close button and bottom sheet. */

/* ==========================================================================
   Bell
   ========================================================================== */

.bc-bell {
	--bc-bell-ring: #fff;   /* the colour behind the bell, drawn around the count */
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 42px;
	height: 42px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: #151515;
	font: inherit;
	line-height: 1;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
	-webkit-tap-highlight-color: transparent;
}
.bc-bell:hover {
	background: rgba(21, 21, 21, .07);
	color: #151515;
}
.bc-bell:focus-visible {
	outline: 2px solid #4a7c59;
	outline-offset: 2px;
}
.bc-bell__icon {
	display: block;
	transform-origin: 50% 2px;
}
.bc-bell__count {
	position: absolute;
	top: 2px;
	right: 1px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	box-sizing: border-box;
	border-radius: 9px;
	background: #72a449;
	box-shadow: 0 0 0 2px var(--bc-bell-ring);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
/* Once the page has loaded (bc-codes.js adds is-ready) the bell rings once, then the count pops in. */
.bc-bell.is-ready .bc-bell__icon {
	animation: bcBellRing .9s ease-in-out 0s 1 both;
}
@keyframes bcBellRing {
	0%, 100% { transform: rotate(0); }
	15% { transform: rotate(14deg); }
	30% { transform: rotate(-12deg); }
	45% { transform: rotate(9deg); }
	60% { transform: rotate(-6deg); }
	75% { transform: rotate(3deg); }
}
.bc-bell__count {
	opacity: 0;
	transform: scale(.3);
}
.bc-bell.is-ready .bc-bell__count {
	animation: bcBellPop .45s cubic-bezier(.2, .9, .3, 1.4) .8s 1 forwards;
}
@keyframes bcBellPop {
	from { opacity: 0; transform: scale(.3); }
	to   { opacity: 1; transform: scale(1); }
}

/* On the homepage the header sits on the dark hero. */
.space-header-menu.homepage-style .bc-bell {
	--bc-bell-ring: #111;
	color: #fff;
}
.space-header-menu.homepage-style .bc-bell:hover {
	background: rgba(255, 255, 255, .14);
	color: #fff;
}

/* Desktop: last in the menu row, right of the newsletter button.
   5px in from the edge puts the bell itself in line with the page content. */
.space-header-menu ul.main-menu li.bc-bell-nav-item {
	display: flex;
	align-items: center;
	margin: 0 5px 0 10px;
	padding: 0;
}

/* Below 1200px: in the header bar, left of the burger. */
.bc-bell--bar {
	display: none;
	position: absolute;
	top: 9px;
	right: 51px;
}
@media (max-width: 1199px) {
	.bc-bell--bar {
		display: inline-grid;
	}
}
@media (max-width: 572px) {
	.space-header-menu.homepage-style .bc-bell--bar {
		right: 63px;   /* the homepage burger sits 12px further in */
	}
}

/* ==========================================================================
   Dialog
   ========================================================================== */

.bc-codes {
	--bc-green: #72a449;
	--bc-green-deep: #4a7c59;
	--bc-ink: #1a2e22;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 16px;
	box-sizing: border-box;
	background: rgba(0, 0, 0, .45);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
	animation: bcCodesFadeIn .3s ease;
}
.bc-codes[hidden] {
	display: none;
}
.bc-codes.is-closing {
	animation: bcCodesFadeOut .22s ease forwards;
}
@keyframes bcCodesFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes bcCodesFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes bcCodesUp {
	from { opacity: 0; transform: translateY(28px) scale(.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bcCodesSheet {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}

.bc-codes__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 520px;
	max-width: 100%;
	max-height: min(560px, calc(100vh - 32px));
	overflow: hidden;
	box-sizing: border-box;
	border: 1px solid rgba(74, 124, 89, .18);
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(74, 124, 89, .08), 0 24px 60px rgba(0, 0, 0, .18), 0 0 60px rgba(74, 124, 89, .06);
	color: var(--bc-ink);
	outline: none;
	animation: bcCodesUp .38s cubic-bezier(.22, 1, .36, 1);
}

.bc-codes .bc-codes__close {
	position: absolute;
	top: 14px;
	right: 16px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	min-width: 0;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 50%;
	background: rgba(0, 0, 0, .04);
	box-shadow: none;
	color: rgba(0, 0, 0, .38);
	font-family: inherit;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	transition: background .2s, color .2s, border-color .2s;
}
.bc-codes .bc-codes__close:hover {
	border-color: rgba(74, 124, 89, .35);
	background: rgba(74, 124, 89, .10);
	color: #2d5a3d;
}
.bc-codes .bc-codes__close:focus-visible {
	outline: 2px solid var(--bc-green-deep);
	outline-offset: 2px;
}

.bc-codes__top {
	flex: none;
	position: relative;
	padding: 24px 28px 14px;
}
.bc-codes .bc-codes__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 14px;
	padding: 4px 12px 4px 9px;
	border: 1px solid rgba(74, 124, 89, .25);
	border-radius: 20px;
	background: rgba(74, 124, 89, .09);
	color: #2d5a3d;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: .07em;
	text-transform: uppercase;
}
.bc-codes__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--bc-green-deep);
	box-shadow: 0 0 6px rgba(74, 124, 89, .6);
}
.bc-codes .bc-codes__title {
	margin: 0 0 6px;
	padding: 0 34px 0 0;
	color: var(--bc-ink);
	font-family: inherit;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -.025em;
}
.bc-codes .bc-codes__sub {
	margin: 0;
	padding: 0;
	color: rgba(26, 46, 34, .56);
	font-size: 13.5px;
	line-height: 1.5;
}

/* The list is the only part that scrolls; the fine print below it always stays in view. */
.bc-codes ol.bc-codes__list {
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
	padding: 2px 20px 4px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
	scrollbar-width: thin;
	scrollbar-color: rgba(74, 124, 89, .35) transparent;
}

/* One code: a voucher, torn along the dashed line. */
.bc-codes li.bc-code {
	position: relative;
	margin: 0 0 12px;
	padding: 14px 16px 12px;
	border: 1px solid rgba(74, 124, 89, .18);
	border-radius: 16px;
	background: #f8faf8;
	list-style: none;
}
.bc-codes li.bc-code::before {
	content: none;
}

.bc-code__head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1.5px dashed rgba(74, 124, 89, .30);
}
/* The two notches where the voucher tears. */
.bc-code__head::before,
.bc-code__head::after {
	content: '';
	position: absolute;
	bottom: -9px;
	width: 16px;
	height: 16px;
	box-sizing: border-box;
	border: 1px solid rgba(74, 124, 89, .18);
	border-radius: 50%;
	background: #fff;
}
.bc-code__head::before {
	left: -25px;
	clip-path: inset(0 0 0 50%);
}
.bc-code__head::after {
	right: -25px;
	clip-path: inset(0 50% 0 0);
}

.bc-code__rank {
	flex: none;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--bc-green);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}
.bc-codes a.bc-code__logo {
	flex: none;
	display: block;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 12px;
	background: #e9efe6;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.bc-codes a.bc-code__logo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.bc-code__what {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}
.bc-code__site {
	max-width: 100%;
	overflow: hidden;
	color: rgba(26, 46, 34, .55);
	font-size: 11px;
	font-weight: 700;
	line-height: 14px;
	letter-spacing: .08em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}
.bc-code__offer {
	max-width: 100%;
	margin-top: 1px;
	overflow: hidden;
	color: var(--bc-ink);
	font-size: 20px;
	font-weight: 800;
	line-height: 24px;
	letter-spacing: -.015em;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.bc-code__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 7px;
}
.bc-code__pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba(26, 46, 34, .07);
	color: rgba(26, 46, 34, .72);
	font-size: 11px;
	font-weight: 600;
	line-height: 14px;
	white-space: nowrap;
	cursor: default;
	font-variant-numeric: tabular-nums;
}
.bc-code__pill--score {
	background: rgba(74, 124, 89, .12);
	color: #2d5a3d;
}

.bc-code__body {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 10px;
	padding-top: 14px;
}

/* ==========================================================================
   Code box (bc_codes_field_html): in the dialog, the list entry card and the ranking grid
   ========================================================================== */

button.bc-code__copy {
	--bc-green: #72a449;
	--bc-green-deep: #4a7c59;
	--bc-ink: #1a2e22;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	width: auto;
	min-width: 0;
	height: 46px;
	margin: 0;
	padding: 0 10px 0 14px;
	box-sizing: border-box;
	border: 1.5px dashed var(--bc-green);
	border-radius: 12px;
	background: #fff;
	box-shadow: none;
	color: var(--bc-ink);
	font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
	font-size: 15px;
	line-height: 1;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
	-webkit-tap-highlight-color: transparent;
}
button.bc-code__copy:hover {
	background: #f1f6ea;
	color: var(--bc-ink);
}
button.bc-code__copy:focus-visible,
.bc-codes a.bc-code__cta:focus-visible {
	outline: 2px solid var(--bc-green-deep) !important;   /* the theme switches outlines off */
	outline-offset: 2px !important;
}
.bc-code__label {
	flex: none;
	color: rgba(26, 46, 34, .45);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}
.bc-code__text {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 3px;
	min-width: 0;
}
.bc-code__eyebrow {
	overflow: hidden;
	color: rgba(26, 46, 34, .5);
	font-size: 10px;
	font-weight: 700;
	line-height: 12px;
	letter-spacing: .08em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}
.bc-code__value {
	min-width: 0;
	overflow: hidden;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 15px;
	font-weight: 700;
	line-height: 18px;
	letter-spacing: .04em;
	text-overflow: ellipsis;
	white-space: nowrap;
}
button.bc-code__copy--eyebrow {
	height: 52px;
}
/* The copy icon; a check mark for a moment once the code is in the clipboard. */
.bc-code__state {
	flex: none;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	color: #4e7a2c;
	transition: background-color .15s ease;
}
button.bc-code__copy:hover .bc-code__state {
	background: rgba(114, 164, 73, .16);
}
.bc-code__state .bc-icon {
	grid-area: 1 / 1;
	transition: opacity .15s ease, transform .15s ease;
}
.bc-code__state .bc-icon--check {
	opacity: 0;
	transform: scale(.6);
}
button.bc-code__copy.is-copied .bc-code__state .bc-icon--copy {
	opacity: 0;
	transform: scale(.6);
}
button.bc-code__copy.is-copied .bc-code__state .bc-icon--check {
	opacity: 1;
	transform: scale(1);
}
.bc-code__state-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
button.bc-code__copy.is-copied {
	border-style: solid;
	background: #f1f6ea;
}
/* In the rolling details line of the list entry card: chip height, not in the tab order. */
button.bc-code__copy--line {
	gap: 6px;
	height: 26px;
	padding: 0 4px 0 9px;
	border-radius: 8px;
}
button.bc-code__copy--line .bc-code__value {
	font-size: 12px;
	line-height: 14px;
}
button.bc-code__copy--line .bc-code__state {
	width: 20px;
	height: 20px;
	border-radius: 6px;
}
.bc-codes a.bc-code__cta {
	flex: 1 1 130px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-width: 0;
	height: 46px;
	padding: 0 16px;
	box-sizing: border-box;
	border: 0;
	border-radius: 12px;
	background: var(--bc-green);
	box-shadow: 0 2px 10px rgba(114, 164, 73, .35);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.bc-code__cta-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}
.bc-codes a.bc-code__cta .bc-icon {
	flex: none;
}
.bc-codes a.bc-code__cta:hover {
	background: #5c8a38;
	box-shadow: 0 4px 16px rgba(114, 164, 73, .45);
	color: #fff;
	transform: translateY(-1px);
}

.bc-codes .bc-code__how {
	margin: 0;
	padding: 10px 0 0;
	color: rgba(26, 46, 34, .56);
	font-size: 12.5px;
	line-height: 18px;
}
.bc-codes .bc-code__how a {
	border: 0;
	color: #4e7a2c;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.bc-codes .bc-codes__fine {
	flex: none;
	margin: 0;
	padding: 12px 28px 16px;
	border-top: 1px solid rgba(74, 124, 89, .12);
	background: #fff;
	box-shadow: 0 -10px 14px -10px rgba(0, 0, 0, .12);
	color: rgba(26, 46, 34, .45);
	font-size: 11.5px;
	line-height: 17px;
}

/* Phones: a sheet from the bottom, like the newsletter dialog. */
@media (max-width: 540px) {
	.bc-codes {
		align-items: flex-end;
		padding: 0;
	}
	.bc-codes__card {
		width: 100%;
		border-width: 1px 0 0;
		border-radius: 20px 20px 0 0;
		padding-bottom: env(safe-area-inset-bottom, 0);
		animation: bcCodesSheet .38s cubic-bezier(.22, 1, .36, 1);
	}
	.bc-codes__top {
		padding: 24px 20px 16px;
	}
	.bc-codes .bc-codes__title {
		font-size: 19px;
	}
	.bc-codes ol.bc-codes__list {
		padding: 0 14px;
	}
	.bc-code__body {
		flex-direction: column;
	}
	.bc-codes button.bc-code__copy,
	.bc-codes a.bc-code__cta {
		flex: none;
		width: 100%;
	}
	.bc-code__head::before {
		left: -25px;
	}
	.bc-codes .bc-codes__fine {
		padding: 10px 20px calc(14px + env(safe-area-inset-bottom, 0));
	}
	.bc-codes__card {
		padding-bottom: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bc-bell.is-ready .bc-bell__icon,
	.bc-bell.is-ready .bc-bell__count,
	.bc-codes,
	.bc-codes__card {
		animation: none;
	}
	.bc-bell.is-ready .bc-bell__count {
		opacity: 1;
		transform: none;
	}
}
