/* Enhancement controls do not participate in the native Image/card layout. */
.nh-home-activities .nh-activity-enlarge,
.nh-property-media .nh-activity-enlarge {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background: transparent;
	color: #fff;
	cursor: zoom-in;
}

/* Native captions remain text, outside image activation even if later added. */
.nh-home-activities figure:has(.nh-activity-enlarge) figcaption,
.nh-property-media figure:has(.nh-activity-enlarge) figcaption {
	position: relative;
	z-index: 1;
}

.nh-property-media .nh-media-photo:has(.nh-activity-enlarge) {
	position: relative;
}

.nh-dialog.nh-activity-lightbox {
	/* Intrinsic image sizing keeps the same padding for every aspect ratio. */
	width: max-content;
	max-width: calc(100vw - 24px);
	padding: 52px 20px 16px;
	border-radius: 24px;
	background: #163c3b;
	color: #fff;
}

.nh-activity-lightbox .nh-dialog-close {
	top: 2px;
	right: 4px;
	width: 44px;
	height: 44px;
	background: transparent;
	color: #fff;
	font-size: 0;
	cursor: pointer;
}

/* The existing close artwork, with a white 24px glyph and a 44px hit target. */
.nh-activity-lightbox .nh-motion-art-close {
	inset: 10px;
}

.nh-activity-lightbox .nh-motion-art-close .nh-motion-layer {
	background-image: none;
	background-color: currentcolor;
	mask: url('ui-states/close-hover.svg') center / contain no-repeat;
}

.nh-activity-lightbox .nh-dialog-scroll {
	min-height: 80px;
	text-align: center;
}

.nh-activity-lightbox img:not([hidden]) {
	display: block;
	width: auto;
	height: auto;
	max-width: min(920px, calc(100vw - 64px));
	max-height: min(640px, calc(var(--nh-dialog-viewport-height, 100dvh) - 108px));
	margin: auto;
	object-fit: contain;
}

.nh-home-activities .is-nh-dragging :is(img, .nh-activity-enlarge),
.nh-property-media .is-nh-dragging :is(img, .nh-activity-enlarge) {
	cursor: grabbing;
}

.nh-activity-lightbox .nh-dialog-close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 7px #163c3b;
}

.nh-home-activities .nh-activity-enlarge:focus-visible,
.nh-property-media .nh-activity-enlarge:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -5px;
	box-shadow: inset 0 0 0 8px #163c3b;
}

/* Match the viewport activation boundary even before its JS change event. */
@media (width <= 1000px) {
	.nh-home-activities .nh-activity-enlarge,
	.nh-property-media .nh-activity-enlarge {
		display: none;
	}
}

@media (forced-colors: active) {
	.nh-activity-lightbox .nh-motion-art-close .nh-motion-layer {
		background-color: ButtonText;
		forced-color-adjust: none;
	}
}

.nh-document-pages {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 12px;
}

.nh-document-pages[hidden] {
	display: none;
}

.nh-document-pages button {
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid currentcolor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 24px;
	cursor: pointer;
}

.nh-document-pages button:disabled {
	opacity: 0.4;
	cursor: default;
}

.nh-document-pages button:focus-visible {
	outline: 3px solid currentcolor;
	outline-offset: 3px;
}

.nh-document-multipage img:not([hidden]) {
	max-height: min(640px, calc(var(--nh-dialog-viewport-height, 100dvh) - 164px));
}

.nh-activity-lightbox > .nh-document-pages {
	flex: 0 0 auto;
}

/* Document controls use the existing palette/timing without shifting hit areas.
 * The scoped class is removed when the shared viewer closes or opens a photo. */
.nh-document-viewer :is(.nh-dialog-close, .nh-document-pages button) {
	border: 1px solid rgb(255 255 255 / 70%);
	border-radius: 50%;
	background: #163c3b;
	color: #fff;
	transition: background-color var(--nh-motion-state) var(--nh-motion-ease),
		border-color var(--nh-motion-state) var(--nh-motion-ease),
		box-shadow var(--nh-motion-state) var(--nh-motion-ease);
}

@media (hover: hover) {
	.nh-document-viewer :is(.nh-dialog-close, .nh-document-pages button):hover:not(:disabled) {
		border-color: var(--nh-mint);
		background: var(--nh-teal);
	}
}

.nh-document-viewer :is(.nh-dialog-close, .nh-document-pages button):active:not(:disabled) {
	border-color: var(--nh-mint-pressed);
	background: var(--nh-deep);
	transition-duration: var(--nh-motion-press);
}

.nh-document-viewer :is(.nh-dialog-close, .nh-document-pages button):focus-visible {
	outline: 2px solid #fff;
	outline-offset: -5px;
	box-shadow: inset 0 0 0 3px var(--nh-mint);
}

@media (prefers-reduced-motion: reduce) {
	.nh-document-viewer :is(.nh-dialog-close, .nh-document-pages button) {
		transition: none;
	}
}
