/**
 * BHASNet Theme — Resources page styles.
 * Extracted from the page-resources.php inline <style> block.
 * Enqueued conditionally by bhasnet_enqueue_resources_page_assets()
 * in inc/assets.php, only when this page template is active.
 */

/* ============================================================
   Featured resources carousel — mirrors Events & Awareness
   ============================================================ */

/* Extra padding-bottom on the page hero so the carousel can
   overlap into it, exactly like .bh-page-head--events does. */
.bh-page-head--resources {
	padding-bottom: 8.5rem;
}

.bh-featured-wrapper {
	margin-top: -5.5rem;
	margin-bottom: 2rem;
	position: relative;
	z-index: 2;
}
.bh-featured-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
}
.bh-featured-label {
	font-family: var(--bh-font-mono);
	font-size: var(--bh-size-small);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--bh-slate);
}
.bh-featured-nav {
	display: flex;
	align-items: center;
}
.bh-featured-scroll {
	display: flex;
	gap: 1rem;
}
.bh-featured-scroll--multi {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding-bottom: 0.6rem;
	-webkit-overflow-scrolling: touch;
	/* Hide scrollbar completely while keeping scroll functionality */
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge */
}
.bh-featured-scroll--multi::-webkit-scrollbar {
	display: none; /* Chrome/Safari/Opera */
}
.bh-featured-card {
	flex: 1 1 100%;
	width: 100%;
}
.bh-featured-scroll--multi .bh-featured-card {
	flex: 0 0 auto;
	width: min(560px, 88vw);
	scroll-snap-align: start;
}
.bh-featured-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	margin-left: 0.5rem;
	background: var(--bh-paper);
	border: 1px solid var(--bh-line-dark);
	border-radius: var(--bh-radius);
	color: var(--bh-ink);
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}
.bh-featured-arrow:hover {
	border-color: var(--bh-amber);
	color: var(--bh-amber);
}

/* On phones, the featured card's icon/body/CTA row (built with inline
   flex styles sized for desktop — flex-basis 50px/200px/150px) just
   wraps awkwardly rather than reading as a clean stack. Force it into
   a single column and let the CTA button go full-width instead. */
@media (max-width: 520px) {
	.bh-featured-card-row {
		flex-direction: column !important;
		gap: 0.85rem !important;
	}
	.bh-featured-card-icon {
		flex: 0 0 auto !important;
		justify-content: flex-start !important;
	}
	.bh-featured-card-body {
		min-width: 0 !important;
		width: 100%;
	}
	.bh-featured-card-cta {
		min-width: 0 !important;
		width: 100%;
		text-align: left !important;
	}
	.bh-featured-card-cta .bh-btn {
		width: 100%;
		justify-content: center;
	}
}

/* ============================================================
   Resources - Compact styling
   ============================================================ */

/* Resource action buttons - compact, consistent with Events */
.bh-resource-action {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	background: transparent !important;
	border: 1px solid var(--bh-line-dark) !important;
	padding: 0.15rem 0.4rem !important;
	font-family: var(--bh-font-mono) !important;
	font-size: var(--bh-size-micro) !important;
	color: var(--bh-ink) !important;
	border-radius: 2px !important;
	cursor: pointer !important;
	text-decoration: none !important;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
}
.bh-resource-action:hover:not(.is-saved) {
	background: var(--bh-ink) !important;
	color: var(--bh-paper) !important;
	border-color: var(--bh-ink) !important;
}
.bh-resource-action.is-saved {
	color: var(--bh-red) !important;
	border-color: var(--bh-red) !important;
}
.bh-resource-action i {
	font-size: 0.85rem;
}
.bh-resource-action span {
	font-size: var(--bh-size-micro);
	font-weight: 400;
	margin-left: 1px;
}

/* New! badge */
.bh-pill--new {
    background: var(--bh-amber);
    color: var(--bh-ink);
    font-weight: 700;
    animation: pulse 2s infinite;
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    margin-right: 0.3rem;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Table cell padding - tighter */
.bh-resource-table td {
	padding: 0.4rem 0.5rem !important;
	font-size: var(--bh-size-small) !important;
}
.bh-resource-table th {
	padding: 0.4rem 0.5rem !important;
	font-size: var(--bh-size-micro) !important;
}

/* File badge - icon only */
.bh-file-badge {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	background: none !important;
	color: var(--bh-ink) !important;
	font-size: 0.7rem !important;
	padding: 0 !important;
	width: 1.6em;
	height: 1.6em;
	min-width: 1.6em !important;
}

/* Step-by-step form */
.bh-form-steps {
	max-width: 640px;
}
.bh-form-progress {
	display: flex;
	gap: 1.75rem;
	margin-bottom: 2rem;
}
.bh-form-progress-step {
	font-family: var(--bh-font-mono);
	font-size: var(--bh-size-micro);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--bh-slate);
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--bh-line-dark);
}
.bh-form-progress-step.is-active {
	color: var(--bh-red);
	border-bottom-color: var(--bh-red);
}
.bh-form-progress-step.is-done {
	color: var(--bh-ink);
	border-bottom-color: var(--bh-ink);
}
.bh-form-step {
	border: none;
	padding: 0;
	margin: 0;
}
.bh-form-step legend {
	padding: 0;
	margin-bottom: 1.25rem;
	width: 100%;
}
.bh-form-step-actions {
	display: flex;
	gap: 0.75rem;
	margin-top: 1.75rem;
}

.bh-form-ajax-status {
	margin-top: 1.25rem;
}
.bh-form-progress-bar {
	height: 6px;
	border-radius: 999px;
	background: var(--bh-line-dark);
	overflow: hidden;
	margin-bottom: 1rem;
}
.bh-form-progress-bar-fill {
	height: 100%;
	width: 0%;
	background: var(--bh-red);
	transition: width 0.2s ease;
}

/* Library layout - wider categories column */
#library .bh-container {
	max-width: 1600px;
	margin-left: 0;
	margin-right: auto;
}
@media (min-width: 900px) {
	.bh-sidebar-layout {
		grid-template-columns: 280px 1fr;
		gap: var(--bh-space-lg);
	}
	/* NEW: results panel gets its own bounded height + scroller, same
	   max-height calc() the filter sidebar next to it already uses, so
	   the two columns read as a matched pair of self-contained panels
	   rather than the results forcing the whole page to grow/scroll. */
	#bh-library-results {
		max-height: calc(100vh - 8rem);
		overflow-y: auto;
		padding-right: 0.5rem; /* keeps row content clear of the scrollbar */
	}
}

/* Sidebar - tighter */
.bh-sidebar-nav a,
.bh-sidebar-nav button {
	padding: 0.35rem 0.2rem !important;
	padding-left: 0.5rem !important;
	font-size: var(--bh-size-micro) !important;
}
.bh-sidebar-nav-group-label {
	padding: 0.5rem 0.2em 0.2em !important;
	font-size: var(--bh-size-micro) !important;
}

/* Title - clickable modal trigger */
.bh-resource-title-wrap {
	font-weight: 400 !important;
}
.bh-resource-title-link {
	background: none;
	border: none;
	font: inherit;
	color: var(--bh-ink);
	cursor: pointer;
	padding: 0;
	text-align: left;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease, color 0.2s ease;
}
.bh-resource-title-link:hover,
.bh-resource-title-link:focus-visible {
	color: var(--bh-red);
	border-bottom-color: currentColor;
	outline: none;
}

/* Tooltip - fixed positioning */
.bh-tooltip-wrap {
	display: inline-flex;
}
.bh-tooltip {
	position: fixed !important;
	top: 0;
	left: 0;
	bottom: auto !important;
	z-index: 999 !important;
	opacity: 0 !important;
	visibility: hidden !important;
	transform: translateY(4px) !important;
}
.bh-tooltip.is-visible {
	opacity: 1 !important;
	visibility: visible !important;
	transform: translateY(0) !important;
}

.bh-resource-credit {
	display: block;
	margin-top: 0.2rem;
	font-size: var(--bh-size-micro);
	color: var(--bh-slate);
}
.bh-resource-credit a {
	color: var(--bh-slate);
	text-decoration: underline;
}
.bh-resource-credit a:hover {
	color: var(--bh-red);
}

/* ============================================================
   Sticky Filter Bar
   ============================================================ */
.bh-sticky-actions {
	position: sticky;
	top: 0;
	z-index: 40;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--bh-line-dark);
	padding: 0.35rem 0;
	transform: none !important;
	opacity: 1 !important;
	transition: top 0.15s ease;
}

.bh-sticky-actions-inner {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.bh-sticky-actions-group {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.bh-sticky-filter-nav {
	display: flex;
	align-items: center;
	gap: 0.05rem;
}

.bh-sticky-filter-link {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.9rem;
	font-family: var(--bh-font-mono);
	font-size: var(--bh-size-micro);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--bh-slate);
	border-bottom: 2px solid transparent;
	transition: color 0.2s ease, border-color 0.2s ease;
	text-decoration: none;
	cursor: pointer;
}
.bh-sticky-filter-link:hover {
	color: var(--bh-ink);
}
.bh-sticky-filter-link.is-active {
	color: var(--bh-red);
	border-bottom-color: var(--bh-red);
}

.bh-sticky-filter-dropdown {
	position: relative;
	display: inline-block;
}

.bh-sticky-filter-dropdown-trigger {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.6rem;
	font-family: var(--bh-font-mono);
	font-size: var(--bh-size-micro);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--bh-slate);
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.2s ease;
}
.bh-sticky-filter-dropdown-trigger:hover {
	color: var(--bh-ink);
}
.bh-sticky-filter-dropdown-trigger[aria-expanded="true"] {
	color: var(--bh-red);
}

.bh-sticky-filter-dropdown-menu {
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 0.25rem;
	min-width: 160px;
	background: var(--bh-paper);
	border: 1px solid var(--bh-line-dark);
	box-shadow: 0 4px 16px rgba(11, 11, 14, 0.12);
	padding: 0.25rem 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	z-index: 50;
}
.bh-sticky-filter-dropdown-menu.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.bh-sticky-filter-dropdown-item {
	display: block;
	padding: 0.3rem 0.9rem;
	font-family: var(--bh-font-body);
	font-size: var(--bh-size-small);
	color: var(--bh-ink);
	text-decoration: none;
	transition: background 0.15s ease;
	cursor: pointer;
}
.bh-sticky-filter-dropdown-item:hover {
	background: var(--bh-paper-dim);
}
.bh-sticky-filter-dropdown-item.is-active {
	color: var(--bh-red);
	font-weight: 600;
}

.bh-sticky-search input[type="search"] {
	padding: 0.2rem 0.6rem;
	border: 1px solid var(--bh-line-dark);
	border-radius: 2px;
	font-family: var(--bh-font-body);
	font-size: var(--bh-size-small);
	background: var(--bh-paper);
	color: var(--bh-ink);
	width: 160px;
}
.bh-sticky-search input[type="search"]:focus-visible {
	outline: 2px solid var(--bh-red);
	outline-offset: 2px;
}

/* Responsive */
@media (max-width: 700px) {
	/* The base table (04-anchor-sidebar-layout.css) is built for a
	   desktop-width table with a horizontal-scroll fallback
	   (min-width:640px on .bh-resource-table + overflow-x:auto on the
	   wrap). On a phone that just means every row is a sideways-scroll
	   strip with the actions cut off-screen — not something people
	   reliably discover. Below this breakpoint we convert each row
	   into a stacked card instead, which is the standard fix for
	   "table doesn't fit a phone screen".  */
	.bh-resource-table-wrap {
		overflow-x: visible;
		border: none;
	}
	.bh-resource-table {
		min-width: 0;
		width: 100%;
		border: none;
	}
	.bh-resource-table thead {
		/* Column headings ("File" / "Category") don't carry their own
		   meaning once each row becomes a self-contained card — the
		   category is now labelled inline (see td:nth-child(2)::before
		   below) and the file cell is self-evident from its content. */
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
	.bh-resource-table tbody,
	.bh-resource-table tr,
	.bh-resource-table td {
		display: block;
		width: 100%;
	}
	.bh-resource-table tr {
		border: 1px solid var(--bh-line-dark);
		border-radius: 6px;
		padding: 0.85rem;
		margin-bottom: 0.75rem;
		background: var(--bh-paper);
	}
	.bh-resource-table tbody tr:hover {
		background: var(--bh-paper);
	}
	.bh-resource-table td {
		padding: 0 !important;
		border-top: none !important;
		font-size: var(--bh-size-small) !important;
	}
	.bh-resource-table td:nth-child(2) {
		margin-top: 0.6rem;
		font-size: var(--bh-size-micro) !important;
		color: var(--bh-slate);
	}
	.bh-resource-table td:nth-child(2)::before {
		content: "Category: ";
		font-weight: 600;
		color: var(--bh-ink);
	}
	.bh-resource-table td:nth-child(2):empty {
		display: none;
	}
	.bh-resource-table td:nth-child(3) {
		margin-top: 0.6rem;
		padding-top: 0.6rem !important;
		border-top: 1px dashed var(--bh-line-dark) !important;
	}
	.bh-resource-table td:nth-child(3) > div {
		justify-content: flex-start !important;
	}
	.bh-resource-action {
		font-size: 0.7rem !important;
		padding: 0.25rem 0.55rem !important;
	}
	.bh-resource-action i {
		font-size: 0.8rem;
	}
	.bh-resource-file-cell {
		align-items: flex-start;
	}
	.bh-sticky-actions-inner {
		justify-content: center;
	}
	.bh-sticky-actions-group {
		flex-direction: column;
		align-items: stretch;
		gap: 0.3rem;
		width: 100%;
	}
	.bh-sticky-filter-nav {
		justify-content: center;
		flex-wrap: wrap;
	}
	.bh-sticky-filter-link {
		padding: 0.2rem 0.6rem;
		font-size: 0.65rem;
	}
	.bh-sticky-filter-dropdown-trigger {
		padding: 0.2rem 0.4rem;
		font-size: 0.65rem;
	}
	.bh-sticky-search input[type="search"] {
		width: 100%;
	}
}