/**
 * Homepage Image Popup - Frontend Stylesheet
 *
 * @package Homepage_Image_Popup
 */

:root {
	--hip-overlay-color: #000000;
	--hip-overlay-opacity: 0.75;
	--hip-popup-width: 600px;
	--hip-max-height: 85vh;
	--hip-border-radius: 12px;
	--hip-transition-speed: 0.35s;
}

/* ==========================================================================
   Overlay & Modal Shell
   ========================================================================== */

.hip-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity var(--hip-transition-speed) cubic-bezier(0.16, 1, 0.3, 1),
	            visibility var(--hip-transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
}

.hip-popup-overlay.hip-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Backdrop Click & Shade */
.hip-popup-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--hip-overlay-color, #000000);
	opacity: var(--hip-overlay-opacity, 0.75);
	cursor: pointer;
	z-index: 1;
	transition: opacity var(--hip-transition-speed) ease;
}

/* Modal Inner Container */
.hip-popup-container {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: var(--hip-popup-width, 600px);
	max-height: var(--hip-max-height, 85vh);
	margin: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	transform: scale(0.92) translateY(12px);
	transition: transform var(--hip-transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
	box-sizing: border-box;
}

.hip-popup-overlay.hip-visible .hip-popup-container {
	transform: scale(1) translateY(0);
}

/* Modal Image Content */
.hip-popup-content {
	position: relative;
	width: 100%;
	max-height: inherit;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	box-sizing: border-box;
}

.hip-popup-link {
	display: block;
	width: 100%;
	max-height: inherit;
	line-height: 0;
	text-decoration: none;
	cursor: pointer;
	outline: none;
	transition: filter 0.2s ease, transform 0.2s ease;
}

.hip-popup-link:hover,
.hip-popup-link:focus-visible {
	filter: brightness(1.02);
}

.hip-popup-image {
	display: block;
	width: 100%;
	height: auto;
	max-height: var(--hip-max-height, 85vh);
	object-fit: contain;
	border-radius: var(--hip-border-radius, 12px);
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45),
	            0 0 0 1px rgba(255, 255, 255, 0.08);
	box-sizing: border-box;
	user-select: none;
	-webkit-user-drag: none;
}

/* ==========================================================================
   Close (X) Button
   ========================================================================== */

.hip-popup-close {
	position: absolute;
	top: -14px;
	right: -14px;
	z-index: 10;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #ffffff;
	color: #0f172a;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22),
	            0 1px 3px rgba(0, 0, 0, 0.1);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	margin: 0;
	outline: none;
	transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
	            background-color 0.2s ease,
	            color 0.2s ease,
	            box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.hip-popup-close svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	transition: transform 0.2s ease;
	pointer-events: none;
}

.hip-popup-close:hover {
	background-color: #f8fafc;
	color: #dc2626;
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.hip-popup-close:hover svg {
	transform: rotate(90deg);
}

.hip-popup-close:active {
	transform: scale(0.95);
}

.hip-popup-close:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

/* ==========================================================================
   Body Scroll Locking
   ========================================================================== */

body.hip-scroll-locked {
	overflow: hidden !important;
	touch-action: none;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 768px) {
	.hip-popup-overlay {
		padding: 16px;
	}

	.hip-popup-container {
		max-width: 95vw !important;
	}

	.hip-popup-close {
		top: -12px;
		right: -12px;
		width: 34px;
		height: 34px;
	}

	.hip-popup-close svg {
		width: 16px;
		height: 16px;
	}
}

@media (max-width: 480px) {
	.hip-popup-overlay {
		padding: 12px;
	}

	.hip-popup-container {
		max-width: 100vw !important;
	}

	.hip-popup-close {
		top: 8px;
		right: 8px;
		width: 32px;
		height: 32px;
		background: rgba(255, 255, 255, 0.95);
	}
}
