/*
 * Photo gallery — Editorial Mosaic.
 *
 * One dominant photo on the start side, up to four beside it in a grid of
 * two by two, and a "View all photos" button in the corner of the last one.
 * The composition follows the count — one wide hero, a large and a small, a
 * large with two stacked, a large with a wide over two, or the full mosaic —
 * so no cell is ever empty. On a phone the main photo runs the full width
 * and the rest sit in a strip that scrolls sideways and snaps.
 *
 * Wide screens: the strip wrapper and the lead wrapper are `display:
 * contents`, so every photo and the button are cells of one grid and land
 * in named areas. Phones: the wrappers become boxes again — the lead holds
 * the button over the photo, the strip scrolls.
 *
 * Loaded only when this layout is the one saved, on top of home.css, whose
 * tokens it reads and never redefines. Every rule is scoped to the section
 * wrapper, so nothing here reaches the theme or the classic grid.
 */

.tripvance-gallery--editorial-mosaic {
	--mosaic-gap: clamp(8px, 1vw, 12px);
	--mosaic-radius: var(--wptm-radius-media, 14px);
	--mosaic-ground: #22252b;
	--mosaic-line: var(--home-line, rgba(0, 0, 0, .1));
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic {
	display: grid;
	grid-template-columns: minmax(0, 58fr) minmax(0, 21fr) minmax(0, 21fr);
	grid-template-rows: repeat(2, minmax(0, 1fr));
	grid-template-areas:
		"main t1 t2"
		"main t3 t4";
	gap: var(--mosaic-gap);
	aspect-ratio: 2 / 1;
	max-height: min(640px, 72vh);
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__lead,
.tripvance-gallery--editorial-mosaic .wptm-mosaic__strip {
	display: contents;
}

/* --- The shapes by count ------------------------------------------------ */
.tripvance-gallery--editorial-mosaic .wptm-mosaic--1 {
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
	grid-template-areas: "main";
	aspect-ratio: 21 / 9;
	max-height: min(560px, 64vh);
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic--2 {
	grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
	grid-template-rows: minmax(0, 1fr);
	grid-template-areas: "main t1";
	aspect-ratio: 21 / 9;
	max-height: min(560px, 64vh);
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic--3 {
	grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
	grid-template-areas:
		"main t1"
		"main t2";
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic--4 {
	grid-template-areas:
		"main t1 t1"
		"main t2 t3";
}

/* --- Each photo --------------------------------------------------------- */
.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot {
	position: relative;
	display: block;
	min-width: 0;
	min-height: 0;
	border-radius: var(--mosaic-radius);
	overflow: hidden;
	background: var(--mosaic-ground);
	color: #fff;
	text-decoration: none;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--main {
	grid-area: main;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--1 {
	grid-area: t1;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--2 {
	grid-area: t2;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--3 {
	grid-area: t3;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--4 {
	grid-area: t4;
}

/* The photos past the fifth are in the viewer, not on the wall. */
.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--extra {
	display: none;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .7s ease;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot:hover .wptm-mosaic__img {
	transform: scale(1.04);
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot:focus-visible {
	outline: 3px solid var(--wptm-accent);
	outline-offset: 3px;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__cap {
	position: absolute;
	inset: auto 0 0 0;
	padding: 28px 14px 12px;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .65));
	color: #fff;
	font-size: .82rem;
	line-height: 1.4;
	opacity: 0;
	transition: opacity .25s ease;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot:hover .wptm-mosaic__cap,
.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot:focus-visible .wptm-mosaic__cap {
	opacity: 1;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--main .wptm-mosaic__cap {
	padding: 40px 18px 16px;
	font-size: .9rem;
}

/* --- "View all photos" -------------------------------------------------- */
/* A cell of the grid, over the last photo, in its end corner. The button
   is a sibling of the photo, never inside it: a link cannot hold a button. */
.tripvance-gallery--editorial-mosaic .wptm-mosaic__all {
	position: relative;
	z-index: 2;
	grid-area: t4;
	justify-self: end;
	align-self: end;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 12px;
	padding: 0 14px;
	min-height: 40px;
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: var(--wptm-radius-sm, 8px);
	background: rgba(20, 22, 26, .72);
	color: #fff;
	font: inherit;
	font-size: .84rem;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--wptm-transition, .18s ease), border-color var(--wptm-transition, .18s ease);
}

/* Printed hidden and shown by the script that runs the viewer; the class
   above outranks the browser's own [hidden] rule, so it is restated. */
.tripvance-gallery--editorial-mosaic .wptm-mosaic__all[hidden] {
	display: none;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__all:hover {
	background: rgba(20, 22, 26, .88);
	border-color: #fff;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__all:active {
	background: rgba(20, 22, 26, .96);
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__all:focus-visible {
	outline: 3px solid var(--wptm-accent);
	outline-offset: 2px;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic__allicon {
	display: inline-flex;
	line-height: 0;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic--2 .wptm-mosaic__all {
	grid-area: t1;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic--3 .wptm-mosaic__all {
	grid-area: t2;
}

.tripvance-gallery--editorial-mosaic .wptm-mosaic--4 .wptm-mosaic__all {
	grid-area: t3;
}

/* --- Tablet: the same wall, a little taller ----------------------------- */
@media (max-width: 1023px) and (min-width: 768px) {
	.tripvance-gallery--editorial-mosaic .wptm-mosaic {
		aspect-ratio: 16 / 9;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic--1,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic--2 {
		aspect-ratio: 16 / 8;
	}
}

/* --- Phone: one large photo, then a strip that scrolls ------------------ */
@media (max-width: 767px) {
	.tripvance-gallery--editorial-mosaic .wptm-mosaic,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic--1,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic--2,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic--3,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic--4 {
		display: block;
		aspect-ratio: auto;
		max-height: none;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__lead {
		position: relative;
		display: block;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--main {
		aspect-ratio: 4 / 3;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--main .wptm-mosaic__cap {
		padding: 30px 14px 12px;
		font-size: .82rem;
	}

	/* The top corner on a phone: the foot of the photo is the caption's. */
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__all {
		position: absolute;
		inset-block-start: 0;
		inset-inline-end: 0;
		margin: 10px;
		min-height: 36px;
		padding: 0 12px;
		font-size: .8rem;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__strip {
		display: flex;
		gap: 8px;
		margin-block-start: 8px;
		padding-block-end: 4px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: 0;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot--extra,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__strip .wptm-mosaic__shot {
		display: block;
		flex: 0 0 min(46%, 220px);
		aspect-ratio: 4 / 3;
		scroll-snap-align: start;
	}

	/* A thumbnail's caption stays visible on a phone, as the grid's does:
	   there is no hover to reveal it. */
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__cap {
		opacity: 1;
		padding: 20px 10px 8px;
		font-size: .76rem;
	}
}

@media (pointer: coarse) {
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__cap {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__img,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__cap,
	.tripvance-gallery--editorial-mosaic .wptm-mosaic__all {
		transition: none;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__shot:hover .wptm-mosaic__img {
		transform: none;
	}

	.tripvance-gallery--editorial-mosaic .wptm-mosaic__strip {
		scroll-behavior: auto;
	}
}
