/*
 * Route detail (data-section «La Transpirenaica en moto, al detalle», pattern transpirenaica/route-detail).
 * Ported from base.css and mobile.css of 01-transpirenaica-en-moto with docs/class-map.md:
 * .ruta → .route, .ruta__head → .route__head, .etapas → .stages, .etapa → .stage (--sin-mapa → --no-map),
 * __texto → __content, __dia → __day, __ruta → __path, __datos → __stats, .dato → .stat, __mapa → __map.
 *
 * The map is a core/image (figure.wp-block-image.stage__map): core gives .wp-block-image a bottom margin with
 * the same weight, so this file (loaded after block-library) resets it.
 */

.route {
	background: var(--forest-800);
	color: var(--on-dark);
}

.route__head {
	max-width: 1120px;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: var(--space-8);
}

.stages {
	max-width: 1120px;
	margin: 0 auto;
}

/* Stage in two levels: title at full width + text / map in two equal columns. */
.stage {
	padding: var(--space-8) 0;
}

.stage:first-child {
	padding-top: 0;
}

.stage:last-child {
	padding-bottom: 0;
}

.stage + .stage {
	border-top: 1px solid var(--on-dark-line);
}

.stage__title {
	margin-bottom: var(--space-6);
	font-family: var(--font-heading);
	font-weight: 800;
	font-size: var(--fs-stage-title);
	line-height: 1.05;
	letter-spacing: var(--ls-heading);
	text-transform: uppercase;
	color: var(--white);
	white-space: nowrap;
}

.stage__label {
	color: var(--mustard);
	white-space: nowrap;
}

.stage__num {
	font-family: var(--font-stencil);
	font-weight: 400;
	font-size: 1em;
	letter-spacing: 0;
}

.stage__sep {
	margin: 0 .12em;
	color: var(--mustard);
}

.stage__body {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: var(--space-8);
	align-items: start;
}

.stage__content {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.stage__day {
	font-size: var(--fs-small);
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--on-dark-muted);
}

.stage__stats {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-6);
	padding-bottom: var(--space-2);
}

.stat {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
	white-space: nowrap;
}

.stat__num {
	font-family: var(--font-stencil);
	font-size: var(--fs-stat);
	line-height: 1;
	color: var(--mustard);
}

.stat__label {
	font-size: var(--fs-small);
	font-weight: 600;
	color: var(--on-dark);
}

.stage__text {
	font-size: var(--fs-body);
	line-height: 1.65;
	color: var(--on-dark-muted);
}

.stage__map {
	margin: 0;
	overflow: hidden;
	line-height: 0;
	background: var(--cream);
	border-radius: var(--radius-media);
}

.stage__map img {
	width: 100%;
	height: auto;
	aspect-ratio: 7 / 5;
	object-fit: contain;
}

/* Tablet (768–1100 px) */
@media (max-width: 1100px) and (min-width: 768px) {
	.route__head {
		margin-bottom: var(--space-7);
	}

	.stage {
		padding: var(--space-7) 0;
	}

	.stage__body {
		column-gap: var(--space-6);
	}
}

/* Mobile (≤767 px): title → map at full width → text. */
@media (max-width: 767px) {
	.route__head {
		margin-bottom: var(--space-7);
	}

	.stage {
		padding: var(--space-7) 0;
	}

	.stage__title {
		margin-bottom: var(--space-5);
		line-height: 1.1;
		white-space: normal;
	}

	.stage__body {
		grid-template-columns: 1fr;
		row-gap: var(--space-5);
	}

	.stage__map {
		order: -1;
	}

	.stage__content {
		gap: var(--space-3);
	}

	.stage__stats {
		gap: var(--space-5);
		padding-bottom: var(--space-1);
	}
}
