/*
 * Media Showcase — front end.
 * Type and colour are inherited from the theme on purpose, so sections
 * look like part of the site rather than a bolted-on gallery.
 */

.mshow-section {
	--mshow-cols: 3;
	--mshow-video-cols: 2;
	--mshow-gap-none: 0px;
	--mshow-gap-small: 8px;
	--mshow-gap-medium: clamp(16px, 2.4vw, 32px);
	--mshow-gap-large: clamp(28px, 4vw, 56px);
	--mshow-gap: var(--mshow-gap-medium);
	--mshow-ratio: 4 / 3;
	--mshow-title-color: #ffffff;
	--mshow-radius: 4px;
	margin: 0 0 clamp(48px, 6vw, 80px);
}

.mshow-sections .mshow-section:last-child {
	margin-bottom: 0;
}

/* Section header ------------------------------------------------------- */

.mshow-section__head {
	margin-bottom: clamp(20px, 3vw, 32px);
	padding-bottom: 12px;
	border-bottom: 1px solid;
	border-image: linear-gradient(to right, currentColor 0 12%, rgba(127, 127, 127, .25) 12%) 1;
}

.mshow-section__title {
	margin: 0;
	color: var(--mshow-title-color);
	font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.mshow-section__intro {
	margin-top: 10px;
	max-width: 68ch;
	opacity: .85;
}

.mshow-section__intro > :last-child {
	margin-bottom: 0;
}

/* Grid ----------------------------------------------------------------- */

.mshow-grid {
	display: grid;
	grid-template-columns: repeat(var(--mshow-cols), minmax(0, 1fr));
	gap: var(--mshow-gap);
	margin: 0;
	padding: 0;
}

/* Videos get fewer, wider columns so they are big enough to watch. */
.mshow-grid--videos {
	grid-template-columns: repeat(var(--mshow-video-cols), minmax(0, 1fr));
}

/* Photos / Videos tabs -------------------------------------------------- */

.mshow-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0 28px;
	margin: 20px 0 16px;
	padding: 0;
	border-bottom: 1px solid rgba(127, 127, 127, .35);
}

.mshow-section .mshow-tab,
.mshow-section .mshow-tab:hover,
.mshow-section .mshow-tab:focus,
.mshow-section .mshow-tab:active {
	appearance: none;
	-webkit-appearance: none;
	margin: 0 0 -1px;
	padding: 8px 0 10px;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	background: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: inherit !important;
	width: auto;
	height: auto;
	min-height: 0;
	font: inherit;
	font-size: 1.05em;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: inherit;
	text-transform: none;
	text-decoration: none;
	opacity: .55;
	cursor: pointer;
	transition: opacity .15s ease, border-color .15s ease;
}

.mshow-section .mshow-tab:hover,
.mshow-section .mshow-tab:focus-visible {
	opacity: .85;
}

.mshow-section .mshow-tab.is-active {
	opacity: 1;
	border-bottom-color: currentColor;
}

.mshow-section .mshow-tab:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* A section with only photos or only videos has no tab bar, just a heading. */
.mshow-group__title {
	margin: 20px 0 12px;
	font-size: 1.05em;
	line-height: 1.3;
}

/* Only the chosen tab's panel is shown once the script has run. */
.mshow-panel[hidden] {
	display: none !important;
}

.mshow-tile {
	margin: 0;
	display: flex;
	flex-direction: column;
}

.mshow-media {
	display: block;
	position: relative;
	overflow: hidden;
	border-radius: var(--mshow-radius);
	background: rgba(127, 127, 127, .12);
	line-height: 0;
}

.mshow-media img,
.mshow-media video {
	display: block;
	width: 100%;
	height: auto;
	border-radius: inherit;
}

/* Uniform tiles: every item is cropped to the same shape so rows line up. */
.mshow-media--fixed {
	aspect-ratio: var(--mshow-ratio);
}

.mshow-media--fixed img,
.mshow-media--fixed video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* Captions sit at a consistent height in a uniform grid. */
.mshow-section--uniform .mshow-tile {
	height: 100%;
}

/* Fallback for browsers without aspect-ratio (pre-2021). */
@supports not (aspect-ratio: 4 / 3) {
	.mshow-media--fixed {
		position: relative;
		padding-top: 75%;
	}

	.mshow-media--video,
	.mshow-media--embed {
		padding-top: 56.25%;
	}

	.mshow-media--fixed img,
	.mshow-media--fixed video,
	.mshow-media--fixed iframe,
	.mshow-media--video video {
		position: absolute;
		inset: 0;
	}
}

.mshow-media--zoom img {
	transition: transform .45s cubic-bezier(.2, .7, .3, 1);
}

.mshow-media--zoom:hover img,
.mshow-media--zoom:focus-visible img {
	transform: scale(1.035);
}

.mshow-media--zoom:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* Small magnifier badge, only visible on hover/focus. */
.mshow-zoom {
	position: absolute;
	right: 10px;
	bottom: 10px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(17, 17, 17, .72);
	opacity: 0;
	transition: opacity .25s ease;
	pointer-events: none;
}

.mshow-zoom::before,
.mshow-zoom::after {
	content: "";
	position: absolute;
	background: #fff;
}

.mshow-zoom::before {
	left: 9px;
	top: 14px;
	width: 12px;
	height: 2px;
}

.mshow-zoom::after {
	left: 14px;
	top: 9px;
	width: 2px;
	height: 12px;
}

.mshow-media--zoom:hover .mshow-zoom,
.mshow-media--zoom:focus-visible .mshow-zoom {
	opacity: 1;
}

/* Uploaded videos and YouTube / Vimeo players share a 16:9 box and are never
   cropped to the photo tile shape; anything taller is letterboxed instead. */
.mshow-media--video,
.mshow-media--embed {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
}

.mshow-media--video video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
}

.mshow-media--embed iframe,
.mshow-media--embed embed,
.mshow-media--embed object {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: inherit;
}

.mshow-media--link {
	padding: 24px;
	line-height: 1.4;
}

/* Caption -------------------------------------------------------------- */

.mshow-caption {
	padding-top: 10px;
	font-size: .95em;
	line-height: 1.5;
}

.mshow-caption__title {
	display: block;
	font-weight: 600;
	letter-spacing: .01em;
}

.mshow-caption__text {
	opacity: .78;
}

.mshow-caption__text p {
	margin: .25em 0 0;
}

.mshow-notice {
	padding: 12px 16px;
	border-left: 3px solid #b32d2e;
	background: rgba(179, 45, 46, .06);
	font-size: .95em;
}

/* Lightbox ------------------------------------------------------------- */

.mshow-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 4vmin;
	background: rgba(10, 10, 12, .93);
	opacity: 0;
	transition: opacity .2s ease;
}

.mshow-lightbox.is-open {
	opacity: 1;
}

.mshow-lightbox__figure {
	margin: 0;
	max-width: min(1200px, 100%);
	max-height: 100%;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.mshow-lightbox__img {
	max-width: 100%;
	max-height: 76vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 3px;
	margin: 0 auto;
	display: block;
}

.mshow-lightbox__caption {
	color: #f2f2f2;
	text-align: center;
	max-width: 70ch;
	margin: 0 auto;
	font-size: .95rem;
	line-height: 1.5;
}

.mshow-lightbox__caption strong {
	display: block;
	margin-bottom: 2px;
}

.mshow-lightbox__caption span {
	opacity: .75;
}

.mshow-lightbox button {
	position: absolute;
	appearance: none;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	border: 0;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background .2s ease;
}

.mshow-lightbox button:hover,
.mshow-lightbox button:focus-visible {
	background: rgba(255, 255, 255, .24);
}

.mshow-lightbox__close {
	top: 3vmin;
	right: 3vmin;
}

.mshow-lightbox__prev {
	left: 3vmin;
	top: 50%;
	transform: translateY(-50%);
}

.mshow-lightbox__next {
	right: 3vmin;
	top: 50%;
	transform: translateY(-50%);
}

.mshow-lightbox__count {
	position: absolute;
	bottom: 3vmin;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, .6);
	font-size: .8rem;
	letter-spacing: .08em;
}

body.mshow-lightbox-open {
	overflow: hidden;
}

/* Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
	.mshow-grid {
		grid-template-columns: repeat(min(var(--mshow-cols), 2), minmax(0, 1fr));
	}

	.mshow-grid--videos {
		grid-template-columns: repeat(min(var(--mshow-video-cols), 2), minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.mshow-grid {
		grid-template-columns: 1fr;
	}

	.mshow-lightbox__prev,
	.mshow-lightbox__next {
		top: auto;
		bottom: 3vmin;
		transform: none;
	}

	.mshow-lightbox__count {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mshow-media--zoom img,
	.mshow-lightbox,
	.mshow-zoom {
		transition: none;
	}

	.mshow-media--zoom:hover img {
		transform: none;
	}
}


/* Accordion collections ------------------------------------------------ */
.mshow-section.mshow-accordion {
	margin-bottom: 14px;
	border-bottom: 1px solid rgba(0,0,0,.12);
}
.mshow-accordion__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	padding: 18px 0;
	margin: 0;
	border: 0;
	background: transparent !important;
	background-image: none !important;
	color: #fff !important;
	font: inherit;
	font-weight: 600;
	font-size: 1.25em;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
}
.mshow-accordion__toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}
.mshow-accordion__icon {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	margin-right: 4px;
	transition: transform .15s ease;
}
.mshow-section.mshow-accordion.is-open .mshow-accordion__icon {
	transform: rotate(225deg);
}
.mshow-section.mshow-accordion .mshow-section__head {
	margin: 0;
}
/* Closed until the visitor opens it (the script adds mshow-accordion-ready so
   nothing is hidden if the script never runs). */
.mshow-section.mshow-accordion.mshow-accordion-ready:not(.is-open) .mshow-section__intro,
.mshow-section.mshow-accordion.mshow-accordion-ready:not(.is-open) .mshow-section__body {
	display: none;
}
@media (max-width: 600px) {
	.mshow-accordion__toggle { padding: 15px 0; font-size: 1.1em; }
}
@media (prefers-reduced-motion: reduce) {
	.mshow-accordion__icon { transition: none; }
}

/* Final accordion overrides */
.mshow-section.mshow-accordion .mshow-accordion__toggle,
.mshow-section.mshow-accordion .mshow-accordion__toggle:hover,
.mshow-section.mshow-accordion .mshow-accordion__toggle:focus,
.mshow-section.mshow-accordion .mshow-accordion__toggle:active {
	background: transparent !important;
	background-color: transparent !important;
	color: #fff !important;
	box-shadow: none !important;
}
.mshow-section.mshow-accordion .mshow-accordion__toggle {
	justify-content: flex-start;
	gap: 8px;
}
.mshow-section.mshow-accordion .mshow-accordion__icon {
	margin-left: 2px;
	margin-right: 0;
}


/* v1.2.3: keep chevron directly beside collection title. */
.mshow-section.mshow-accordion .mshow-accordion__toggle {
	width: auto !important;
	max-width: 100%;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 10px !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}
.mshow-section.mshow-accordion .mshow-accordion__label {
	display: inline-block;
	flex: 0 1 auto;
}
.mshow-section.mshow-accordion .mshow-accordion__icon {
	display: inline-block;
	flex: 0 0 8px;
	margin: 0 !important;
}
.mshow-section.mshow-accordion .mshow-accordion__toggle:hover,
.mshow-section.mshow-accordion .mshow-accordion__toggle:focus,
.mshow-section.mshow-accordion .mshow-accordion__toggle:active {
	color: #fff !important;
}


/* v1.2.4: readable captions on dark site backgrounds. */
.mshow-section.mshow-accordion .mshow-caption,
.mshow-section.mshow-accordion .mshow-caption__title,
.mshow-section.mshow-accordion .mshow-caption__text,
.mshow-section.mshow-accordion .mshow-caption__text p,
.mshow-section.mshow-accordion .mshow-tab,
.mshow-section.mshow-accordion .mshow-group__title,
.mshow-section.mshow-accordion .mshow-section__intro {
	color: #fff !important;
}
.mshow-section.mshow-accordion .mshow-caption__text {
	opacity: 1 !important;
}
.mshow-section.mshow-accordion .mshow-caption a,
.mshow-section.mshow-accordion .mshow-section__intro a {
	color: #fff !important;
}
