/**
 * GoHighLevel Integration front-end styles.
 *
 * Everything is scoped under .ghld-directory and uses custom properties, so a
 * theme can restyle the directory by redefining the tokens instead of fighting
 * selector specificity.
 */

.ghld-directory {
	--ghld-columns: 3;
	--ghld-gap: 1.25rem;
	--ghld-radius: 12px;
	--ghld-border: rgba(0, 0, 0, 0.12);
	--ghld-surface: #fff;
	--ghld-muted: rgba(0, 0, 0, 0.62);
	--ghld-accent: currentColor;

	position: relative;
	container-type: inline-size;
}

/* Filter bar ------------------------------------------------------------- */

.ghld-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem;
	margin: 0 0 1.25rem;
}

.ghld-field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
	flex: 1 1 12rem;
}

.ghld-field-search {
	flex: 2 1 18rem;
}

.ghld-field-actions {
	flex: 0 0 auto;
	flex-direction: row;
	gap: 0.5rem;
}

.ghld-label {
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--ghld-muted);
}

/* Present for assistive tech, absent on screen. */
.ghld-label-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	white-space: nowrap;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
}

.ghld-input,
.ghld-select {
	/* No width here — the theme's own form styling decides. max-width only
	   stops a field overflowing its column on a narrow screen. */
	max-width: 100%;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--ghld-border);
	border-radius: calc(var(--ghld-radius) / 2);
	background: var(--ghld-surface);
	color: inherit;
	font: inherit;
	line-height: 1.3;
}

.ghld-button {
	width: auto;
	flex: 0 0 auto;
	padding: 0.55rem 1rem;
	border: 1px solid var(--ghld-border);
	border-radius: calc(var(--ghld-radius) / 2);
	background: var(--ghld-surface);
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.ghld-button:hover,
.ghld-button:focus-visible {
	border-color: var(--ghld-accent);
}

/* A theme that sets width:100% on `button` outranks the class above, so repeat
   it at a specificity the theme can't beat. */
.ghld-directory .ghld-filter-bar button.ghld-button,
.ghld-directory button.ghld-button {
	width: auto;
	max-width: 100%;
}

/* With JavaScript the filters apply as you type, so the submit button is only
   needed as the no-JS fallback. */
.ghld-directory.is-enhanced .ghld-submit {
	display: none;
}

.ghld-summary {
	margin: 0 0 0.75rem;
	font-size: 0.9rem;
	color: var(--ghld-muted);
}

/* Results ---------------------------------------------------------------- */

.ghld-results {
	transition: opacity 150ms ease;
}

.ghld-results[aria-busy="true"] {
	opacity: 0.5;
}

.ghld-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: var(--ghld-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 56rem) {
	.ghld-grid {
		grid-template-columns: repeat(var(--ghld-columns), minmax(0, 1fr));
	}
}

.ghld-layout-list .ghld-grid {
	grid-template-columns: minmax(0, 1fr);
}

.ghld-grid-item {
	margin: 0;
	min-width: 0;
}

.ghld-card {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.85rem;
	height: 100%;
	padding: 1.25rem;
	border: 1px solid var(--ghld-border);
	border-radius: var(--ghld-radius);
	background: var(--ghld-surface);
	text-align: center;
	box-sizing: border-box;
}

.ghld-layout-list .ghld-card {
	flex-direction: row;
	align-items: flex-start;
	text-align: left;
	gap: 1.25rem;
}

.ghld-card-media {
	flex: 0 0 auto;
	width: 100%;
	container-type: inline-size;
}

.ghld-layout-list .ghld-card-media {
	width: 12rem;
	max-width: 40%;
}

.ghld-card-body {
	min-width: 0;
	width: 100%;
}

/* Square, and as wide as the space allows: cropping a headshot to a circle
   throws away most of the frame, and a small circle wastes the card. Stated at
   a specificity themes can't outrank. */
.ghld-directory img.ghld-avatar,
.ghld-directory .ghld-card img.ghld-avatar,
.ghld-directory .ghld-modal-dialog img.ghld-avatar {
	border-radius: 0;
	object-fit: cover;
	object-position: center top;
	aspect-ratio: 1 / 1;
	width: 100%;
	height: auto;
	max-width: 100%;
}

.ghld-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 0;
	object-fit: cover;
	background: rgba(0, 0, 0, 0.06);
}

.ghld-avatar-placeholder {
	background: none;
}

.ghld-avatar-initials {
	font-size: clamp( 2rem, 22cqw, 4rem );
	font-weight: 600;
	letter-spacing: 0.03em;
	color: var(--ghld-muted);
}

.ghld-name {
	margin: 0 0 0.15rem;
	font-size: 1.05rem;
	line-height: 1.3;
}

.ghld-title,
.ghld-company,
.ghld-location,
.ghld-custom {
	margin: 0 0 0.15rem;
	font-size: 0.9rem;
	color: var(--ghld-muted);
}

.ghld-bio {
	margin: 0.5rem 0 0;
	font-size: 0.9rem;
	line-height: 1.5;
}

.ghld-tags {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.35rem;
	margin: 0.6rem 0 0;
	padding: 0;
	list-style: none;
}

.ghld-layout-list .ghld-tags {
	justify-content: flex-start;
}

.ghld-tag {
	padding: 0.15rem 0.55rem;
	border: 1px solid var(--ghld-border);
	border-radius: 999px;
	font-size: 0.75rem;
	color: var(--ghld-muted);
	white-space: nowrap;
}

.ghld-contact-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	margin: 0.75rem 0 0;
	font-size: 0.85rem;
	overflow-wrap: anywhere;
}

.ghld-layout-list .ghld-contact-links {
	justify-content: flex-start;
}

.ghld-empty {
	margin: 2rem 0;
	text-align: center;
	color: var(--ghld-muted);
}

.ghld-error {
	margin: 1rem 0;
	padding: 0.75rem 1rem;
	border: 1px solid var(--ghld-border);
	border-radius: calc(var(--ghld-radius) / 2);
	color: var(--ghld-muted);
}

/* Pagination ------------------------------------------------------------- */

.ghld-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.35rem;
	margin: 1.5rem 0 0;
}

.ghld-page {
	padding: 0.4rem 0.75rem;
	border: 1px solid var(--ghld-border);
	border-radius: calc(var(--ghld-radius) / 2);
	text-decoration: none;
	color: inherit;
	font-size: 0.9rem;
}

.ghld-page-current {
	font-weight: 700;
	border-color: var(--ghld-accent);
}

.ghld-page-gap {
	padding: 0 0.25rem;
	color: var(--ghld-muted);
}

/* Dark mode, only where the page behind it is actually dark ---------------- */

/*
 * prefers-color-scheme reports the visitor's operating system, not the colour of
 * the page this directory is sitting on. Acting on it alone painted white text,
 * white borders and transparent cards onto themes that stay light whatever the
 * system says — invisible content for every visitor in dark mode, and perfectly
 * fine for everybody else, which is as hard a fault to find as it sounds. The
 * tokens below therefore wait for the site to say its theme follows the system
 * too ("Follow the visitor's dark mode", which sets this attribute). A theme can
 * also just redefine the tokens, as the top of this file describes.
 */
@media (prefers-color-scheme: dark) {
	.ghld-directory[data-ghld-color-scheme="auto"] {
		--ghld-border: rgba(255, 255, 255, 0.18);
		--ghld-surface: rgba(255, 255, 255, 0.04);
		--ghld-muted: rgba(255, 255, 255, 0.68);
	}

	.ghld-directory[data-ghld-color-scheme="auto"] .ghld-avatar {
		background: rgba(255, 255, 255, 0.08);
	}
}

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

/* Names ------------------------------------------------------------------ */

/* Some themes lowercase or small-caps every heading, which mangles a person's
   name. The directory always prints names exactly as they are stored. */
.ghld-directory .ghld-card .ghld-name,
.ghld-directory .ghld-modal-title,
.ghld-directory .ghld-name-button {
	text-transform: capitalize;
	font-variant: normal;
}

/* Clickable cards -------------------------------------------------------- */

.ghld-card-clickable {
	cursor: pointer;
	transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.ghld-card-clickable:hover {
	border-color: var(--ghld-accent);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

/* The name is a real button so the card is reachable by keyboard; it inherits
   the heading's typography so it still reads as a heading. */
.ghld-name-button {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: inherit;
	cursor: pointer;
}

.ghld-name-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 3px;
}

/* Modal ------------------------------------------------------------------ */

.ghld-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

/* Beats the [hidden] { display: none } that a display rule would override. */
.ghld-modal[hidden] {
	display: none;
}

.ghld-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.ghld-modal-dialog {
	position: relative;
	width: min(40rem, 100%);
	max-height: min(85vh, 50rem);
	overflow-y: auto;
	padding: 1.75rem;
	border-radius: var(--ghld-radius);
	background: var(--ghld-surface);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.ghld-modal-close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	border-radius: 50%;
	background: none;
	color: inherit;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

/* The close button is the bare glyph in every state — no plate, no hover, no
   focus ring. Stated at a specificity themes can't outrank. Escape also closes
   the dialog, so keyboard users are not left without a way out. */
.ghld-directory button.ghld-modal-close,
.ghld-directory button.ghld-modal-close:hover,
.ghld-directory button.ghld-modal-close:focus,
.ghld-directory button.ghld-modal-close:focus-visible,
.ghld-directory button.ghld-modal-close:active {
	width: 2.25rem;
	min-width: 0;
	height: 2.25rem;
	padding: 0;
	background: none;
	box-shadow: none;
	border: 0;
	outline: 0;
	opacity: 1;
	transform: none;
	line-height: 1;
}

/* The dialog takes focus on open so no control shows a ring. */
.ghld-directory .ghld-modal-dialog:focus,
.ghld-directory .ghld-modal-dialog:focus-visible {
	outline: none;
}

.ghld-modal-title {
	margin: 0 2.5rem 1rem 0;
	font-size: 1.5rem;
	line-height: 1.25;
}

.ghld-detail {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	align-items: flex-start;
}

.ghld-detail-media {
	flex: 0 0 auto;
}

.ghld-detail-body {
	flex: 1 1 15rem;
	min-width: 0;
}

.ghld-detail-title {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	color: var(--ghld-muted);
}

.ghld-detail-company {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	font-weight: 700;
}

.ghld-detail-bio {
	margin: 0.75rem 0 0;
	line-height: 1.6;
}

/* The practice block: name, postal address, then P. / F. — laid out the way a
   practice listing reads rather than as labelled metadata. */
.ghld-detail-practice p {
	margin: 0 0 0.15rem;
	line-height: 1.45;
}

.ghld-detail-address {
	color: inherit;
}

.ghld-detail-tel {
	overflow-wrap: anywhere;
}

.ghld-tel-label {
	display: inline-block;
	min-width: 1.25em;
	font-weight: 600;
}

.ghld-detail-practice a {
	color: inherit;
}

.ghld-detail-rows {
	margin: 1rem 0 0;
}

.ghld-detail-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	padding: 0.5rem 0;
	border-top: 1px solid var(--ghld-border);
}

.ghld-detail-label {
	flex: 0 0 auto;
	max-width: 100%;
	white-space: nowrap;
	margin: 0;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--ghld-muted);
}

.ghld-detail-value {
	flex: 1 1 12rem;
	margin: 0;
	min-width: 0;
	overflow-wrap: anywhere;
}

.ghld-detail .ghld-tags {
	justify-content: flex-start;
	margin-top: 1rem;
}

.ghld-modal-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.ghld-card-clickable {
		transition: none;
	}

	.ghld-card-clickable:hover {
		transform: none;
	}
}

/* "Name, Title" ----------------------------------------------------------- */

/* The credential reads as part of the name itself, so it takes the heading's
   own weight and colour; nowrap just keeps ", MD" from wrapping on its own. */
.ghld-name-title {
	font-weight: inherit;
	color: inherit;
	white-space: nowrap;
}

/* Several credentials take their own line and wrap there; the comma that
   introduces them stays with the name. */
.ghld-name-credentials {
	display: block;
	white-space: normal;
}

/* Specialty --------------------------------------------------------------- */

/* Sits directly under the name as a subtitle, the way a physician's
   specialties read on a practice listing. */
.ghld-detail-specialty,
.ghld-specialty {
	margin: 0 0 0.5rem;
	font-style: italic;
	color: var(--ghld-muted);
}

.ghld-detail-specialty {
	margin: -0.5rem 0 1rem;
	font-size: 1.05rem;
}


/* Modal alignment ---------------------------------------------------------- */

/* Themes frequently centre headings and dialog content; a person's name and
   their address both read as a left-aligned block. */
.ghld-directory .ghld-modal-dialog,
.ghld-directory .ghld-modal-title,
.ghld-directory .ghld-detail,
.ghld-directory .ghld-detail-body,
.ghld-directory .ghld-detail-practice,
.ghld-directory .ghld-detail-practice p,
.ghld-directory .ghld-detail-specialty,
.ghld-directory .ghld-detail-title,
.ghld-directory .ghld-detail-company,
.ghld-directory .ghld-detail-address,
.ghld-directory .ghld-detail-bio,
.ghld-directory .ghld-detail-rows,
.ghld-directory .ghld-detail-row {
	text-align: left;
}


/* Contact pages ----------------------------------------------------------- */

.ghld-name-link {
	color: inherit;
	text-decoration: none;
}

.ghld-name-link:hover,
.ghld-name-link:focus-visible {
	text-decoration: underline;
}

.ghld-profile-back {
	margin: 0 0 1.5rem;
	font-size: 0.9rem;
}

.ghld-profile-name {
	margin: 0 0 1.25rem;
	line-height: 1.2;
}

.ghld-profile .ghld-detail-specialty {
	margin-top: -0.75rem;
}



/* The contact page --------------------------------------------------------- */

.ghld-profile .ghld-detail {
	gap: 2rem;
}

.ghld-profile .ghld-detail-media {
	flex: 0 0 16rem;
	max-width: 40%;
	container-type: inline-size;
}

.ghld-profile .ghld-detail-body {
	flex: 1 1 20rem;
}

/* The name is the page's real subject, so it carries the weight — the theme's
   own page title is stepped down to a label on these pages. */
.ghld-detail-name {
	margin: 0 0 0.75rem;
	font-size: clamp( 1.6rem, 4vw, 2.4rem );
	line-height: 1.15;
}

body.ghld-contact-page .entry-title,
body.ghld-contact-page .page-title,
body.ghld-contact-page h1.wp-block-post-title,
body.ghld-contact-page .elementor-heading-title.elementor-size-xxl {
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.65;
}

/* Specialty reads as the qualifier beneath the practice details. */
.ghld-detail-specialty {
	margin: 0.9rem 0 0;
	font-style: normal;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 0.9rem;
	color: inherit;
}

/* The back control carries the theme's own btn-blue class; the plugin adds no
   styling of its own beyond the spacing around it. */
.ghld-profile-back {
	margin: 0 0 1.5rem;
}

@media (max-width: 40rem) {
	.ghld-profile .ghld-detail-media {
		flex-basis: 100%;
		max-width: 14rem;
	}
}


/* The panel beside a contact ---------------------------------------------- */

.ghld-profile-columns {
	display: flex;
	flex-wrap: wrap;
	gap: 2.5rem;
	align-items: flex-start;
}

.ghld-profile-columns .ghld-profile {
	flex: 1 1 26rem;
	min-width: 0;
}

.ghld-profile-sidebar {
	flex: 0 1 20rem;
	min-width: 0;
}

/* Full width when there is no panel, rather than a column of empty space. */
.ghld-profile-columns:not(.has-sidebar) .ghld-profile {
	flex-basis: 100%;
}

@media (max-width: 48rem) {
	.ghld-profile-sidebar {
		flex-basis: 100%;
	}
}
