/*
 * Gallery grid (data-section «Cuadrícula de galerías», pattern transpirenaica/gallery-grid, anchor #galerias).
 * Ported from base.css and mobile.css of 03-galerias with docs/class-map.md (.galerias → .galleries,
 * .galeria-card → .gallery-card).
 *
 * - Lead paragraph (720 px, 64/48 px above the cards) and a grid of 4 columns (48 × 24 px gaps), 2 columns from
 *   768 to 959 px and 1 on mobile (48 px gap). The number of cards follows the published galleries.
 * - Cover 4:3 with a 16 px radius and a CSS zoom on hover/focus, off with prefers-reduced-motion.
 * - The group icon of the participants line is the mask of components.css (mask-icon mask-icon--group).
 * - Rules carry two classes: they also win over GP's dynamic h2 typography and over a:hover, a:focus,
 *   a:active (0,1,1), whose colours are repeated for the title link.
 */

.galleries {
	background: var(--cream);
}

.galleries .galleries__intro {
	max-width: 720px;
	margin-bottom: var(--space-8);
}

.galleries .galleries__lead {
	font-size: var(--fs-lead);
	line-height: 1.55;
	font-weight: 500;
	color: var(--ink);
	text-wrap: pretty;
}

.galleries .galleries__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--space-7) var(--space-5);
}

/* margin:0 — the loop item gets post_class(), which for the gallery CPT includes «gallery», and GeneratePress
   styles the classic shortcode gallery with .gallery{margin-bottom:1.5em}: 25.5/24 px more under every card. */
.galleries .gallery-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	min-width: 0;
	margin: 0;
}

/* The 4:3 frame is also on the link, so a gallery without featured image keeps a forest box of the same size
   and the row stays aligned (GB removes the photo when {{featured_image}} is empty). */
.galleries .gallery-card__media {
	display: block;
	aspect-ratio: 4 / 3;
	border-radius: var(--radius-band);
	overflow: hidden;
	line-height: 0;
	background: var(--forest-800);
}

.galleries .gallery-card__img {
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: 50% 50%;
	transform: scale(1);
	transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

.galleries .gallery-card:is(:hover, :focus-within) .gallery-card__img {
	transform: scale(1.05);
}

.galleries .gallery-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

.galleries .gallery-card__title {
	font-family: var(--font-heading);
	font-weight: 800;
	font-size: var(--fs-h3);
	line-height: 1.05;
	letter-spacing: var(--ls-heading);
	text-transform: uppercase;
	color: var(--ink);
}

.galleries .gallery-card__title a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 3px;
	text-underline-offset: 6px;
	transition: text-decoration-color .2s ease;
}

.galleries .gallery-card__title a,
.galleries .gallery-card__title a:is(:hover, :focus, :active) {
	color: var(--ink);
}

.galleries .gallery-card:hover .gallery-card__title a,
.galleries .gallery-card__title a:focus-visible {
	text-decoration-color: var(--mustard);
}

.galleries .gallery-card__title a:focus-visible {
	outline: 3px solid var(--mustard);
	outline-offset: 4px;
	box-shadow: 0 0 0 2px var(--forest-800);
	border-radius: 4px;
}

.galleries .gallery-card__meta {
	--icon-size: 18px;
	--icon-color: var(--forest);
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--fs-small);
	line-height: 1.3;
	font-weight: 500;
	color: var(--body-text);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.galleries .gallery-card__img,
	.galleries .gallery-card__title a {
		transition: none;
	}

	.galleries .gallery-card:is(:hover, :focus-within) .gallery-card__img {
		transform: none;
	}
}

@media (max-width: 959px) and (min-width: 768px) {
	.galleries .galleries__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.galleries .galleries__intro {
		margin-bottom: var(--space-7);
	}

	.galleries .galleries__grid {
		grid-template-columns: 1fr;
		gap: var(--space-7);
	}

	.galleries .gallery-card {
		gap: var(--space-2);
	}

	.galleries .gallery-card__body {
		gap: 0;
	}

	.galleries .gallery-card__title a {
		min-height: 48px;
	}
}
