/* Apex Deals — frontend slot frame */

.da-deal-slot {
	position: relative;
	display: block;
	margin: 1.75rem 0;
	border-radius: var(--da-radius, 16px);
	overflow: hidden;
	background: var(--da-surface-1, rgba(20, 22, 26, 0.55));
	-webkit-backdrop-filter: blur(12px) saturate(120%);
	backdrop-filter: blur(12px) saturate(120%);
	border: 1px solid rgba(255, 255, 255, 0.06);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
	isolation: isolate;
}

.da-deal-slot__pip {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 600;
	background: rgba(0, 0, 0, 0.65);
	color: var(--da-text-secondary, rgba(255, 255, 255, 0.78));
	padding: 4px 9px;
	border-radius: 999px;
	pointer-events: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

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

.da-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 frontend.js). Discreet by design — the goal
   is to invite a click, not yell. Per-campaign opt-in via admin toggle. */
.da-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 */
}
.da-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%;
}
.da-deal-slot__cta-btn {
	display: inline-block;
	background: linear-gradient(135deg, var(--da-accent, #3da2ff), #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;
}
.da-deal-slot.is-in-view .da-deal-slot__cta-label {
	transform: translateX(0);
	opacity: 1;
}
.da-deal-slot.is-in-view .da-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. Touch devices skip this
   entirely (no hover means no way to recover). */
.da-deal-slot__cta-overlay {
	transition: transform 480ms cubic-bezier(0.5, 0, 0.18, 1),
	            opacity   480ms ease;
}
.da-deal-slot.is-retracted .da-deal-slot__cta-overlay {
	transform: translateX(calc(-100% - 14px));
	opacity: 0;
}
.da-deal-slot.is-retracted:hover .da-deal-slot__cta-overlay,
.da-deal-slot.is-retracted:focus-within .da-deal-slot__cta-overlay {
	transform: translateX(0);
	opacity: 1;
}

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

/* Brand-logo hover overlay (transparent advertiser logo, bottom-right).
   Hidden by default on devices that support hover; subtly always-visible on
   touch devices (no hover state). */
.da-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;
}
.da-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));
}
.da-deal-slot:hover .da-deal-slot__brand,
.da-deal-slot:focus-within .da-deal-slot__brand {
	opacity: 1;
	transform: translateY(0);
}
@media (hover: none) {
	/* Touch — always visible, slightly subdued, smaller */
	.da-deal-slot__brand {
		opacity: 0.85;
		transform: none;
		width: 48px;
		height: 48px;
		bottom: 10px;
		right: 10px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.da-deal-slot__brand { transition: none; }
}

/* Slot aspect-ratio locks (wrapper, not <img>) */
.da-deal-slot--pit-wall            .da-deal-slot__media { aspect-ratio: 4 / 5; }
.da-deal-slot--section-banner      .da-deal-slot__media { aspect-ratio: 6 / 1; }
.da-deal-slot--inline-insert       .da-deal-slot__media { aspect-ratio: 16 / 9; }
.da-deal-slot--dashboard-greeting  .da-deal-slot__media { aspect-ratio: 5 / 1; }

/* Inline Insert — cap width and centre so it feels like a neat block in the
   article body, not a full-bleed billboard. Mobile keeps full width. */
.da-deal-slot--inline-insert {
	max-width: 480px;
	margin-left: auto;
	margin-right: auto;
}

/* ───────── Video creative variant ─────────
   Used when the creative has a video_url set. Poster comes from the featured
   image; <video> auto-plays muted on viewport, "Play with sound" promotes audio,
   dismiss button kills the overlay, CTA goes through the click-tracking redirect. */
.da-deal-slot--video .da-deal-slot__media {
	background: #000;
}
.da-deal-slot__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: 50% 50%;
	background: #000;
}
.da-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;
}
.da-deal-slot--video.is-active .da-deal-slot__ui,
.da-deal-slot--video:hover .da-deal-slot__ui,
.da-deal-slot--video:focus-within .da-deal-slot__ui {
	opacity: 1;
	pointer-events: auto;
}
.da-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;
}
.da-deal-slot__cta:hover {
	background: #fff;
	transform: translateY(-1px);
	color: #000 !important;
	text-decoration: none;
}
.da-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;
}
.da-deal-slot__sound:hover { background: rgba(255, 255, 255, 0.24); }
.da-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);
}
.da-deal-slot--video.is-cta-closed .da-deal-slot__cta,
.da-deal-slot--video.is-cta-closed .da-deal-slot__dismiss { display: none; }
.da-deal-slot--video.is-unmuted .da-deal-slot__sound { display: none; }

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

/* Sticky Bottom Strip — pinned to viewport bottom, dismissable per session */
.da-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: da-sticky-up 480ms cubic-bezier(0.18, 0.85, 0.3, 1.05) 600ms forwards;
}
.da-deal-sticky-bottom-wrap.is-dismissed { display: none; }
.da-deal-sticky-bottom-wrap .da-deal-slot {
	margin: 0;
	max-width: 1100px;
	margin-left: auto;
	margin-right: auto;
}
.da-deal-sticky-bottom-wrap .da-deal-slot--sticky-bottom .da-deal-slot__media { aspect-ratio: 8 / 1; }
@media (max-width: 600px) {
	.da-deal-sticky-bottom-wrap .da-deal-slot--sticky-bottom .da-deal-slot__media { aspect-ratio: 6 / 1; }
}

.da-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;
}
.da-deal-sticky-bottom__close:hover { background: rgba(40, 44, 52, 0.98); color: #fff; transform: scale(1.05); }

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

/* Story Lead — thin horizontal strip; sits between author meta and article body.
   Locked to the source ratio (6:1) on every viewport — keeps brand assets at the
   edges of advertiser-supplied creatives visible on mobile (no side-crop). */
.da-deal-slot--story-lead .da-deal-slot__media { aspect-ratio: 6 / 1; }

/* Swiper Card renders via the theme's actual card template — no extra CSS needed. */

@media (max-width: 600px) {
	/* Section Break — was 3:1 (50% side-crop of a 6:1 source). 5:1 keeps the
	   banner tall enough to read on a phone while only losing ~17% of edge content. */
	.da-deal-slot--section-banner      .da-deal-slot__media { aspect-ratio: 5 / 1; }
	/* Member Hub stays 3:1 on mobile — source is 5:1 so the crop trade-off is
	   smaller, and the dashboard surface has tighter vertical budget. */
	.da-deal-slot--dashboard-greeting  .da-deal-slot__media { aspect-ratio: 3 / 1; }
}

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

/* Theme host wrappers — control where the slot sits in the page,
   not how the banner itself looks. */
.da-drawer__deal      { margin: 18px 0 6px; padding: 0 4px; }
.da-story-lead-deal   { margin: 16px 0 22px; }
.da-section-deal      { margin: 12px 0 24px; }
.da-dashboard-deal    { margin: 0 0 22px; }
.da-story-lead-deal .da-deal-slot,
.da-section-deal    .da-deal-slot { margin: 0; }

/* ───── Long-slot hover overlay (story-lead, section-banner) ─────
   Heading rolls down from the top edge, button rolls up from the bottom.
   Hover/focus only — no viewport-entry firing for these slots. Overlay is
   suppressed entirely on touch devices (no mouse-off = no way to dismiss). */
@media (hover: hover) and (pointer: fine) {
	.da-deal-slot--story-lead     .da-deal-slot__cta-overlay,
	.da-deal-slot--section-banner .da-deal-slot__cta-overlay {
		position: absolute;
		inset: 0;
		left: 0;
		right: 0;
		bottom: 0;
		max-width: none;
		display: block;
		gap: 0;
		pointer-events: none;
	}
	.da-deal-slot--story-lead     .da-deal-slot__cta-label,
	.da-deal-slot--section-banner .da-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;
	}
	.da-deal-slot--story-lead     .da-deal-slot__cta-btn,
	.da-deal-slot--section-banner .da-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(--da-accent, #3da2ff), #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 auto .is-in-view show-and-retract behaviour from upstream rules
	   — long slots are strictly hover-driven. Listed BEFORE the :hover reveal
	   so source order lets :hover win the cascade tie. */
	.da-deal-slot--story-lead.is-in-view     .da-deal-slot__cta-label,
	.da-deal-slot--section-banner.is-in-view .da-deal-slot__cta-label {
		transform: translate(-50%, -110%);
		opacity: 0;
	}
	.da-deal-slot--story-lead.is-in-view     .da-deal-slot__cta-btn,
	.da-deal-slot--section-banner.is-in-view .da-deal-slot__cta-btn {
		transform: translate(-50%, calc(100% + 28px));
		opacity: 0;
	}
	.da-deal-slot--story-lead.is-retracted     .da-deal-slot__cta-overlay,
	.da-deal-slot--section-banner.is-retracted .da-deal-slot__cta-overlay {
		transform: none;
		opacity: 1;
	}
	/* Hover/focus brings both elements in. Chained :is-in-view selector
	   bumps specificity so this wins even if the cascade order shifts. */
	.da-deal-slot--story-lead:hover                  .da-deal-slot__cta-label,
	.da-deal-slot--story-lead:focus-within           .da-deal-slot__cta-label,
	.da-deal-slot--story-lead.is-in-view:hover       .da-deal-slot__cta-label,
	.da-deal-slot--story-lead.is-in-view:focus-within .da-deal-slot__cta-label,
	.da-deal-slot--section-banner:hover              .da-deal-slot__cta-label,
	.da-deal-slot--section-banner:focus-within       .da-deal-slot__cta-label,
	.da-deal-slot--section-banner.is-in-view:hover   .da-deal-slot__cta-label,
	.da-deal-slot--section-banner.is-in-view:focus-within .da-deal-slot__cta-label {
		transform: translate(-50%, 0);
		opacity: 1;
	}
	.da-deal-slot--story-lead:hover                  .da-deal-slot__cta-btn,
	.da-deal-slot--story-lead:focus-within           .da-deal-slot__cta-btn,
	.da-deal-slot--story-lead.is-in-view:hover       .da-deal-slot__cta-btn,
	.da-deal-slot--story-lead.is-in-view:focus-within .da-deal-slot__cta-btn,
	.da-deal-slot--section-banner:hover              .da-deal-slot__cta-btn,
	.da-deal-slot--section-banner:focus-within       .da-deal-slot__cta-btn,
	.da-deal-slot--section-banner.is-in-view:hover   .da-deal-slot__cta-btn,
	.da-deal-slot--section-banner.is-in-view:focus-within .da-deal-slot__cta-btn {
		transform: translate(-50%, 0);
		opacity: 1;
	}
}

/* Touch / no-hover — overlay suppressed for the long slots (no dismiss path) */
@media (hover: none) {
	.da-deal-slot--story-lead     .da-deal-slot__cta-overlay,
	.da-deal-slot--section-banner .da-deal-slot__cta-overlay {
		display: none;
	}
}

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