/*
 * Carousel styles for NewSections Listing block
 * Uses Swiper.js library
 */

/* Carousel container */
.ns-listing.ns-layout-carousel {
	display: block;
	width: 100%;
	position: relative;
	overflow: hidden;
}

/* Peek mode: parent must allow overflow */
.ns-listing.ns-layout-carousel:has(.ns-carousel--peek) {
	overflow: visible;
}

/* Swiper overrides for NewSections */
.ns-carousel.swiper {
	width: 100%;
	padding-bottom: 40px; /* Space for pagination */
	overflow: hidden;
}

/* Peek mode: must be visible to show partial slides */
.ns-carousel--peek.swiper {
	overflow: visible !important;
}

.ns-carousel .swiper-wrapper {
	display: flex;
	align-items: stretch;
	width: 100%;
	/* Tüm slide'ları aynı yüksekliğe getir */
	align-items: flex-start;
}

.ns-carousel .swiper-slide {
	display: flex;
	align-items: stretch;
	height: 100%;
	padding: 0;
	width: 100%;
	box-sizing: border-box;
	flex-shrink: 0;
}

/* Slide card styling */
.ns-carousel .ns-card {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--ns-card-bg, #ffffff);
	border: var(--ns-card-border-width, 1px) solid var(--ns-card-border-color, #e5e7eb);
	border-radius: var(--ns-card-border-radius, 12px) !important;
	padding: var(--ns-card-padding, 16px);
	box-shadow: var(--ns-card-shadow, 0 1px 2px rgba(0,0,0,0.04));
	transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
	position: relative;
	box-sizing: border-box;
}

/* Card hover effects */
.ns-carousel .ns-card:hover {
	background-color: var(--ns-card-hover-bg, #ffffff);
	border-color: var(--ns-card-hover-border, #e5e7eb);
	box-shadow: var(--ns-card-hover-shadow, 0 8px 24px rgba(0,0,0,0.08));
}

/* Card hover transform */
.ns-carousel .ns-card--hover-transform:hover {
	transform: translateY(-3px);
}

/* Shadow variations */
.ns-carousel .ns-card--shadow-none {
	box-shadow: none;
}

.ns-carousel .ns-card--shadow-light {
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ns-carousel .ns-card--shadow-medium {
	box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ns-carousel .ns-card--shadow-heavy {
	box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* Image styling in carousel */
.ns-carousel .ns-card__image,
.ns-carousel .ns-card .wp-block-post-featured-image img,
.ns-carousel .ns-card__thumb img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: var(--ns-image-radius, 4px);
	border-width: var(--ns-image-border-width, 0);
	border-style: solid;
	border-color: var(--ns-image-border-color, transparent);
	opacity: var(--ns-image-opacity, 1);
	box-shadow: var(--ns-image-shadow, none);
	filter: var(--ns-image-filter, none);
	transition: opacity var(--ns-image-hover-out, .3s) var(--ns-image-hover-ease, ease),
	            transform var(--ns-image-hover-out, .3s) var(--ns-image-hover-ease, ease),
	            filter var(--ns-image-hover-out, .3s) var(--ns-image-hover-ease, ease);
	object-fit: cover;
	aspect-ratio: var(--ns-image-aspect-ratio, 16/9);
}

/* Image hover effects in carousel */
.ns-carousel .ns-card:hover .ns-card__image,
.ns-carousel .ns-card:hover .wp-block-post-featured-image img,
.ns-carousel .ns-card:hover .ns-card__thumb img {
	opacity: var(--ns-image-hover-opacity, 1);
	transform: scale(var(--ns-image-hover-scale, 1.05));
	filter: var(--ns-image-hover-filter, var(--ns-image-filter, none));
	transition: opacity var(--ns-image-hover-in, .3s) var(--ns-image-hover-ease, ease),
	            transform var(--ns-image-hover-in, .3s) var(--ns-image-hover-ease, ease),
	            filter var(--ns-image-hover-in, .3s) var(--ns-image-hover-ease, ease);
}

/* Card title */
.ns-carousel .ns-card__title {
	margin: 8px 0 6px;
	font-size: 1.06rem;
	font-weight: 600;
	line-height: 1.35;
}

.ns-carousel .ns-card__title a {
	text-decoration: none;
	color: inherit;
}

.ns-carousel .ns-card__title a:hover {
	text-decoration: underline;
}

/* Card media link */
.ns-carousel .ns-card__media-link {
	display: block;
	overflow: hidden;
	margin-bottom: 12px;
	border-radius: var(--ns-image-radius, 4px);
	position: relative;
	z-index: 2;
}

/* Card inner content */
.ns-carousel .ns-card__inner {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Meta text */
.ns-carousel .ns-card__meta,
.ns-carousel .ns-card p {
	color: #6b7280;
	font-size: 0.95rem;
	margin: 0;
}

/* Overlay link for full card click */
.ns-carousel .ns-card__overlay-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	text-indent: -9999px;
}

/* Swiper pagination styling */
.ns-carousel .swiper-pagination {
	position: relative;
	bottom: 0;
	margin-top: 20px;
	display: flex !important;
	justify-content: center;
	gap: 8px;
	visibility: visible !important;
	opacity: 1 !important;
}

.ns-carousel .swiper-pagination-bullet {
	width: 10px;
	height: 10px;
	background-color: #1e417c;
	border-radius: 50%;
	opacity: 1 !important;
	transition: background-color 0.3s ease, width 0.3s ease;
	cursor: pointer;
	display: inline-block !important;
	visibility: visible !important;
}

.ns-carousel .swiper-pagination-bullet-active {
	background-color: #1e417c;
	width: 40px;
	border-radius: 4px;
	opacity: 1 !important;
	visibility: visible !important;
}

/* Swiper navigation buttons */
.ns-carousel .swiper-button-prev,
.ns-carousel .swiper-button-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 100px;
	background-color: #23417b;
	border: 1px solid #e5e7eb;
	border-radius: 0;
	display: flex !important;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 10;
	transition: all 0.3s ease;
	color: #fff;
	font-size: 18px;
	outline: none;
}

.ns-carousel .swiper-button-prev:hover,
.ns-carousel .swiper-button-next:hover {
	background-color: red;
	color: white;
	border-color: #bababa;
}

.ns-carousel .swiper-button-prev {
	left: -40px;
}

.ns-carousel .swiper-button-next {
	right: -40px;
}

.ns-carousel .swiper-button-prev::after,
.ns-carousel .swiper-button-next::after {
	content: '';
	font-size: 0;
}

.ns-carousel .swiper-button-prev::before {
	content: '‹';
	font-size: 24px;
	font-weight: bold;
}

.ns-carousel .swiper-button-next::before {
	content: '›';
	font-size: 24px;
	font-weight: bold;
}

.ns-carousel .swiper-button-prev.swiper-button-disabled,
.ns-carousel .swiper-button-next.swiper-button-disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.ns-carousel .swiper-button-prev,
	.ns-carousel .swiper-button-next {
		width: 36px;
		height: 36px;
		font-size: 16px;
		display: flex !important;
	}

	.ns-carousel:not(.ns-carousel--peek) .swiper-button-prev {
		left: 8px;
	}

	.ns-carousel:not(.ns-carousel--peek) .swiper-button-next {
		right: 8px;
	}

	.ns-carousel .ns-card {
		padding: 12px;
	}

	.ns-carousel .ns-card__title {
		font-size: 0.95rem;
		margin: 6px 0 4px;
	}

	.ns-carousel .ns-card__meta,
	.ns-carousel .ns-card p {
		font-size: 0.85rem;
	}

	.ns-carousel .swiper-pagination {
		display: flex !important;
		visibility: visible !important;
		opacity: 1 !important;
	}

	.ns-carousel .swiper-pagination-bullet {
		display: inline-block !important;
		opacity: 1 !important;
		visibility: visible !important;
	}

	.ns-carousel .swiper-pagination-bullet-active {
		opacity: 1 !important;
		visibility: visible !important;
	}
}

@media (max-width: 600px) {
	/* Normal (non-peek) carousel on mobile */
	.ns-carousel.swiper:not(.ns-carousel--peek) {
		padding-bottom: 40px;
		margin: 0 -16px;
		width: calc(100% + 32px);
		padding-left: 16px;
		padding-right: 16px;
	}

	.ns-carousel .swiper-button-prev,
	.ns-carousel .swiper-button-next {
		width: 32px;
		height: 32px;
		font-size: 14px;
		display: flex !important;
	}

	.ns-carousel .swiper-button-prev {
		left: 6px;
	}

	.ns-carousel .swiper-button-next {
		right: 6px;
	}

	.ns-carousel .ns-card {
		padding: 12px;
		margin: 0;
	}

	.ns-carousel .ns-card__title {
		font-size: 0.85rem;
		line-height: 1.3;
	}

	.ns-carousel .swiper-pagination {
		margin-top: 12px;
		display: flex !important;
		visibility: visible !important;
		opacity: 1 !important;
	}

	.ns-carousel .swiper-pagination-bullet {
		width: 6px;
		height: 6px;
		display: inline-block !important;
		opacity: 1 !important;
		visibility: visible !important;
	}

	.ns-carousel .swiper-pagination-bullet-active {
		width: 20px;
		opacity: 1 !important;
		visibility: visible !important;
	}

	/* Only force full-width slides in non-peek mode */
	.ns-carousel:not(.ns-carousel--peek) .swiper-slide {
		width: 100%;
		min-width: 100%;
	}
}

/* =============================================
   Mobile Peek Effect
   ============================================= */

@media (max-width: 767px) {
	/* Non-active slides are slightly dimmed */
	.ns-carousel--peek .swiper-slide {
		opacity: 0.6;
		transition: opacity 0.3s ease;
	}

	/* Active (center) slide is fully visible */
	.ns-carousel--peek .swiper-slide-active {
		opacity: 1 !important;
	}
}

/* Accessibility */
.ns-carousel .swiper-button-prev:focus-visible,
.ns-carousel .swiper-button-next:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

.ns-carousel .ns-card a:focus-visible,
.ns-carousel .ns-card button:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

/* Lazy loading support */
.ns-carousel[style*="--ns-lazy-loading: 1"] .wp-block-post-featured-image img[loading="lazy"],
.ns-carousel[style*="--ns-lazy-loading: 1"] .ns-card__thumb img[loading="lazy"] {
	transition: filter 0.3s ease, opacity 0.3s ease;
}

.ns-carousel[style*="--ns-lazy-loading: 1"] .wp-block-post-featured-image img[loading="lazy"].loaded,
.ns-carousel[style*="--ns-lazy-loading: 1"] .ns-card__thumb img[loading="lazy"].loaded {
	/* Image loaded */
}
