/*
 * Current program card (cover, season, dates, link to the PDF).
 * Rendered by cjdng_centre_program_links_html() on the activity lists and the
 * centre page's Activités block; enqueued by that helper.
 */

.cjdng-program {
	--cjdng-pg-accent: var(--cjndg-centre-accent, var(--cjndg-color-primary, #2563eb));
	--cjdng-pg-text: var(--cjndg-color-text, #1f2937);
	--cjdng-pg-muted: color-mix(in srgb, var(--cjdng-pg-text) 62%, transparent);
	--cjdng-pg-border: #e5e7eb;

	margin: 2.5rem 0 0;
	font-family: var(--cjndg-font-text, inherit);
	color: var(--cjdng-pg-text);
}

.cjdng-program-card {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 1.4rem;
	background: #fff;
	border: 1px solid var(--cjdng-pg-border);
	border-radius: 14px;
}

/* The cover sits like a printed brochure: slight tilt and a soft shadow.
   It keeps the PDF's own shape (some programs are landscape schedules). */
.cjdng-program-cover {
	flex: none;
	max-width: 100%;
	border-radius: 4px;
	overflow: hidden;
	background: color-mix(in srgb, var(--cjdng-pg-accent) 12%, #fff);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05), 0 8px 18px rgba(80, 30, 20, 0.18);
	transform: rotate(-2deg);
	display: block;
}

.cjdng-program-cover img {
	display: block;
	width: auto;
	height: auto;
	max-width: 180px;
	max-height: 166px;
}

/* No cover yet: a plain brochure icon. */
.cjdng-program-cover.is-empty {
	width: 128px;
	aspect-ratio: 612 / 792;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cjdng-program-cover.is-empty::before {
	content: "";
	width: 40%;
	aspect-ratio: 1;
	background: var(--cjdng-pg-accent);
	opacity: 0.5;
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linejoin='round'><path d='M6 3h9l4 4v14H6z'/><path d='M15 3v4h4M9 12h7M9 15h7M9 18h4'/></svg>") center / contain no-repeat;
	        mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linejoin='round'><path d='M6 3h9l4 4v14H6z'/><path d='M15 3v4h4M9 12h7M9 15h7M9 18h4'/></svg>") center / contain no-repeat;
}

.cjdng-program-body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
}

.cjdng-program-eyebrow {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cjdng-pg-accent);
}

.cjdng-program-season {
	font-family: var(--cjndg-font-heading, inherit);
	font-weight: 700;
	font-size: 1.6rem;
	line-height: 1.15;
	margin: 0;
	color: var(--cjdng-pg-text);
}

.cjdng-program-dates {
	font-size: 0.95rem;
}

.cjdng-program-blurb {
	font-size: 0.95rem;
	color: var(--cjdng-pg-muted);
	margin: 0;
}

.cjdng-program-btn {
	margin-top: 0.6rem;
	display: inline-flex;
	align-items: center;
	padding: 0.65rem 1.1rem;
	background: var(--cjdng-pg-accent);
	color: #fff;
	border-radius: 8px;
	font-weight: 700;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.cjdng-program-btn:hover,
.cjdng-program-btn:focus {
	opacity: 0.88;
	color: #fff;
}

.cjdng-program-past {
	margin: 0.9rem 0 0;
	text-align: center;
	font-size: 0.9rem;
	color: var(--cjdng-pg-muted);
}

.cjdng-program-past a {
	color: var(--cjdng-pg-accent);
	text-decoration: underline;
}

/* Older seasons as small covers inside the card (centre page). */
.cjdng-program-pastcovers {
	margin-left: auto;
	align-self: stretch;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.6rem;
	padding-left: 1.4rem;
	border-left: 1px solid var(--cjdng-pg-border);
}

.cjdng-program-pastcovers-label {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cjdng-pg-muted);
}

.cjdng-program-pastcovers-list {
	display: flex;
	gap: 0.9rem;
}

.cjdng-program-pastcover {
	width: 72px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	color: var(--cjdng-pg-text);
	text-decoration: none;
}

.cjdng-program-pastcover:hover,
.cjdng-program-pastcover:focus {
	color: var(--cjdng-pg-accent);
}

.cjdng-program-pastcover-img {
	display: block;
	width: 100%;
	border-radius: 3px;
	overflow: hidden;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
	filter: saturate(0.8);
	transition: filter 0.15s ease, transform 0.15s ease;
}

.cjdng-program-pastcover-img img {
	display: block;
	width: 100%;
	height: auto;
}

.cjdng-program-pastcover-img.is-empty {
	aspect-ratio: 612 / 792;
	background: color-mix(in srgb, var(--cjdng-pg-accent) 12%, #fff);
}

.cjdng-program-pastcover:hover .cjdng-program-pastcover-img,
.cjdng-program-pastcover:focus .cjdng-program-pastcover-img {
	filter: none;
	transform: translateY(-2px);
}

/* Not enough room beside the text: older seasons go under it. */
@media (max-width: 900px) {
	.cjdng-program-card:has(.cjdng-program-pastcovers) {
		flex-wrap: wrap;
	}

	.cjdng-program-pastcovers {
		flex-basis: 100%;
		margin-left: 0;
		padding: 1rem 0 0;
		border-left: 0;
		border-top: 1px solid var(--cjdng-pg-border);
	}
}

@media (max-width: 600px) {
	.cjdng-program-card {
		flex-direction: column;
		align-items: flex-start;
	}


	.cjdng-program-btn {
		align-self: stretch;
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cjdng-program-cover {
		transform: none;
	}

	.cjdng-program-pastcover-img {
		transition: none;
	}
}
