/* Krushiahbivruddi Gallery — frontend styles
   Kept intentionally minimal/neutral so it inherits the host theme's
   typography and colors rather than imposing a competing design.
   All selectors are plugin-scoped (kbg-*) to avoid clashing with the
   existing theme's own .gallery/.card/.container/etc. classes. */

.kbg-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px 16px 40px;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
}

/* Archive listing: height follows content — no forced extra space above footer */
.kbg-archive-main {
	min-height: 0;
	height: auto;
	flex: 0 0 auto;
}

.kbg-archive-main .kbg-container {
	padding-bottom: 24px;
}

.kbg-archive-title,
.kbg-single-title {
	margin: 0 0 16px;
	font-weight: 700;
	font-family: inherit;
	color: inherit;
}

/* ---------- Galleries grid (archive / shortcode) ---------- */

.kbg-galleries-grid {
	display: grid;
	grid-template-columns: repeat(var(--kbg-cols-mobile, 1), minmax(0, 1fr));
	gap: 16px;
}

@media (min-width: 600px) {
	.kbg-galleries-grid {
		grid-template-columns: repeat(var(--kbg-cols-tablet, 2), minmax(0, 1fr));
		gap: 20px;
	}
}

@media (min-width: 1024px) {
	.kbg-galleries-grid {
		grid-template-columns: repeat(var(--kbg-cols-desktop, 3), minmax(0, 1fr));
		gap: 24px;
	}
}

.kbg-gallery-card {
	display: block;
	text-decoration: none;
	color: inherit;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.kbg-gallery-card:hover,
.kbg-gallery-card:focus-visible {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
	border-color: rgba(46, 125, 50, 0.25);
}

.kbg-gallery-card-thumb {
	aspect-ratio: 4 / 3;
	width: 100%;
	overflow: hidden;
	background: #f0f0f1;
}

.kbg-gallery-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.25s ease;
}

.kbg-gallery-card:hover .kbg-gallery-card-thumb img,
.kbg-gallery-card:focus-visible .kbg-gallery-card-thumb img {
	transform: scale(1.03);
}

.kbg-gallery-card-thumb-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #eaeaea, #f5f5f5);
}

.kbg-gallery-card-body {
	padding: 14px 16px 16px;
}

.kbg-gallery-card-title {
	margin: 0 0 4px;
	font-size: 16px;
	line-height: 1.35;
	font-weight: 600;
	overflow-wrap: break-word;
}

@media (min-width: 1024px) {
	.kbg-gallery-card-title {
		font-size: 18px;
	}
}

.kbg-gallery-card-count {
	display: block;
	font-size: 13px;
	color: #6b7280;
}

.kbg-gallery-card-cta {
	display: block;
	margin-top: 10px;
	font-size: 13px;
	font-weight: 600;
	color: var(--kbg-accent-color, #2e7d32);
}

.kbg-gallery-card-categories {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 8px;
}

.kbg-gallery-card-category {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--kbg-accent-color, #2e7d32);
	background: rgba(46, 125, 50, 0.08);
	border-radius: 4px;
	padding: 3px 8px;
}

/* ---------- Category filters + Load More (archive) ---------- */

.kbg-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 20px;
}

.kbg-gallery-filter {
	appearance: none;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: #fff;
	color: #333;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	padding: 8px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.kbg-gallery-filter:hover,
.kbg-gallery-filter:focus-visible {
	border-color: var(--kbg-accent-color, #2e7d32);
	color: var(--kbg-accent-color, #2e7d32);
	outline: none;
}

.kbg-gallery-filter.is-active {
	background: var(--kbg-accent-color, #2e7d32);
	border-color: var(--kbg-accent-color, #2e7d32);
	color: #fff;
}

.kbg-galleries-grid.is-loading {
	opacity: 0.55;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.kbg-load-more-wrap {
	display: flex;
	justify-content: center;
	margin: 28px 0 8px;
}

.kbg-load-more-wrap[hidden] {
	display: none;
}

.kbg-load-more {
	appearance: none;
	border: 1px solid var(--kbg-accent-color, #2e7d32);
	background: #fff;
	color: var(--kbg-accent-color, #2e7d32);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 28px;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.kbg-load-more:hover,
.kbg-load-more:focus-visible {
	background: var(--kbg-accent-color, #2e7d32);
	color: #fff;
	outline: none;
}

.kbg-load-more:disabled {
	opacity: 0.65;
	cursor: wait;
}

@media (max-width: 600px) {
	.kbg-gallery-filters {
		gap: 6px;
	}

	.kbg-gallery-filter {
		font-size: 12px;
		padding: 7px 12px;
	}
}

.kbg-breadcrumb {
	/* Typography aligned with theme .newsmatic-breadcrumb-wrap (About Us) */
	font-family: inherit;
	font-size: inherit;
	font-weight: 400;
	line-height: inherit;
	letter-spacing: normal;
	color: var(--breadcrumb-text-color, #000000);
	margin: 0 0 16px;
	padding: 12px 16px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	box-sizing: border-box;
	width: 100%;
}

.kbg-breadcrumb a {
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	color: var(--breadcrumb-link-color, #000000);
	text-decoration: none;
}

.kbg-breadcrumb a:hover,
.kbg-breadcrumb a:focus {
	color: var(--breadcrumb-link-color-hover, #000000);
	text-decoration: none;
}

.kbg-breadcrumb-sep {
	margin: 0 5px;
	color: var(--breadcrumb-link-color, #000000);
	font-weight: inherit;
}

.kbg-breadcrumb-current {
	color: var(--breadcrumb-text-color, #000000);
	font-weight: inherit;
}

.kbg-foogallery-embed {
	margin: 0 0 24px;
	width: 100%;
	max-width: 100%;
}

/* Keep FooGallery grid flush with the content container */
.kbg-foogallery-embed .foogallery,
.kbg-foogallery-embed .fg-gallery,
.kbg-foogallery-embed .foogallery-container {
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

.kbg-foogallery-embed img {
	max-width: 100%;
	height: auto;
}

/* Style FooGallery's OWN caption/description markup (when the admin
   enables "Captions" on a gallery in FooGallery FREE) so Title/Short
   Description shown under each image match the site's look. Scoped
   under .kbg-foogallery-embed so this never leaks into other FooGallery
   instances elsewhere on the site, and never touches FooGallery's own
   files/CSS. */
.kbg-foogallery-embed .fg-caption-title,
.kbg-foogallery-embed .fg-caption-desc {
	font-family: inherit;
}

.kbg-foogallery-embed .fg-caption-title {
	font-weight: 600;
	color: #111827;
}

.kbg-foogallery-embed .fg-caption-desc {
	color: #6b7280;
	font-size: 13px;
}

.kbg-single-description {
	margin: 0;
	padding: 0;
	color: #333;
	line-height: 1.7;
	max-width: 100%;
	width: 100%;
	font-family: inherit;
	box-sizing: border-box;
}

.kbg-single-description > *:first-child {
	margin-top: 0;
}

.kbg-single-description > *:last-child {
	margin-bottom: 0;
}

.kbg-single-description p,
.kbg-single-description ul,
.kbg-single-description ol {
	margin: 0 0 1em;
}

.kbg-single-description h2,
.kbg-single-description h3,
.kbg-single-description h4 {
	margin: 1.25em 0 0.5em;
	color: inherit;
	font-family: inherit;
}

/* Single page main: avoid theme sidebar-related squeeze */
.kbg-single-main {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.kbg-no-galleries,
.kbg-no-images {
	color: #6b7280;
	font-style: italic;
}

/* ---------- Single gallery image grid ---------- */

.kbg-single-gallery-grid {
	display: grid;
	grid-template-columns: repeat(var(--kbg-cols-mobile, 1), minmax(0, 1fr));
	gap: 14px;
}

@media (min-width: 600px) {
	.kbg-single-gallery-grid {
		grid-template-columns: repeat(var(--kbg-cols-tablet, 2), minmax(0, 1fr));
		gap: 18px;
	}
}

@media (min-width: 1024px) {
	.kbg-single-gallery-grid {
		grid-template-columns: repeat(var(--kbg-cols-desktop, 3), minmax(0, 1fr));
		gap: 24px;
	}
}

.kbg-single-gallery-item {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	border-radius: 6px;
	overflow: hidden;
	aspect-ratio: 4 / 3;
}

.kbg-single-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.2s ease;
}

.kbg-single-gallery-item:hover img,
.kbg-single-gallery-item:focus-visible img {
	transform: scale(1.03);
}

/* ---------- Lightbox ---------- */

.kbg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
}

.kbg-lightbox[hidden] {
	display: none;
}

.kbg-lightbox-content {
	max-width: 92vw;
	max-height: 86vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.kbg-lightbox-image {
	max-width: 92vw;
	max-height: 80vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
}

.kbg-lightbox-counter {
	color: #f0f0f1;
	margin-top: 12px;
	font-size: 14px;
	letter-spacing: 0.02em;
}

.kbg-lightbox-close,
.kbg-lightbox-prev,
.kbg-lightbox-next {
	position: absolute;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 20px;
	line-height: 44px;
	text-align: center;
	transition: background 0.15s ease;
}

.kbg-lightbox-close:hover,
.kbg-lightbox-prev:hover,
.kbg-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.2);
}

.kbg-lightbox-close {
	top: 16px;
	right: 16px;
}

.kbg-lightbox-prev {
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
}

.kbg-lightbox-next {
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.kbg-lightbox-prev,
	.kbg-lightbox-next {
		width: 38px;
		height: 38px;
		line-height: 38px;
		font-size: 16px;
	}

	.kbg-lightbox-close {
		width: 38px;
		height: 38px;
		line-height: 38px;
	}
}

body.kbg-lightbox-open {
	overflow: hidden;
}
