/**
 * Authors Grid for Elementor (PublishPress) — frontend styles.
 *
 * Layout model: text-align based so the Grid > Alignment control moves the
 * avatar, text, social icons and button together. Elementor selectors provide
 * colours, spacing, typography and responsive columns; these are sane defaults.
 */

.enhag-wrap {
	--enhag-muted: #6b7280;
	--enhag-skeleton: #e5e7eb;
	--enhag-skeleton-hi: #f3f4f6;
}

/* -------------------------------------------------------------------- Grid */
/* Each layout class owns its own display so nothing can override it. */
.enhag-grid {
	gap: 24px;
}

.enhag-layout-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	align-items: start;
}

.enhag-layout-list {
	display: block;
}

.enhag-layout-grid.enhag-equal-height {
	align-items: stretch;
}

/* -------------------------------------------------------------------- Card */
.enhag-card {
	display: block;
	text-align: center;
	box-sizing: border-box;
	background: #fff;
	border-radius: 12px;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	will-change: transform;
}

.enhag-layout-grid.enhag-equal-height .enhag-card {
	height: 100%;
}

.enhag-card * {
	box-sizing: border-box;
}

/* ----------------------------------------------------------- List (media) */
.enhag-layout-list .enhag-card {
	display: flex;
	align-items: flex-start;
	column-gap: 28px;
	text-align: left;
	padding-bottom: 28px;
	margin-bottom: 28px;
	border-bottom: 1px solid var( --enhag-divider, #e5e7eb );
	transition: none;
}

.enhag-layout-list .enhag-card:last-child {
	border-bottom: 0;
	margin-bottom: 0;
}

.enhag-layout-list .enhag-media {
	flex: 0 0 var( --enhag-media-w, 200px );
	width: var( --enhag-media-w, 200px );
	display: flex;
	flex-direction: column;
	align-items: stretch;
	text-align: center;
}

/* In list mode the count button fills the left column, arrow + text left-aligned. */
.enhag-layout-list .enhag-count-btn {
	width: 100%;
	justify-content: flex-start;
}

.enhag-layout-list .enhag-content {
	flex: 1 1 auto;
	min-width: 0;
}

.enhag-layout-list .enhag-card:hover {
	transform: none;
}

@media (max-width: 600px) {
	.enhag-layout-list .enhag-card {
		flex-direction: column;
		align-items: center;
		text-align: center;
		row-gap: 8px;
	}
	.enhag-layout-list .enhag-media {
		flex-basis: auto;
		width: auto;
	}
}

/* ------------------------------------------------------------- Media column */
.enhag-media {
	display: block;
	margin-bottom: 16px;
}

.enhag-layout-list .enhag-media {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------ Avatar */
.enhag-avatar {
	display: block;
	margin-bottom: 16px;
	line-height: 0;
}

.enhag-avatar a {
	display: inline-block;
	line-height: 0;
}

.enhag-avatar img,
.enhag-avatar-ph {
	display: inline-block;
	width: 96px;
	height: 96px;
	object-fit: cover;
	border-radius: 50%;
	vertical-align: middle;
}

.enhag-avatar-ph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #e5e7eb;
	color: #4b5563;
	font-weight: 700;
	font-size: 36px;
	text-transform: uppercase;
}

/* ----------------------------------------------------------------- Content */
.enhag-content {
	display: block;
}

.enhag-name {
	margin: 0 0 6px;
	line-height: 1.25;
}

.enhag-name a {
	text-decoration: none;
	color: inherit;
	transition: color 0.2s ease;
}

.enhag-role {
	display: block;
	margin-bottom: 10px;
	color: var(--enhag-muted);
	font-size: 0.875em;
}

.enhag-bio {
	margin: 0 0 12px;
	color: var(--enhag-muted);
	line-height: 1.6;
}

.enhag-meta {
	margin-bottom: 4px;
	color: var(--enhag-muted);
	font-size: 0.85em;
}

.enhag-count {
	display: inline-block;
}

/* ------------------------------------------------------------------ Social */
.enhag-social {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
	vertical-align: middle;
}

.enhag-social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--enhag-muted);
	transition: color 0.2s ease, transform 0.2s ease;
}

.enhag-social-link:hover {
	transform: translateY(-2px);
}

.enhag-social-link svg {
	width: 18px;
	height: 18px;
	display: block;
}

/* -------------------------------------------------------- Post count button */
.enhag-count-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	padding: 9px 14px;
	background-color: #57a806;
	color: #fff;
	text-decoration: none;
	text-transform: uppercase;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.03em;
	line-height: 1;
	border-radius: 4px;
	transition: background-color 0.2s ease, color 0.2s ease;
	cursor: pointer;
}

.enhag-count-btn:hover {
	background-color: #4a9005;
	color: #fff;
}

.enhag-count-btn .enhag-arrow {
	flex: 0 0 auto;
}

/* ------------------------------------------------------------------ Button */
.enhag-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 18px;
	padding: 10px 20px;
	background-color: #2563eb;
	color: #fff;
	text-decoration: none;
	border-radius: 8px;
	line-height: 1.2;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
	cursor: pointer;
}

.enhag-btn:hover {
	background-color: #1d4ed8;
	color: #fff;
}

/* ----------------------------------------------------------------- Toolbar */
.enhag-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 24px;
	align-items: center;
}

.enhag-search {
	flex: 1 1 220px;
}

.enhag-search-input,
.enhag-filter {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	color: #111827;
	font: inherit;
	line-height: 1.3;
}

.enhag-filter {
	width: auto;
	min-width: 160px;
	flex: 0 0 auto;
	cursor: pointer;
}

.enhag-search-input:focus,
.enhag-filter:focus {
	outline: 2px solid #2563eb;
	outline-offset: 1px;
}

/* --------------------------------------------------------------- Pagination */
.enhag-pagination {
	margin-top: 28px;
	text-align: center;
}

.enhag-pagination[hidden] {
	display: none;
}

.enhag-load-more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 26px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #f9fafb;
	color: #111827;
	font: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.enhag-load-more:hover {
	background: #f3f4f6;
	border-color: #9ca3af;
}

.enhag-load-more[disabled] {
	opacity: 0.7;
	cursor: default;
}

/* ------------------------------------------------------------------ Spinner */
.enhag-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: enhag-spin 0.7s linear infinite;
}

.enhag-load-more.is-loading .enhag-spinner {
	display: inline-block;
}

@keyframes enhag-spin {
	to {
		transform: rotate(360deg);
	}
}

/* --------------------------------------------------------------- No results */
.enhag-no-results {
	text-align: center;
	color: var(--enhag-muted);
	padding: 32px 0;
	margin: 0;
}

.enhag-no-results[hidden] {
	display: none;
}

/* ---------------------------------------------------------- Editor notice */
.enhag-notice {
	padding: 16px;
	background: #fff7ed;
	border: 1px dashed #fdba74;
	color: #9a3412;
	border-radius: 8px;
}

/* ----------------------------------------------------------------- Skeleton */
.enhag-skeleton {
	pointer-events: none;
}

.enhag-skeleton .enhag-sk {
	display: block;
	margin: 0 auto 12px;
	border-radius: 6px;
	background: linear-gradient( 90deg, var(--enhag-skeleton) 25%, var(--enhag-skeleton-hi) 37%, var(--enhag-skeleton) 63% );
	background-size: 400% 100%;
	animation: enhag-shimmer 1.4s ease infinite;
}

.enhag-skeleton .enhag-sk-avatar {
	width: 96px;
	height: 96px;
	border-radius: 50%;
}

.enhag-skeleton .enhag-sk-line {
	height: 12px;
}

.enhag-skeleton .enhag-sk-line.enhag-w60 { width: 60%; }
.enhag-skeleton .enhag-sk-line.enhag-w40 { width: 40%; }
.enhag-skeleton .enhag-sk-line.enhag-w80 { width: 80%; }

@keyframes enhag-shimmer {
	0% { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
	.enhag-card,
	.enhag-btn,
	.enhag-social-link,
	.enhag-spinner,
	.enhag-skeleton .enhag-sk {
		transition: none;
		animation: none;
	}
}

/* ------------------------------------------------- Responsive fallback only */
/* Elementor outputs its own responsive column rules; this is a safety net    */
/* for contexts where those inline styles are unavailable.                    */
@media (max-width: 1024px) {
	.enhag-layout-grid:not([style*="grid-template-columns"]) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.enhag-layout-grid:not([style*="grid-template-columns"]) {
		grid-template-columns: 1fr;
	}
	.enhag-filter {
		width: 100%;
	}
}
