/**
 * Homepage Popup Slider - frontend styles
 */

/* ---------- Overlay (dark, semi-transparent) ---------- */
.hps-overlay {
	display: none;                        /* Hidden until JS opens it */
	position: fixed;
	top: 0; right: 0; bottom: 0; left: 0;
	z-index: 999999;
	box-sizing: border-box;
	padding: 20px;
	overflow-y: auto;                     /* Lets very tall popups scroll */
	background: rgba(0, 0, 0, 0.78);
}
.hps-overlay.hps-is-open {
	display: flex;
	animation: hps-fade-in 0.3s ease both;
}
.hps-overlay *,
.hps-overlay *::before,
.hps-overlay *::after { box-sizing: border-box; }

html.hps-no-scroll { overflow: hidden; }

@keyframes hps-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Popup box (width / height come from admin via CSS variables) ---------- */
.hps-popup {
	position: relative;
	margin: auto;                          /* Centers in both directions, safe on overflow */
	width: var(--hps-width, 600px);
	max-width: 100%;
	background: #fff;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.hps-slider {
	position: relative;
	overflow: hidden;
}

/* ---------- Slides (cross-fade) ---------- */
.hps-slide {
	position: absolute;
	top: 0; left: 0;
	width: 100%;
	z-index: 0;
	opacity: 0;
	visibility: hidden;
	/* Outgoing slide stays opaque until the incoming one has faded in (no flicker) */
	transition: opacity 0s linear 0.5s, visibility 0s linear 0.5s;
}
.hps-slide.hps-active {
	position: relative;                    /* Active slide defines the height in "auto" mode */
	z-index: 1;
	opacity: 1;
	visibility: visible;
	transition: opacity 0.5s ease;
}

.hps-popup .hps-slide-inner {
	display: block;
	position: relative;
	height: 100%;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
}

/* Image: always fits the popup width, never stretched */
.hps-popup .hps-img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;                          /* Height follows the aspect ratio */
	margin: 0;
	border: 0;
	border-radius: 0;
}

/* ---------- Fixed height mode (when a custom height is set) ---------- */
.hps-popup.hps-fixed .hps-slider {
	height: var(--hps-height);
	max-height: calc(100vh - 40px);
}
.hps-popup.hps-fixed .hps-slide,
.hps-popup.hps-fixed .hps-slide.hps-active {
	position: absolute;
	top: 0; left: 0;
	height: 100%;
}
.hps-popup.hps-fixed .hps-img {
	height: 100%;
	object-fit: cover;                     /* Fills the box, no stretching */
}

/* ---------- Caption (title + description) ---------- */
.hps-popup .hps-caption {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	padding: 44px 24px 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
	color: #fff;
	text-align: left;
	pointer-events: none;
}
.hps-popup .hps-title {
	margin: 0 0 4px;
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
}
.hps-popup .hps-desc {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.45;
	color: #fff;
}

/* ---------- Close button + arrows: transparent, thin border, minimalist ---------- */
.hps-popup .hps-close,
.hps-popup .hps-arrow {
	-webkit-appearance: none;
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.8);   /* Thin border */
	border-radius: 50%;
	color: #fff;
	line-height: 0;
	cursor: pointer;
	opacity: 0.6;                                  /* Subtle / slightly transparent */
	filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.55)); /* Keeps it visible on bright images, no background */
	transition: opacity 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}
/* No background in ANY state (overrides aggressive theme button styles) */
.hps-popup .hps-close,
.hps-popup .hps-close:hover,
.hps-popup .hps-close:focus,
.hps-popup .hps-close:active,
.hps-popup .hps-arrow,
.hps-popup .hps-arrow:hover,
.hps-popup .hps-arrow:focus,
.hps-popup .hps-arrow:active {
	background: transparent !important;
	background-image: none !important;
	box-shadow: none;
}
.hps-popup .hps-close:hover,
.hps-popup .hps-arrow:hover { opacity: 1; }

.hps-popup .hps-close:focus-visible,
.hps-popup .hps-arrow:focus-visible {
	opacity: 1;
	outline: 1px solid #fff;
	outline-offset: 3px;
}

/* Close button: top right of the popup */
.hps-popup .hps-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 5;
	width: 34px;
	height: 34px;
}

/* Arrows: vertically centered, on the extreme left / right edges */
.hps-popup .hps-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 4;
	width: 42px;
	height: 42px;
}
.hps-popup .hps-prev { left: 0; }
.hps-popup .hps-next { right: 0; }

/* One slide only: no arrows */
.hps-popup.hps-single .hps-arrow { display: none; }

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
	.hps-overlay { padding: 12px; }
	.hps-popup .hps-arrow { width: 36px; height: 36px; }
	.hps-popup .hps-caption { padding: 36px 16px 14px; }
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.hps-overlay.hps-is-open { animation: none; }
	.hps-slide, .hps-slide.hps-active { transition: none; }
}
