/**
 * Boxed "Split Map/Content with sidebar" archive (Customizer > Listings List
 * Options > Split layout width: Boxed). Inside the site container: the
 * categories bar with the Filters button as one sticky row on top, the list
 * on the left and a sticky rounded map on the right. Below 1024px the map
 * opens full screen from a floating "Show map" button.
 *
 * Loaded only with that option. The markup is the regular split template
 * (listeo-core templates/archive-listing-split-sidebar.php); its wrappers are
 * flattened with display: contents so the parts sit in one grid. The sticky
 * offsets come from listeo-core assets/js/archive-split-views.js.
 */
body.listeo-split-boxed-layout {
	/* Same edges as a boxed page under the header builder header. */
	--listeo-split-boxed-width: 1334px;
	--listeo-split-gap: 48px;
	--listeo-split-radius: 20px;
	--listeo-split-text: #222;
	--listeo-split-muted: #6a6a6a;
	--listeo-split-line: #ebebeb;
	/* The page scrolls, not the list column. */
	max-height: none;
	overflow: visible;
}

/* Theme header: the width of its .container. */
body.listeo-split-boxed-layout:not(.lhb-header-builder-enabled) {
	--listeo-split-boxed-width: 1180px;
}

/* Layout grid. The body class outranks the full-height rules of the split
   layout and of the header builder (header-builder-frontend.css). */
body.listeo-split-boxed-layout .full-page-container.full-page-jobs.listeo-split-boxed {
	display: grid;
	grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
	grid-template-rows: auto auto 1fr;
	grid-template-areas:
		"bar bar"
		"title map"
		"list map";
	column-gap: var(--listeo-split-gap);
	box-sizing: border-box;
	width: min(100% - 66px, var(--listeo-split-boxed-width));
	height: auto;
	max-height: none;
	margin: 0 auto;
	padding: 0;
	overflow: visible;
}

.listeo-split-boxed > .full-page-content-container,
.listeo-split-boxed > .full-page-content-container > .full-page-content-inner,
.listeo-split-boxed .full-page-content-inner > .filters-container {
	display: contents;
}

/* Categories bar + Filters button */
.listeo-split-boxed .filters-container > .filter-button-container {
	grid-area: bar;
	position: sticky;
	top: var(--listeo-split-sticky-top, 0px);
	z-index: 30;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin: 0 0 24px;
	padding: 12px 0 0;
	border-bottom: 1px solid var(--listeo-split-line);
	background: #fff;
	/* White to the edges of the window while the list scrolls under it. */
	box-shadow: 0 0 0 100vmax #fff;
	clip-path: inset(0 -100vmax);
}

.listeo-split-boxed .filter-button-container > .slider-container {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	max-width: none;
	min-height: 0;
}

.listeo-split-boxed .filter-button-container > .listeo-filters-open,
.listeo-split-boxed .filter-button-container > .enable-filters-button {
	order: 2;
	margin: 0 0 12px auto;
}

/* "Show Filters" of the slide-in sidebar, shaped like the Filters button. */
.listeo-split-boxed .filter-button-container > .enable-filters-button,
.listeo-split-boxed .filter-button-container > .enable-filters-button.active {
	position: static;
	left: auto;
	top: auto;
	flex: 0 0 auto;
	min-width: 0;
	height: 48px;
	line-height: 46px;
	padding: 0 16px;
	border: 1px solid #ddd;
	border-radius: 12px;
	box-shadow: none;
}

.listeo-split-boxed .enable-filters-button .enable-filters-button-icon {
	display: none;
}

/* Category items: icon above label, active item underlined. */
.listeo-split-boxed .category-slider {
	padding: 0;
}

.listeo-split-boxed .category-item,
.listeo-split-boxed .category-item:hover,
.listeo-split-boxed .category-item.active {
	position: relative;
	flex: 0 0 auto;
	min-width: 56px;
	margin: 0 32px 0 0;
	padding: 4px 0 14px;
	border-radius: 0;
	background: none;
	transform: none;
	opacity: 1;
}

.listeo-split-boxed .category-item .icon-container {
	width: 24px;
	height: 24px;
	margin: 0 0 8px;
	opacity: 0.7;
	transition: opacity 0.2s;
}

.listeo-split-boxed .category-item .icon-container i,
.listeo-split-boxed .category-item .icon-container i.fa,
.listeo-split-boxed .category-item .icon-container i.sl {
	height: 24px;
	margin: 0;
	color: var(--listeo-split-text);
	font-size: 22px;
	line-height: 24px;
}

.listeo-split-boxed .category-item .icon-container svg,
.listeo-split-boxed .category-item .icon-container svg.listeo-term-svg-icon,
.listeo-split-boxed .category-item .icon-container img {
	width: 24px;
	height: 24px;
	color: var(--listeo-split-text);
	fill: currentColor;
}

.listeo-split-boxed .category-item .category-name,
.listeo-split-boxed .category-item:hover .category-name {
	color: var(--listeo-split-muted);
	font-size: 12px;
	line-height: 16px;
	font-weight: 500;
	white-space: nowrap;
}

.listeo-split-boxed .category-item:hover .category-name,
.listeo-split-boxed .category-item.active .category-name {
	color: var(--listeo-split-text);
}

.listeo-split-boxed .category-item:hover .icon-container,
.listeo-split-boxed .category-item.active .icon-container {
	opacity: 1;
}

.listeo-split-boxed .category-item::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: transparent;
	transition: background-color 0.2s;
}

.listeo-split-boxed .category-item:hover::after {
	background: #ddd;
}

.listeo-split-boxed .category-item.active::after {
	background: var(--listeo-split-text);
}

/* Icons from the library are filled with the primary color: one color for the
   whole row. Line icons (fill="none") keep their stroke. */
body .listeo-split-boxed .category-item .listeo-svg-icon-box-grid svg:not([fill="none"]) :is(g, circle, rect, path, polygon, ellipse):not([fill="none"]) {
	fill: currentColor;
}

/* Round prev / next arrows when the categories overflow. */
.listeo-split-boxed .nav-button {
	width: 48px;
	height: 100%;
	background-image: linear-gradient(90deg, rgb(255 255 255 / 0%) 0%, #fff 45%);
}

.listeo-split-boxed .nav-button.prev {
	background-image: linear-gradient(90deg, #fff 55%, rgb(255 255 255 / 0%) 100%);
}

.listeo-split-boxed .nav-button:before {
	width: 32px;
	height: 32px;
	border-color: #ddd;
	box-shadow: none;
}

.listeo-split-boxed .nav-button:hover:before {
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.listeo-split-boxed .nav-button svg {
	width: 16px;
	height: 16px;
	fill: var(--listeo-split-text);
}

/* Title row: archive title and sorting */
.listeo-split-boxed .split-grid-title-row,
.listeo-split-boxed .split-grid-sort-below-filters {
	grid-area: title;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	min-width: 0;
	margin: 0 0 24px;
}

.listeo-split-boxed .split-grid-title-row .page-title {
	margin: 0;
	padding: 0;
	color: var(--listeo-split-text);
	font-size: 26px;
	line-height: 32px;
	font-weight: 600;
}

.listeo-split-boxed .split-grid-sort-below-filters {
	justify-content: flex-end;
}

/* Grid/list switcher next to the sorting. */
.listeo-split-boxed .split-grid-sort-control {
	display: flex;
	align-items: center;
	gap: 16px;
}

.listeo-split-boxed .split-grid-sort-control .col-md-3,
.listeo-split-boxed .split-grid-sort-control .col-md-9 {
	display: flex;
	align-items: center;
	width: auto;
	float: none;
	margin: 0;
	padding: 0;
}

/* Above the size where the theme hides the switcher. */
@media (min-width: 769px) {
	.listeo-split-boxed .split-grid-sort-control .layout-switcher {
		display: flex;
		align-items: center;
		gap: 4px;
	}
}

.listeo-split-boxed .split-grid-sort-control .fullwidth-filters {
	top: 0;
}

.listeo-split-boxed .split-grid-sort-control .sort-by {
	top: 0;
	float: none;
	margin: 0;
}

.listeo-split-boxed .split-grid-sort-control .sort-by-select {
	float: none;
	margin: 0;
	vertical-align: top;
}

/* Sorting: plain text on every screen, the title keeps the weight of the row. */
.listeo-split-boxed .split-grid-sort-control .select2-container--default .select2-selection--single .select2-selection__rendered,
.listeo-split-boxed .split-grid-sort-control .select2-container--default .select2-selection--single .select2-selection__rendered:hover {
	padding-left: 0;
	background: none !important; /* Beats the phone pill of style.css. */
	color: var(--listeo-split-text);
	font-size: 14px;
	font-weight: 500;
}

.listeo-split-boxed .split-grid-sort-control .col-md-12,
.listeo-split-boxed .split-grid-sort-control .fullwidth-filters {
	width: auto;
	float: none;
	margin: 0;
	padding: 0;
}

/* List */
.listeo-split-boxed .full-page-job-listings-container {
	grid-area: list;
	min-width: 0;
	padding: 0 0 48px;
}

.listeo-split-boxed .full-page-job-listings-container > .fs-switcher {
	margin: 0;
}

.listeo-split-boxed.full-page-container .full-page-content-container #listeo-listings-container:not(.list_old-layout):not(.grid_old-layout):not(.compact):not(.compact-layout) {
	padding: 0;
}

.listeo-split-boxed .pagination-container {
	margin: 40px 0 0 !important;
}

.listeo-split-boxed .listeo-load-more-container {
	margin-top: 0 !important;
}

/* Map: sticky under the bar, rounded */
.listeo-split-boxed > .full-page-map-container {
	grid-area: map;
	position: sticky;
	/* The script sets the real offsets. The fallbacks are the usual header and bar. */
	top: calc(var(--listeo-split-sticky-top, 82px) + var(--listeo-split-bar-height, 79px) + 24px);
	align-self: start;
	flex: none;
	height: calc(100vh - var(--listeo-split-sticky-top, 82px) - var(--listeo-split-bar-height, 79px) - 48px);
	min-height: 360px;
	overflow: hidden;
	border-radius: var(--listeo-split-radius);
	/* Shows beyond the tiles when a wide zoom leaves part of the map empty. */
	background: #f2f2f2;
	/* Clips the Leaflet panes to the rounded corners. */
	isolation: isolate;
}

.listeo-split-boxed > .full-page-map-container #map-container {
	height: 100%;
	margin: 0;
}

.listeo-split-boxed .listeo-split-map-toggle {
	display: none;
}

/* Tablets and phones: list only, the map opens full screen. */
@media (max-width: 1024px) {
	body.listeo-split-boxed-layout .full-page-container.full-page-jobs.listeo-split-boxed {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"bar"
			"title"
			"list";
		width: 100%;
		padding: 0 16px;
	}

	.listeo-split-boxed .filters-container > .filter-button-container {
		gap: 12px;
	}

	.listeo-split-boxed .category-item,
	.listeo-split-boxed .category-item:hover,
	.listeo-split-boxed .category-item.active {
		margin-right: 24px;
	}

	.listeo-split-boxed .split-grid-title-row .page-title {
		font-size: 22px;
		line-height: 28px;
	}

	.listeo-split-boxed > .full-page-map-container {
		position: fixed;
		inset: 0;
		/* Above sticky headers (the header builder uses 1100). */
		z-index: 1101;
		align-self: stretch;
		height: auto;
		min-height: 0;
		border-radius: 0;
		visibility: hidden;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease, visibility 0.2s ease;
	}

	.listeo-split-boxed > .full-page-map-container.map-active {
		visibility: visible;
		opacity: 1;
		pointer-events: auto;
	}

	/* The collapsible mobile map of custom.js does not apply here. */
	body .listeo-split-boxed > .full-page-map-container #map-container,
	body.mobile-map-collapsible-loading .listeo-split-boxed > .full-page-map-container #map-container {
		height: 100% !important;
		max-height: none !important;
		margin: 0;
	}

	.listeo-split-boxed #map-container.mobile-map-collapsible::after,
	.listeo-split-boxed .mobile-map-toggle-btn,
	.listeo-split-boxed .mobile-map-collapse-btn {
		display: none !important;
	}

	.listeo-split-boxed > .listeo-split-map-toggle,
	.listeo-split-boxed > .listeo-split-map-toggle:hover,
	.listeo-split-boxed > .listeo-split-map-toggle:focus {
		position: fixed;
		left: 50%;
		bottom: calc(24px + env(safe-area-inset-bottom));
		z-index: 1102;
		display: inline-flex;
		align-items: center;
		gap: 8px;
		height: 48px;
		padding: 0 20px;
		border-radius: 999px;
		background: #222;
		color: #fff;
		font-size: 14px;
		font-weight: 600;
		line-height: 48px;
		text-decoration: none;
		white-space: nowrap;
		box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
		transform: translateX(-50%);
	}

	.listeo-split-boxed > .listeo-split-map-toggle::after {
		content: "\f279";
		font-family: "Font Awesome 6 Free";
		font-weight: 900;
		font-size: 14px;
	}

	.listeo-split-boxed > .full-page-map-container.map-active ~ .listeo-split-map-toggle::after {
		content: "\f03a";
	}
}

/* Phones: an icon-only Filters button leaves the row to the categories. */
@media (max-width: 600px) {
	.listeo-split-boxed .filter-button-container > .listeo-filters-open {
		justify-content: center;
		width: 48px;
		padding: 0;
	}

	.listeo-split-boxed .listeo-filters-open__text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* Filters as a slide-in panel over the page (Filters display: Sidebar). */
body.listeo-split-boxed-layout .listeo-split-boxed > .full-page-sidebar.hidden-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	z-index: 1103;
	width: 380px;
	max-width: 100%;
	max-height: none;
	height: 100%;
	overflow-y: auto;
	visibility: hidden;
	opacity: 1;
	box-shadow: 0 0 24px rgba(0, 0, 0, 0.18);
	transform: translateX(-100%);
	transition: transform 0.3s ease, visibility 0.3s ease;
}

body.listeo-split-boxed-layout .listeo-split-boxed > .full-page-sidebar.hidden-sidebar.enabled-sidebar {
	max-width: 100%;
	visibility: visible;
	transform: none;
}

/* Its own "Hide Filters" button closes it on every screen size. */
.listeo-split-boxed > .full-page-sidebar .sidebar-container .enable-filters-button,
.listeo-split-boxed > .full-page-sidebar .sidebar-container .enable-filters-button.active {
	position: static;
	display: block;
	width: 100%;
	height: 48px;
	margin: 0 0 20px;
	padding: 0 16px;
	border-radius: 12px;
}
