/* TPM Map Tailoring 0.9.5 (compact bar) / 0.8.0 — small button on the left above the map, panel full width under it, layer over the map.
   Colours follow the site (brand red #b85450, slate #23445d). */

/* ---------- compact button above the map ---------- */
.tpm-mt-bar {
	position: relative;
	z-index: 60;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	box-sizing: border-box;
	/* 0.8.0: full width also inside a vertical flex group of the page (it used to shrink to its content). */
	align-self: stretch;
	width: 100%;
	max-width: 100%;
	margin: 0 0 6px;
	font-family: "Roboto Condensed", Roboto, Arial, sans-serif;
}

.tpm-mt-bar .tpm-mt-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 4px 10px;
	border: 1px solid #c5d2dc;
	border-radius: 999px;
	background: #fff;
	box-shadow: none;
	color: #23445d;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: normal;
	line-height: 1.3;
	text-transform: none;
	cursor: pointer;
}

.tpm-mt-bar .tpm-mt-toggle:hover,
.tpm-mt-bar.is-open .tpm-mt-toggle {
	border-color: #b85450;
}

/* Some steps are switched off — the button says so in brand red. */
.tpm-mt-bar .tpm-mt-toggle.is-filtering {
	border-color: #b85450;
	background: #b85450;
	color: #fff;
}

.tpm-mt-bar .tpm-mt-toggle.is-off {
	color: #5d7f99;
}

.tpm-mt-caret {
	width: 0;
	height: 0;
	border-top: 5px solid currentColor;
	border-right: 4px solid transparent;
	border-left: 4px solid transparent;
}

.tpm-mt-bar.is-open .tpm-mt-caret {
	transform: rotate(180deg);
}

.tpm-mt-bar .tpm-mt-toggle:focus-visible {
	outline: 2px solid #5d7f99;
	outline-offset: 2px;
}

/* ---------- the panel, full width under the button (like the panel on the guide page) ---------- */
.tpm-mt-drop {
	align-self: stretch;
	width: 100%;
}

.tpm-mt-panel {
	box-sizing: border-box;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid #d5dee6;
	border-radius: 10px;
	background: #f6f9fb;
	color: #23445d;
	font-family: "Roboto Condensed", Roboto, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
}

/* The theme styles every button and select; the panel keeps its own look. */
.tpm-mt-panel button,
.tpm-mt-panel select {
	height: auto;
	min-height: 0;
	margin: 0;
	box-shadow: none;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	line-height: 1.3;
}

.tpm-mt-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
}

.tpm-mt-title {
	font-size: 15px;
}

.tpm-mt-panel .tpm-mt-switch {
	padding: 3px 12px;
	border: 1px solid #b85450;
	border-radius: 999px;
	background: #fff;
	color: #b85450;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.tpm-mt-panel .tpm-mt-switch.is-on {
	background: #b85450;
	color: #fff;
}

.tpm-mt-count,
.tpm-mt-source {
	color: #5d7f99;
	font-size: 13px;
}

.tpm-mt-hint {
	margin: 0;
	color: #5d7f99;
	font-size: 13px;
}

/* 0.8.0: presets, Reset and Fine-tune flow in the same wrapping row as the button, On/Off and the count. */
.tpm-mt-chips {
	display: contents;
}

.tpm-mt-panel .tpm-mt-chip,
.tpm-mt-panel .tpm-mt-reset {
	padding: 4px 10px;
	border: 1px solid #c5d2dc;
	border-radius: 999px;
	background: #fff;
	color: #23445d;
	font-size: 13px;
	cursor: pointer;
}

.tpm-mt-panel .tpm-mt-chip:hover,
.tpm-mt-panel .tpm-mt-reset:hover {
	border-color: #b85450;
}

.tpm-mt-panel .tpm-mt-chip.is-on {
	border-color: #b85450;
	background: #b85450;
	color: #fff;
}

.tpm-mt-panel .tpm-mt-reset {
	border-style: dashed;
	color: #5d7f99;
}

/* "Fine-tune" — a toggle chip: "+" while closed, "−" while open. */
.tpm-mt-panel .tpm-mt-more-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px 5px 8px;
	border: 1px solid #5d7f99;
	border-radius: 999px;
	background: #fff;
	color: #23445d;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.tpm-mt-panel .tpm-mt-more-toggle:hover,
.tpm-mt-panel .tpm-mt-more-toggle.is-open {
	border-color: #b85450;
}

.tpm-mt-pm {
	position: relative;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #23445d;
}

.tpm-mt-more-toggle.is-open .tpm-mt-pm {
	background: #b85450;
}

.tpm-mt-pm::before,
.tpm-mt-pm::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 2px;
	border-radius: 1px;
	background: #fff;
	transform: translate(-50%, -50%);
	transition: transform 0.15s ease;
}

.tpm-mt-pm::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.tpm-mt-more-toggle.is-open .tpm-mt-pm::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

.tpm-mt-badge {
	min-width: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: #b85450;
	color: #fff;
	font-size: 11px;
	line-height: 16px;
	text-align: center;
}

.tpm-mt-dials {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 8px 14px;
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #d5dee6;
}

.tpm-mt-dial {
	display: flex;
	flex-direction: column;
	gap: 3px;
	justify-content: flex-end; /* selects stay on one line when a label wraps */
	font-size: 12px;
}

.tpm-mt-dial select {
	max-width: 100%;
	padding: 4px 6px;
	border: 1px solid #c5d2dc;
	border-radius: 6px;
	background: #fff;
	color: #23445d;
	font-size: 13px;
}

.tpm-mt-panel button:focus-visible,
.tpm-mt-panel select:focus-visible {
	outline: 2px solid #5d7f99;
	outline-offset: 2px;
}

/* ---------- layer over the map (inside the Image Map Pro zoom box, so it zooms with the map) ---------- */

.tpm-mt-layer {
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
}

.tpm-mt-mask {
	position: absolute;
	box-sizing: border-box;
	border: 1px dashed rgba(255, 255, 255, 0.55);
	border-radius: 4px;
	background: rgba(54, 78, 99, 0.42);
	pointer-events: auto;
	cursor: not-allowed;
}

.tpm-mt-mask--hide {
	border-color: transparent;
	background: rgba(78, 104, 126, 0.96);
}

.imp-shape.tpm-mt-off {
	pointer-events: none !important;
}

.tpm-mt-arrows {
	position: absolute;
	inset: 0;
	overflow: visible;
}

.tpm-mt-edge {
	fill: none;
	stroke: #5d6368;
	stroke-width: 2px;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ?tpm-arrows=check: the plugin arrows in pink over the painted ones */
.tpm-mt-arrows.is-check .tpm-mt-edge {
	opacity: 0.85;
}

.tpm-mt-edge.is-loop {
	stroke-dasharray: 6 5;
}

.tpm-mt-caption {
	position: absolute;
	padding: 0 4px;
	border-radius: 2px;
	background: #5d6368;
	color: #fff;
	font-family: Roboto, Arial, sans-serif;
	font-size: clamp(7px, 0.62vw, 11px);
	line-height: 1.35;
	white-space: nowrap;
	transform: translate(-50%, -50%);
}

/* Caption on a vertical line reads bottom to top, along the line (as on the painted map). */
.tpm-mt-caption.is-vertical {
	transform: translate(-50%, -50%) rotate(-90deg);
}

/* left step list on project pages */
.tpm-mt-hidden {
	display: none !important;
}

@media (max-width: 600px) {
	.tpm-mt-panel {
		padding: 8px 10px;
	}

	.tpm-mt-dials {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	}
}

@media (max-width: 380px) {
	.tpm-mt-dials {
		grid-template-columns: 1fr;
	}
}

/* 0.7.0: the button sits inside the open panel as its first row (one box, Max 30.10). */
.tpm-mt-bar .tpm-mt-panel .tpm-mt-toggle {
	border-color: #b85450;
}

/* ---------- 0.9.0 (Max, video 31.10 + Alex 31.10) ---------- */

/* The map always takes the full width of its column. Image Map Pro caps .imp-wrap at the picture's own
   width (inline max-width: 1497px on the phase maps), and the map block shrank to it inside the
   vertical flex group of the home page — so the second map was narrower than the first. */
[data-tpm-mt] {
	align-self: stretch;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
}

[data-tpm-mt] .imp-wrap {
	width: 100% !important;
	max-width: 100% !important;
}

/* Every item of the panel stays on one line: no button, chip or label breaks into two lines. */
.tpm-mt-head > *,
.tpm-mt-panel .tpm-mt-chip,
.tpm-mt-panel .tpm-mt-reset,
.tpm-mt-panel .tpm-mt-more-toggle,
.tpm-mt-bar .tpm-mt-toggle {
	flex-shrink: 0;
	white-space: nowrap;
}

.tpm-mt-dial > span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Wide screens: the whole head is ONE row; the hint gives way (shortened with "…", full text on hover). */
@media (min-width: 1200px) {
	.tpm-mt-head {
		flex-wrap: nowrap;
	}

	.tpm-mt-head > .tpm-mt-hint {
		flex: 1 1 auto;
		flex-shrink: 1;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}

/* Project page of the cabinet: read-only panel with a visible note why. */
.tpm-mt-head > .tpm-mt-lock-note {
	display: inline-flex;
	flex: 1 1 auto;
	flex-shrink: 1;
	align-items: center;
	gap: 6px;
	min-width: 0;
	padding: 3px 10px;
	overflow: hidden;
	border-radius: 999px;
	background: #e8eef3;
	color: #23445d;
	font-size: 13px;
	text-overflow: ellipsis;
}

.tpm-mt-lock-note svg {
	flex: 0 0 auto;
	color: #b85450;
}

.tpm-mt-dial.is-locked select {
	background: #eef2f5;
	color: #23445d;
	opacity: 1;
	cursor: not-allowed;
}

.tpm-mt-lock-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- 0.9.5 (Max, video 3 of 02.11): compact bar ---------- */

/* Normal bar: the presets are plain chips in the row, the folding button is not shown. */
.tpm-mt-presets,
.tpm-mt-presets-list {
	display: contents;
}

.tpm-mt-panel .tpm-mt-presets-btn {
	display: none;
}

/* Compact bar (the one row would not fit): the hint hides, the presets fold into one "+ Project type" chip,
   their list drops down under it on hover (computer) or on tap. Reset and Fine-tune always stay visible. */
.tpm-mt-bar.is-compact .tpm-mt-head > .tpm-mt-hint {
	display: none;
}

.tpm-mt-bar.is-compact .tpm-mt-presets {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
}

.tpm-mt-bar.is-compact .tpm-mt-panel .tpm-mt-presets-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: 260px;
	padding: 4px 10px 4px 6px;
	border: 1px solid #c5d2dc;
	border-radius: 999px;
	background: #fff;
	color: #23445d;
	font-size: 13px;
	white-space: nowrap;
	cursor: pointer;
}

.tpm-mt-presets-label {
	overflow: hidden;
	text-overflow: ellipsis;
}

.tpm-mt-bar.is-compact .tpm-mt-panel .tpm-mt-presets-btn.is-on {
	border-color: #b85450;
	background: #b85450;
	color: #fff;
}

.tpm-mt-presets-btn.is-on .tpm-mt-pm {
	background: #fff;
}

.tpm-mt-presets-btn.is-on .tpm-mt-pm::before,
.tpm-mt-presets-btn.is-on .tpm-mt-pm::after {
	background: #b85450;
}

.tpm-mt-bar.is-compact .tpm-mt-presets:hover .tpm-mt-pm::after,
.tpm-mt-bar.is-compact .tpm-mt-presets.is-open .tpm-mt-pm::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

.tpm-mt-bar.is-compact .tpm-mt-presets-list {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 90;
	display: none;
	flex-direction: column;
	align-items: stretch;
	gap: 6px;
	min-width: 100%;
	margin: 0;
	padding: 8px;
	border: 1px solid #d5dee6;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 6px 18px rgba(35, 68, 93, 0.18);
}

/* A transparent strip above the list keeps the hover alive while the pointer moves down to it. */
.tpm-mt-bar.is-compact .tpm-mt-presets-list::before {
	content: "";
	position: absolute;
	top: -8px;
	right: 0;
	left: 0;
	height: 8px;
}

.tpm-mt-bar.is-compact .tpm-mt-presets {
	padding-bottom: 0;
}

.tpm-mt-bar.is-compact .tpm-mt-presets-list .tpm-mt-chip {
	text-align: left;
}

@media (hover: hover) {
	.tpm-mt-bar.is-compact .tpm-mt-presets:hover .tpm-mt-presets-list {
		display: flex;
	}
}

.tpm-mt-bar.is-compact .tpm-mt-presets.is-open .tpm-mt-presets-list,
.tpm-mt-bar.is-compact .tpm-mt-presets:focus-within .tpm-mt-presets-list {
	display: flex;
}

.tpm-mt-bar.is-compact .tpm-mt-presets-list {
	margin-top: 4px;
}
