/**
 * Facilitator directory.
 *
 * Scoped under .cfd so nothing leaks into the theme, and built on custom
 * properties so the child theme can restyle without overriding rules.
 */

.cfd {
	--cfd-gap: 1.5rem;
	--cfd-radius: 14px;
	--cfd-border: #e2e8e7;
	--cfd-ink: #1b2422;
	--cfd-muted: #444;
	--cfd-accent: #DC530A;
	--cfd-surface: #fff;
	--cfd-placeholder: #eef3f1;
	/* Buttons follow the site's square-ish corners, not a pill. */
	--cfd-btn-radius: 8px;

	/* Philosopher is Flatsome's heading font, self-hosted via OMGF. Exposed as
	   tokens so a child theme can retarget both in one place if the theme's
	   heading font or brand colour ever changes. */
	--cfd-heading-font: 'Philosopher', sans-serif;
	--cfd-heading-color: var(--cfd-accent);

	margin: 0 auto;
	max-width: 1240px;
}

/* ---------- filters ---------- */

.cfd .cfd-filters__grid {
	display: grid;
	/* 170px keeps two columns on a phone: 2 x 170 + 1rem gap = 356px, which
	   fits inside a 390px viewport once page padding is taken off. Narrower
	   than that and auto-fit drops to one column on its own. */
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 1rem;
	margin: 0;
}

.cfd-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0;
}

.cfd-field label {
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--cfd-muted);
}

.cfd .cfd-field select,
.cfd .cfd-field select[multiple] {
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--cfd-border);
	border-radius: 10px;
	background: var(--cfd-surface);
	color: var(--cfd-ink);
	font-size: 0.95rem;
	height: auto;
	/* Themes give form controls a bottom margin; the filter grid spaces its
	   own rows with gap, so the inherited margin only adds a gutter. */
	margin-bottom: 0;
}

/*
 * Dimmed with opacity on purpose: letting the page colour show through is the
 * intended look, so a disabled Region or City field picks up whatever sits
 * behind the grid rather than staying flat white.
 */
.cfd-field select:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.cfd-filters__actions {
	display: flex;
	gap: 0.6rem;
	align-items: center;
	margin: 1rem 0 0;
}

/*
 * Scoped under .cfd and element-qualified for the same reason as the grid:
 * themes style bare `button` / `.button` / `input[type=submit]` with a bottom
 * margin, and a single-class selector only ties with them - source order then
 * decides, which is not something a plugin can rely on.
 */
.cfd .cfd-btn,
.cfd a.cfd-btn,
.cfd button.cfd-btn,
.cfd .cfd-map-toggle,
.cfd button.cfd-map-toggle {
	margin: 0;
}

.cfd-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.65rem 1.25rem;
	border-radius: var(--cfd-btn-radius, 8px);
	border: 1px solid transparent;
	font-size: 0.92rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	line-height: 1.2;
}

.cfd .cfd-btn--primary,
.cfd a.cfd-btn--primary,
.cfd button.cfd-btn--primary {
	background: var(--cfd-accent);
	color: #fff;
	margin: 0;
}

.cfd .cfd-btn--plain,
.cfd a.cfd-btn--plain {
	background: transparent;
	color: var(--cfd-muted);
	border-color: var(--cfd-border);
	margin: 0;
}

.cfd-btn:focus-visible,
.cfd-map-toggle:focus-visible,
.cfd-card__link:focus-visible,
.cfd-field select:focus-visible {
	outline: 2px solid var(--cfd-accent);
	outline-offset: 2px;
}

/* ---------- toolbar ---------- */

.cfd-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin: 1.75rem 0 1rem;
}

.cfd-count {
	margin: 0;
	color: var(--cfd-muted);
	font-size: 0.95rem;
}

.cfd .cfd-map-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.4rem 1rem;
	border: 1px solid var(--cfd-border);
	border-radius: var(--cfd-btn-radius, 8px);
	background: var(--cfd-surface);
	color: var(--cfd-ink);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}

.cfd-map-toggle__icon {
	display: inline-flex;
	color: var(--cfd-accent);
}

/* ---------- map ---------- */

.cfd-map {
	height: 460px;
	margin-bottom: 1.75rem;
	border: 1px solid var(--cfd-border);
	border-radius: var(--cfd-radius);
	overflow: hidden;
	background: var(--cfd-placeholder);
}

.cfd-map[hidden] {
	display: none;
}

/* CSS pin, so no marker images are shipped or requested. */
.cfd-pin__dot {
	display: block;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--cfd-accent, #DC530A);
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.cfd-popup {
	display: grid;
	gap: 0.35rem;
	justify-items: center;
	text-align: center;
	min-width: 150px;
}

.cfd-popup__img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 50%;
}

.cfd-popup__name {
	font-size: 0.98rem;
}

.cfd-popup__place {
	color: var(--cfd-muted, #444);
	font-size: 0.85rem;
}

.cfd-popup__link {
	margin-top: 0.2rem;
	font-weight: 600;
	color: var(--cfd-accent, #DC530A);
}

/* ---------- grid ---------- */

/*
 * Selectors are deliberately over-specific here. Themes style bare `ul` and
 * `li` inside content areas - Flatsome indents list items - and those rules
 * beat a single-class selector, so the grid inherits a left margin it should
 * not have.
 */
.cfd .cfd-grid,
.cfd ul.cfd-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: var(--cfd-gap);
	list-style: none;
	margin: 0;
	margin-left: 0;
	padding: 0;
	padding-left: 0;
}

.cfd .cfd-grid .cfd-card,
.cfd ul.cfd-grid > li.cfd-card {
	margin: 0;
	margin-left: 0;
	padding: 0;
	list-style: none;
}

.cfd .cfd-grid .cfd-card::before,
.cfd .cfd-grid .cfd-card::marker {
	content: none;
}

.cfd .cfd-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	border: 0 solid var(--cfd-border);
	border-radius: var(--cfd-radius);
	overflow: hidden;
	background: var(--cfd-surface);
	color: inherit;
	text-decoration: none;
	/*
	 * Two layers rather than one: a tight shadow defines the card's edge, a
	 * wider soft one grounds it. Kept low-alpha neutral so it reads the same
	 * whatever colour sits behind the grid.
	 */
	box-shadow: 0 1px 2px rgba(17, 24, 23, 0.10), 0 6px 18px rgba(17, 24, 23, 0.09);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cfd .cfd-card__link:hover {
	transform: translateY(-3px);
	box-shadow: 0 2px 4px rgba(17, 24, 23, 0.12), 0 14px 30px rgba(17, 24, 23, 0.18);
}

/*
 * Square by construction. The image is absolutely positioned inside a padded
 * box rather than relying on height:100%, because themes commonly set
 * `img { height: auto }`, which silently defeats it and lets each photo keep
 * its own aspect ratio.
 */
.cfd-card__media {
	position: relative;
	display: block;
	width: 100%;
	padding-top: 100%;
	overflow: hidden;
	background: var(--cfd-placeholder);
}

.cfd-card__image,
.cfd-card__media img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
	margin: 0;
	max-width: none;
}

.cfd-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	padding: 0.95rem 1rem 1.1rem;
}

.cfd .cfd-card__name {
	font-size: 1.5rem;
	font-weight: normal;
	line-height: 1.25;
	font-family: var(--cfd-heading-font);
	color: var(--cfd-heading-color);
}

.cfd-card__place {
	font-size: 0.85rem;
	color: var(--cfd-muted);
}

.cfd .cfd-card__offering {
	font-size: 0.9rem;
	color: var(--cfd-ink);
	margin-top: 0.15rem;
	font-weight: 400;
}

.cfd-card__languages {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 0.45rem;
}

.cfd-card__language {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.75rem;
	color: var(--cfd-muted);
	background: var(--cfd-placeholder);
	border-radius: 999px;
	padding: 0.15rem 0.55rem;
}

.cfd-card__flag {
	font-size: 0.95rem;
	line-height: 1;
}

/* ---------- states ---------- */

.cfd-empty {
	padding: 2.5rem 1rem;
	text-align: center;
	color: var(--cfd-muted);
	border: 1px dashed var(--cfd-border);
	border-radius: var(--cfd-radius);
}

.cfd-loading {
	padding: 0.85rem 0;
	text-align: center;
	color: var(--cfd-muted);
	font-size: 0.9rem;
}

.cfd-loading[hidden] {
	display: none;
}

.cfd-results[aria-busy="true"] {
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

/* ---------- pagination ---------- */

.cfd-pagination {
	display: flex;
	justify-content: center;
	margin-top: 2rem;
}

.cfd-pagination .page-numbers {
	display: inline-block;
	padding: 0.45rem 0.8rem;
	margin: 0 0.15rem;
	border-radius: 8px;
	border: 1px solid var(--cfd-border);
	color: var(--cfd-ink);
	text-decoration: none;
	font-size: 0.9rem;
}

.cfd-pagination .page-numbers.current {
	background: var(--cfd-accent);
	border-color: var(--cfd-accent);
	color: #fff;
}

/* ---------- small screens ---------- */

@media (max-width: 549px) {
	/* The map is a secondary, opt-in action; on a phone it should not compete
	   with the result count beside it. */
	.cfd .cfd-map-toggle {
		font-size: 0.65rem;
	}

	/* The pin is fixed at 18px in the markup, which would tower over 0.65rem
	   text and undo the point of shrinking the label. */
	.cfd .cfd-map-toggle__icon svg {
		width: 14px;
		height: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cfd-card__link,
	.cfd-results {
		transition: none;
	}

	.cfd-card__link:hover {
		transform: none;
	}
}
