/*
 * Gallery styles (ESPECIFICACIO.md, 6.3). Mobile first.
 * inc/galeria.php puts --od-r (width / height) and a shape class on each image.
 * Selectors carry :not(#individual-image) to match core's own specificity.
 */

/* Mosaic: justified rows. Same height per row, nothing cropped, order kept. */
.wp-block-gallery.has-nested-images.is-style-od-files {
	--od-h: 9rem;
}

.wp-block-gallery.has-nested-images.is-style-od-files figure.wp-block-image:not(#individual-image) {
	width: auto;
	flex: calc(var(--od-r, 1.5) * 1000) 1 calc(var(--od-r, 1.5) * var(--od-h));
	aspect-ratio: var(--od-r, 1.5);
	margin: 0;
}

.wp-block-gallery.has-nested-images.is-style-od-files figure.wp-block-image:not(#individual-image) img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The last row keeps its natural height instead of stretching. */
.wp-block-gallery.has-nested-images.is-style-od-files::after {
	content: "";
	flex: 1000000 1 0;
}

@media (min-width: 782px) {
	.wp-block-gallery.has-nested-images.is-style-od-files {
		--od-h: 15rem;
	}
}

/* Collage: the mosaic rows, with some horizontal photos stacked in pairs
 * (inc/galeria.php groups them). Order kept, nothing cropped. */
.wp-block-gallery.has-nested-images.is-style-od-collage {
	--od-h: 12rem;
}

.wp-block-gallery.has-nested-images.is-style-od-collage > figure.wp-block-image:not(#individual-image),
.wp-block-gallery.has-nested-images.is-style-od-collage > .od-parella {
	width: auto;
	flex: calc(var(--od-r, 1.5) * 1000) 1 calc(var(--od-r, 1.5) * var(--od-h));
	aspect-ratio: var(--od-r, 1.5);
	margin: 0;
}

.wp-block-gallery.has-nested-images.is-style-od-collage .od-parella {
	display: flex;
	flex-direction: column;
	gap: var(--wp--style--unstable-gallery-gap, 16px);
}

/* !important: core sizes a two-photo set to 50% with selectors carrying two ids. */
.wp-block-gallery.has-nested-images.is-style-od-collage .od-parella figure.wp-block-image:not(#individual-image) {
	width: 100% !important;
	flex: calc(1000 / var(--od-r, 1.5)) 1 0;
	min-height: 0;
	margin: 0;
}

.wp-block-gallery.has-nested-images.is-style-od-collage figure.wp-block-image:not(#individual-image) img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wp-block-gallery.has-nested-images.is-style-od-collage::after {
	content: "";
	flex: 1000000 1 0;
}

@media (min-width: 782px) {
	.wp-block-gallery.has-nested-images.is-style-od-collage {
		--od-h: 22rem;
	}
}

/* Viewer affordance. */
img.od-visor {
	cursor: zoom-in;
}

img.od-visor:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* The viewer covers everything, floating chat buttons included (Click to Chat
   at Ses Terrisses stayed on top, 2026-11-30; the Florinda and Milano have their
   own WhatsApp button too). */
.pswp.pswp { /* beats photoswipe.css, loaded after this file */
	--pswp-root-z-index: 2147483000;
}

/* ------------------------------------------------------------
   Carousel ("Carrusel"): one photo at a time, arrows and dots
   (assets/galeria/carrusel.js), never moving on its own.
   The colour of the arrows and dots follows the text colour.
   ------------------------------------------------------------ */

.od-carrusel {
	position: relative;
	margin-bottom: 2.5rem;
}

.wp-block-gallery.has-nested-images.is-style-carrusel {
	display: flex;
	flex-wrap: nowrap;
	gap: 0 !important;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.wp-block-gallery.has-nested-images.is-style-carrusel::-webkit-scrollbar {
	display: none;
}

.wp-block-gallery.has-nested-images.is-style-carrusel figure.wp-block-image:not(#individual-image) {
	flex: 0 0 100%;
	width: 100%;
	margin: 0;
	scroll-snap-align: start;
}

.wp-block-gallery.has-nested-images.is-style-carrusel figure.wp-block-image:not(#individual-image) img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.od-carrusel__fletxa {
	position: absolute;
	top: 50%;
	width: 2.75rem;
	height: 2.75rem;
	margin-top: -1.375rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgb(255 255 255 / 0.92);
	color: var(--wp--preset--color--contrast, #1f1f1f);
	box-shadow: 0 2px 10px rgb(0 0 0 / 0.2);
	cursor: pointer;
	z-index: 2;
}

.od-carrusel__fletxa::before {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 0.7rem;
	height: 0.7rem;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.od-carrusel__fletxa--ant { left: 0.75rem; }
.od-carrusel__fletxa--ant::before { transform: translateX(15%) rotate(-135deg); }
.od-carrusel__fletxa--seg { right: 0.75rem; }
.od-carrusel__fletxa--seg::before { transform: translateX(-15%) rotate(45deg); }

.od-carrusel__fletxa:disabled {
	opacity: 0.35;
	cursor: default;
}

.od-carrusel__punts {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1.9rem;
	display: flex;
	justify-content: center;
	gap: 0.1rem;
}

/* A 24 px touch target (WCAG 2.5.8) with the visible dot drawn inside. */
.od-carrusel__punts button {
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.od-carrusel__punts button::before {
	content: "";
	width: 0.7rem;
	height: 0.7rem;
	box-sizing: border-box;
	border: 2px solid currentColor;
	border-radius: 50%;
}

.od-carrusel__punts button[aria-current="true"]::before {
	background: currentColor;
}

/* Upright (or almost square) photos in the carousel: whole, never cropped, inside the same 3:2 frame,
   on the same photo blurred behind (inc/galeria.php marks them od-foto-alta). Landscape photos as before. */
.wp-block-gallery.has-nested-images.is-style-carrusel figure.wp-block-image.od-foto-alta:not(#individual-image) {
	position: relative;
	overflow: hidden;
}

.wp-block-gallery.has-nested-images.is-style-carrusel figure.wp-block-image.od-foto-alta:not(#individual-image)::before {
	content: "";
	position: absolute;
	inset: -24px;
	background: var(--od-fons, none) center / cover no-repeat;
	filter: blur(20px) brightness(0.85);
}

.wp-block-gallery.has-nested-images.is-style-carrusel figure.wp-block-image.od-foto-alta:not(#individual-image) img {
	position: relative;
	object-fit: contain;
}
