/*
 * Business Ads (card 163): the leaderboard, the inline feed ad and the popup.
 * Loaded only while the business_ads switch is on and a live ad, or the
 * "Contact us" house slot, is on the page (BusinessAdRenderer::enqueue). Nothing was prototyped; these are
 * developer-judgment styles in the theme's own neutrals.
 */

.ys-bad {
	position: relative;
	box-sizing: border-box;
	text-align: center;
}

.ys-bad-tag {
	display: block;
	margin: 0 0 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #8a8a8a;
	line-height: 1.2;
}

.ys-bad-item {
	display: inline-block;
	max-width: 100%;
	line-height: 0;
}

.ys-bad-item[hidden] {
	display: none;
}

.ys-bad-item img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 6px;
}

.ys-bad-item:focus-visible {
	outline: 3px solid #2E9E3D;
	outline-offset: 3px;
	border-radius: 6px;
}

/* 728x90 between the carousel and the feed; scales down on a phone. */
.ys-bad-leaderboard {
	max-width: 728px;
	margin: 16px auto 24px;
	padding: 0 12px;
}

.ys-bad-leaderboard .ys-bad-item img {
	width: 728px;
	aspect-ratio: 728 / 90;
	object-fit: cover;
}

/*
 * Change list item 33: on the homepage the leaderboard (or its "Advertise
 * your business here" house slot) sits INSIDE the card grid, after the 4th
 * listing -- a full-width row of its own, like the inline ad, so it falls
 * between rows of cards. Centred at its own width within that row.
 */
.cat-list-wrp > .ys-bad-leaderboard,
.cat-list-wrp > .ys-bad-house-leaderboard {
	flex: 0 0 100%;
	width: 100%;
	max-width: none;
	margin: 0 0 40px;
	padding: 0 20px;
}

.cat-list-wrp > .ys-bad-house-leaderboard .ys-bad-house-link {
	max-width: 728px;
	margin: 0 auto;
}

@media (max-width: 767px) {
	.cat-list-wrp > .ys-bad-leaderboard,
	.cat-list-wrp > .ys-bad-house-leaderboard {
		padding: 0 12px;
		margin-bottom: 28px;
	}
}

/*
 * 300x250 as a full-width row of its own inside the flex card grid
 * (.cat-list-wrp, whose cards carry 20px side margins against its -20px),
 * so it sits between rows of cards and never squeezes into one.
 */
.cat-list-wrp > .ys-bad-inline,
.ys-bad-inline {
	flex: 0 0 100%;
	width: 100%;
	margin: 0 0 48px;
	padding: 0 20px;
}

.ys-bad-inline .ys-bad-item img {
	width: 300px;
	aspect-ratio: 300 / 250;
	object-fit: cover;
}

/*
 * Round 2 N20: an inline ad whose full row is not on the page yet waits,
 * hidden, until infinite scroll brings the cards (feed-ad-rows.js).
 */
.cat-list-wrp > .ys-bad[hidden] {
	display: none;
}

@media (max-width: 767px) {
	.cat-list-wrp > .ys-bad-inline,
	.ys-bad-inline {
		padding: 0 12px;
		margin-bottom: 32px;
	}
}

/* The popup: a centred interstitial over a dimmed page. */
.ys-bad-popup {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.ys-bad-popup[hidden] {
	display: none;
}

.ys-bad-popup-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .72);
}

.ys-bad-popup-box {
	position: relative;
	box-sizing: border-box;
	max-width: min(600px, 100%);
	max-height: calc(100vh - 32px);
	padding: 12px 12px 14px;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
	text-align: center;
	overflow: auto;
}

.ys-bad-popup-box .ys-bad-tag {
	margin: 2px 48px 8px;
}

.ys-bad-popup-box .ys-bad-item img {
	width: 600px;
	max-height: calc(100vh - 110px);
	object-fit: contain;
}

/* Prominent: a 44px target, high contrast, always in the corner. */
.ys-bad-popup-x {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: #111;
	color: #fff;
	font: 400 28px/1 sans-serif;
	cursor: pointer;
	z-index: 1;
}

.ys-bad-popup-x:hover,
.ys-bad-popup-x:focus-visible {
	background: #2E9E3D;
	outline: 3px solid #fff;
	outline-offset: -5px;
}

html.ys-bad-popup-open,
html.ys-bad-popup-open body {
	overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
	.ys-bad-popup:not([hidden]) .ys-bad-popup-box {
		animation: ys-bad-in .18s ease-out;
	}

	@keyframes ys-bad-in {
		from { opacity: 0; transform: scale(.96); }
		to { opacity: 1; transform: none; }
	}
}

/*
 * The house slot (master plan v122 Section 14A, D2 #10): where the
 * leaderboard or an inline spot has no live ad, one quiet line --
 * "Advertise your business here. Contact us" -- linking to WhatsApp. Small
 * on purpose: it fills the space without pretending to be an ad.
 */
.ys-bad-house {
	margin: 12px auto 20px;
	padding: 0 12px;
	max-width: 728px;
}

.cat-list-wrp > .ys-bad-house-inline,
.ys-bad-house-inline {
	flex: 0 0 100%;
	width: 100%;
	max-width: none;
	margin: 0 0 40px;
	padding: 0 20px;
}

.ys-bad-house-link {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px 10px;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px dashed #d4d4d4;
	border-radius: 8px;
	color: #555;
	font-size: 14px;
	line-height: 1.35;
	text-decoration: none;
	background: #fafafa;
}

.ys-bad-house-cta {
	font-weight: 700;
	color: #25843A;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ys-bad-house-link:hover,
.ys-bad-house-link:focus-visible {
	border-color: #2E9E3D;
	background: #EEF7EF;
	color: #333;
}

.ys-bad-house-link:focus-visible {
	outline: 3px solid #2E9E3D;
	outline-offset: 2px;
}

@media (max-width: 767px) {
	.cat-list-wrp > .ys-bad-house-inline,
	.ys-bad-house-inline {
		padding: 0 12px;
		margin-bottom: 28px;
	}
}
