/**
 * Collaboration Hub — frontend styles.
 *
 * Design principle: be a good CSS citizen. Typography (font family, and text
 * colour where possible) is INHERITED from the active theme — we never hardcode
 * a font-family, and form controls/buttons are forced to `font: inherit` so they
 * pick up the site font (e.g. Satoshi on ca-mspace.eu) instead of the browser
 * default. Colours come from CSS custom properties emitted by the settings
 * screen, with brand-aligned fallbacks. Only structural styling lives here.
 */

.ch-page {
	padding: 1.5rem;
	box-sizing: border-box;
	color: inherit;
}

/* ---------- Grid ---------- */
.ch-card-grid {
	display: grid;
	grid-template-columns: repeat(var(--ch-grid-cols, 2), minmax(0, 1fr));
	gap: var(--ch-card-gap, 24px);
}

@media (max-width: 782px) {
	.ch-card-grid {
		grid-template-columns: repeat(var(--ch-grid-cols-tablet, 2), minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.ch-card-grid {
		grid-template-columns: 1fr;
	}
}

/* ---------- Cards ---------- */
.ch-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	background: var(--ch-card-bg, #fff);
	border: 1px solid var(--ch-card-border, #e6e8ec);
	border-radius: var(--ch-card-radius, 10px);
	box-shadow: var(--ch-card-shadow, 0 1px 3px rgba(16, 24, 40, 0.06));
	padding: var(--ch-card-padding, 24px);
	transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.ch-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12);
	border-color: color-mix(in srgb, var(--ch-btn-color, #0047ab) 35%, var(--ch-card-border, #e6e8ec));
}

.ch-card__badge {
	margin-bottom: 0.15rem;
}

.ch-card__title {
	font-size: var(--ch-title-size, 18px);
	line-height: 1.3;
	margin: 0;
	/* Inherit theme heading colour unless the admin overrides it. */
	color: var(--ch-title-color, inherit);
}

.ch-card__title a {
	color: inherit;
	text-decoration: none;
}

.ch-card__title a:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ch-card__excerpt,
.ch-card__leader {
	font-size: var(--ch-body-size, 14px);
	color: var(--ch-text-color, inherit);
	opacity: 0.85;
	margin: 0;
}

.ch-card__leader {
	font-weight: 600;
	opacity: 1;
}

.ch-card__actions {
	margin: 0.35rem 0 0;
}

/* ---------- Stage badges ---------- */
.ch-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 999px;
	font-size: var(--ch-badge-size, 12px);
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.02em;
	color: var(--ch-badge-text, #fff);
	background: var(--ch-open-color, #16a34a);
}

.ch-badge--active {
	background: var(--ch-active-color, #eab308);
}

.ch-badge--closed {
	background: var(--ch-closed-color, #3b82f6);
}

/* ---------- Buttons ----------
 * The element-qualified selectors (button.ch-btn / input.ch-btn) raise
 * specificity to (0,1,1) so the plugin's styling wins over theme/Elementor
 * button resets such as `[type="submit"], button { background: transparent }`
 * (specificity 0,1,0) that load after this stylesheet — without !important.
 */
.ch-btn,
button.ch-btn,
input.ch-btn {
	display: inline-block;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	padding: 0.6rem 1.15rem;
	border-radius: 8px;
	text-decoration: none;
	background: var(--ch-btn-color, #0047ab);
	color: var(--ch-btn-text, #fff) !important;
	border: 0;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.15s ease;
}

.ch-btn:hover,
button.ch-btn:hover,
input.ch-btn:hover {
	filter: brightness(1.08);
}

.ch-btn:active {
	transform: translateY(1px);
}

.ch-btn--small {
	padding: 0.35rem 0.8rem;
	font-size: 0.9em;
}

/* ---------- Forms ---------- */
.ch-form p {
	margin: 0 0 1.15rem;
}

.ch-form label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.3rem;
}

.ch-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ch-form textarea,
.ch-form select,
.ch-form .widefat {
	font: inherit;
	width: 100%;
	max-width: 560px;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--ch-card-border, #cfd4dc);
	border-radius: 8px;
	background: #fff;
	color: inherit;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ch-form textarea {
	min-height: 8rem;
	resize: vertical;
}

.ch-form input:focus,
.ch-form textarea:focus,
.ch-form select:focus {
	outline: none;
	border-color: var(--ch-btn-color, #0047ab);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ch-btn-color, #0047ab) 22%, transparent);
}

/* Checkbox / radio labels are inline and normal-weight, not block headings. */
.ch-form label:has(input[type="checkbox"]),
.ch-form label:has(input[type="radio"]) {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-weight: 400;
	margin-bottom: 0;
}

.ch-login-errors {
	margin: 0 0 1rem;
	padding: 0.65rem 0.9rem;
	border-radius: 8px;
	background: color-mix(in srgb, #b91c1c 9%, transparent);
	border-left: 4px solid #b91c1c;
	color: #b91c1c;
}

/* Visible keyboard focus for all interactive elements (a11y). */
.ch-btn:focus-visible,
.ch-submit-cta:focus-visible,
.ch-resource-link:focus-visible,
.ch-card__title a:focus-visible {
	outline: 2px solid var(--ch-btn-color, #0047ab);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------- Messages ---------- */
.ch-msg {
	margin: 0.5rem 0 1rem;
}

.ch-msg.ch-success {
	color: #15803d;
}

.ch-msg.ch-error {
	color: #b91c1c;
}

/* ---------- Stage notices ---------- */
.ch-notice {
	padding: 1rem 1.15rem;
	border-radius: var(--ch-card-radius, 10px);
	margin: 1rem 0;
	background: rgba(0, 0, 0, 0.04);
	line-height: 1.5;
}

.ch-notice--active {
	background: color-mix(in srgb, var(--ch-active-color, #eab308) 12%, transparent);
	border-left: 4px solid var(--ch-active-color, #eab308);
}

.ch-notice--closed {
	background: color-mix(in srgb, var(--ch-closed-color, #3b82f6) 10%, transparent);
	border-left: 4px solid var(--ch-closed-color, #3b82f6);
}

/* ---------- Section B: action + template downloads ---------- */
.ch-action-block {
	margin: 1.5rem 0 2.5rem;
}

/* "Submit a New Collaboration": black circular button with a four-dot icon. */
.ch-submit-cta {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	text-decoration: none;
	color: inherit;
	font: inherit;
	font-weight: 700;
}

.ch-submit-cta__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #000;
	flex: 0 0 auto;
	transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.ch-submit-cta__icon svg {
	fill: #fff;
}

.ch-submit-cta:hover .ch-submit-cta__icon,
.ch-submit-cta:focus-visible .ch-submit-cta__icon {
	transform: scale(1.07);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

.ch-resource-links {
	list-style: none;
	margin: 1.1rem 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}

.ch-resource-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	text-decoration: none;
	font-size: var(--ch-body-size, 14px);
	font-weight: 600;
	color: var(--ch-btn-color, #0047ab);
}

.ch-resource-link:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.ch-resource-link__icon {
	font-size: 1.15em;
	line-height: 1;
}

/* ---------- Single ---------- */
/* Constrain the article to a comfortable reading measure on wide screens. */
.ch-single__article {
	max-width: 860px;
	margin-inline: auto;
}

.ch-single__head {
	position: relative;
	margin-bottom: 1.25rem;
}

.ch-single__badge {
	margin-bottom: 0.6rem;
}

.ch-single__title {
	margin: 0.35rem 0;
	line-height: 1.2;
}

.ch-single__proposers {
	font-weight: 600;
	opacity: 0.85;
}

.ch-single__head .ch-btn {
	margin-top: 0.75rem;
}

.ch-single__expertise {
	margin-top: 1.5rem;
}

/* Expertise rendered as tag chips when comma-separated. */
.ch-tags {
	list-style: none;
	margin: 0.5rem 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ch-tag {
	display: inline-block;
	padding: 0.3rem 0.7rem;
	border-radius: 999px;
	font-size: 0.9em;
	line-height: 1.4;
	background: color-mix(in srgb, var(--ch-btn-color, #0047ab) 10%, transparent);
	color: color-mix(in srgb, var(--ch-btn-color, #0047ab) 78%, #303030);
	border: 1px solid color-mix(in srgb, var(--ch-btn-color, #0047ab) 22%, transparent);
}

.ch-back {
	margin-top: 2rem;
}

/* ---------- Archive ---------- */
/* Full-width background band, but content sits in a centred container. */
.ch-archive__inner {
	max-width: 1200px;
	margin-inline: auto;
}

.ch-archive__title {
	margin-bottom: 0.5rem;
}

.ch-archive__intro {
	max-width: 70ch;
	line-height: 1.6;
	opacity: 0.9;
}

.ch-stage-section {
	margin-bottom: 2.5rem;
}

.ch-stage-heading {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.ch-stage-heading .ch-count {
	font-size: 0.7em;
	font-weight: 500;
	opacity: 0.6;
}

/* ---------- Respect reduced-motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
	.ch-card,
	.ch-btn,
	.ch-submit-cta__icon {
		transition: none;
	}
	.ch-card:hover,
	.ch-submit-cta:hover .ch-submit-cta__icon {
		transform: none;
	}
}

/* ---------- Admin list-table badges ---------- */
.ch-admin-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: #64748b;
}

.ch-admin-badge--open {
	background: #16a34a;
}

.ch-admin-badge--active {
	background: #eab308;
	color: #111;
}

.ch-admin-badge--closed {
	background: #3b82f6;
}
