/**
 * Avada Portfolio Grid Display - Frontend Styles
 *
 * @package Avada_Portfolio_Grid_Display
 */

/* ============================================
   Grid Container
   ============================================ */
.apgd-grid {
	display: grid;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ============================================
   Post Item / Card
   ============================================ */
.apgd-post-item {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	height: 100%;
	position: relative;
}

.apgd-post-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* ============================================
   Post Image - Fully Responsive
   ============================================ */
.apgd-post-image {
	width: 100%;
	overflow: hidden;
	position: relative;
}

.apgd-post-image a {
	display: block;
	width: 100%;
}

/* Responsive Images - Width 100%, Height Auto */
.apgd-post-image img,
.apgd-responsive-image {
	width: 100% !important;
	height: auto !important;
	display: block;
	object-fit: contain;
	max-width: 100%;
	transition: transform 0.3s ease;
}

/* ============================================
   Post Content
   ============================================ */
.apgd-post-content {
	flex: 1;
	display: flex;
	flex-direction: column;
}

/* ============================================
   Post Title
   ============================================ */
.apgd-post-title {
	margin: 0;
	line-height: 1.4;
	font-weight: 600;
	word-break: break-word;
}

.apgd-post-title a {
	text-decoration: none;
	color: inherit;
	transition: color 0.2s ease;
}

.apgd-post-title a:hover {
	text-decoration: underline;
}

.apgd-post-title a:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* ============================================
   Post Date
   ============================================ */
.apgd-post-date {
	margin: 0;
	line-height: 1.5;
	word-break: break-word;
}

/* ============================================
   Post Categories & Skills
   ============================================ */
.apgd-post-categories,
.apgd-post-skills {
	margin: 0;
	line-height: 1.5;
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	align-items: center;
}

.apgd-category-link,
.apgd-skill-link {
	text-decoration: none;
	transition: opacity 0.2s ease;
	display: inline-block;
}

.apgd-category-link:hover,
.apgd-skill-link:hover {
	opacity: 0.7;
}

.apgd-separator {
	color: #999;
}

/* ============================================
   Project URL Button
   ============================================ */
.apgd-project-url {
	margin-top: auto;
	padding-top: 10px;
}

.apgd-project-url-btn {
	display: inline-block;
	padding: 8px 16px;
	background-color: #2271b1;
	color: #ffffff !important;
	text-decoration: none;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 500;
	transition: background-color 0.2s ease, transform 0.2s ease;
	cursor: pointer;
}

.apgd-project-url-btn:hover {
	background-color: #1a5a96;
	color: #ffffff !important;
	transform: translateY(-1px);
}

/* ============================================
   Carousel Styles
   ============================================ */
.apgd-carousel {
	width: 100%;
	overflow: hidden;
	position: relative;
	padding: 20px 0;
}

.apgd-carousel .swiper-slide {
	height: auto;
}

.apgd-carousel .apgd-post-item {
	height: 100%;
}

.apgd-carousel .apgd-post-image {
	width: 100%;
}

/* Carousel Images - Fully Responsive */
.apgd-carousel .apgd-post-image img,
.apgd-carousel .apgd-responsive-image {
	width: 100% !important;
	height: auto !important;
	display: block;
	object-fit: contain;
	max-width: 100%;
}

/* ============================================
   Swiper Navigation
   ============================================ */
.apgd-carousel .swiper-button-next,
.apgd-carousel .swiper-button-prev {
	color: #333;
	background: rgba(255, 255, 255, 0.95);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	top: 50%;
	transform: translateY(-50%);
	transition: all 0.3s ease;
}

.apgd-carousel .swiper-button-next:after,
.apgd-carousel .swiper-button-prev:after {
	font-size: 18px;
	font-weight: bold;
}

.apgd-carousel .swiper-button-next:hover,
.apgd-carousel .swiper-button-prev:hover {
	background: #fff;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.apgd-carousel .swiper-button-disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* ============================================
   Swiper Pagination
   ============================================ */
.apgd-carousel .swiper-pagination {
	position: relative;
	margin-top: 20px;
	bottom: 0;
}

.apgd-carousel .swiper-pagination-bullet {
	width: 10px;
	height: 10px;
	background: #ccc;
	opacity: 1;
	transition: all 0.3s ease;
}

.apgd-carousel .swiper-pagination-bullet-active {
	background: #2271b1;
	transform: scale(1.2);
}

/* ============================================
   No Posts Message
   ============================================ */
.apgd-no-posts {
	text-align: center;
	padding: 40px 20px;
	color: #666;
	font-size: 16px;
	background: #f9f9f9;
	border-radius: 8px;
}

/* ============================================
   Clickable Card Styles
   ============================================ */
.apgd-clickable-card {
	cursor: pointer;
	text-decoration: none;
	display: block;
	color: inherit;
}

.apgd-clickable-card:hover,
.apgd-clickable-card:focus {
	text-decoration: none;
	color: inherit;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (max-width: 991px) {
	.apgd-carousel .swiper-button-next,
	.apgd-carousel .swiper-button-prev {
		width: 40px;
		height: 40px;
	}

	.apgd-carousel .swiper-button-next:after,
	.apgd-carousel .swiper-button-prev:after {
		font-size: 16px;
	}
}

@media (max-width: 767px) {
	.apgd-carousel .swiper-button-next,
	.apgd-carousel .swiper-button-prev {
		width: 36px;
		height: 36px;
	}

	.apgd-carousel .swiper-button-next:after,
	.apgd-carousel .swiper-button-prev:after {
		font-size: 14px;
	}

	.apgd-carousel {
		padding: 15px 0;
	}

	.apgd-project-url-btn {
		padding: 6px 12px;
		font-size: 12px;
	}
}

@media (max-width: 480px) {
	.apgd-carousel .swiper-button-next,
	.apgd-carousel .swiper-button-prev {
		width: 32px;
		height: 32px;
	}

	.apgd-carousel .swiper-button-next:after,
	.apgd-carousel .swiper-button-prev:after {
		font-size: 12px;
	}
}

/* ============================================
   Accessibility
   ============================================ */
.apgd-post-title a:focus,
.apgd-clickable-card:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.apgd-carousel .swiper-button-next:focus,
.apgd-carousel .swiper-button-prev:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
	.apgd-grid {
		display: block;
	}

	.apgd-post-item {
		page-break-inside: avoid;
		margin-bottom: 20px;
		box-shadow: none;
	}

	.apgd-carousel .swiper-button-next,
	.apgd-carousel .swiper-button-prev,
	.apgd-carousel .swiper-pagination {
		display: none;
	}

	.apgd-project-url-btn {
		background: none;
		color: #2271b1 !important;
		border: 1px solid #2271b1;
	}
}

/* ============================================
   Animation Utilities
   ============================================ */
@keyframes apgd-fade-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.apgd-grid .apgd-post-item {
	animation: apgd-fade-in 0.4s ease forwards;
}

.apgd-grid .apgd-post-item:nth-child(1) { animation-delay: 0.05s; }
.apgd-grid .apgd-post-item:nth-child(2) { animation-delay: 0.1s; }
.apgd-grid .apgd-post-item:nth-child(3) { animation-delay: 0.15s; }
.apgd-grid .apgd-post-item:nth-child(4) { animation-delay: 0.2s; }
.apgd-grid .apgd-post-item:nth-child(5) { animation-delay: 0.25s; }
.apgd-grid .apgd-post-item:nth-child(6) { animation-delay: 0.3s; }
.apgd-grid .apgd-post-item:nth-child(7) { animation-delay: 0.35s; }
.apgd-grid .apgd-post-item:nth-child(8) { animation-delay: 0.4s; }

/* ============================================
   RTL Support
   ============================================ */
[dir="rtl"] .apgd-carousel .swiper-button-next {
	right: auto;
	left: 10px;
}

[dir="rtl"] .apgd-carousel .swiper-button-prev {
	left: auto;
	right: 10px;
}

[dir="rtl"] .apgd-post-categories,
[dir="rtl"] .apgd-post-skills {
	direction: rtl;
}
