/* ==========================================================================
   BSA member directory — the directory page (236) and the profile card
     The card (WP Grid Builder card 1) serves the directory grid, the home
     page's featured members and Explore more on each profile, so its
     rules aren't tied to any one page.
   Mockup: Directory.dc.html on the design canvas; the design system's
   .bsa-card (bundle.css) for the card.
   Markup reference: docs/shortcodes.md section 8 (our blocks inside the
   card); WP Grid Builder's own markup, read from the live page.
   Needs tokens.css, typography.css, buttons.css and profile.css first
   (profile.css holds the tier label rule the card shares).

   WP Grid Builder prints its card builder settings as ".wpgb-card-1
   .wpgb-block-N" rules. Rules here carry ":not(#bsa)" to outrank them,
   and target our own bsa- classes or the card's structure, not the
   block numbers, which change if a block is re-added.

   Breakpoints follow Divi: 980px (tablet) and 767px (phone). The grid's
   column counts are WP Grid Builder settings, not CSS.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. The card
   -------------------------------------------------------------------------- */

/* White panel, hairline border, 6px corners. Fills its cell, so cards in
   a row match (WP Grid Builder sets each card's height). */
.wpgb-card-1 .wpgb-card-wrapper:not(#bsa),
.wpgb-card-1 .wpgb-card-inner:not(#bsa) {
	height: 100%;
	box-shadow: none;                      /* WP Grid Builder's card shadow: the border does the job */
}

.wpgb-card-1 .wpgb-card-inner:not(#bsa) {
	position: relative;                    /* for the stretched name link */
	box-sizing: border-box;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	transition: border-color 0.15s ease;
}

.wpgb-card-1 .wpgb-card-inner:hover {
	border-color: var(--Blue);
}

.wpgb-card-1 .wpgb-card-content:not(#bsa) {
	height: 100%;
	background: transparent;
	color: var(--ink);
}

/* The body is a one-column grid. The image block and the In Memoriam
   badge share the first row, so the badge lies across the bottom of the
   image and takes no height of its own; every other block follows in
   order, one per row. */
.wpgb-card-1 .wpgb-card-body:not(#bsa) {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-content: start;
	row-gap: var(--space-2);
	height: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: var(--space-4);
	font-family: var(--font-sans);
}

.wpgb-card-1 .wpgb-card-body > :not(#bsa) {
	min-width: 0;
	margin: 0;
}

/* Image, or initials for a profile with none: 4:3, cropped to fill. */
.wpgb-card-1 .wpgb-card-body > :has(> img.size-bsa_card, > .bsa-card-initials) {
	grid-row: 1;
	grid-column: 1;
	line-height: 0;
}

.wpgb-card-1 img.size-bsa_card {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: center;
	border-radius: var(--radius-none);
}

.wpgb-card-1 .bsa-card-initials:not(#bsa) {
	background: var(--blue-50);
	color: var(--Blue);
	font-family: var(--font-serif);
	font-size: 3rem;                       /* 48px */
	line-height: 1;
	letter-spacing: 0.02em;
}

/* In Memoriam: a strip across the bottom of the image. */
.wpgb-card-1 .wpgb-card-body > :has(> .bsa-badge-memorial) {
	grid-row: 1;
	grid-column: 1;
	align-self: end;
	line-height: normal;
}

.wpgb-card-1 .bsa-badge-memorial:not(#bsa) {
	margin: 0;
	padding: 6px var(--space-3);
	background: var(--ink);
	color: var(--surface);
	font-family: var(--font-sans);
	font-size: 0.8125rem;                  /* eyebrow 13/16 */
	line-height: 1.23;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

/* 16px from the image to the tier, as in the design system's card. */
.wpgb-card-1 .wpgb-card-body > :has(> .bsa-card-tier):not(#bsa) {
	margin-top: var(--space-2);
}

/* Name: serif 25/32, the only link in the card, stretched over all of it. */
body .wp-grid-builder .wpgb-card-1 .wpgb-card-body h3:not(#bsa) {
	margin: 0;
	padding: 0;
	font-family: var(--font-serif);
	font-size: 1.5625rem;
	line-height: 1.28;
	font-weight: 400;
	color: var(--ink);
	text-wrap: balance;
}

body .wpgb-card-1 .wpgb-card-body h3 a:not(#bsa) {
	color: inherit;
	text-decoration: none;
}

.wpgb-card-1 .wpgb-card-body h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--radius-md);
}

body .wpgb-card-1 .wpgb-card-inner:hover h3 a:not(#bsa) {
	text-decoration: underline;
	text-decoration-color: var(--Blue);
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
}

/* The focus ring goes round the whole card. */
body .wpgb-card-1 .wpgb-card-body h3 a:not(#bsa):focus-visible {
	outline: none;
}

.wpgb-card-1 .wpgb-card-body h3 a:focus-visible::after {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}

/* Art media: small, muted. */
.wpgb-card-1 .bsa-card-media:not(#bsa) {
	margin: 0;
	padding: 0;
	font-size: 0.9375rem;                  /* 15/22 */
	line-height: 1.47;
	color: var(--ink-muted);
}


/* --------------------------------------------------------------------------
   2. Directory page (236): section and module spacing
   Divi prints page module CSS as "#et-boc .et-l .et_pb_section_N…", so
   these carry "#et-boc .et-l" as well as ":not(#bsa)" to win.
   Leave padding at Divi's defaults on these two sections.
   -------------------------------------------------------------------------- */

#et-boc .et-l .bsa-directory-intro.et_pb_section:not(#bsa) {
	padding-bottom: 0;
}

#et-boc .et-l .bsa-directory-intro .et_pb_row:not(#bsa) {
	padding-bottom: 0;
}

#et-boc .et-l .bsa-directory-results.et_pb_section:not(#bsa) {
	padding: var(--space-8) 0 var(--space-24);          /* 32 / 96 */
}

#et-boc .et-l .bsa-directory-results .et_pb_row:not(#bsa) {
	padding: 0;
}

#et-boc .et-l .bsa-directory-results .et_pb_module:not(#bsa) {
	margin-bottom: 0;
}

/* WP Grid Builder spaces every facet 40px apart; the layout here does it. */
:is(.bsa-directory-tiers, .bsa-directory-filters, .bsa-directory-status, .bsa-directory-paging) .wpgb-facet:not(#bsa) {
	margin: 0;
}

:is(.bsa-directory-tiers, .bsa-directory-filters) fieldset:not(#bsa) {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}


/* --------------------------------------------------------------------------
   3. Tier facet as tabs (WP Grid Builder's buttons)
   Not given tab roles: they don't behave like tabs from the keyboard
   (docs/directory.md section 4).
   -------------------------------------------------------------------------- */

#et-boc .et-l .bsa-directory-tiers.et_pb_module:not(#bsa) {
	margin-top: var(--space-4);
	margin-bottom: 0;
}

.bsa-directory-tiers .wpgb-inline-list:not(#bsa) {
	display: flex;
	flex-wrap: wrap;
	gap: 0 40px;
	margin: 0;
	padding: 0;
	list-style: none;
	border-bottom: 1px solid var(--border);
}

.bsa-directory-tiers .wpgb-inline-list li:not(#bsa) {
	margin: 0 0 -1px;                      /* the underline sits on the hairline */
	padding: 0;
}

.bsa-directory-tiers .wpgb-button:not(#bsa) {
	display: inline-block;
	min-height: 0;
	margin: 0;
	padding: 14px 0 12px;
	border: 0;
	border-bottom: 4px solid transparent;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 20px;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.bsa-directory-tiers .wpgb-button:not(#bsa):hover {
	background: transparent;
	color: var(--Blue);
	border-bottom-color: var(--border-strong);
}

.bsa-directory-tiers .wpgb-button[aria-pressed="true"]:not(#bsa) {
	background: transparent;
	color: var(--ink);
	border-bottom-color: var(--Blue);
}

/* No results with the other filters as they are: shown, but quiet. */
.bsa-directory-tiers .wpgb-button[aria-disabled="true"]:not(#bsa) {
	color: var(--ink-muted);
	border-bottom-color: transparent;
	opacity: 0.6;
	cursor: default;
}

.bsa-directory-tiers .wpgb-button-label:not(#bsa) {
	padding: 0;
	font: inherit;
	color: inherit;
}


/* --------------------------------------------------------------------------
   4. Filter panel: Search (wide), Art media, Tags, Sort by
   -------------------------------------------------------------------------- */

.bsa-directory-filters .et_pb_code_inner {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr 1fr;
	gap: var(--space-6);
	align-items: end;
	padding: var(--space-6);
	background: var(--paper);
	border-radius: var(--radius-md);
}

/* The visible label (WP Grid Builder's facet title). The hidden legend
   shares its class, so this names the h4 only. */
.bsa-directory-filters h4.wpgb-facet-title:not(#bsa) {
	margin: 0 0 var(--space-2);
	padding: 0;
	font-family: var(--font-sans);
	font-size: 0.9375rem;                  /* the design system's label: 15/20 600 */
	line-height: 20px;
	font-weight: 600;
	color: var(--ink);
}

.bsa-directory-filters label:not(#bsa) {
	position: relative;
	display: block;
	margin: 0;
}

/* Inputs and selects: the design system's .bsa-input. */
.bsa-directory-filters :is(.wpgb-input, .wpgb-select):not(#bsa) {
	box-sizing: border-box;
	width: 100%;
	min-height: 48px;
	height: auto;
	margin: 0;
	padding: 11px var(--space-4);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	box-shadow: none;
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 1.0625rem;                  /* 17/24 */
	line-height: 24px;
	font-weight: 400;
	transition: border-color 0.15s ease;
}

.bsa-directory-filters :is(.wpgb-input, .wpgb-select):not(#bsa):hover {
	border-color: var(--ink-muted);
}

.bsa-directory-filters :is(.wpgb-input, .wpgb-select):not(#bsa):focus {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
	border-color: var(--Blue);
}

.bsa-directory-filters .wpgb-input::placeholder {
	color: var(--ink-muted);
	opacity: 1;
}

/* Search: room for the magnifier on the left. */
.bsa-directory-filters .wpgb-search-facet .wpgb-input:not(#bsa) {
	padding-left: 44px;
}

.bsa-directory-filters .wpgb-input-icon:not(#bsa) {
	left: var(--space-4);
	width: 18px;
	height: 18px;
	color: var(--ink-muted);
}

/* Selects: WP Grid Builder's chevron, without its separator line. */
.bsa-directory-filters .wpgb-select:not(#bsa) {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 48px;
	cursor: pointer;
}

.bsa-directory-filters .wpgb-select-separator:not(#bsa) {
	display: none;
}

.bsa-directory-filters .wpgb-select-controls:not(#bsa) {
	right: var(--space-3);
	color: var(--ink);
}


/* --------------------------------------------------------------------------
   5. Result count and Clear Filters
   -------------------------------------------------------------------------- */

#et-boc .et-l .bsa-directory-status.et_pb_module:not(#bsa) {
	margin: var(--space-8) 0 var(--space-6);
}

.bsa-directory-status .et_pb_code_inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-6);
}

.bsa-directory-status .wpgb-result-count:not(#bsa) {
	font-size: 0.9375rem;                  /* small 15/22 */
	line-height: 1.47;
	color: var(--ink-muted);
}

/* Clear Filters: the design system's quiet button. */
.bsa-directory-status .wpgb-reset:not(#bsa) {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin: 0;
	padding: 0 var(--space-3);
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	box-shadow: none;
	color: var(--Blue);
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 20px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	opacity: 1;
	cursor: pointer;
}

.bsa-directory-status .wpgb-reset:not(#bsa):hover {
	background: var(--blue-50);
	color: var(--blue-700);
	text-decoration-thickness: 2px;
}

/* Nothing to clear: hidden, but it keeps its place, so the count
   doesn't move when it appears. */
.bsa-directory-status .wpgb-reset:not(#bsa):disabled {
	visibility: hidden;
}


/* --------------------------------------------------------------------------
   6. Pagination
   -------------------------------------------------------------------------- */

#et-boc .et-l .bsa-directory-paging.et_pb_module:not(#bsa) {
	margin-top: var(--space-12);
}

.bsa-directory-paging ul:not(#bsa) {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bsa-directory-paging li:not(#bsa) {
	margin: 0;
	padding: 0;
}

body .bsa-directory-paging a:not(#bsa) {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 var(--space-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 20px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease;
}

body .bsa-directory-paging a:not(#bsa):hover {
	border-color: var(--Blue);
	color: var(--Blue);
}

body .bsa-directory-paging a[aria-current]:not([aria-current="false"]):not(#bsa) {
	border-color: var(--Blue);
	background: var(--Blue);
	color: var(--surface);
}


/* --------------------------------------------------------------------------
   7. Tablet (980px and narrower)
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {

	/* Search across the top, the three selects under it. */
	.bsa-directory-filters .et_pb_code_inner {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.bsa-directory-filters .wpgb-facet:first-child {
		grid-column: 1 / -1;
	}

	.bsa-directory-tiers .wpgb-inline-list:not(#bsa) {
		column-gap: var(--space-6);
	}
}


/* --------------------------------------------------------------------------
   8. Phone (767px and narrower)
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {

	.bsa-directory-filters .et_pb_code_inner {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--space-4);
		padding: var(--space-4);
	}

	#et-boc .et-l .bsa-directory-results.et_pb_section:not(#bsa) {
		padding: var(--space-6) 0 var(--space-16);
	}
}
