/* Exmotech Gallery — photo viewer (main photo + thumbnail strip) and album grid.
   Colours and sizes are CSS variables, so a theme can restyle them without editing this file. */

.exmo-viewer {
	--exmo-bg: #111;
	--exmo-fg: #fff;
	--exmo-accent: var(--wp--preset--color--orange, #ff8a00);
	--exmo-ratio: 3 / 2;
	--exmo-thumb: 76px;
	--exmo-thumb-radius: 6px;
	--exmo-fade: 0.5s;

	position: relative;
	box-sizing: border-box;
	background: var(--exmo-bg);
	color: var(--exmo-fg);
	padding: clamp(0.5rem, 2vw, 1.25rem);
	border-radius: 4px;
	outline: none;
	-webkit-user-select: none;
	user-select: none;
}
.exmo-viewer:focus-visible { box-shadow: 0 0 0 2px var(--exmo-accent); }

/* Light backgrounds: dark arrows/text in the thumbnail strip, softer frame */
.exmo-viewer--light { --exmo-fg: #111; }
.exmo-viewer--light .exmo-viewer__thumb { opacity: 0.7; }

/* Widths */
.exmo-viewer--content { max-width: var(--wp--style--global--content-size, 760px); margin-inline: auto; }

/* Full screen width: break out of the page column, edge to edge */
.exmo-breakout {
	box-sizing: border-box;
	width: calc(100vw - var(--exmo-sbw, 0px)) !important;
	max-width: none !important;
	margin-left: calc(50% - (100vw - var(--exmo-sbw, 0px)) / 2) !important;
	margin-right: 0 !important;
}
.exmo-viewer.exmo-breakout { border-radius: 0; padding-inline: clamp(0.5rem, 2vw, 1.5rem); }
.exmo-viewer.exmo-breakout .exmo-viewer__stage { max-height: 82vh; }

/* ---------- Main photo ---------- */
.exmo-viewer__stage {
	position: relative;
	aspect-ratio: var(--exmo-ratio);
	max-height: 78vh;
	width: 100%;
	overflow: hidden;
	touch-action: pan-y;
	cursor: zoom-in;
}
.exmo-viewer__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0;
	transition: opacity var(--exmo-fade) ease;
	pointer-events: none;
}
.exmo-viewer__img.is-visible { opacity: 1; }
.exmo-viewer__img:not([src]) { display: none; }

.exmo-viewer__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border: 3px solid rgba(127, 127, 127, 0.3);
	border-top-color: var(--exmo-fg);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s;
	animation: exmo-spin 0.8s linear infinite;
	pointer-events: none;
}
.exmo-viewer.is-loading .exmo-viewer__spinner { opacity: 1; transition-delay: 0.25s; }
@keyframes exmo-spin { to { transform: rotate(360deg); } }

/* Buttons on the photo */
.exmo-viewer button {
	font: inherit;
	color: #fff;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.exmo-viewer__nav,
.exmo-viewer__fs {
	position: absolute;
	z-index: 2;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.45);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.25s, background-color 0.2s;
}
.exmo-viewer__nav { top: 50%; width: 46px; height: 46px; margin-top: -23px; }
.exmo-viewer__nav--prev { left: 12px; }
.exmo-viewer__nav--next { right: 12px; }
.exmo-viewer__fs { top: 12px; right: 12px; width: 40px; height: 40px; }
.exmo-viewer svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.exmo-viewer__stage:hover .exmo-viewer__nav,
.exmo-viewer__stage:hover .exmo-viewer__fs,
.exmo-viewer:focus-within .exmo-viewer__nav,
.exmo-viewer:focus-within .exmo-viewer__fs { opacity: 1; }
.exmo-viewer__nav:hover,
.exmo-viewer__fs:hover { background: var(--exmo-accent); }
@media (hover: none) {
	.exmo-viewer__nav, .exmo-viewer__fs { opacity: 0.85; }
}

.exmo-viewer__count {
	color: #fff;
	position: absolute;
	z-index: 2;
	left: 12px;
	bottom: 10px;
	padding: 2px 10px;
	font-size: 0.8rem;
	letter-spacing: 0.05em;
	background: rgba(0, 0, 0, 0.45);
	border-radius: 999px;
	pointer-events: none;
}

/* ---------- Thumbnail strip ---------- */
.exmo-viewer__strip {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: clamp(0.5rem, 1.5vw, 0.9rem);
}
.exmo-viewer__thumbs {
	position: relative;
	flex: 1;
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 4px 2px;
	list-style: none;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}
.exmo-viewer__thumbs::-webkit-scrollbar { display: none; }
.exmo-viewer__thumbs li { flex: 0 0 auto; margin: 0; padding: 0; scroll-snap-align: start; }
.exmo-viewer__thumb {
	display: block;
	width: var(--exmo-thumb);
	height: var(--exmo-thumb);
	border-radius: var(--exmo-thumb-radius);
	overflow: hidden;
	opacity: 0.55;
	outline: 2px solid transparent;
	outline-offset: 1px;
	transition: opacity 0.2s, outline-color 0.2s;
}
.exmo-viewer__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	margin: 0;
}
.exmo-viewer__thumb:hover,
.exmo-viewer__thumb:focus-visible { opacity: 1; }
.exmo-viewer__thumb[aria-current="true"] { opacity: 1; outline-color: var(--exmo-accent); }

.exmo-viewer__page {
	flex: 0 0 auto;
	color: var(--exmo-fg) !important;
	display: grid;
	place-items: center;
	width: 32px;
	height: var(--exmo-thumb);
	padding: 0;
	border: 0;
	background: transparent;
	transition: opacity 0.2s;
}
.exmo-viewer__page:hover { color: var(--exmo-accent); }
.exmo-viewer__page[disabled] { opacity: 0.2; cursor: default; }
.exmo-viewer.no-paging .exmo-viewer__page { display: none; }

/* Without JavaScript the strip is simply a row of links to the full photos */
.exmo-viewer:not(.is-ready) .exmo-viewer__nav,
.exmo-viewer:not(.is-ready) .exmo-viewer__fs,
.exmo-viewer:not(.is-ready) .exmo-viewer__page { display: none; }

/* ---------- Full screen ---------- */
.exmo-viewer.is-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	border-radius: 0;
	padding: clamp(0.5rem, 2vw, 1.25rem);
	background: #000;
}
.exmo-viewer:fullscreen { background: #000; }
.exmo-viewer.is-fullscreen .exmo-viewer__stage {
	flex: 1;
	aspect-ratio: auto;
	max-height: none;
	cursor: default;
}
body.exmo-viewer-locked { overflow: hidden; }

@media (max-width: 600px) {
	.exmo-viewer { --exmo-thumb: 58px; padding: 6px; border-radius: 0; }
	.exmo-viewer__nav { width: 38px; height: 38px; margin-top: -19px; }
	.exmo-viewer__page { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.exmo-viewer { --exmo-fade: 0s; }
	.exmo-viewer__thumbs { scroll-behavior: auto; }
}

/* ================================================================
   Album grid: build covers with titles underneath
   ================================================================ */
.exmo-album {
	--exmo-cols: 3;
	--exmo-cover-ratio: 3 / 2;
	display: grid;
	grid-template-columns: repeat(var(--exmo-cols), minmax(0, 1fr));
	gap: clamp(1rem, 2.5vw, 1.75rem) clamp(0.75rem, 2vw, 1.25rem);
	margin: 0;
	padding: 0;
	list-style: none;
}
.exmo-album li { margin: 0; padding: 0; }
.exmo-album__link {
	display: block;
	color: inherit;
	text-decoration: none;
}
.exmo-album__cover {
	display: block;
	aspect-ratio: var(--exmo-cover-ratio);
	overflow: hidden;
	background: #eee;
	border-radius: 2px;
}
.exmo-album__cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease, filter 0.3s;
}
.exmo-album__link:hover .exmo-album__cover img,
.exmo-album__link:focus-visible .exmo-album__cover img { transform: scale(1.04); filter: brightness(1.05); }
.exmo-album__title {
	display: block;
	margin-top: 0.6em;
	font-size: 0.875rem;
	font-weight: 500;
	letter-spacing: 0.05em;
	text-align: center;
	text-transform: uppercase;
}
.exmo-album__link:hover .exmo-album__title { color: var(--exmo-accent, var(--wp--preset--color--orange, #ff8a00)); }
.exmo-album__count {
	display: block;
	font-size: 0.75rem;
	opacity: 0.6;
	text-align: center;
}
.exmo-album--full { padding-inline: var(--wp--style--root--padding-left, clamp(1rem, 4vw, 2.5rem)) !important; }
@media (max-width: 900px) { .exmo-album { --exmo-cols: 2 !important; } }
@media (max-width: 480px) { .exmo-album { --exmo-cols: 1 !important; } }

/* ================================================================
   Build page: back link, title, description, previous/next
   ================================================================ */
.exmo-build__head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.9rem;
	margin-bottom: 1.25rem;
}
.exmo-build__back { margin: 0 0 1rem; }
.exmo-build__title + .exmo-viewer,
.exmo-build__back + .exmo-viewer { margin-top: 0; }

/* Back to album: rounded pill button */
.exmo-back {
	--exmo-back-c: currentColor;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.5em 1.15em 0.5em 0.9em;
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none !important;
	color: inherit !important;
	border: 1px solid rgba(127, 127, 127, 0.35);
	border-radius: 999px;
	background: transparent;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.exmo-back svg {
	width: 1.15em;
	height: 1.15em;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 0.2s ease;
}
.exmo-back:hover,
.exmo-back:focus-visible {
	border-color: var(--wp--preset--color--orange, #ff8a00);
	background: var(--wp--preset--color--orange, #ff8a00);
	color: #000 !important;
	box-shadow: 0 4px 14px rgba(255, 138, 0, 0.25);
}
.exmo-back:hover svg,
.exmo-back:focus-visible svg { transform: translateX(-3px); }

/* Gallery name: small, light, spaced capitals */
.exmo-build__title {
	margin: 0 0 1.1rem !important;
	font-family: inherit;
	font-size: clamp(1rem, 1.4vw, 1.25rem) !important;
	font-weight: 400 !important;
	line-height: 1.3;
	letter-spacing: 0.16em !important;
	text-transform: uppercase;
	opacity: 0.85;
}
.exmo-build__desc { max-width: 760px; margin: 2rem auto 0; }
.exmo-build__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2rem; }
.exmo-build__nav {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 2.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.exmo-build__nav a { text-decoration: none; }
.exmo-build__nav a:hover { color: var(--wp--preset--color--orange, #ff8a00); }
.exmo-build__nav .is-next { margin-left: auto; text-align: right; }

/* Hidden but still read by search engines and screen readers */
.exmo-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}
