/* ==========================================================================
   IGIT Related Posts – Frontend Styles
   Grid and List layouts, fully responsive.
   ========================================================================== */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.igit-rpwt {
	margin: 2rem 0;
	clear: both;
	font-family: inherit;
	color: inherit;
}

.igit-rpwt__heading {
	border-bottom: 2px solid #e0e0e0;
	padding-bottom: 0.5rem;
	margin-bottom: 1.25rem;
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.igit-rpwt__heading h2,
.igit-rpwt__heading h3,
.igit-rpwt__heading h4 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
}

.igit-rpwt__query-time {
	font-size: 0.7rem;
	color: #aaa;
	font-weight: 400;
	white-space: nowrap;
	letter-spacing: 0.01em;
}

.igit-rpwt__query-time--standalone {
	display: block;
	margin-bottom: 0.75rem;
}

.igit-rpwt__no-posts {
	color: #888;
	font-style: italic;
}

/* ── Grid layout ─────────────────────────────────────────────────────────── */
.igit-rpwt--grid .igit-rpwt__items {
	display: grid;
	grid-template-columns: repeat(var(--igit-cols, 4), 1fr);
	gap: 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.igit-rpwt--grid .igit-rpwt__item {
	min-width: 0;
}

/* ── List layout ─────────────────────────────────────────────────────────── */
.igit-rpwt--list .igit-rpwt__items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.igit-rpwt--list .igit-rpwt__item {
	border-bottom: 1px solid #f0f0f0;
}

.igit-rpwt--list .igit-rpwt__item:last-child {
	border-bottom: none;
}

/* ── Compact layout ──────────────────────────────────────────────────────── */
.igit-rpwt--compact .igit-rpwt__items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.igit-rpwt--compact .igit-rpwt__item {
	border-bottom: 1px solid #f0f0f0;
}

.igit-rpwt--compact .igit-rpwt__item:last-child {
	border-bottom: none;
}

.igit-rpwt--compact .igit-rpwt__link {
	flex-direction: row;
	align-items: center;
	padding: 0.4rem 0;
}

.igit-rpwt--compact .igit-rpwt__link:hover,
.igit-rpwt--compact .igit-rpwt__link:focus {
	transform: none;
	box-shadow: none;
	background: #fafafa;
}

.igit-rpwt--compact .igit-rpwt__thumb-wrap {
	display: none;
}

/* ── Item & link ─────────────────────────────────────────────────────────── */
.igit-rpwt__link {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	border-radius: 6px;
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.igit-rpwt--grid .igit-rpwt__link {
	height: 100%;
	border: 1px solid #e8e8e8;
}

.igit-rpwt--list .igit-rpwt__link {
	flex-direction: row;
	align-items: center;
	gap: 0.75rem;
	padding: 0.65rem 0;
}

.igit-rpwt__link:hover,
.igit-rpwt__link:focus {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
	text-decoration: none;
	color: inherit;
}

.igit-rpwt--list .igit-rpwt__link:hover,
.igit-rpwt--list .igit-rpwt__link:focus {
	transform: none;
	box-shadow: none;
	background: #fafafa;
}

/* ── Thumbnail ───────────────────────────────────────────────────────────── */
.igit-rpwt__thumb-wrap {
	display: block;
	overflow: hidden;
	background: #f0f0f0;
	position: relative;
}

.igit-rpwt--grid .igit-rpwt__thumb-wrap {
	width: 100%;
	aspect-ratio: 3 / 2;
}

.igit-rpwt--list .igit-rpwt__thumb-wrap {
	flex-shrink: 0;
	width: 80px;
	height: 60px;
	border-radius: 4px;
}

.igit-rpwt__thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.igit-rpwt__cat-badge {
	position: absolute;
	bottom: 7px;
	left: 7px;
	background: rgba(0,0,0,0.65);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: 3px;
	line-height: 1.4;
	pointer-events: none;
	white-space: nowrap;
	max-width: calc(100% - 14px);
	overflow: hidden;
	text-overflow: ellipsis;
}

.igit-rpwt__link:hover .igit-rpwt__thumb {
	transform: scale(1.05);
}

/* ── Body (title + excerpt + meta column) ───────────────────────────────── */
.igit-rpwt__body {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.igit-rpwt--grid .igit-rpwt__body {
	padding: 0.6rem 0.75rem 0.75rem;
	flex: 1;
}

.igit-rpwt--list .igit-rpwt__body {
	flex: 1;
	min-width: 0;
}

/* ── Excerpt ─────────────────────────────────────────────────────────────── */
.igit-rpwt__excerpt {
	display: block;
	font-size: 0.8rem;
	line-height: 1.5;
	color: inherit;
	opacity: 0.75;
}

/* ── Meta badges row ─────────────────────────────────────────────────────── */
.igit-rpwt__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem 0.5rem;
	margin-top: 0.15rem;
}

.igit-rpwt__badge {
	display: inline-flex;
	align-items: center;
	font-size: 0.72rem;
	color: inherit;
	opacity: 0.6;
	white-space: nowrap;
}

.igit-rpwt__badge + .igit-rpwt__badge::before {
	content: '·';
	margin-right: 0.5rem;
	opacity: 0.5;
}

/* ── Title ───────────────────────────────────────────────────────────────── */
.igit-rpwt__title {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
}

.igit-rpwt--list .igit-rpwt__title {
	min-width: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.igit-rpwt--grid .igit-rpwt__item {
		flex: 1 1 140px;
	}
}

@media (max-width: 380px) {
	.igit-rpwt--grid .igit-rpwt__items {
		flex-direction: column;
	}
}

/* ── Masonry layout ──────────────────────────────────────────────────────── */
.igit-rpwt--masonry .igit-rpwt__items {
	columns: 3;
	column-gap: 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.igit-rpwt--masonry .igit-rpwt__item {
	break-inside: avoid;
	margin-bottom: 1rem;
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	overflow: hidden;
}

.igit-rpwt--masonry .igit-rpwt__link {
	flex-direction: column;
}

@media (max-width: 768px) {
	.igit-rpwt--masonry .igit-rpwt__items { columns: 2; }
}

@media (max-width: 480px) {
	.igit-rpwt--masonry .igit-rpwt__items { columns: 1; }
}

/* ── Carousel layout ─────────────────────────────────────────────────────── */
.igit-rpwt__carousel-wrap {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
}

.igit-rpwt--carousel .igit-rpwt__items {
	display: flex;
	flex: 1;
	min-width: 0;
	overflow-x: auto;
	scroll-behavior: smooth;
	gap: 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.igit-rpwt--carousel .igit-rpwt__items::-webkit-scrollbar {
	display: none;
}

.igit-rpwt--carousel .igit-rpwt__item {
	flex: 0 0 calc(33.333% - 0.67rem);
	min-width: 180px;
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	overflow: hidden;
}

.igit-rpwt--carousel .igit-rpwt__link {
	height: 100%;
	flex-direction: column;
}

.igit-rpwt--carousel .igit-rpwt__thumb-wrap {
	width: 100%;
	aspect-ratio: 16 / 9;
	flex-shrink: 0;
}

.igit-rpwt--carousel .igit-rpwt__body {
	padding: 0.6rem 0.75rem 0.75rem;
	flex: 1;
}

.igit-rpwt__carousel-btn {
	flex-shrink: 0;
	background: none;
	border: 1px solid #ddd;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	padding: 0;
	font-size: 1.4rem;
	line-height: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	transition: background 0.2s, border-color 0.2s;
}

.igit-rpwt__carousel-btn:hover {
	background: #f0f0f0;
	border-color: #bbb;
}

.igit-rpwt__carousel-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

@media (max-width: 600px) {
	.igit-rpwt--carousel .igit-rpwt__item {
		flex: 0 0 80%;
	}
}

/* ── Chip / Pill layout ──────────────────────────────────────────────────── */
.igit-rpwt--chip .igit-rpwt__items {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.igit-rpwt__chip {
	display: inline-flex;
}

.igit-rpwt__chip a {
	display: inline-flex;
	align-items: center;
	border-radius: 9999px;
	padding: 0.3rem 0.9rem;
	border: 1px solid currentColor;
	font-size: 0.8rem;
	text-decoration: none;
	color: inherit;
	opacity: 0.8;
	transition: opacity 0.2s, background 0.2s;
	white-space: nowrap;
}

.igit-rpwt__chip a:hover {
	opacity: 1;
	background: rgba(0, 0, 0, 0.05);
	text-decoration: none;
}

/* ── Async loading placeholder ───────────────────────────────────────────── */
.igit-rpwt-placeholder {
	margin: 2rem 0;
	clear: both;
	min-height: 60px;
	display: flex;
	align-items: center;
}

.igit-rpwt-loading {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: #888;
	font-size: 0.875rem;
	font-style: italic;
}

.igit-rpwt-loading::before {
	content: '';
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #e0e0e0;
	border-top-color: #999;
	border-radius: 50%;
	animation: igit-rpwt-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@keyframes igit-rpwt-spin {
	to { transform: rotate( 360deg ); }
}
