/* Spotlight Slideshow Gallery
 * Self-contained styles. No external dependencies.
 * Custom properties let themes override the accent without editing this file.
 */

:root {
	--pss-accent: #f7cb00;
	--pss-overlay: rgba(0, 0, 0, 0.7);
	--pss-panel: #000000;
	--pss-text: #ffffff;
	--pss-muted: #cfcfcf;
	--pss-ad-width: 300px;
	--pss-z: 99999;
}

/* ---------- Inline trigger (the clickable thumbnail) ---------- */

.pss-trigger {
	position: relative;
	/* Block (not inline-block): an inline-block wrapper is shrink-to-fit, which
	   collapses themes that size the image with width:100% (e.g. mobile full-width
	   images) down to the image's min-content width, leaving it tiny + left-aligned.
	   Block lets the wrapper fill the figure so the image sizes as it did unwrapped.
	   !important is required to beat WordPress core block-library's
	   `.wp-block-image > a { display:inline-block }` (specificity 0,1,1, higher than
	   a single class), which our trigger anchor would otherwise inherit. */
	display: block !important;
	cursor: zoom-in;
	line-height: 0;
}

.pss-trigger img {
	display: block;
	max-width: 100%;
	height: auto;
}

.pss-trigger__badge {
	position: absolute;
	right: 10px;
	bottom: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 6px;
	border: 3px solid #fff;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font: 700 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
	pointer-events: none;
}

.pss-trigger__badge::before {
	content: "";
	width: 14px;
	height: 14px;
	margin-right: 4px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M21 3H7a2 2 0 0 0-2 2v2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h13a2 2 0 0 0 2-2v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm-4 16H4V9h13v10z'/></svg>") center / contain no-repeat;
	mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M21 3H7a2 2 0 0 0-2 2v2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h13a2 2 0 0 0 2-2v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm-4 16H4V9h13v10z'/></svg>") center / contain no-repeat;
}

/* ---------- Modal shell ---------- */

.pss-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: var(--pss-z);
}

.pss-modal.is-open {
	display: block;
}

.pss-modal__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	/* Scroll tall panels (e.g. a stacked 300x600 ad on mobile) instead of
	   letting them overflow off-screen; margin:auto on the container still
	   centers it when there's room. */
	overflow-y: auto;
	padding: 24px;
	background: var(--pss-overlay);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.pss-modal__container {
	position: relative;
	width: 100%;
	max-width: 1180px;
	/* Centers in the scrollable overlay when there's room; top-aligns + scrolls
	   when the panel is taller than the viewport. */
	margin: auto;
	/* overflow visible so the close button can perch outside the corner. */
	overflow: visible;
	/* Solid panel that wraps the image + ad, with the page dimmed behind. */
	background: var(--pss-panel);
	padding: 24px;
	border-radius: 3px;
	outline: none;
}

/* Circular close perched on the very top-right corner of the panel, half
   outside it — reads as closing the whole gallery, not the ad beneath it. */
.pss-modal__close {
	position: absolute;
	top: -18px;
	right: -18px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.pss-modal__close:hover,
.pss-modal__close:focus-visible {
	background: var(--pss-accent);
	border-color: var(--pss-accent);
	color: #000;
	outline: none;
}

@media (max-width: 600px) {
	.pss-modal__overlay { padding: 12px; }
	.pss-modal__container { padding: 16px; }
	.pss-modal__close { top: 8px; right: 8px; }
}

/* ---------- Layout: image left, ad right ---------- */

.pss-modal__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.pss-modal[data-has-ad] .pss-modal__layout {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1000px) {
	/* Ad column appears beside the image on desktop. */
	.pss-modal__layout:has(.pss-modal__ad) {
		grid-template-columns: minmax(0, 1fr) var(--pss-ad-width);
	}
}

.pss-modal__main {
	position: relative;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ---------- Slider ---------- */

.pss-slider {
	position: relative;
	overflow: hidden;
	width: 100%;
}

.pss-slider__track {
	display: flex;
	width: 100%;
	transition: transform 0.32s ease;
	will-change: transform;
}

.pss-slide {
	flex: 0 0 100%;
	width: 100%;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.pss-slide__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-height: 64vh;
	overflow: hidden;
	cursor: zoom-in;
}

.pss-slide__media img {
	max-width: 100%;
	max-height: 64vh;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: transform 0.3s ease;
}

.pss-slide__media.is-zoomed {
	cursor: zoom-out;
	overflow: auto;
}

.pss-slide__media.is-zoomed img {
	transform: scale(1.8);
}

.pss-slide__caption {
	margin-top: 14px;
	max-width: 760px;
	color: var(--pss-text);
	font: 600 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	text-align: center;
}

.pss-slide__credit {
	display: block;
	margin-top: 6px;
	color: var(--pss-muted);
	font-weight: 400;
	font-size: 13px;
}

/* ---------- Nav + counter bar (centered below the image) ---------- */

.pss-slider__bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 22px;
}

.pss-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--pss-accent);
	cursor: pointer;
	transition: transform 0.12s ease, opacity 0.15s ease;
}

.pss-nav svg {
	display: block;
	width: 46px;
	height: 46px;
}

.pss-nav:hover { transform: scale(1.08); }
.pss-nav:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 50%; }
.pss-nav[hidden] { display: none; }

@media (max-width: 600px) {
	.pss-nav svg { width: 40px; height: 40px; }
}

.pss-counter {
	min-width: 64px;
	text-align: center;
	color: var(--pss-text);
	font: 700 16px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	letter-spacing: 0.02em;
}

.pss-counter__sep {
	margin: 0 4px;
	font-weight: 400;
	color: var(--pss-muted);
}

/* ---------- Filmstrip / thumbnail rail ---------- */

.pss-filmstrip {
	display: flex;
	gap: 8px;
	width: 100%;
	margin-top: 4px;
	padding-bottom: 4px;
	overflow-x: auto;
	scrollbar-width: thin;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
}

.pss-thumb {
	flex: 0 0 auto;
	width: 76px;
	height: 50px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 3px;
	background: none;
	cursor: pointer;
	opacity: 0.55;
	overflow: hidden;
	transition: opacity 0.15s ease, border-color 0.15s ease;
}

.pss-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pss-thumb:hover { opacity: 0.85; }
.pss-thumb:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.pss-thumb.is-active {
	opacity: 1;
	border-color: var(--pss-accent);
}

@media (max-width: 600px) {
	.pss-thumb { width: 60px; height: 42px; }
}

/* ---------- Ad column ---------- */

.pss-modal__ad {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 0;
}

.pss-modal__ad-label {
	color: #8c8c8c;
	font: 400 10px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.pss-modal__ad-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 250px;
	width: 100%;
	max-width: var(--pss-ad-width);
}

.pss-modal__ad-slot img { max-width: 100%; height: auto; }

@media (max-width: 999px) {
	/* On smaller screens the ad drops below the image. */
	.pss-modal__ad { order: 2; margin-top: 8px; }
	.pss-modal__ad-slot { min-height: 0; }
}

/* ---------- Body scroll lock ---------- */

body.pss-modal-open {
	overflow: hidden;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
	.pss-slider__track,
	.pss-slide__media img,
	.pss-nav { transition: none; }
}
