/* ============================================
 * Tiny Portfolio - Main Stylesheet
 * Slider Version (Fade In + Auto) - Fixed Popup
 * ============================================ */

.tp-portfolio[data-infinite="1"] .tp-page-links {
	display: none;
}

/* ============================================
 * Grid Layout
 * ============================================ */
.tp-portfolio {
	width: 100%;
	height: auto;
	overflow: hidden;
	position: relative;
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: flex-start;
}

.tp-portfolio .grid-item {
	position: relative;
	box-sizing: border-box;
	min-height: 50px;
	height: auto;
	overflow: hidden;
	margin-block-end: 20px;
	margin-inline-end: 20px;
}

/* 1 Column */
.tp-portfolio.columns-1 .grid-item {
	width: 100%;
	margin-inline-end: 0;
}

.tp-portfolio.columns-2 .grid-item {
	width: calc(1/2 * 100% - (1 - 1/2) * 20px);
}

.tp-portfolio.columns-3 .grid-item {
	width: calc(1/3 * 100% - (1 - 1/3) * 20px);
}

.tp-portfolio.columns-4 .grid-item {
	width: calc(1/4 * 100% - (1 - 1/4) * 20px);
}

.tp-portfolio.columns-5 .grid-item {
	width: calc(1/5 * 100% - (1 - 1/5) * 20px);
}

.tp-portfolio .grid-item.last {
	margin-inline-end: 0 !important;
}

/* ============================================
 * Grid Overlay
 * ============================================ */
.tp-portfolio .grid-item .grid-overlay {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	background: #000;
	transition: all .5s ease;
	z-index: 1;
}

/* ============================================
 * Grid Content & Titles
 * ============================================ */
.tp-portfolio .grid-item .grid-title {
	font-size: 14px;
	margin: 15px 0 5px;
	cursor: pointer;
	transition: color .3s ease;
}

.tp-portfolio .grid-item .grid-title:hover {
	color: #333;
}

.tp-portfolio .grid-item .excerpt {
	margin: 0;
	color: #888;
	font-size: 12px;
	line-height: 1.6;
}

/* ============================================
 * Grid Thumbnail
 * ============================================ */
.tp-portfolio .grid-item .grid-thumbnail {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: flex-end;
	cursor: pointer;
	overflow: hidden;
	flex-wrap: wrap;
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	min-height: 50px;
	transition: all .5s ease;
}

.tp-portfolio .grid-item .grid-thumbnail:hover {
	transform: scale(1.05);
}

.tp-portfolio .grid-item .grid-content {
	width: 100%;
	position: relative;
	z-index: 3;
}

.tp-portfolio .grid-item .grid-thumbnail .grid-title {
	margin: 15px;
	color: #fff;
	z-index: 2;
	position: relative;
}

.tp-portfolio .grid-item .grid-thumbnail .excerpt {
	color: #fff;
	margin: 0 15px 15px;
	position: relative;
	z-index: 2;
}

/* ============================================
 * SINGLE PORTFOLIO (POPUP) - Fixed Layout
 * ============================================ */
.tp-single-portfolio {
	position: fixed;
	top: 0;
	inset-inline-start: 0;
	width: 100vw;
	height: 100vh;
	z-index: 10000;
	display: none;
	overflow: hidden;
	box-sizing: border-box;
	padding: 40px;
	align-items: center;
	justify-content: center;
}

.tp-single-portfolio .tp-wrapper {
	position: relative;
	width: 100%;
	max-width: 1200px;
	height: 100%;
	max-height: 85vh;
	background: rgba(0, 0, 0, 0.85);
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	overflow: hidden;
	display: flex;
	justify-content: space-between;
	align-items: stretch;
	padding: 40px;
	box-sizing: border-box;
	gap: 40px;
}

.tp-single-portfolio.video .tp-wrapper {
	align-items: center;
}

/* Media Container - Slider */
.tp-single-portfolio .tp-wrapper .tp-media {
	width: 60%;
	height: 100%;
	max-height: 100%;
	overflow: hidden;
	order: 1;
	box-sizing: border-box;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 4px;
}

/* Content Container */
.tp-single-portfolio .tp-wrapper .tp-content {
	width: 40%;
	height: 100%;
	max-height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	font-size: 16px;
	color: #fff;
	order: 2;
	padding-inline-end: 10px;
	box-sizing: border-box;
}

.tp-single-portfolio .popup-title {
	font-size: 2em;
	line-height: 1.2;
	color: #fff;
	margin: 0 0 1em;
	padding-inline-end: 40px;
}

.tp-single-portfolio .popup-content {
	font-size: 16px;
	line-height: 1.7;
	color: #fff;
	margin-block-end: 1em;
}

/* ============================================
 * SLIDER (Fade In + Infinite Loop)
 * ============================================ */
.tp-slider {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tp-slider .tp-slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 1s ease-in-out;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tp-slider .tp-slide.active {
	opacity: 1;
	z-index: 1;
}

.tp-slider .tp-slide img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	display: block;
}

/* Dots Navigation */
.tp-slider-dots {
	position: absolute;
	bottom: 15px;
	inset-inline-start: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
	z-index: 5;
	padding: 8px 12px;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 20px;
}

.tp-slider-dots .tp-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
	cursor: pointer;
	transition: background .3s ease, transform .3s ease;
	border: none;
	padding: 0;
}

.tp-slider-dots .tp-dot.active {
	background: #ffffff;
	transform: scale(1.2);
}

.tp-slider-dots .tp-dot:hover {
	background: rgba(255, 255, 255, 0.8);
}

/* Video & Audio (Not Slider) */
.tp-single-portfolio .tp-video-container,
.tp-single-portfolio.video .tp-media iframe {
	height: 350px;
	width: 100%;
	background: #000;
	border-radius: 4px;
}

.tp-single-portfolio.audio .tp-media iframe {
	width: 100%;
	border-radius: 4px;
}

.tp-single-portfolio .tp-video-container.vimeo,
.tp-single-portfolio.video .tp-media .tp-video-container.vimeo iframe {
	height: 400px;
}

/* ============================================
 * Custom Scrollbar (Content Only)
 * ============================================ */
.tp-single-portfolio .tp-content::-webkit-scrollbar {
	width: 6px;
}
.tp-single-portfolio .tp-content::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 3px;
}
.tp-single-portfolio .tp-content::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.3);
	border-radius: 3px;
}
.tp-single-portfolio .tp-content::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.6);
}

.tp-single-portfolio .tp-content {
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.05);
}

/* Audio Specific Layout */
.tp-single-portfolio.audio .tp-wrapper {
	align-items: center;
	justify-content: center;
	flex-direction: column;
	overflow-y: auto;
}

.tp-single-portfolio.audio .tp-content,
.tp-single-portfolio.audio .tp-media {
	width: 100%;
	height: auto;
	max-height: none;
	overflow: visible;
}

.tp-single-portfolio.audio .tp-content .tp-entry-content {
	width: 60%;
	float: inline-start;
}

.tp-single-portfolio.audio .tp-content .tp-portfolio-details {
	float: inline-end;
	width: 30%;
	margin-block-start: 0;
	padding-inline-start: 50px;
	border-inline-start: 1px dotted #ddd;
}

/* ============================================
 * Popup Close Button (X)
 * ============================================ */
.tp-close {
	position: absolute;
	inset-inline-end: 20px;
	top: 20px;
	width: 40px;
	height: 40px;
	background: rgba(0, 0, 0, 0.7);
	border-radius: 50%;
	opacity: 0.8;
	cursor: pointer;
	z-index: 30;
	transition: opacity .3s ease, transform .3s ease, background .3s ease;
}

.tp-close:hover {
	opacity: 1;
	background: rgba(200, 0, 0, 0.9);
	transform: rotate(90deg);
}

.tp-close:before,
.tp-close:after {
	position: absolute;
	inset-inline-start: 19px;
	content: ' ';
	height: 22px;
	width: 2px;
	background-color: #fff;
	top: 9px;
}

.tp-close:before {
	transform: rotate(45deg);
}

.tp-close:after {
	transform: rotate(-45deg);
}

/* ============================================
 * Portfolio Details
 * ============================================ */
.tp-single-portfolio .tp-portfolio-details {
	margin-block-start: 2em;
	padding-block-start: 1em;
	border-block-start: 1px solid rgba(255, 255, 255, 0.1);
}

.tp-single-portfolio .tp-portfolio-details p {
	margin: 5px 0;
	font-size: 14px;
	color: #fff;
	opacity: 0.85;
}

/* ============================================
 * Overlay & Loader
 * ============================================ */
.tp-single-portfolio-overlay {
	width: 100vw;
	height: 100vh;
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	background: #000;
	opacity: 0.95;
}

.tp-load-status {
	position: absolute;
	bottom: -40px;
	z-index: 999;
	transform: scale(0.4);
	inset-inline-start: 50%;
	margin-inline-start: -32px;
	display: none;
}
.tp-loader {
	display: inline-block;
	position: relative;
	width: 80px;
	height: 80px;
}
.tp-loader div {
	display: inline-block;
	position: absolute;
	inset-inline-start: 8px;
	width: 16px;
	background: #333;
	animation: lds-facebook 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
}
.tp-loader div:nth-child(1) { inset-inline-start: 8px; animation-delay: -0.24s; }
.tp-loader div:nth-child(2) { inset-inline-start: 32px; animation-delay: -0.12s; }
.tp-loader div:nth-child(3) { inset-inline-start: 56px; animation-delay: 0; }
@keyframes lds-facebook {
	0% { top: 8px; height: 64px; }
	50%, 100% { top: 24px; height: 32px; }
}

/* ============================================
 * Responsive
 * ============================================ */
@media (max-width: 1024px) and (min-width: 768px) {
	.tp-portfolio.columns-4 .grid-item,
	.tp-portfolio.columns-5 .grid-item {
		width: calc(1/3 * 100% - (1 - 1/3) * 20px);
	}

	.tp-single-portfolio .tp-wrapper {
		padding: 30px;
		gap: 30px;
	}

	.tp-single-portfolio .popup-title {
		font-size: 1.7em;
	}
}

@media (max-width: 767px) {
	.tp-portfolio .grid-item {
		width: 100% !important;
		margin-inline-end: 0 !important;
	}

	.tp-single-portfolio {
		padding: 15px;
	}

	.tp-single-portfolio .tp-wrapper {
		flex-wrap: wrap;
		height: auto;
		max-height: 90vh;
		overflow-y: auto;
		padding: 20px;
		gap: 20px;
		align-items: flex-start;
	}

	.tp-single-portfolio .tp-wrapper .tp-content {
		margin-block-end: 2em;
		order: 1;
		width: 100%;
		height: auto;
		max-height: none;
		overflow-y: visible;
		padding-inline-end: 0;
	}

	.tp-single-portfolio .tp-wrapper .tp-media {
		order: 2;
		width: 100%;
		height: auto;
		min-height: 300px;
		max-height: 400px;
		overflow: visible;
		padding-inline-end: 0;
	}

	.tp-slider {
		height: 300px;
	}

	.tp-single-portfolio .tp-portfolio-title {
		font-size: 1.5em;
	}

	.tp-single-portfolio .tp-video-container,
	.tp-single-portfolio.video .tp-media iframe {
		height: 250px;
	}

	.tp-close {
		top: 10px;
		inset-inline-end: 10px;
		width: 35px;
		height: 35px;
	}

	.tp-close:before,
	.tp-close:after {
		inset-inline-start: 16px;
		top: 7px;
		height: 21px;
	}

	.tp-slider-dots {
		bottom: 10px;
		padding: 6px 10px;
	}

	.tp-slider-dots .tp-dot {
		width: 8px;
		height: 8px;
	}
}

@media (max-width: 480px) {
	.tp-single-portfolio {
		padding: 10px;
	}

	.tp-single-portfolio .tp-wrapper {
		padding: 15px;
		gap: 15px;
		max-height: 95vh;
	}

	.tp-single-portfolio .popup-title {
		font-size: 1.3em;
		padding-inline-end: 35px;
	}

	.tp-single-portfolio .popup-content {
		font-size: 14px;
	}

	.tp-single-portfolio .tp-wrapper .tp-media {
		min-height: 220px;
		max-height: 280px;
	}

	.tp-single-portfolio .tp-video-container,
	.tp-single-portfolio.video .tp-media iframe {
		height: 200px;
	}

	.tp-slider {
		height: 220px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tp-portfolio .grid-item .grid-thumbnail,
	.tp-portfolio .grid-item .grid-overlay,
	.tp-close,
	.tp-slider .tp-slide {
		transition: none;
	}
	.tp-portfolio .grid-item .grid-thumbnail:hover {
		transform: none;
	}
}