/**
 * Canopy Levels (cn-levels): the forest cross-section drawn to scale.
 * Figma: Home "V5 Signature · Forest cross-section", The place "M4 Signature · Forest
 * cross-section", lodge pages "Your forest level".
 *
 * The SVG of each breakpoint is printed once (wide scene at 1440 and 834, one panel per cabin
 * at 390); CSS shows the one that matches. Texts sit over the SVG in HTML, placed in % of it.
 */

.cn-levels {
	/* Figma: 80 (Home) / 96 (The place, lodge pages) desktop, 64 tablet and phone. */
	--cn-section-pad: 96px;
}

.cn-levels--section:not(.cn-levels--legend) {
	--cn-section-pad: 80px;
}

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

.cn-levels .cn-heading__text {
	max-width: 780px;
	font-size: 16px;
	line-height: 24px;
}

/* ------------------------------------------------------------------ */
/* Drawing                                                            */
/* ------------------------------------------------------------------ */

.cn-levels__drawing {
	position: relative;
	color: var(--cn-heading);
}

.cn-levels__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: hidden;
}

.cn-levels__tree {
	fill: var(--cn-line);
}

.cn-levels__ink {
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cn-levels__flat {
	stroke-linecap: butt;
}

.cn-levels__cabin {
	fill: var(--cn-levels-cabin, var(--cn-c-paper));
}

/* Forest palette: light lines, so the cabins take the section colour. */
.cn--forest .cn-levels__cabin {
	fill: var(--cn-levels-cabin, var(--cn-bg));
}

.cn-levels__dot {
	fill: currentColor;
}

/* Ruler numbers: right-aligned 6px left of the ruler, centred on their tick. */
.cn-levels__ruler {
	position: absolute;
	color: var(--cn-muted);
	white-space: nowrap;
	transform: translateY(-50%);
}

.cn-levels__ruler--zero {
	transform: translateY(calc(-50% - 12px));
}

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

.cn-levels__layer {
	position: absolute;
	right: 0;
	color: var(--cn-muted);
	white-space: nowrap;
}

/*
 * Height and note above each roof: their last line ends 8px over the ridge. A line that would
 * run past the drawing is pulled left to end 8px inside it (Figma 834, "Moss Hideout · no main
 * flight"). In a flex column an auto margin on the start side takes the free space (line on the
 * left) but drops to 0 on overflow (line flush with the end); the rtl box makes that start the right.
 */
.cn-levels__tag {
	position: absolute;
	right: 8px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	direction: rtl;
	transform: translateY(calc(-100% - 8px));
}

.cn-levels__height,
.cn-levels__note {
	display: block;
	margin-right: auto;
	direction: ltr;
	white-space: nowrap;
	color: var(--cn-heading);
}

/* One drawing per breakpoint. */
.cn-levels__scene--t,
.cn-levels__single--t,
.cn-levels__single--m,
.cn-levels__panels {
	display: none;
}

/* ------------------------------------------------------------------ */
/* Lodge links under the scene (The place)                            */
/* ------------------------------------------------------------------ */

/* Columns start under each cabin: the widget sets their left edges in % of the drawing. */
.cn-levels__legend {
	display: flex;
	margin-top: 32px;
}

.cn-levels__legend-item {
	flex: 0 0 var(--cn-lw-d, auto);
	min-width: 0;
	padding-right: 12px;
}

.cn-levels__legend-item:first-child {
	margin-left: var(--cn-lg-d, 0);
}

.cn-levels__legend-item:last-child {
	flex: 1 1 auto;
	padding-right: 0;
}

.cn-levels .cn-levels__legend .cn-link,
.cn-levels .cn-levels__panel-text .cn-link {
	display: flex;
	width: fit-content;
}

.cn-levels__size {
	margin-top: 4px;
	color: var(--cn-text);
}

/* ------------------------------------------------------------------ */
/* Phone panels                                                       */
/* ------------------------------------------------------------------ */

.cn-levels__panel + .cn-levels__panel {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid var(--cn-line);
}

.cn-levels__panel-text {
	margin-top: 12px;
}

.cn-levels__kicker {
	margin-bottom: 4px;
	color: var(--cn-heading);
}

.cn-levels__level {
	margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/* Lodge pages: one cabin and the comparison table                    */
/* ------------------------------------------------------------------ */

.cn-levels__detail {
	display: grid;
	grid-template-columns: minmax(0, 700fr) minmax(0, 452fr);
	column-gap: 48px;
	align-items: start;
}

.cn-levels__table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	color: var(--cn-text);
}

.cn-levels__table th,
.cn-levels__table td {
	padding: 14px 0;
	border-bottom: 1px solid var(--cn-line);
	font-size: 16px;
	line-height: 24px;
	font-weight: 400;
	text-align: left;
	vertical-align: middle;
}

.cn-levels__table thead th {
	padding: 0 0 12px;
	color: var(--cn-heading);
	font-size: var(--cn-fs-label);
	line-height: var(--cn-lh-label);
	font-weight: 600;
	vertical-align: bottom;
}

.cn-levels__table th:nth-child(2),
.cn-levels__table th:nth-child(3),
.cn-levels__table td {
	width: 108px;
	padding-left: 12px;
	text-align: right;
}

.cn-levels__table .is-current th,
.cn-levels__table .is-current td {
	font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Tablet (834)                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
	.cn-levels,
	.cn-levels--section:not(.cn-levels--legend) {
		--cn-section-pad: 64px;
	}

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

	.cn-levels__scene--d,
	.cn-levels__single--d {
		display: none;
	}

	.cn-levels__scene--t,
	.cn-levels__single--t {
		display: block;
	}

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

	.cn-levels__legend-item {
		flex-basis: var(--cn-lw-t, auto);
	}

	.cn-levels__legend-item:first-child {
		margin-left: var(--cn-lg-t, 0);
	}

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

/* ------------------------------------------------------------------ */
/* Phone (390)                                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
	.cn-levels__scene--t,
	.cn-levels__single--t,
	.cn-levels__legend {
		display: none;
	}

	.cn-levels__panels,
	.cn-levels__single--m {
		display: block;
	}

	.cn-levels__table th:nth-child(2),
	.cn-levels__table th:nth-child(3),
	.cn-levels__table td {
		width: 84px;
	}
}
