/**
 * Project styling — single-Project detail (Frontend\ProjectDetailsShortcode /
 * templates/project-details.php) and the Project list/filter view
 * (Frontend\ProjectsShortcode / templates/project-list.php). Self-contained —
 * does not depend on `bchbc-events.css` being loaded, even though the visual
 * language deliberately matches it (same brand-color variables, same card/
 * badge/filter/file-list/gallery conventions) for a consistent look across
 * Events and Projects.
 *
 * @package BCHBC\ChapterManagement
 */

:root {
	--bchbc-primary: var( --e-global-color-primary, #2c4540 );
	--bchbc-accent: var( --e-global-color-accent, #5e7c8a );
	--bchbc-border-color: #e3e0d8;
	--bchbc-muted: #6b6f66;
	/* Soft blue-grey — deliberately distinct from --bchbc-primary so the
	   Chapter badge never reads as another action button. */
	--bchbc-badge-bg: #e4e9ec;
	--bchbc-badge-text: #45535c;
}

/* Two columns on desktop (main content / sidebar), one column — main
   first — on mobile. */
.bchbc-project-detail {
	display: grid;
	grid-template-columns: minmax( 0, 2fr ) minmax( 0, 1fr );
	gap: 2em;
	align-items: start;
}

.bchbc-project-detail-main,
.bchbc-project-detail-sidebar {
	display: flex;
	flex-direction: column;
	gap: 1.5em;
}

.bchbc-project-detail-card {
	padding: 1.5em;
	background: #fff;
	border: 1px solid var( --bchbc-border-color );
	border-radius: 14px;
}

.bchbc-project-detail-thumb-img {
	display: block;
	width: 100%;
	max-height: 420px;
	object-fit: cover;
	border-radius: 14px;
}

/* Slim, unboxed byline row above the content — Chapter badge + Start Year,
   deliberately not wrapped in a card the way the rest of the detail sections
   are, so it reads as a lightweight label rather than its own content block. */
.bchbc-project-byline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1.25em;
}

/* "Under Construction - Contact Chapter for information", shown directly
   after the title on both the list card and the single-Project view. Reads
   as a sentence rather than a pill: it carries an instruction ("contact the
   Chapter"), not just a label, and a pill at this length would wrap badly on
   a narrow card. Colour reinforces the wording, which stands alone. */
.bchbc-project-construction-notice {
	margin: 0;
	color: #8a2f22;
	font-size: 0.9em;
	font-style: italic;
	font-weight: 600;
}

.bchbc-project-chapter-badge {
	display: inline-block;
	padding: 0.3em 0.9em;
	background: var( --bchbc-badge-bg );
	color: var( --bchbc-badge-text );
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border-radius: 999px;
}

.bchbc-project-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	color: var( --bchbc-muted );
	font-size: 0.9em;
}

/* `bchbc_event_icon()` (the shared icon set from Frontend\template-tags.php)
   sets its own `color` via `.bchbc-event-icon`, so no separate icon class
   is needed here — reused as-is on Project meta items. */
.bchbc-project-meta-item .bchbc-event-icon {
	color: var( --bchbc-primary );
}

.bchbc-project-detail-section {
	padding-top: 1.5em;
	border-top: 1px solid var( --bchbc-border-color );
}

.bchbc-project-detail-section:first-of-type {
	padding-top: 0;
	border-top: none;
}

.bchbc-project-detail-heading {
	margin: 0 0 0.75em;
	font-size: 1.15em;
	font-weight: 700;
}

.bchbc-project-detail-content {
	font-size: 1.05em;
	line-height: 1.7;
}

.bchbc-project-detail-content > :first-child {
	margin-top: 0;
}

.bchbc-project-detail-content > :last-child {
	margin-bottom: 0;
}

.bchbc-project-file-list {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bchbc-project-file-item a {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	color: var( --bchbc-primary );
	font-weight: 600;
	text-decoration: none;
}

.bchbc-project-file-item a:hover {
	text-decoration: underline;
}

.bchbc-project-gallery {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 140px, 1fr ) );
	gap: 0.75em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bchbc-project-gallery-item a {
	display: block;
}

.bchbc-project-gallery-item img {
	display: block;
	width: 100%;
	height: 140px;
	object-fit: cover;
	border-radius: 10px;
}

.bchbc-project-share-copy {
	margin: 0 0 1em;
	color: var( --bchbc-muted );
}

.bchbc-project-share-links {
	display: flex;
	gap: 0.75em;
	margin: 0;
}

.bchbc-project-share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.4em;
	height: 2.4em;
	background: var( --bchbc-accent );
	color: #fff;
	border-radius: 50%;
}

.bchbc-project-share-btn:hover {
	background: color-mix( in srgb, var( --bchbc-accent ) 85%, black );
}

/* ---- Project list/filter view ---- */

.bchbc-projects-filter-card {
	display: flex;
	flex-direction: column;
	gap: 1em;
	margin-bottom: 0.75em;
	padding: 1.5em;
	background: #fff;
	border: 1px solid var( --bchbc-border-color );
	border-radius: 14px;
}

.bchbc-projects-filters {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	gap: 1.5em;
	align-items: flex-end;
}

.bchbc-projects-filter {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
	min-width: 160px;
}

.bchbc-projects-filter label {
	font-size: 0.8em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --bchbc-muted );
}

.bchbc-projects-filter select {
	width: 100%;
	padding: 0.65em 0.9em;
	background: #fff;
	color: inherit;
	font-size: 1em;
	border: 1px solid var( --bchbc-border-color );
	border-radius: 8px;
}

.bchbc-projects-filter-submit {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.75em 1.4em;
	background: var( --bchbc-accent );
	color: #fff;
	font-size: 0.9em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
	border: none;
	border-radius: 999px;
	cursor: pointer;
}

.bchbc-projects-filter-submit:hover {
	background: color-mix( in srgb, var( --bchbc-accent ) 85%, black );
}

.bchbc-projects-clear-filters {
	align-self: flex-start;
	font-size: 0.85em;
	font-weight: 600;
	color: var( --bchbc-primary );
	text-decoration: underline;
}

.bchbc-projects-clear-filters:hover {
	color: color-mix( in srgb, var( --bchbc-primary ) 85%, black );
}

.bchbc-projects-count {
	margin: 0 0 0.75em;
	font-size: 1.4em;
	font-weight: 700;
}

.bchbc-projects-empty {
	padding: 1em 0;
}

.bchbc-project-list {
	display: flex;
	flex-direction: column;
	gap: 1.25em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bchbc-project-list-item {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 1.25em;
	padding: 1.25em;
	background: #fff;
	border: 1px solid var( --bchbc-border-color );
	border-radius: 14px;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* Subtle hover: border + shadow + a small upward shift — the whole card is
   clickable (see the title link's stretched-link ::after below), so this
   also functions as the hover affordance for that. */
.bchbc-project-list-item:hover {
	transform: translateY( -2px );
	border-color: color-mix( in srgb, var( --bchbc-primary ) 35%, var( --bchbc-border-color ) );
	box-shadow: 0 6px 16px rgba( 0, 0, 0, 0.08 );
}

.bchbc-project-list-thumb {
	flex: 0 0 180px;
}

.bchbc-project-list-thumb-img {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	border-radius: 10px;
}

.bchbc-project-list-thumb-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 3 / 4;
	background: color-mix( in srgb, var( --bchbc-primary ) 12%, white );
	border-radius: 10px;
}

.bchbc-project-list-thumb-placeholder-img {
	max-width: 90%;
	max-height: 90%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.bchbc-project-list-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.5em;
	min-width: 0;
}

/* A flex column's default `align-items: stretch` overrides a child's own
   sizing on the cross axis regardless of its `display` — without this, the
   badge's `inline-block` is ignored and it stretches to the card's full
   width instead of hugging its own text. */
.bchbc-project-list-body .bchbc-project-chapter-badge {
	align-self: flex-start;
}

.bchbc-project-list-title {
	margin: 0;
	font-size: 1.5em;
}

.bchbc-project-list-title a {
	color: inherit;
	text-decoration: none;
}

.bchbc-project-list-title a:hover {
	text-decoration: underline;
}

/* Makes the whole card clickable via one real, accessible link (the title's
   `<a>`) instead of duplicate anchors to the same destination. */
.bchbc-project-list-title a::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
}

.bchbc-project-list-summary {
	margin: 0;
	color: var( --bchbc-muted );
}

.bchbc-project-list-links {
	position: relative;
	/* Sits above the title link's stretched-link overlay (::after, z-index: 1)
	   so View Project stays independently clickable. */
	z-index: 2;
	display: flex;
	justify-content: flex-end;
	margin: 0.5em 0 0;
}

.bchbc-project-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-width: 150px;
	padding: 0.6em 1.2em;
	background: var( --bchbc-accent );
	color: #fff;
	font-size: 0.85em;
	font-weight: 700;
	white-space: nowrap;
	text-decoration: none;
	border-radius: 999px;
}

.bchbc-project-btn:hover {
	background: color-mix( in srgb, var( --bchbc-accent ) 85%, black );
	color: #fff;
}

.bchbc-projects-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 1.5em;
}

.bchbc-projects-load-more {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.75em 1.75em;
	background: var( --bchbc-accent );
	color: #fff;
	font-size: 0.9em;
	font-weight: 700;
	text-decoration: none;
	border-radius: 999px;
}

.bchbc-projects-load-more:hover {
	background: color-mix( in srgb, var( --bchbc-accent ) 85%, black );
}

.bchbc-projects-load-more[aria-busy="true"] {
	opacity: 0.7;
	pointer-events: none;
}

@media ( max-width: 600px ) {
	.bchbc-projects-filter-card {
		flex-direction: column;
		align-items: stretch;
	}

	.bchbc-projects-filters {
		flex-direction: column;
		align-items: stretch;
	}

	.bchbc-projects-filter-submit {
		justify-content: center;
		width: 100%;
	}

	.bchbc-project-list-item {
		flex-direction: column;
	}

	.bchbc-project-list-thumb {
		flex-basis: auto;
	}

	.bchbc-project-list-thumb-img,
	.bchbc-project-list-thumb-placeholder {
		aspect-ratio: 16 / 9;
	}

	.bchbc-project-list-links {
		justify-content: stretch;
	}

	.bchbc-project-list-links .bchbc-project-btn {
		width: 100%;
	}
}

/* Visible focus states throughout — never rely on the browser default alone. */
.bchbc-project-detail a:focus-visible,
.bchbc-projects a:focus-visible,
.bchbc-projects button:focus-visible,
.bchbc-projects select:focus-visible {
	outline: 2px solid var( --bchbc-primary );
	outline-offset: 2px;
}

@media ( max-width: 800px ) {
	.bchbc-project-detail {
		display: flex;
		flex-direction: column;
	}
}
