/**
 * Photos plugin front-end styles (album single, album archive, shared chrome).
 */

body.nm-photos-page {
	--nm-photos-bg: var(--ast-global-color-5, #ffffff);
	--nm-photos-text: var(--ast-global-color-2, #1a1a1a);
	--nm-photos-muted: var(--ast-global-color-3, #5a5a5a);
	--nm-photos-accent: var(--ast-global-color-2, #1a1a1a);
	--nm-photos-hover: var(--ast-global-color-4, #f5f5f5);
	--nm-photos-gap: 4px;
	--nm-photos-max-width: 1400px;
}

/* Light header chrome on photos routes — Astra defaults to dark nav bar + white text. */
body.nm-photos-page #masthead,
body.nm-photos-page .site-header,
body.nm-photos-page .ast-primary-header-bar,
body.nm-photos-page .ast-builder-menu-1 .main-header-menu,
body.nm-photos-page .ast-builder-menu-1 .main-header-menu .sub-menu,
body.nm-photos-page .ast-mobile-header-wrap .ast-primary-header-bar,
body.nm-photos-page .ast-builder-menu-mobile .main-header-menu {
	background-color: var(--nm-photos-bg) !important;
	background-image: none !important;
}

body.nm-photos-page .ast-builder-menu-1 .menu-item > .menu-link,
body.nm-photos-page .ast-builder-menu-1 .menu-item > .ast-menu-toggle,
body.nm-photos-page .ast-builder-menu-mobile .menu-item > .menu-link,
body.nm-photos-page .ast-builder-menu-mobile .menu-item > .ast-menu-toggle,
body.nm-photos-page #masthead a,
body.nm-photos-page .site-header a,
body.nm-photos-page .site-title a,
body.nm-photos-page .site-branding a,
body.nm-photos-page .wp-block-site-title a,
body.nm-photos-page .wp-block-navigation a {
	color: var(--nm-photos-text) !important;
	text-decoration-color: currentColor;
}

body.nm-photos-page .ast-builder-menu-1 .menu-item:hover > .menu-link,
body.nm-photos-page .ast-builder-menu-1 .menu-item:hover > .ast-menu-toggle,
body.nm-photos-page .ast-builder-menu-1 .menu-item.current-menu-item > .menu-link,
body.nm-photos-page .ast-builder-menu-1 .menu-item.current-menu-ancestor > .menu-link,
body.nm-photos-page .ast-builder-menu-mobile .menu-item:hover > .menu-link,
body.nm-photos-page .ast-builder-menu-mobile .menu-item.current-menu-item > .menu-link {
	color: var(--nm-photos-text) !important;
	background-color: var(--nm-photos-hover) !important;
}

body.nm-photos-page [data-section="section-header-mobile-trigger"] .ast-mobile-menu-trigger-fill {
	color: var(--nm-photos-text) !important;
	background: transparent !important;
	border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

body.nm-photos-page .site-content {
	background: var(--nm-photos-bg);
	color: var(--nm-photos-text);
}

/* Album single */
.nm-photos-album {
	max-width: var(--nm-photos-max-width);
	margin: 0 auto;
	padding: 2rem 1rem 4rem;
	background: var(--nm-photos-bg);
	color: var(--nm-photos-text);
}

.nm-photos-album__back {
	margin-bottom: 1rem;
}

.nm-photos-album__back-link {
	display: inline-flex;
	align-items: center;
	color: var(--nm-photos-muted);
	font-size: 0.9375rem;
	text-decoration: none;
	transition: color 0.15s ease;
}

.nm-photos-album__back-link:hover,
.nm-photos-album__back-link:focus-visible {
	color: var(--nm-photos-text);
	text-decoration: underline;
}

.nm-photos-album__header {
	display: grid;
	gap: 1.5rem;
	margin-bottom: 2rem;
}

@media (min-width: 768px) {
	.nm-photos-album__header {
		grid-template-columns: 220px 1fr;
		align-items: start;
	}
}

.nm-photos-album__cover-image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.nm-photos-album__title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	line-height: 1.2;
	color: var(--nm-photos-text);
}

.nm-photos-album__facts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin: 0 0 0.5rem;
}

.nm-photos-album__date,
.nm-photos-album__count {
	margin: 0;
	color: var(--nm-photos-muted);
}

.nm-photos-album__download-all {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2rem;
	padding: 0.375rem 0.75rem;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 6px;
	background: var(--nm-photos-bg);
	color: var(--nm-photos-text);
	font-size: 0.875rem;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.nm-photos-album__download-all:hover:not(.is-busy),
.nm-photos-album__download-all:focus-visible:not(.is-busy) {
	background: var(--nm-photos-hover);
	border-color: rgba(0, 0, 0, 0.28);
	color: var(--nm-photos-text);
}

.nm-photos-album__download-all:focus-visible {
	outline: 2px solid var(--nm-photos-accent);
	outline-offset: 2px;
}

.nm-photos-album__download-all.is-busy {
	opacity: 0.55;
	cursor: wait;
	pointer-events: none;
}

.nm-photos-album__description {
	margin-top: 1rem;
	line-height: 1.6;
	color: var(--nm-photos-text);
}

.nm-photos-album__description a {
	color: var(--nm-photos-text);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.nm-photos-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: var(--nm-photos-gap);
}

@media (min-width: 768px) {
	.nm-photos-grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	}
}

.nm-photos-grid__item {
	display: block;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	overflow: hidden;
	aspect-ratio: 1;
}

.nm-photos-grid__item:focus-visible {
	outline: 2px solid var(--nm-photos-accent);
	outline-offset: 2px;
}

.nm-photos-grid__image,
.nm-photos-grid__item picture,
.nm-photos-grid__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nm-photos-grid__placeholder {
	background: rgba(127, 127, 127, 0.08);
}

.nm-photos-grid__loader {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 1.5rem;
	padding: 0.5rem 0 1rem;
}

.nm-photos-grid__loader[hidden] {
	display: none !important;
}

.nm-photos-grid__spinner {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
	border: 2px solid rgba(127, 127, 127, 0.2);
	border-top-color: var(--nm-photos-text);
	border-radius: 50%;
	animation: nm-photos-spin 0.75s linear infinite;
}

@keyframes nm-photos-spin {
	to {
		transform: rotate(360deg);
	}
}

.nm-photos-grid__status {
	margin-top: 1rem;
	color: var(--nm-photos-muted);
	min-height: 1.5rem;
}

.nm-photos-grid__item--video {
	position: relative;
}

.nm-photos-grid__play-badge {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1;
	width: 2.75rem;
	height: 2.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 0.875rem;
	line-height: 1;
	pointer-events: none;
}

.nm-photos-grid__picture {
	display: block;
	width: 100%;
	height: 100%;
}

/* Album archive index */
.nm-photos-archive {
	max-width: var(--nm-photos-max-width);
	margin: 0 auto;
	padding: 2rem 1rem 4rem;
}

.nm-photos-archive__title {
	margin: 0 0 0.5rem;
	font-size: clamp(2rem, 4vw, 3rem);
	line-height: 1.15;
	color: var(--nm-photos-text);
}

.nm-photos-archive__intro {
	margin: 0 0 2rem;
	color: var(--nm-photos-muted);
	line-height: 1.6;
	max-width: 42rem;
}

.nm-photos-archive__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.5rem;
}

.nm-photos-archive__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 6px;
	overflow: hidden;
	background: var(--nm-photos-bg);
	color: inherit;
	text-decoration: none;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.nm-photos-archive__card:hover,
.nm-photos-archive__card:focus-visible {
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
	color: inherit;
}

.nm-photos-archive__card:focus-visible {
	outline: 2px solid var(--nm-photos-accent);
	outline-offset: 2px;
}

.nm-photos-archive__cover {
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.04);
	position: relative;
}

.nm-photos-archive__badge {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	padding: 0.25rem 0.55rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.72);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.nm-photos-collection__label {
	margin: 0 0 0.35rem;
	font-size: 0.875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--nm-photos-muted);
}

.nm-photos-collection__facts {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.5rem 1rem;
	margin: 0 0 1rem;
}

.nm-photos-collection__date,
.nm-photos-collection__count {
	margin: 0;
	color: var(--nm-photos-muted);
}

.nm-photos-archive__cover img,
.nm-photos-archive__cover picture {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nm-photos-archive__body {
	padding: 1rem 1rem 1.25rem;
}

.nm-photos-archive__card-title {
	margin: 0 0 0.35rem;
	font-size: 1.125rem;
	line-height: 1.3;
	color: var(--nm-photos-text);
}

.nm-photos-archive__meta {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0 0 0.75rem;
	font-size: 0.875rem;
	color: var(--nm-photos-muted);
}

.nm-photos-archive__desc {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--nm-photos-muted);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.nm-photos-archive__empty {
	color: var(--nm-photos-muted);
}

.nm-photos-archive__pagination {
	margin-top: 2rem;
}

.nm-photos-archive__pagination .nav-links {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
}

.nm-photos-archive__pagination a,
.nm-photos-archive__pagination span {
	color: var(--nm-photos-text);
}

/* Lightbox */
.nm-photos-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	height: 100%;
	height: 100dvh;
}

.nm-photos-lightbox[hidden] {
	display: none !important;
}

.nm-photos-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
}

.nm-photos-lightbox__dialog {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3rem 3.5rem 1rem;
	box-sizing: border-box;
}

.nm-photos-lightbox__figure {
	position: relative;
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nm-photos-lightbox__picture,
.nm-photos-lightbox__picture img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.nm-photos-lightbox__picture[hidden] {
	display: none !important;
}

.nm-photos-lightbox__video {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 8rem);
	width: auto;
	height: auto;
	background: #000;
}

.nm-photos-lightbox__video[hidden] {
	display: none !important;
}

.nm-photos-lightbox__video-message {
	position: absolute;
	bottom: 1rem;
	left: 50%;
	transform: translateX(-50%);
	margin: 0;
	padding: 0.5rem 0.75rem;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.72);
	color: #fff;
	font-size: 0.875rem;
	line-height: 1.4;
	text-align: center;
	max-width: min(90vw, 24rem);
}

.nm-photos-lightbox__video-message[hidden] {
	display: none !important;
}

.nm-photos-lightbox--video .nm-photos-lightbox__figure {
	position: relative;
}

.nm-photos-lightbox__close,
.nm-photos-lightbox__nav {
	position: absolute;
	z-index: 2;
	border: 0;
	background: transparent;
	color: #ffffff;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
	padding: 0.5rem;
}

.nm-photos-lightbox__close {
	top: 0.75rem;
	right: 0.75rem;
}

.nm-photos-lightbox__nav--prev {
	left: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
}

.nm-photos-lightbox__nav--next {
	right: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
}

.nm-photos-lightbox__actions {
	position: relative;
	z-index: 2;
	flex: 0 0 auto;
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0 1rem 1rem;
}

.nm-photos-lightbox__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	color: #ffffff;
	text-decoration: none;
	padding: 0.625rem 1rem;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.08);
	font-size: 0.9375rem;
	line-height: 1.2;
	white-space: nowrap;
}

.nm-photos-lightbox__action--primary {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.5);
}

.nm-photos-lightbox__action:hover,
.nm-photos-lightbox__action:focus-visible {
	color: #ffffff;
	border-color: #ffffff;
	background: rgba(255, 255, 255, 0.2);
}

.nm-photos-lightbox__action-text--short {
	display: none;
}

@media (max-width: 767px) {
	.nm-photos-lightbox__dialog {
		padding: 2.75rem 0.25rem 0.25rem;
	}

	.nm-photos-lightbox__close {
		top: max(0.5rem, env(safe-area-inset-top));
		right: max(0.5rem, env(safe-area-inset-right));
		width: 2.75rem;
		height: 2.75rem;
		border-radius: 999px;
		background: rgba(0, 0, 0, 0.45);
	}

	.nm-photos-lightbox__nav {
		width: 2.5rem;
		height: 2.5rem;
		border-radius: 999px;
		background: rgba(0, 0, 0, 0.35);
		font-size: 1.75rem;
	}

	.nm-photos-lightbox__nav--prev {
		left: max(0.25rem, env(safe-area-inset-left));
	}

	.nm-photos-lightbox__nav--next {
		right: max(0.25rem, env(safe-area-inset-right));
	}

	.nm-photos-lightbox__actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 0.625rem;
		width: 100%;
		padding: 0.75rem 0.75rem max(0.75rem, env(safe-area-inset-bottom));
		box-sizing: border-box;
		background: linear-gradient(to top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.75));
		border-top: 1px solid rgba(255, 255, 255, 0.12);
		backdrop-filter: blur(12px);
		-webkit-backdrop-filter: blur(12px);
	}

	.nm-photos-lightbox__action {
		width: 100%;
		min-height: 3rem;
		padding: 0.75rem 0.5rem;
		font-size: 0.875rem;
		white-space: normal;
	}

	.nm-photos-lightbox__action-text--long {
		display: none;
	}

	.nm-photos-lightbox__action-text--short {
		display: inline;
	}
}

@media (min-width: 768px) {
	.nm-photos-lightbox {
		display: block;
		height: auto;
	}

	.nm-photos-lightbox__dialog {
		height: 100%;
		padding: 3rem 3.5rem;
	}

	.nm-photos-lightbox__figure {
		max-height: calc(100vh - 6rem);
	}

	.nm-photos-lightbox__picture,
	.nm-photos-lightbox__picture img {
		max-height: calc(100vh - 6rem);
	}

	.nm-photos-lightbox__actions {
		position: absolute;
		bottom: 1rem;
		left: 50%;
		transform: translateX(-50%);
		padding: 0;
		background: none;
		border: 0;
		backdrop-filter: none;
	}
}

body.nm-photos-lightbox-open {
	overflow: hidden;
}
