/**
 * Canopy Route (cn-route): boardwalk site plan with walking times, a distance table or a
 * route ledger. Figma: Home "V5 Signature · Boardwalk map", The place "M4 Signature ·
 * Boardwalk map", lodge pages "Your route".
 *
 * The map is drawn three times (desktop 696×440, tablet 770×400, phone 350×700); only the
 * one for the current width is shown.
 */

.cn-route {
	--cn-route-ground: var(--cn-c-paper);
	--cn-route-tree: var(--cn-c-sage);
	--cn-route-tree-line: var(--cn-c-line);
	--cn-route-color: var(--cn-c-forest);
	--cn-route-on-color: var(--cn-c-white);
	--cn-route-faded: var(--cn-c-line);
	--cn-route-muted: var(--cn-c-muted);
	--cn-route-pad: 96px;
}

/* Home: 80px; The place and lodge pages: 96px; 64px on tablet and phone. */
.cn-route--times {
	--cn-route-pad: 80px;
}

.cn-route.cn-pad {
	padding-top: var(--cn-pad-t, var(--cn-route-pad));
	padding-bottom: var(--cn-pad-b, var(--cn-route-pad));
}

.cn-route .cn-heading {
	margin-bottom: 32px;
}

.cn-route .cn-heading__text {
	margin-top: 16px;
	font-size: var(--cn-fs-body);
	line-height: var(--cn-lh-body);
	color: var(--cn-text);
}

/* Plan and panel: 696 + 48 + 456 at 1440. */
.cn-route__plan {
	display: grid;
	grid-template-columns: minmax(0, 696fr) minmax(0, 456fr);
	column-gap: 48px;
	align-items: start;
}

.cn-route__map {
	min-width: 0;
	background: var(--cn-route-ground);
}

/* ------------------------------------------------------------------ */
/* Map (inline SVG)                                                   */
/* ------------------------------------------------------------------ */

.cn-route__svg {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	overflow: visible;
}

.cn-route__svg--tablet,
.cn-route__svg--phone {
	display: none;
}

.cn-route__ground {
	fill: var(--cn-route-ground);
}

.cn-route__trees circle {
	fill: var(--cn-route-tree);
	stroke: var(--cn-route-tree-line);
	stroke-width: 1.25;
}

.cn-route__path {
	fill: none;
	stroke: var(--cn-route-color);
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cn-route__path--shared,
.cn-route__path.is-active {
	stroke-width: 5;
}

.cn-route__path.is-faded {
	stroke: var(--cn-route-faded);
	stroke-width: 2;
}

.cn-route__marker circle {
	fill: var(--cn-route-color);
}

.cn-route__marker text {
	fill: var(--cn-route-on-color);
	font-family: var(--cn-sans);
	font-size: 16px;
	font-weight: 600;
	text-anchor: middle;
	dominant-baseline: central;
}

.cn-route__marker.is-faded circle {
	fill: var(--cn-route-ground);
	stroke: var(--cn-route-faded);
	stroke-width: 1;
}

.cn-route__marker.is-faded text {
	fill: var(--cn-route-muted);
}

.cn-route__label,
.cn-route__scale-text {
	fill: var(--cn-route-color);
	font-family: var(--cn-sans);
	font-size: 14px;
	font-weight: 400;
	dominant-baseline: central;
}

.cn-route__label--caps {
	font-size: 12px;
	font-weight: 600;
}

.cn-route__label.is-faded,
.cn-route__scale-text {
	fill: var(--cn-route-muted);
}

.cn-route__rule {
	fill: none;
	stroke: var(--cn-route-color);
	stroke-width: 1.5;
	stroke-linejoin: round;
}

.cn-route__rule--round {
	stroke-linecap: round;
}

/* Lodge markers that link to the lodge page (The place). */
.cn-route__link {
	cursor: pointer;
}

.cn-route__link:hover .cn-route__marker circle,
.cn-route__link:focus-visible .cn-route__marker circle {
	fill: var(--cn-c-forest-dark);
}

.cn-route__link:hover .cn-route__label {
	text-decoration: underline;
}

.cn-route__link:focus {
	outline: none;
}

/* Focus: the marker and its label get a ring. */
.cn-route__link:focus-visible {
	outline: 2px solid var(--cn-route-color);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Walking times (Home)                                               */
/* ------------------------------------------------------------------ */

.cn-route__time {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 20px 0;
	border-bottom: 1px solid var(--cn-line);
}

.cn-route__minutes {
	color: var(--cn-heading);
}

.cn-route__time-text {
	color: var(--cn-muted);
}

/* ------------------------------------------------------------------ */
/* Distance table (The place)                                         */
/* ------------------------------------------------------------------ */

.cn-route__row {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	grid-template-areas: "pins seg total";
	column-gap: 16px;
	align-items: start;
	padding: 16px 0;
	border-bottom: 1px solid var(--cn-line);
}

.cn-route__row--head {
	padding: 0 0 12px;
}

.cn-route__pins {
	grid-area: pins;
	font-size: var(--cn-fs-label);
	line-height: var(--cn-lh-label);
	font-weight: 600;
}

.cn-route__seg {
	grid-area: seg;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.cn-route__total {
	grid-area: total;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	min-width: 80px;
	text-align: right;
}

.cn-route__row--head .cn-route__seg,
.cn-route__row--head .cn-route__total {
	font-size: var(--cn-fs-label);
	line-height: var(--cn-lh-label);
	font-weight: 600;
}

.cn-route__seg-name {
	font-weight: 600;
}

.cn-route__seg-detail,
.cn-route__total-time {
	color: var(--cn-muted);
}

.cn-route__distance {
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Route ledger (lodge pages)                                         */
/* ------------------------------------------------------------------ */

.cn-route__ledger {
	border-top: 1px solid var(--cn-line);
}

.cn-route__entry {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 0;
	border-bottom: 1px solid var(--cn-line);
}

/* The total sits between two forest rules. */
.cn-route__entry--total {
	margin-top: -1px;
	border-top: 1px solid var(--cn-text);
	border-bottom-color: var(--cn-text);
}

.cn-route__entry-label {
	font-size: var(--cn-fs-label);
	line-height: var(--cn-lh-label);
	font-weight: 600;
}

.cn-route__entry-title {
	font-weight: 600;
}

/* Photo under the plan (lodge pages): 1200×520, square corners. */
.cn-route__photo {
	margin-top: 32px;
}

.cn-route__photo .cn-figure__media {
	aspect-ratio: 1200 / 520;
	border-radius: 0;
}

.cn-route__photo .cn-figure__caption {
	margin-top: 12px;
	color: var(--cn-text);
}

/* ------------------------------------------------------------------ */
/* Tablet (834): map full width, panel under it                       */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
	.cn-route,
	.cn-route--times {
		--cn-route-pad: 64px;
	}

	.cn-route .cn-heading {
		margin-bottom: 24px;
	}

	.cn-route__plan {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 24px;
	}

	.cn-route__svg--desktop {
		display: none;
	}

	.cn-route__svg--tablet {
		display: block;
	}

	/* Walking times in one row, centred. */
	.cn-route__times {
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: minmax(0, 1fr);
		column-gap: 24px;
		text-align: center;
	}

	.cn-route__time {
		padding: 0;
		border-bottom: 0;
	}

	.cn-route__photo {
		margin-top: 24px;
	}

	.cn-route__photo .cn-figure__media {
		aspect-ratio: 5 / 3;
	}
}

/* ------------------------------------------------------------------ */
/* Phone (390): portrait map                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
	.cn-route__svg--tablet {
		display: none;
	}

	.cn-route__svg--phone {
		display: block;
	}

	.cn-route__times {
		grid-auto-flow: row;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 24px;
	}

	/* Route code above the segment name; distance at the right. */
	.cn-route__row {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"pins total"
			"seg total";
		row-gap: 4px;
	}

	.cn-route__row--head {
		grid-template-areas: "pins total";
		row-gap: 0;
	}

	.cn-route__row--head .cn-route__seg {
		display: none;
	}
}
