/**
 * Two Image Slider Block (TIS)
 * Pixel-perfect: white section, centered container, 2-image row, caption, arrow buttons.
 *
 * @package sarantaporo
 */

/* -----------------------------------------------------------------------------
   Section & Container
   ----------------------------------------------------------------------------- */

.tis {
	box-sizing: border-box;
	width: 100%;
	background-color: #ffffff;
}

.tis *,
.tis *::before,
.tis *::after {
	box-sizing: inherit;
}

.tis__container {
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 24px;
	padding-right: 24px;
}

.tis.alignwide .tis__container {
	max-width: 1400px;
}

.tis.alignfull .tis__container {
	max-width: none;
	padding-left: max(24px, env(safe-area-inset-left));
	padding-right: max(24px, env(safe-area-inset-right));
}

/* -----------------------------------------------------------------------------
   Row: arrows + track (desktop)
   ----------------------------------------------------------------------------- */

.tis__row {
	display: flex;
	align-items: center;
	gap: 20px;
	width: 100%;
}

/* -----------------------------------------------------------------------------
   Arrow buttons (square, vertically centered)
   ----------------------------------------------------------------------------- */

.tis__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	padding: 0;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.tis__arrow:hover,
.tis__arrow:focus {
	opacity: 0.9;
}

.tis__arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.tis__arrow--prev {
	background-color: #d3d8cf;
	color: #666666;
}

.tis__arrow--next {
	background-color: #fbbf24;
	color: #666666;
}

.tis__arrow-icon {
	font-size: 1.5rem;
	line-height: 1;
	font-weight: 300;
}

/* -----------------------------------------------------------------------------
   Track & Slides
   ----------------------------------------------------------------------------- */

.tis__track {
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

/* No-JS / fallback: 2-column grid desktop, stacked mobile */
.tis__slides {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px;
}

/* With JS: slider uses scroll (script adds .tis--js and sets --tis-slide-width) */
.tis--js .tis__track {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
}

.tis--js .tis__slides {
	display: flex;
	flex-wrap: nowrap;
	grid-template-columns: unset;
	gap: 20px;
}

.tis--js .tis__slide {
	flex: 0 0 var(--tis-slide-width, calc(50% - 10px));
	min-width: var(--tis-slide-width, calc(50% - 10px));
}

/* -----------------------------------------------------------------------------
   Single slide
   ----------------------------------------------------------------------------- */

.tis__slide {
	position: relative;
}

.tis__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tis__link,
.tis__img-wrap {
	display: block;
	width: 100%;
	overflow: hidden;
}

.tis__img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
	aspect-ratio: 16 / 10;
	vertical-align: middle;
}

.tis__caption {
	margin: 0;
	font-size: 0.7rem;
	line-height: 1.3;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #666666;
}

/* -----------------------------------------------------------------------------
   Single slide mode: center one image, hide arrows (handled in PHP)
   ----------------------------------------------------------------------------- */

.tis--single .tis__slides {
	grid-template-columns: 1fr;
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

.tis--single.tis--js .tis__slide {
	flex: 0 0 100%;
	min-width: 100%;
}

/* -----------------------------------------------------------------------------
   Empty / placeholder (editor)
   ----------------------------------------------------------------------------- */

.tis--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
}

.tis__placeholder {
	margin: 0;
	padding: 1rem 1.5rem;
	color: #666;
	text-align: center;
	font-size: 0.95rem;
}

/* -----------------------------------------------------------------------------
   Tablet (768–1024px): 2 images with tighter spacing
   ----------------------------------------------------------------------------- */

@media (max-width: 1024px) {
	.tis__container {
		padding-left: 20px;
		padding-right: 20px;
	}

	.tis__row {
		gap: 16px;
	}

	.tis__slides {
		gap: 16px;
	}

	.tis--js .tis__slide {
		flex: 0 0 calc(50% - 8px);
		min-width: calc(50% - 8px);
	}

	.tis__arrow {
		width: 44px;
		height: 44px;
	}
}

/* -----------------------------------------------------------------------------
   Mobile (<768px): 1 image per view, arrows below or beside
   ----------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.tis__container {
		padding-left: 16px;
		padding-right: 16px;
	}

	.tis__row {
		flex-wrap: wrap;
		gap: 16px;
	}

	.tis__track {
		order: 1;
		width: 100%;
	}

	.tis__slides {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.tis--js .tis__slide {
		flex: 0 0 100%;
		min-width: 100%;
	}

	/* Arrows on mobile: full width row below track */
	.tis__arrow {
		order: 2;
		width: 44px;
		height: 44px;
	}

	.tis__arrow--prev {
		margin-right: auto;
	}

	.tis__arrow--next {
		margin-left: auto;
	}

	.tis__caption {
		font-size: 0.65rem;
	}
}
