/*
 * Deals frontend CSS — direct port of Double Apex's apex-deals/assets/css/frontend.css.
 * Renamed `da-` → `pr-` and remapped DA's CSS variables to the front-end theme's
 * tokens (with sane fallbacks so the plugin still renders cleanly on any theme).
 *
 * The visual model: frosted-glass card with native-feeling chrome — rounded
 * corners + subtle border + shadow. Pip and brand-logo are absolute overlays
 * that show on hover/focus (or always-on at reduced subtlety on touch). CTA
 * overlay slides in on viewport entry, retracts after a dwell, and returns on
 * hover. Long-strip slots (story-lead, section-banner) get a centred hover
 * overlay; short rectangles get a bottom-left chip + button stack.
 */

.pr-deal-slot {
	position: relative;
	display: block;
	margin: 1.75rem 0;
	border-radius: var(--radius-lg, 16px);
	overflow: hidden;
	background: transparent;
	border: 0;
	box-shadow: none;
	isolation: isolate;
	/* Kill anonymous text-line-boxes from indent whitespace between
	 * <span class="…__pip"> and <a class="…__link">. Without this, the
	 * theme's inherited line-height creates an empty band above the
	 * image which reads as a "shadow gap" on light page backgrounds. */
	font-size: 0;
	line-height: 0;
}
/* Children re-establish typography — wrapper's font-size:0 doesn't cascade
 * into elements that explicitly set their own. */
.pr-deal-slot__pip,
.pr-deal-slot__cta-label,
.pr-deal-slot__cta-btn,
.pr-deal-slot__cta {
	line-height: 1.2;
}

.pr-deal-slot__pip {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 3;
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 600;
	background: rgba(0, 0, 0, 0.72);
	color: rgba(255, 255, 255, 0.92);
	padding: 5px 11px;
	border-radius: 999px;
	pointer-events: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	/* Hover-reveal — matches the brand logo's behaviour so chrome only
	 * surfaces when the visitor engages, keeping the ad reading native. */
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 220ms ease, transform 220ms ease;
}
.pr-deal-slot:hover .pr-deal-slot__pip,
.pr-deal-slot:focus-within .pr-deal-slot__pip {
	opacity: 1;
	transform: translateY(0);
}
@media (hover: none) {
	/* Touch — no hover state available, so show the pip subtly at rest. */
	.pr-deal-slot__pip { opacity: 0.85; transform: none; }
}

.pr-deal-slot--house .pr-deal-slot__pip {
	color: var(--accent, #3da2ff);
	border: 1px solid rgba(61, 162, 255, 0.35);
}

.pr-deal-slot__link {
	display: block;
	width: 100%;
	text-decoration: none;
	color: inherit;
	background: transparent;
}

.pr-deal-slot__media {
	position: relative;
	display: block;
	width: 100%;
	overflow: hidden;
}

.pr-deal-slot__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 50%;
	display: block;
	border: 0;
}

/* "Find out more" overlay — campaign title slides in from the left, then a
   small CTA button flaps down beneath it. Triggered by .is-in-view (added
   by the IntersectionObserver in deals.js). Discreet by design. */
.pr-deal-slot__cta-overlay {
	position: absolute;
	left: 14px;
	bottom: 14px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	pointer-events: none;
	max-width: calc(100% - 90px); /* leave room for brand logo bottom-right */
}
.pr-deal-slot__cta-label {
	display: inline-block;
	background: rgba(0, 0, 0, 0.78);
	color: #fff;
	padding: 6px 11px;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	transform: translateX(-14px);
	opacity: 0;
	transition: transform 380ms cubic-bezier(0.18, 0.85, 0.3, 1.05) 200ms,
	            opacity   380ms ease 200ms;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}
.pr-deal-slot__cta-btn {
	display: inline-block;
	background: linear-gradient(135deg, var(--accent, #3da2ff), var(--accent-2, #8b5cf6));
	color: #fff;
	padding: 7px 14px;
	border-radius: 10px;
	font-size: 10px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	box-shadow: 0 6px 18px rgba(61, 162, 255, 0.32), 0 2px 6px rgba(139, 92, 246, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
	transform-origin: 50% 0%;
	transform: rotateX(-90deg);
	opacity: 0;
	transition: transform 320ms cubic-bezier(0.36, 0, 0.18, 1.4) 700ms,
	            opacity   320ms ease 700ms;
}
.pr-deal-slot.is-in-view .pr-deal-slot__cta-label {
	transform: translateX(0);
	opacity: 1;
}
.pr-deal-slot.is-in-view .pr-deal-slot__cta-btn {
	transform: rotateX(0);
	opacity: 1;
}

/* Retract-after-dwell — wrapper slides off to the left a few seconds after
   the entrance completes. Hover brings it back. */
.pr-deal-slot__cta-overlay {
	transition: transform 480ms cubic-bezier(0.5, 0, 0.18, 1),
	            opacity   480ms ease;
}
.pr-deal-slot.is-retracted .pr-deal-slot__cta-overlay {
	transform: translateX(calc(-100% - 14px));
	opacity: 0;
}
.pr-deal-slot.is-retracted:hover .pr-deal-slot__cta-overlay,
.pr-deal-slot.is-retracted:focus-within .pr-deal-slot__cta-overlay {
	transform: translateX(0);
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.pr-deal-slot__cta-label,
	.pr-deal-slot__cta-btn,
	.pr-deal-slot__cta-overlay {
		transition: none !important;
		transform: none !important;
		opacity: 1;
	}
}

/* Brand-logo hover overlay — transparent advertiser logo bottom-right of slot.
   Hidden by default on hover-capable devices; subtly always-visible on touch.
   The IMG inside fills a 64×64 box and anchors itself to the bottom-right via
   object-position, so wide-rectangle logos hug the corner cleanly. */
.pr-deal-slot__brand {
	position: absolute;
	bottom: 12px;
	right: 12px;
	z-index: 2;
	width: 64px;
	height: 64px;
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 280ms ease, transform 280ms ease;
}
.pr-deal-slot__brand img {
	position: static;
	inset: auto;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: 100% 100%;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
.pr-deal-slot:hover .pr-deal-slot__brand,
.pr-deal-slot:focus-within .pr-deal-slot__brand {
	opacity: 1;
	transform: translateY(0);
}
@media (hover: none) {
	.pr-deal-slot__brand {
		opacity: 0.85;
		transform: none;
		width: 48px;
		height: 48px;
		bottom: 10px;
		right: 10px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.pr-deal-slot__brand { transition: none; }
}

/* Slot aspect-ratio locks — on the MEDIA (not the wrapper), so the rounded
   chrome around the image is the wrapper's job. */
.pr-deal-slot--pit-wall            .pr-deal-slot__media { aspect-ratio: 4 / 5; }
.pr-deal-slot--section-banner      .pr-deal-slot__media { aspect-ratio: 6 / 1; }
.pr-deal-slot--inline-insert       .pr-deal-slot__media { aspect-ratio: 16 / 9; }
.pr-deal-slot--dashboard-greeting  .pr-deal-slot__media { aspect-ratio: 5 / 1; }
.pr-deal-slot--story-lead          .pr-deal-slot__media { aspect-ratio: 6 / 1; }

/* Inline Insert — sits inside the article column with a small visible inset
   on both sides so it reads as an editorial block, not a full-bleed banner.
   Mobile: drop the inset so the ad takes the full width. */
.pr-deal-slot--inline-insert {
	width: calc(100% - 64px);
	max-width: 720px;
	margin-left: auto;
	margin-right: auto;
}
@media (max-width: 600px) {
	.pr-deal-slot--inline-insert { width: 100%; }
}

/* --------- Video creative variant --------- */
.pr-deal-slot--video .pr-deal-slot__media { background: #000; }
.pr-deal-slot__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: 50% 50%;
	background: #000;
}
.pr-deal-slot__ui {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	padding: 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.08) 55%, rgba(0, 0, 0, 0));
	opacity: 0;
	pointer-events: none;
	transition: opacity 250ms ease;
}
.pr-deal-slot--video.is-active .pr-deal-slot__ui,
.pr-deal-slot--video:hover .pr-deal-slot__ui,
.pr-deal-slot--video:focus-within .pr-deal-slot__ui {
	opacity: 1;
	pointer-events: auto;
}
.pr-deal-slot__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 0 18px;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.96);
	color: #111 !important;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transition: background 0.15s, transform 0.15s;
}
.pr-deal-slot__cta:hover {
	background: #fff;
	transform: translateY(-1px);
	color: #000 !important;
	text-decoration: none;
}
.pr-deal-slot__sound {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 0 18px;
	border: 1px solid rgba(255, 255, 255, 0.26);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-family: inherit;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	transition: background 0.15s;
}
.pr-deal-slot__sound:hover { background: rgba(255, 255, 255, 0.24); }
.pr-deal-slot__dismiss {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font: 400 24px/1 inherit;
	cursor: pointer;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
.pr-deal-slot--video.is-cta-closed .pr-deal-slot__cta,
.pr-deal-slot--video.is-cta-closed .pr-deal-slot__dismiss { display: none; }
.pr-deal-slot--video.is-unmuted .pr-deal-slot__sound { display: none; }

@media (max-width: 767px) {
	.pr-deal-slot__ui { padding: 14px; gap: 10px; flex-wrap: wrap; }
	.pr-deal-slot__cta,
	.pr-deal-slot__sound { min-height: 42px; padding: 0 14px; font-size: 12px; }
	.pr-deal-slot__dismiss { top: 10px; right: 10px; width: 34px; height: 34px; font-size: 22px; }
}

/* Sticky Bottom Strip — pinned to viewport bottom, dismissable per session */
.pr-deal-sticky-bottom-wrap {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9999;
	padding: 8px 12px 10px;
	background: linear-gradient(180deg, rgba(14, 16, 20, 0.45), rgba(14, 16, 20, 0.85));
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	transform: translateY(110%);
	animation: pr-sticky-up 480ms cubic-bezier(0.18, 0.85, 0.3, 1.05) 600ms forwards;
}
.pr-deal-sticky-bottom-wrap.is-dismissed { display: none; }
.pr-deal-sticky-bottom-wrap .pr-deal-slot {
	margin: 0;
	max-width: 1100px;
	margin-left: auto;
	margin-right: auto;
}
.pr-deal-sticky-bottom-wrap .pr-deal-slot--sticky-bottom .pr-deal-slot__media { aspect-ratio: 8 / 1; }
@media (max-width: 600px) {
	.pr-deal-sticky-bottom-wrap .pr-deal-slot--sticky-bottom .pr-deal-slot__media { aspect-ratio: 6 / 1; }
}

.pr-deal-sticky-bottom__close {
	position: absolute;
	top: -14px;
	right: 12px;
	z-index: 2;
	width: 28px;
	height: 28px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	background: rgba(20, 22, 26, 0.95);
	color: rgba(255, 255, 255, 0.75);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
	transition: background 0.15s, color 0.15s, transform 0.15s;
}
.pr-deal-sticky-bottom__close:hover { background: rgba(40, 44, 52, 0.98); color: #fff; transform: scale(1.05); }

@keyframes pr-sticky-up {
	from { transform: translateY(110%); }
	to   { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
	.pr-deal-sticky-bottom-wrap { animation: none; transform: translateY(0); }
}

@media (max-width: 600px) {
	/* Mobile: keep tall enough to read while only losing ~17% of edge content. */
	.pr-deal-slot--section-banner      .pr-deal-slot__media { aspect-ratio: 5 / 1; }
	.pr-deal-slot--dashboard-greeting  .pr-deal-slot__media { aspect-ratio: 3 / 1; }
}

@media print {
	.pr-deal-slot { display: none !important; }
}

/* ----- Long-slot hover overlay (story-lead, section-banner) -----
   Heading rolls down from the top edge, button rolls up from the bottom.
   Hover/focus only. Suppressed on touch (no mouse-off = no way to dismiss). */
@media (hover: hover) and (pointer: fine) {
	.pr-deal-slot--story-lead     .pr-deal-slot__cta-overlay,
	.pr-deal-slot--section-banner .pr-deal-slot__cta-overlay {
		position: absolute;
		inset: 0;
		left: 0;
		right: 0;
		bottom: 0;
		max-width: none;
		display: block;
		gap: 0;
		pointer-events: none;
	}
	.pr-deal-slot--story-lead     .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner .pr-deal-slot__cta-label {
		position: absolute;
		top: 0;
		left: 50%;
		transform: translate(-50%, -110%);
		opacity: 0;
		max-width: min(72%, 720px);
		text-align: center;
		white-space: normal;
		font-size: 13px;
		padding: 10px 18px;
		border-radius: 0 0 14px 14px;
		background: rgba(0, 0, 0, 0.85);
		text-overflow: clip;
		overflow: visible;
		transition: transform 360ms cubic-bezier(0.18, 0.85, 0.3, 1.05) 60ms,
		            opacity   280ms ease 60ms;
	}
	.pr-deal-slot--story-lead     .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner .pr-deal-slot__cta-btn {
		position: absolute;
		left: 50%;
		bottom: 14px;
		transform: translate(-50%, calc(100% + 28px));
		transform-origin: 50% 50%;
		opacity: 0;
		background: linear-gradient(135deg, var(--accent, #3da2ff), var(--accent-2, #8b5cf6));
		padding: 11px 22px;
		font-size: 12px;
		border-radius: 999px;
		box-shadow: 0 10px 28px rgba(61, 162, 255, 0.30),
		            0 4px 10px rgba(139, 92, 246, 0.22),
		            inset 0 1px 0 rgba(255, 255, 255, 0.25);
		transition: transform 380ms cubic-bezier(0.18, 0.85, 0.3, 1.05) 80ms,
		            opacity   320ms ease 80ms;
	}
	/* Defeat the .is-in-view auto-show — long slots are strictly hover-driven. */
	.pr-deal-slot--story-lead.is-in-view     .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner.is-in-view .pr-deal-slot__cta-label {
		transform: translate(-50%, -110%);
		opacity: 0;
	}
	.pr-deal-slot--story-lead.is-in-view     .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner.is-in-view .pr-deal-slot__cta-btn {
		transform: translate(-50%, calc(100% + 28px));
		opacity: 0;
	}
	.pr-deal-slot--story-lead.is-retracted     .pr-deal-slot__cta-overlay,
	.pr-deal-slot--section-banner.is-retracted .pr-deal-slot__cta-overlay {
		transform: none;
		opacity: 1;
	}
	.pr-deal-slot--story-lead:hover                  .pr-deal-slot__cta-label,
	.pr-deal-slot--story-lead:focus-within           .pr-deal-slot__cta-label,
	.pr-deal-slot--story-lead.is-in-view:hover       .pr-deal-slot__cta-label,
	.pr-deal-slot--story-lead.is-in-view:focus-within .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner:hover              .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner:focus-within       .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner.is-in-view:hover   .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner.is-in-view:focus-within .pr-deal-slot__cta-label {
		transform: translate(-50%, 0);
		opacity: 1;
	}
	.pr-deal-slot--story-lead:hover                  .pr-deal-slot__cta-btn,
	.pr-deal-slot--story-lead:focus-within           .pr-deal-slot__cta-btn,
	.pr-deal-slot--story-lead.is-in-view:hover       .pr-deal-slot__cta-btn,
	.pr-deal-slot--story-lead.is-in-view:focus-within .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner:hover              .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner:focus-within       .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner.is-in-view:hover   .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner.is-in-view:focus-within .pr-deal-slot__cta-btn {
		transform: translate(-50%, 0);
		opacity: 1;
	}
}

@media (hover: none) {
	.pr-deal-slot--story-lead     .pr-deal-slot__cta-overlay,
	.pr-deal-slot--section-banner .pr-deal-slot__cta-overlay {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pr-deal-slot--story-lead     .pr-deal-slot__cta-label,
	.pr-deal-slot--story-lead     .pr-deal-slot__cta-btn,
	.pr-deal-slot--section-banner .pr-deal-slot__cta-label,
	.pr-deal-slot--section-banner .pr-deal-slot__cta-btn {
		transition: none !important;
		transform: translate(-50%, 0) !important;
	}
}
