/**
 * QES PRO directory section — filter sidebar + results grid.
 *
 * Brand: Navy var(--pro-navy, #0d2952) (primary), Crimson var(--pro-teal, #12B5AA) (accent).
 * Desktop: two columns (filter + results). Mobile: filter becomes an
 * off-canvas drawer toggled by the Filters button.
 */

.qes-dir {
	position: relative;
	width: 100%;
	font-family: var(--pro-font, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
}

/* ---- Hero header + search bar ---- */
.qes-dir__hero {
	background: linear-gradient(115deg, var(--pro-navy, #0d2952), var(--pro-navy-700, #1b3f6e));
	color: #fff;
	border-radius: 18px;
	padding: 34px 30px;
	margin-bottom: 24px;
}
.qes-dir__hero-title {
	font-size: 28px;
	font-weight: 800;
	margin: 0 0 8px;
	color: #fff;
}
.qes-dir__hero-sub {
	margin: 0;
	opacity: 0.85;
	font-size: 14.5px;
	max-width: 640px;
}
.qes-dir__search {
	display: flex;
	gap: 10px;
	margin-top: 20px;
	background: #fff;
	border-radius: 12px;
	padding: 8px;
	flex-wrap: wrap;
}
.qes-dir__search-input {
	flex: 1 1 220px;
	min-width: 0;
	border: 1px solid var(--pro-line, #e6e9f0);
	border-radius: 8px;
	padding: 12px 14px;
	font-size: 14px;
	color: var(--pro-navy, #0d2952);
}
.qes-dir__search-go {
	flex: 0 0 auto;
	background: var(--pro-teal, #12B5AA);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 12px 28px;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
}
.qes-dir__search-go:hover { background: var(--pro-teal-700, #0C746D); }

/* ---- Results-only page (search results): branded hero ---- */
/* Full-bleed: break out of the theme's container so the Navy band spans the
   whole viewport width, regardless of the wrapper's max-width/padding. The
   negative viewport margins pull the edges out; inner padding re-centers. */
.qes-dir__res-hero {
	box-sizing: border-box;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	margin-bottom: 28px;
	background: linear-gradient(115deg, var(--pro-navy, #0d2952), var(--pro-navy-700, #1b3f6e));
	color: #fff;
	padding: 56px 24px;
	text-align: center;
}
.qes-dir__res-eyebrow {
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--pro-star, #f6c358);
	margin-bottom: 10px;
}
.qes-dir__res-hero .qes-dir__res-title {
	font-size: 30px;
	font-weight: 800;
	color: #fff;
	margin: 0 0 4px;
}
.qes-dir__res-title {
	font-size: 24px;
	font-weight: 800;
	color: var(--pro-navy, #0d2952);
	margin: 0 0 16px;
}
.qes-dir__res-title em {
	font-style: normal;
	color: var(--pro-star, #f6c358);
}
/* In results-only mode the grid spans full width (no sidebar). */
.qes-dir--results-only .qes-dir__results--wide { width: 100%; }

/* ---- Search results: Companies / Guides tabs ---- */
.qes-dir__tabs {
	display: flex;
	justify-content: center;
	gap: 10px;
	margin: 0 0 24px;
}
.qes-dir__tab {
	appearance: none;
	background: var(--pro-sunken, #eef1f6);
	border: 0;
	border-radius: 999px;
	padding: 11px 26px;
	font-size: 15px;
	font-weight: 700;
	color: var(--pro-muted, #667085);
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}
.qes-dir__tab:hover { color: var(--pro-navy, #0d2952); }
.qes-dir__tab.is-active {
	background: var(--pro-navy, #0d2952);
	color: #fff;
}
/* Panes: only the active one shows. */
.qes-dir__pane { display: none; }
.qes-dir__pane.is-active { display: block; }

/* ---- Guide cards (articles in search results) ---- */
.qes-guides-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 22px;
}
.qes-guide-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--pro-sunken, #eceef3);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 2px 10px rgba(13, 41, 82, 0.05);
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.qes-guide-card:hover {
	box-shadow: 0 10px 26px rgba(13, 41, 82, 0.12);
	transform: translateY(-2px);
}
.qes-guide-card__media {
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--pro-sunken, #f1f4f9);
	line-height: 0;
	overflow: hidden;
}
.qes-guide-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.qes-guide-card__ph {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--pro-line, #c2cad8);
}
.qes-guide-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px 18px 16px;
	flex: 1 1 auto;
}
.qes-guide-card__tag {
	align-self: flex-start;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--pro-teal, #12B5AA);
	background: rgba(18,181,170,0.10);
	padding: 3px 9px;
	border-radius: 999px;
}
.qes-guide-card__title {
	font-size: 17px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
}
.qes-guide-card__title a {
	color: var(--pro-navy, #0d2952);
	text-decoration: none;
}
.qes-guide-card__title a:hover { color: var(--pro-teal, #12B5AA); }
.qes-guide-card__excerpt {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--pro-muted, #667085);
}
.qes-guide-card__meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: auto;
	padding-top: 6px;
	font-size: 12.5px;
}
.qes-guide-card__date { color: var(--pro-faint, #98a2b3); }
.qes-guide-card__read {
	font-weight: 700;
	color: var(--pro-teal, #12B5AA);
	text-decoration: none;
	white-space: nowrap;
}
.qes-guide-card__read:hover { color: var(--pro-teal-700, #0C746D); }

@media (max-width: 575px) {
	.qes-dir__res-hero { padding: 30px 20px; }
	.qes-dir__res-hero .qes-dir__res-title { font-size: 24px; }
	.qes-dir__tabs { overflow-x: auto; }
	.qes-dir__tab { padding: 12px 14px; white-space: nowrap; }
}

/* ---- Results header: count + sort ---- */
.qes-dir__res-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 16px;
}
.qes-dir__res-count { font-size: 14px; color: var(--pro-muted, #667085); }
.qes-dir__res-count b { color: var(--pro-navy, #0d2952); }
.qes-dir__sort { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.qes-dir__sort label { font-size: 13px; color: var(--pro-muted, #667085); font-weight: 600; white-space: nowrap; }
.qes-dir__sort-select {
	padding: 8px 12px;
	border: 1px solid var(--pro-line, #e6e9f0);
	border-radius: 8px;
	color: var(--pro-navy, #0d2952);
	font-weight: 600;
	font-size: 13px;
	background: #fff;
}

/* ---- Active filter chips ---- */
.qes-dir__chips {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 16px;
	align-items: center;
}
.qes-dir__chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--pro-sunken, #eef2f8);
	color: var(--pro-navy, #0d2952);
	border-radius: 20px;
	padding: 5px 12px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
}
.qes-dir__chip-x { color: var(--pro-teal, #12B5AA); font-weight: 800; font-size: 15px; line-height: 1; }
.qes-dir__chip-clear {
	background: transparent;
	border: 0;
	color: var(--pro-teal, #12B5AA);
	text-decoration: underline;
	cursor: pointer;
	font-size: 12.5px;
	font-weight: 600;
}

/* ---- Empty state ---- */
.qes-dir__empty {
	background: #fff;
	border: 1px dashed var(--pro-line, #c9d3e6);
	border-radius: 14px;
	padding: 50px 24px;
	text-align: center;
}
.qes-dir__empty-ico { color: var(--pro-navy-700, #4a6491); margin-bottom: 10px; }
.qes-dir__empty h3 { color: var(--pro-navy, #0d2952); font-size: 20px; margin: 0 0 6px; }
.qes-dir__empty p { color: var(--pro-muted, #667085); font-size: 14px; margin: 0 0 18px; }
.qes-dir__empty-cta {
	display: inline-block;
	background: var(--pro-navy, #0d2952);
	color: #fff;
	text-decoration: none;
	padding: 11px 24px;
	border-radius: 9px;
	font-weight: 700;
	font-size: 14px;
}
.qes-dir__empty-cta:hover { background: var(--pro-navy-900, #08203f); color: #fff; }

@media (max-width: 575px) {
	.qes-dir__hero { padding: 24px 18px; }
	.qes-dir__hero-title { font-size: 22px; }
	.qes-dir__search-go { width: 100%; }
	.qes-dir__res-head { flex-direction: column; align-items: flex-start; }
}

/* ---- Layout ---- */
.qes-dir__layout {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 28px;
	align-items: start;
}

.qes-dir__results {
	min-width: 0;
	transition: opacity 0.15s ease;
}
.qes-dir__results.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

/* ---- Filter card ---- */
.qes-dir__filter {
	background: #fff;
	border: 1px solid var(--pro-line, #e6e9f0);
	border-radius: 14px;
	padding: 22px;
	box-shadow: 0 2px 10px rgba(13, 41, 82, 0.05);
}

.qes-dir__filter-head { margin-bottom: 18px; }
.qes-dir__filter-title {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 800;
	color: var(--pro-navy, #0d2952);
	font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.qes-dir__filter-sub {
	margin: 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--pro-faint, #8a93a6);
}

.qes-dir__group {
	padding: 18px 0;
	border-top: 1px solid var(--pro-sunken, #eef0f5);
}
.qes-dir__group:first-of-type { border-top: 0; padding-top: 0; }
.qes-dir__group-title {
	margin: 0 0 12px;
	font-size: 14px;
	font-weight: 700;
	color: var(--pro-navy, #0d2952);
	text-transform: none;
}

/* Checkboxes + counts */
.qes-dir__check {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-bottom: 11px;
	font-size: 14px;
	color: var(--pro-ink, #3a4253);
	cursor: pointer;
}
.qes-dir__check:last-child { margin-bottom: 0; }
.qes-dir__check input {
	accent-color: var(--pro-navy, #0d2952);
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	margin: 0; /* override theme margins that misalign the box */
	vertical-align: middle;
	position: relative;
	top: 0;
}
.qes-dir__check-name { line-height: 1.3; }
.qes-dir__check--count .qes-dir__check-name { flex: 1 1 auto; }
.qes-dir__check-count { color: var(--pro-faint, #8a93a6); font-size: 13px; font-weight: 600; line-height: 1.3; }

/* --- Parent/child category tree --- */
.qes-dir__cat { margin-bottom: 11px; }
.qes-dir__cat:last-child { margin-bottom: 0; }
.qes-dir__cat-row { display: flex; align-items: center; gap: 6px; }
.qes-dir__cat-row .qes-dir__check { flex: 1 1 auto; margin-bottom: 0; }
/* Parent expand/collapse toggle (chevron) */
.qes-dir__cat-toggle {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	border: 0;
	background: transparent;
	cursor: pointer;
	padding: 0;
	border-radius: 6px;
	position: relative;
}
.qes-dir__cat-toggle:hover { background: var(--pro-sunken, #eef2f6); }
.qes-dir__cat-toggle::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 7px;
	height: 7px;
	border-right: 2px solid var(--pro-muted, #5b6b7b);
	border-bottom: 2px solid var(--pro-muted, #5b6b7b);
	transform: translate(-50%, -70%) rotate(45deg);
	transition: transform 0.18s ease;
}
.qes-dir__cat.is-open > .qes-dir__cat-row .qes-dir__cat-toggle::before {
	transform: translate(-50%, -30%) rotate(225deg);
}
/* Child sub-categories: indented under the parent */
.qes-dir__cat-kids {
	margin: 8px 0 2px 26px;
	padding-left: 12px;
	border-left: 1px solid var(--pro-line, #d7e0e8);
}
.qes-dir__cat-kids[hidden] { display: none; }
.qes-dir__cat-kids .qes-dir__check { font-size: 13.5px; margin-bottom: 9px; }
.qes-dir__cat-kids .qes-dir__check:last-child { margin-bottom: 0; }

/* Location pills */
.qes-dir__locations {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.qes-dir__loc {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px 8px;
	border: 1px solid var(--pro-line, #d6dce8);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	color: var(--pro-navy, #0d2952);
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.qes-dir__loc input { position: absolute; opacity: 0; pointer-events: none; }
.qes-dir__loc:hover { border-color: var(--pro-navy, #0d2952); }
.qes-dir__loc.is-active {
	background: var(--pro-navy, #0d2952);
	border-color: var(--pro-navy, #0d2952);
	color: #fff;
}

/* Actions */
.qes-dir__actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 20px;
}
.qes-dir__apply {
	width: 100%;
	padding: 13px;
	background: var(--pro-navy, #0d2952);
	color: #fff;
	border: 0;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s ease;
}
.qes-dir__apply:hover { background: var(--pro-navy-900, #08203f); }
.qes-dir__reset {
	width: 100%;
	padding: 11px;
	background: transparent;
	color: var(--pro-muted, #5a6478);
	border: 1px solid var(--pro-line, #d6dce8);
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.qes-dir__reset:hover { color: var(--pro-navy, #0d2952); border-color: var(--pro-navy, #0d2952); }

/* ---- Ad blocks ---- */
/* The banner image fills the block — no frame, padding, or label. */
.qes-dir__ad {
	margin-top: 22px;
	border-radius: 12px;
	overflow: hidden;
	text-align: center;
	line-height: 0; /* kill inline-image gap so the image flushes the edges */
}
.qes-dir__ad--ingrid {
	grid-column: 1 / -1;
	margin-top: 0;
}
.qes-dir__ad img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
}

/* ---- Empty state ---- */
.qes-dir__empty {
	padding: 40px 20px;
	text-align: center;
	color: var(--pro-faint, #8a93a6);
	font-size: 15px;
	background: var(--pro-sunken, #f8f9fc);
	border-radius: 12px;
}

/* ---- Pagination ---- */
.qes-dir__pagination {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 28px;
}
.qes-dir__pagination a,
.qes-dir__pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--pro-line, #d6dce8);
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--pro-navy, #0d2952);
	text-decoration: none;
	background: #fff;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.qes-dir__pagination a:hover { border-color: var(--pro-navy, #0d2952); }
.qes-dir__pagination .current {
	background: var(--pro-navy, #0d2952);
	border-color: var(--pro-navy, #0d2952);
	color: #fff;
}
.qes-dir__pagination .dots { border-color: transparent; background: transparent; }

/* ---- Mobile toggle / drawer ---- */
.qes-dir__mobile-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
	padding: 11px 18px;
	background: var(--pro-navy, #0d2952);
	color: #fff;
	border: 0;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}
.qes-dir__backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(7, 16, 33, 0.5);
	z-index: 9998;
}

@media (max-width: 900px) {
	.qes-dir__layout { grid-template-columns: 1fr; }
	.qes-dir__mobile-toggle { display: inline-flex; }

	/* The filter is an off-canvas drawer: a fixed panel slid off-screen to the
	   left by default, regardless of where it sits in the DOM (it lives in the
	   root when closed and is moved to <body> while open — see JS). It only
	   becomes visible when the open class is present. */
	.qes-dir .qes-dir__filter,
	body > .qes-dir__filter {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: 86%;
		max-width: 340px;
		z-index: 100000;
		border-radius: 0;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		box-shadow: 4px 0 24px rgba(7, 16, 33, 0.25);
	}

	/* Slide in only when open (class is on <body> while the panel is parked there). */
	body.qes-dir--drawer-open > .qes-dir__filter {
		transform: translateX(0);
	}

	/* Backdrop: hidden by default, shown when open. */
	.qes-dir__backdrop { display: none; }
	body.qes-dir--drawer-open .qes-dir__backdrop {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 99999;
	}
}

/* Lock background scroll while the drawer is open. */
body.qes-dir-noscroll { overflow: hidden; }
