/**
 * AJ Advertising — frontend slot styles.
 *
 * The viewport reserves height via aspect-ratio before any image loads, so the
 * slot never shifts layout. The mobile ratio (1300/672) is the default; an
 * inline rule (printed with the configured breakpoint) flips it to the desktop
 * ratio (2400/320) on wider viewports.
 */

.aj-ad {
	width: 100%;
	margin: 1.5rem 0;
	position: relative; /* anchor the overlaid dots + nav arrows */
}

/* When a slot is auto-inserted inside post content, themes often style
   `.entry-content button { margin-bottom: … }`. That (class,element) rule lands
   on the carousel's dot/nav buttons and shifts them. These class-scoped resets
   have higher specificity, so the slot stays theme-independent. */
.aj-ad .aj-ad__dot,
.aj-ad .aj-ad__nav {
	margin: 0;
}

.aj-ad__viewport {
	position: relative;
	width: 100%;
	aspect-ratio: 1300 / 672; /* mobile creative; desktop ratio set inline at the breakpoint */
	overflow: hidden;
	border-radius: 8px;
	background: var(--aj-ad-placeholder, rgba(0, 0, 0, 0.04));
}

.aj-ad__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 0.5s ease;
	pointer-events: none;
}

.aj-ad__slide.is-active {
	opacity: 1;
	pointer-events: auto;
}

/* A single-ad slot has just the one (active) slide — keep it fully opaque even
   before the script runs. */
.aj-ad:not(.aj-ad--carousel) .aj-ad__slide {
	opacity: 1;
	pointer-events: auto;
}

.aj-ad__link,
.aj-ad__pic,
.aj-ad__img {
	display: block;
	width: 100%;
	height: 100%;
}

.aj-ad__img {
	object-fit: cover;
	object-position: center;
}

/* Per-ad corner badge (disclosure label) */
.aj-ad__label {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	padding: 2px 8px;
	font-size: 11px;
	line-height: 1.5;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--aj-ad-label-color, #fff);
	background: var(--aj-ad-label-bg, rgba(0, 0, 0, 0.6));
	border-radius: 4px;
	pointer-events: none;
}

/* Dots — overlaid on the bottom of the image so they don't add vertical space */
.aj-ad__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 8px;
	z-index: 3;
	display: flex;
	justify-content: center;
	gap: 8px;
	pointer-events: none; /* re-enabled on the dots themselves below */
}

.aj-ad__dot {
	width: 9px;
	height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
	cursor: pointer;
	pointer-events: auto;
	transition: background 0.2s ease, transform 0.2s ease;
}

.aj-ad__dot:hover {
	background: rgba(255, 255, 255, 0.8);
}

.aj-ad__dot.is-active {
	background: #fff;
	transform: scale(1.2);
}

/* Prev/next arrows — hidden by default; revealed on hover on pointer devices.
   Touch devices use swipe instead. */
.aj-ad__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.aj-ad__nav--prev {
	left: 8px;
}

.aj-ad__nav--next {
	right: 8px;
}

.aj-ad__nav:hover {
	background: rgba(0, 0, 0, 0.68);
}

@media (hover: hover) and (pointer: fine) {
	.aj-ad:hover .aj-ad__nav {
		opacity: 1;
		pointer-events: auto;
	}
}

.aj-ad__nav:focus-visible {
	opacity: 1;
	pointer-events: auto;
	outline: 2px solid #fff;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.aj-ad__nav {
		transition: none;
	}
}

.aj-ad__empty {
	padding: 0.75rem 1rem;
	border: 1px dashed rgba(0, 0, 0, 0.2);
	border-radius: 6px;
	color: #555;
	font-size: 0.9em;
}

@media (prefers-reduced-motion: reduce) {
	.aj-ad__slide {
		transition: none;
	}
}
