/* site-image-viewer.css — shared modal image viewer
   ------------------------------------------------
   Presentation for the <dialog> injected by js/site-image-viewer.js.
   The browser supplies the modal behaviour (focus trap, top layer,
   Escape); this sheet only paints the darkened full-viewport surface,
   the contained image, its caption and the close control.

   Consumed directly via <link> on article and project pages — the
   typography import keeps its token references valid even when this is
   the first shared sheet in the cascade. */
@import "site-typography.css";

/* The dialog IS the fullscreen surface: pinned to every edge so its
   own padding acts as the safe-area-aware gutter, and clicks on that
   padding reach it as the backdrop target. */
.site-image-viewer {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	border: 0;
	padding: calc(1rem + env(safe-area-inset-top))
		calc(1rem + env(safe-area-inset-right))
		calc(1rem + env(safe-area-inset-bottom))
		calc(1rem + env(safe-area-inset-left));
	background: rgba(0, 0, 0, 0.9);
}

.site-image-viewer-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
}

/* the image always fits — never crops, never overflows */
.site-image-viewer-image {
	max-width: 100%;
	max-height: 70dvh;
	object-fit: contain;
}

@media (min-width: 48rem) {
	.site-image-viewer-image {
		max-height: 80dvh;
	}
}

/* captions share the site's label face; long figcaptions scroll
   instead of squeezing the image */
.site-image-viewer-caption {
	max-width: 70vw;
	max-height: 15dvh;
	margin: 0.5rem 0 0;
	padding: 0 1rem;
	overflow-y: auto;
	font-family: var(--site-font-nav);
	font-weight: 300;
	font-size: var(--site-text-summary);
	line-height: 1.4;
	color: #fff;
	text-align: center;
}

/* load-failure notice — the `hidden` attribute does the showing and
   hiding, so this rule deliberately declares no display */
.site-image-viewer-status {
	margin: 0.5rem 0 0;
	font-family: var(--site-font-nav);
	font-weight: 400;
	font-size: var(--site-text-summary);
	color: #fca5a5;
	text-align: center;
}

/* a real 44px close target with a visible focus ring */
.site-image-viewer-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
}

.site-image-viewer-close:hover {
	background: rgba(255, 255, 255, 0.24);
}

.site-image-viewer-close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.site-image-viewer-close svg {
	display: block;
}
