/**
 * Frontend CSS for Sali Popup Story Post
 */

/* Global Font Family Default */
.sali-stories-grid,
.sali-story-card,
.sali-story-pagination,
.sali-story-modal {
	font-family: 'DM Sans', sans-serif;
}

/* 1. Grid Layout Container */
.sali-stories-grid {
	display: grid;
	gap: 30px;
	width: 100%;
	margin-bottom: 40px;
}

/* Responsiveness for columns (fallback if not styled by Elementor) */
.sali-stories-grid.sali-cols-1 { grid-template-columns: 1fr; }
.sali-stories-grid.sali-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sali-stories-grid.sali-cols-3 { grid-template-columns: repeat(3, 1fr); }
.sali-stories-grid.sali-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 991px) {
	.sali-stories-grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 20px;
	}
}

@media (max-width: 767px) {
	.sali-stories-grid {
		grid-template-columns: 1fr !important;
		gap: 20px;
	}
}

/* 2. Card Styling */
.sali-story-card {
	display: flex;
	flex-direction: column;
	cursor: pointer;
	text-decoration: none;
	background: transparent;
	overflow: hidden;
	transition: transform 0.3s ease;
}

.sali-story-card:hover .sali-story-image-wrap img {
	transform: scale(1.06);
}

.sali-story-image-wrap {
	width: 100%;
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: #f0f0f0;
	border-radius: 4px; /* minimal rounded corners like the screenshot */
}

.sali-story-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
	display: block;
}

/* Play button overlay for Video Cards */
.sali-story-card-video .sali-story-image-wrap::after {
	content: '\f144'; /* FontAwesome video play icon */
	font-family: 'Font Awesome 6 Free';
	font-weight: 900;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 48px;
	color: rgba(255, 255, 255, 0.85);
	text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
	transition: all 0.3s ease;
	opacity: 0.8;
}

.sali-story-card-video:hover .sali-story-image-wrap::after {
	transform: translate(-50%, -50%) scale(1.15);
	color: #ffffff;
	opacity: 1;
}

.sali-story-title {
	margin-top: 15px;
	font-family: 'DM Sans', sans-serif;
	font-size: 17px;
	line-height: 1.4;
	color: #333333;
	font-weight: 600;
	transition: color 0.2s ease;
	text-align: left;
}

.sali-story-card:hover .sali-story-title {
	color: #084c7c; /* Blue color change on card hover */
}

/* 3. Custom Pagination Styling */
.sali-story-pagination-container {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 40px;
	width: 100%;
}

.sali-story-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	font-family: 'DM Sans', sans-serif;
}

.sali-story-pagination .page-numbers {
	border: none !important;
	background: transparent !important;
	color: #4a4a4a !important;
	font-size: 18px !important;
	font-weight: 400 !important;
	padding: 0 !important;
	margin: 0 !important;
	text-decoration: none !important;
	box-shadow: none !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	transition: color 0.3s ease;
}

.sali-story-pagination span.current {
	color: #d1d1d1 !important;
}

.sali-story-pagination a.prev,
.sali-story-pagination a.next {
	background-color: #003e78 !important;
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	border-radius: 50% !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative !important;
	color: transparent !important; /* Hide original text */
	font-size: 0 !important;
	text-decoration: none !important;
	overflow: hidden !important;
	transition: background-color 0.3s ease !important;
}

.sali-story-pagination a.prev:hover,
.sali-story-pagination a.next:hover {
	background-color: #002b54 !important;
}

.sali-story-pagination a.prev::after {
	content: "‹" !important;
	color: #ffffff !important;
	font-size: 32px !important;
	font-weight: 300 !important;
	line-height: 1 !important;
	margin-top: -4px !important;
	display: block !important;
	font-family: Arial, sans-serif !important;
}

.sali-story-pagination a.next::after {
	content: "›" !important;
	color: #ffffff !important;
	font-size: 32px !important;
	font-weight: 300 !important;
	line-height: 1 !important;
	margin-top: -4px !important;
	display: block !important;
	font-family: Arial, sans-serif !important;
}

/* 4. Modal Popup Styles */
.sali-story-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.6);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	padding: 20px;
}

.sali-story-modal.is-active {
	opacity: 1;
	pointer-events: auto;
}

/* Narrative Popup Box */
.sali-story-modal-content {
	background-color: #f7f7f7 !important; /* Soft premium off-white/light grey background */
	max-width: 550px;
	width: 100%;
	border-radius: 16px !important; /* Modern rounded corners */
	position: relative;
	padding: 40px 30px !important;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18) !important; /* Soft, deep modern shadow */
	transform: translateY(30px);
	transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
	max-height: 90vh;
	overflow-y: auto;
	box-sizing: border-box;
}

.sali-story-modal.is-active .sali-story-modal-content {
	transform: translateY(0);
}

/* Close Button - Narrative Popup (Inside the card, never clipped) */
.sali-story-modal-close {
	position: absolute !important;
	top: 20px !important;
	right: 20px !important;
	width: 36px !important;
	height: 36px !important;
	background: #ffffff !important;
	border: none !important;
	color: #333333 !important;
	font-size: 15px !important;
	cursor: pointer !important;
	border-radius: 50% !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
	padding: 0 !important;
	line-height: 1 !important;
	z-index: 100 !important;
}

.sali-story-modal-close:hover {
	background: #003e78 !important; /* Theme blue hover */
	color: #ffffff !important;
	transform: scale(1.1) rotate(90deg) !important;
	box-shadow: 0 4px 12px rgba(0, 62, 120, 0.3) !important;
}

/* Close Button - Video Lightbox (Floats inside on top-right of video viewport) */
.sali-story-video-modal-close {
	position: absolute !important;
	top: 15px !important;
	right: 15px !important;
	width: 36px !important;
	height: 36px !important;
	background: rgba(0, 0, 0, 0.5) !important; /* Semi-transparent black */
	border: none !important;
	color: #ffffff !important;
	font-size: 15px !important;
	cursor: pointer !important;
	border-radius: 50% !important;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
	padding: 0 !important;
	line-height: 1 !important;
	z-index: 1000 !important;
}

.sali-story-video-modal-close:hover {
	background: rgba(0, 0, 0, 0.8) !important;
	color: #ffffff !important;
	transform: scale(1.1) rotate(90deg) !important;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
}

@media (max-width: 600px) {
	.sali-story-modal-close {
		top: 15px !important;
		right: 15px !important;
	}
	.sali-story-video-modal-close {
		top: 10px !important;
		right: 10px !important;
	}
}

/* Popup Image (Square inside white frame) */
.sali-story-modal-image-wrap {
	width: 100%;
	max-width: 340px;
	margin: 0 auto 30px auto !important;
	aspect-ratio: 1 / 1;
	background-color: #ffffff !important;
	padding: 12px !important;
	box-shadow: 0 10px 30px rgba(0,0,0,0.06) !important;
	border-radius: 12px !important;
	box-sizing: border-box;
}

.sali-story-modal-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px !important;
	display: block;
}

/* Popup Title: Mom and Baby Name */
.sali-story-modal-title {
	font-family: 'DM Sans', sans-serif;
	font-size: 24px !important;
	font-weight: 700 !important;
	color: #111111 !important;
	text-align: center;
	margin-bottom: 18px !important;
	line-height: 1.3 !important;
	letter-spacing: -0.5px !important;
}

/* Popup Story Narrative Paragraph */
.sali-story-modal-text {
	font-family: 'DM Sans', sans-serif;
	font-size: 15px !important;
	line-height: 1.7 !important;
	color: #444444 !important;
	text-align: justify;
	margin: 0 !important;
	padding: 0 10px !important;
}

/* 5. Video Lightbox Popup Box */
.sali-story-video-modal-content {
	background-color: #000000;
	max-width: 850px;
	width: 100%;
	aspect-ratio: 16 / 9;
	position: relative;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
	transform: translateY(20px);
	transition: transform 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.sali-story-modal.is-active .sali-story-video-modal-content {
	transform: translateY(0);
}

.sali-story-video-container {
	width: 100%;
	height: 100%;
}

.sali-story-video-container iframe,
.sali-story-video-container video {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

@media (max-width: 850px) {
	.sali-story-video-modal-content {
		width: 95%;
	}
}

/* Prevent page scrolling when modal is active */
body.sali-modal-open {
	overflow: hidden;
}
