/* WP-GALLERY frontend */

.wp-gallery {
	--wp-gallery-bg: #f6f4f0;
	--wp-gallery-surface: #ffffff;
	--wp-gallery-text: #1c1917;
	--wp-gallery-muted: #78716c;
	--wp-gallery-accent: #8b4513;
	--wp-gallery-accent-soft: #e8ddd4;
	--wp-gallery-border: #e7e5e4;
	--wp-gallery-shadow: 0 4px 24px rgba(28, 25, 23, 0.06);
	--wp-gallery-radius: 12px;
	--wp-gallery-columns: 3;
	--wp-gallery-gap: 20px;
	--wp-gallery-aspect: 4/3;
	--wp-gallery-overlay-bg: rgba(28, 25, 23, 0.88);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--wp-gallery-text);
	max-width: 1200px;
	margin: 0 auto 2rem;
	padding: 1rem 0;
}

.wp-gallery--dark {
	--wp-gallery-bg: #1c1917;
	--wp-gallery-surface: #292524;
	--wp-gallery-text: #fafaf9;
	--wp-gallery-muted: #a8a29e;
	--wp-gallery-border: #44403c;
	--wp-gallery-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
	--wp-gallery-overlay-bg: rgba(0, 0, 0, 0.9);
}

.wp-gallery-notice {
	padding: 12px 20px;
	margin: 1rem 0;
	border-left: 4px solid #b91c1c;
	background: #fef2f2;
	border-radius: 4px;
}

.wp-gallery-notice h4 {
	margin: 0 0 6px;
	color: #b91c1c;
}

.wp-gallery-notice p {
	margin: 0;
}

.wp-gallery__header {
	margin-bottom: 1.25rem;
}

.wp-gallery__eyebrow {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp-gallery-accent);
	margin-bottom: 4px;
}

.wp-gallery__title {
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 700;
	margin: 0 0 0.75rem;
	line-height: 1.2;
}

/* Nav: breadcrumb */

.wp-gallery__nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	margin-bottom: 1.25rem;
}

.wp-gallery__breadcrumb {
	flex: 1;
	min-width: 0;
}

.wp-gallery__breadcrumb-list {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0;
	list-style: none;
	margin: 0;
	padding: 8px 14px;
	font-size: 0.875rem;
	background: var(--wp-gallery-surface);
	border: 1px solid var(--wp-gallery-border);
	border-radius: 10px;
	box-shadow: var(--wp-gallery-shadow);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.wp-gallery__breadcrumb-list::-webkit-scrollbar {
	display: none;
}

.wp-gallery__breadcrumb-item {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.wp-gallery__breadcrumb-item:not(.is-current):not(:last-child)::after {
	content: "/";
	margin: 0 6px;
	color: var(--wp-gallery-muted);
	font-weight: 400;
	opacity: 0.7;
}

.wp-gallery__breadcrumb-item button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	padding: 2px 4px;
	margin: 0;
	font: inherit;
	font-weight: 500;
	color: var(--wp-gallery-accent);
	cursor: pointer;
	border-radius: 6px;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
	white-space: nowrap;
}

.wp-gallery__breadcrumb-item button:hover {
	background: var(--wp-gallery-accent-soft);
	color: var(--wp-gallery-text);
}

.wp-gallery__breadcrumb-item.is-current span {
	display: inline-block;
	padding: 2px 4px;
	font-weight: 600;
	color: var(--wp-gallery-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 14rem;
}

.wp-gallery__breadcrumb-back {
	font-weight: 600 !important;
}

.wp-gallery__breadcrumb-back-icon {
	font-size: 1em;
	line-height: 1;
}

.wp-gallery__breadcrumb-home {
	flex-shrink: 0;
}

@media (max-width: 520px) {
	.wp-gallery__nav {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
		margin-bottom: 1rem;
	}

	.wp-gallery__breadcrumb-list {
		padding: 6px 10px;
		font-size: 0.8125rem;
		border-radius: 8px;
	}

	.wp-gallery__breadcrumb-item.is-current span {
		max-width: none;
		flex: 1;
		min-width: 0;
	}

	.wp-gallery__breadcrumb-item:not(.is-current):not(:last-child)::after {
		content: none;
	}

	.wp-gallery__breadcrumb-list:has(.wp-gallery__breadcrumb-back) {
		justify-content: space-between;
		gap: 8px;
	}

	.wp-gallery__breadcrumb-list:has(.wp-gallery__breadcrumb-back) .wp-gallery__breadcrumb-item.is-current {
		flex: 1;
		min-width: 0;
		justify-content: flex-end;
	}
}

.wp-gallery__status {
	font-size: 0.875rem;
	color: var(--wp-gallery-muted);
	min-height: 1.25rem;
	margin-bottom: 0.5rem;
}

.wp-gallery__status.is-error {
	color: #b91c1c;
}

.wp-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--wp-gallery-columns), 1fr);
	gap: var(--wp-gallery-gap);
}

@media (max-width: 900px) {
	.wp-gallery__grid {
		grid-template-columns: repeat(min(2, var(--wp-gallery-columns)), 1fr);
	}
}

@media (max-width: 520px) {
	.wp-gallery__grid {
		grid-template-columns: 1fr;
	}
}

.wp-gallery__card {
	margin: 0;
	border-radius: var(--wp-gallery-radius);
	overflow: hidden;
	background: var(--wp-gallery-surface);
	box-shadow: var(--wp-gallery-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wp-gallery__card:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(28, 25, 23, 0.12);
}

.wp-gallery__card button,
.wp-gallery__card a.wp-gallery__open {
	display: block;
	width: 100%;
	padding: 0;
	border: none;
	background: none;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: inherit;
	text-decoration: none;
}

.wp-gallery__card a.wp-gallery__open:focus-visible {
	outline: 2px solid var(--wp-gallery-accent);
	outline-offset: 2px;
}

.wp-gallery__thumb {
	position: relative;
	aspect-ratio: var(--wp-gallery-aspect);
	overflow: hidden;
	background: var(--wp-gallery-accent-soft);
}

.wp-gallery__thumb img {
	width: 100%;
	height: 100%;
	display: block;
}

/* Album covers: fill the frame */
.wp-gallery__card--album .wp-gallery__thumb img {
	object-fit: cover;
	object-position: center;
}

/* Photos: show entire image inside the frame */
.wp-gallery__card--image .wp-gallery__thumb img {
	object-fit: contain;
	object-position: center;
	background: #2a2622;
}

/* Video cards */
.wp-gallery__card--video .wp-gallery__thumb img,
.wp-gallery__card--video .wp-gallery__thumb-video {
	object-fit: cover;
	object-position: center;
}

.wp-gallery__thumb--video-auto {
	background: linear-gradient(145deg, #3d3834 0%, #2a2622 100%);
}

.wp-gallery__thumb-video {
	width: 100%;
	height: 100%;
	display: block;
	background: #2a2622;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.wp-gallery__thumb-video.is-ready {
	opacity: 1;
}

.wp-gallery__thumb--video-placeholder {
	background: linear-gradient(145deg, #3d3834 0%, #2a2622 100%);
}

.wp-gallery__video-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	transform: translate(-50%, -50%);
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 50%;
	color: var(--wp-gallery-accent);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	pointer-events: none;
}

.wp-gallery__card--video:hover .wp-gallery__video-icon {
	background: #fff;
	transform: translate(-50%, -50%) scale(1.05);
}

/* Text overlay on images and albums */

.wp-gallery__overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 12px 14px 14px;
	color: #fff;
	background: linear-gradient(
		180deg,
		transparent 0%,
		rgba(28, 25, 23, 0.65) 35%,
		var(--wp-gallery-overlay-bg) 100%
	);
	pointer-events: none;
}

.wp-gallery__overlay--album {
	padding-bottom: 16px;
}

.wp-gallery__card--album .wp-gallery__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(28, 25, 23, 0.35) 0%, transparent 45%);
	pointer-events: none;
	z-index: 1;
}

.wp-gallery__album-icon {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--wp-gallery-accent);
	pointer-events: none;
}

.wp-gallery__overlay .wp-gallery__name {
	font-weight: 600;
	font-size: 1rem;
	margin: 0 0 4px;
	line-height: 1.3;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.wp-gallery__overlay .wp-gallery__caption {
	font-size: 0.8125rem;
	margin: 0;
	color: rgba(255, 255, 255, 0.92);
	line-height: 1.45;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.wp-gallery__overlay .wp-gallery__caption {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-top: 4px;
}

.wp-gallery__empty {
	text-align: center;
	color: var(--wp-gallery-muted);
	padding: 2rem;
}

.wp-gallery.is-loading .wp-gallery__grid {
	opacity: 0.5;
	pointer-events: none;
}

/* Lightbox caption */

/* PhotoSwipe: fit whole image in viewport (override theme img rules) */
.pswp {
	--pswp-bg: rgba(0, 0, 0, 0.92);
}

.pswp__img {
	object-fit: contain !important;
	object-position: center !important;
}

.pswp__zoom-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Hide PhotoSwipe default title (filenames) — only our caption when config.txt has text */
.pswp__dynamic-caption {
	display: none !important;
}

.pswp__custom-caption {
	font-size: 0.9375rem;
	line-height: 1.5;
	max-width: 640px;
	margin: 0 auto;
	padding: 14px 20px 20px;
	text-align: center;
	color: #fff;
	background: rgba(28, 25, 23, 0.92);
	border-radius: 8px 8px 0 0;
}

.pswp__custom-caption:empty {
	display: none !important;
	padding: 0;
	background: transparent;
}

/* Video player in lightbox */
.pswp__video-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.pswp__video-wrap video {
	max-width: min(calc(100vw - 40px), 1920px);
	max-height: min(calc(100vh - 144px), 1080px);
	width: auto;
	height: auto;
	object-fit: contain;
	background: #000;
}

.pswp--has-video .pswp__button--zoom,
.pswp--has-video .pswp__button--arrow {
	opacity: 0.35;
	pointer-events: none;
}
