/* stylelint-disable selector-class-pattern */

/**
 * B2B Resources archive page layout.
 *
 * Constrains each section row to 80% of the viewport width with a 1440px
 * maximum on desktop/tablet, and 90% width on mobile. All token values
 * reference var(--wp--preset--*) properties generated from theme.json.
 */

/* Sticky anchor navigation bar */
.b2b-archive-nav {
	padding: 0;
	position: sticky;
	top: 0;
	z-index: 10;
}

/*
 * Spread nav links equally across the full bar width.
 * The navigation block stamps justify-content:center via its layout
 * classes; width:100% + justify-content:unset override that, and
 * flex:1 on each <li> divides the bar into identical columns.
 */
.b2b-archive-nav .wp-block-navigation {
	width: 100%;
	max-width: unset;
	margin: 0 !important;
	background-color: var(--wp--preset--color--white);
}

.b2b-archive-nav .wp-block-navigation__container {
	z-index: 100;
	width: 100%;
	min-height: 100px;
	justify-content: unset;
	background-color: var(--wp--preset--color--noom-off-white);
	border-bottom-left-radius: 50px;
}

.b2b-archive-nav .wp-block-navigation-item {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
}

/* ── Search form ─────────────────────────────────────────────────────────── */

/* "SEARCH" label: magnifying-glass icon + uppercase text */
body.post-type-archive-b2b_resource .b2b-search-label {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-family: var(--wp--preset--font-family--label);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}

body.post-type-archive-b2b_resource .b2b-search-label::before {
	content: "";
	display: inline-block;
	width: 1em;
	height: 1em;
	flex-shrink: 0;
	background-color: currentcolor;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='black'%3E%3Cpath fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='black'%3E%3Cpath fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/%3E%3C/svg%3E");
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

/* Right-justify label + input within the group */
.b2b-search-group.wp-block-group {
	justify-content: flex-end;
	min-width: 0;
}

/* SearchWP form: fill the remaining flex space */
body.post-type-archive-b2b_resource .b2b-search-group .searchwp-form {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
}

/* Reset SearchWP's own flex wrappers so the input fills the space */
.b2b-search-group .swp-flex--col,
.b2b-search-group .swp-flex--row,
body.post-type-archive-b2b_resource .b2b-search-group .searchwp-form-input-container {
	display: contents;
}

/* Pill-shaped input.
 * SearchWP enqueues its own styles using the ID selector #searchwp-form-{n},
 * which always outweighs class/attribute selectors. !important is intentional
 * here to override the third-party plugin rule in our archive context only.
 */
.b2b-search-group [id^="searchwp-form"] .swp-input {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box !important;
	padding: 10px 20px !important;
	border: 0 !important;
	border-radius: 50px !important;
	background: none !important;
	background-color: var(--wp--preset--color--white) !important;
	font-size: 1rem !important;
	line-height: 1.5 !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	box-shadow: none !important;
}

.b2b-search-group [id^="searchwp-form"] .swp-input:focus {
	outline: 2px solid var(--wp--preset--color--noom-black) !important;
	outline-offset: 2px !important;
}

.b2b-all-resources .b2b-search-group [id^="searchwp-form"] .swp-input {
	background-color: var(--wp--preset--color--noom-off-white) !important;
}

/* ── All-resources taxonomy filters ─────────────────────────────────────── */

/* Place label and select on the same line */
.b2b-all-resources .wp-block-query-filter {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 10px;
}

/* Match the "SEARCH" label typography */
.b2b-all-resources .wp-block-query-filter__label {
	flex-shrink: 0;
	margin: 0;
	font-family: var(--wp--preset--font-family--label);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Pill-shaped select matching the SearchWP input */
.b2b-all-resources .wp-block-query-filter__select {
	padding: 10px 40px 10px 20px;
	border: 0;
	border-radius: 50px;
	background-color: var(--wp--preset--color--noom-off-white);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	background-size: 12px 8px;
	font-size: 1rem;
	font-family: inherit;
	line-height: 1.5;
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none;
	cursor: pointer;
}

.b2b-all-resources .wp-block-query-filter__select:focus {
	outline: 2px solid var(--wp--preset--color--noom-black);
	outline-offset: 2px;
}

@media (max-width: 781px) {

	.b2b-archive-nav {
		position: static !important;
	}

	.b2b-filter-group.wp-block-group,
	.b2b-search-group.wp-block-group,
	.b2b-all-resources .wp-block-query-filter {
		align-items: stretch;
		flex-direction: column;
		width: 100%;
	}

	.b2b-filter-group.wp-block-group,
	.b2b-all-resources .wp-block-query-filter {
		gap: 8px;
	}

	body.post-type-archive-b2b_resource .b2b-search-label,
	.b2b-all-resources .wp-block-query-filter__label {
		white-space: normal;
	}

	.b2b-all-resources .wp-block-query-filter__select,
	body.post-type-archive-b2b_resource .b2b-search-group .searchwp-form {
		width: 100%;
		max-width: 100%;
	}
}
