/**
 * Shared layout primitives for child-theme page templates.
 */

.ych-page {
	/* Compatibility aliases for templates built before the global token pass. */
	--ych-page-navy: var(--ych-bg-primary);
	--ych-page-blue: var(--ych-accent-blue);
	--ych-page-purple: var(--ych-accent-purple);
	--ych-page-white: var(--ych-surface-white);
	--ych-page-background: var(--ych-surface-soft);
	--ych-page-copy: var(--ych-copy-on-light);
	--ych-page-border: var(--ych-border-on-light);
	width: 100%;
	max-width: none;
	margin: 0;
	background: var(--ych-page-white);
	color: var(--ych-page-navy);
	font-family: var(--ych-font-body);
}

.ych-page *,
.ych-page *::before,
.ych-page *::after { box-sizing: border-box; }

.ych-page__hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	background: var(--ych-page-navy);
	color: var(--ych-page-white);
}

.ych-page__hero::after {
	position: absolute;
	z-index: -1;
	top: -14rem;
	right: -12rem;
	width: 36rem;
	height: 36rem;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--ych-page-blue), var(--ych-page-purple));
	filter: blur(7rem);
	opacity: 0.3;
	content: "";
	pointer-events: none;
}

.ych-page__hero-inner { padding-block: var(--ych-section-space); }

.ych-page__section {
	padding-block: var(--ych-section-space);
	background: var(--ych-page-white);
}

.ych-page__section--light { background: var(--ych-page-background); }
.ych-page__section--navy { background: var(--ych-page-navy); color: var(--ych-page-white); }

.ych-page__section-header {
	max-width: var(--ych-measure-reading);
	margin: 0 auto var(--ych-space-5);
	text-align: center;
}

.ych-page__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(1rem, 2vw, 1.5rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ych-page__split {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: stretch;
}

.ych-page__media-placeholder {
	display: grid;
	width: 100%;
	min-height: 15rem;
	place-items: center;
	padding: 2rem;
	border-radius: var(--ych-radius-card);
	background: radial-gradient(circle at 26% 24%, rgba(255, 255, 255, 0.18), transparent 32%), linear-gradient(135deg, var(--ych-page-blue), var(--ych-page-purple));
	color: var(--ych-page-white);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-align: center;
	text-transform: uppercase;
}

.ych-card > .ych-page__media-placeholder { margin-bottom: 1.5rem; }

.ych-page__steps,
.ych-page__details {
	display: grid;
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ych-page__step,
.ych-page__detail {
	padding: 1.25rem;
	border-left: 0.25rem solid var(--ych-page-purple);
	border-radius: 0 1rem 1rem 0;
	background: var(--ych-page-white);
	box-shadow: var(--ych-shadow-small);
}

.ych-page__step strong,
.ych-page__detail dt {
	display: block;
	margin-bottom: 0.4rem;
	color: var(--ych-page-navy);
	font-weight: 700;
}

.ych-page__detail dd {
	margin: 0;
	color: var(--ych-page-copy);
	line-height: 1.6;
}

.ych-page__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.875rem;
	justify-content: center;
	margin-top: clamp(2rem, 5vw, 3.5rem);
}

@media (min-width: 48rem) {
	.ych-page__grid--2,
	.ych-page__grid--3,
	.ych-page__split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
	.ych-page__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.ych-page__grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Canonical inner-page system. */
.ych-inner-hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	border-bottom: 0.0625rem solid var(--ych-border);
	background: linear-gradient(145deg, var(--ych-bg-primary), var(--ych-bg-secondary));
	color: var(--ych-text-primary);
}

.ych-inner-hero::after {
	position: absolute;
	z-index: -1;
	top: -14rem;
	right: -10rem;
	width: 34rem;
	height: 34rem;
	border-radius: 50%;
	background: var(--ych-accent-gradient);
	content: "";
	filter: blur(8rem);
	opacity: 0.24;
	pointer-events: none;
}

.ych-inner-hero__inner {
	position: relative;
	padding-block: var(--ych-section-space-compact);
}

.ych-inner-hero .ych-page__label {
	margin-bottom: var(--ych-space-2);
	color: var(--ych-accent-blue);
}

.ych-inner-hero h1 {
	max-width: min(14ch, 100%);
	margin: var(--ych-space-1) 0 var(--ych-space-2);
	color: var(--ych-text-primary);
	font-family: var(--ych-font-heading);
	font-size: var(--ych-type-display);
	font-weight: 700;
	letter-spacing: -0.04em;
	line-height: var(--ych-leading-heading);
	text-wrap: balance;
	overflow-wrap: anywhere;
}

.ych-inner-hero__lead {
	max-width: var(--ych-measure-reading);
	margin: 0;
	color: var(--ych-text-secondary);
	font-size: var(--ych-type-body-large);
	line-height: var(--ych-leading-body);
	text-wrap: pretty;
}

.ych-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	min-height: 2.75rem;
	align-items: center;
	gap: 0.25rem 0.55rem;
	margin-bottom: var(--ych-space-4);
	color: var(--ych-text-muted);
	font-size: var(--ych-type-label);
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.4;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.ych-breadcrumb a {
	display: inline-flex;
	min-height: 2.75rem;
	align-items: center;
	border-radius: 0.25rem;
	color: var(--ych-accent-blue);
	text-decoration: none;
	transition: color var(--ych-transition);
}

.ych-breadcrumb a:hover { color: var(--ych-text-primary); }

.ych-breadcrumb a:focus-visible {
	outline: 0.1875rem solid var(--ych-focus);
	outline-offset: 0.2rem;
}

.ych-breadcrumb > [aria-hidden="true"] { color: var(--ych-border-strong); }
.ych-breadcrumb > [aria-current="page"] { color: var(--ych-text-secondary); }

.ych-content-section {
	padding-block: var(--ych-section-space);
	background: var(--ych-bg-primary);
	color: var(--ych-text-primary);
}

.ych-content-section--alt { background: var(--ych-bg-secondary); }

.ych-section-heading {
	max-width: var(--ych-measure-reading);
	margin-bottom: var(--ych-space-5);
}

.ych-section-heading h2,
.ych-content-section h2 {
	color: var(--ych-text-primary);
	font-family: var(--ych-font-heading);
	font-size: var(--ych-type-h2);
	letter-spacing: -0.035em;
	line-height: var(--ych-leading-heading);
}

.ych-directory-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(1.25rem, 2.5vw, 2rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ych-directory-card {
	display: flex;
	overflow: hidden;
	height: 100%;
	flex-direction: column;
	border: 0.0625rem solid var(--ych-border);
	border-radius: var(--ych-radius-card);
	background: linear-gradient(155deg, rgba(19, 36, 58, 0.96), rgba(12, 24, 40, 0.98));
	box-shadow: var(--ych-shadow-small);
	transition: border-color var(--ych-transition), box-shadow var(--ych-transition), transform var(--ych-transition);
}

.ych-directory-card:hover,
.ych-directory-card:focus-within {
	border-color: var(--ych-border-strong);
	box-shadow: var(--ych-shadow-medium);
	transform: translateY(-0.35rem);
}

.ych-directory-card__media { overflow: hidden; aspect-ratio: 16 / 9; }
.ych-directory-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.ych-directory-card:hover .ych-directory-card__media img { transform: scale(1.04); }
.ych-directory-card__body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: clamp(1.4rem, 3vw, 2rem); }
.ych-directory-card h3 { margin: 0.7rem 0; color: var(--ych-text-primary); font-size: clamp(1.35rem, 2vw, 1.8rem); }
.ych-directory-card p:not(.ych-page__label) { color: var(--ych-text-secondary); line-height: var(--ych-leading-body); }
.ych-directory-card a { margin-top: auto; color: var(--ych-accent-blue); font-weight: 700; text-decoration: none; }

.ych-empty-state {
	max-width: 52rem;
	margin-inline: auto;
	padding: clamp(2rem, 5vw, 4rem);
	border: 0.0625rem solid var(--ych-border);
	border-radius: var(--ych-radius-card);
	background: var(--ych-bg-card);
	box-shadow: var(--ych-shadow-medium);
	text-align: center;
}

.ych-empty-state__mark {
	display: block;
	width: 4rem;
	height: 0.3rem;
	margin: 0 auto 1.5rem;
	border-radius: 999px;
	background: var(--ych-accent-gradient);
}

.ych-empty-state p { max-width: 38rem; margin: 0 auto 1.75rem; color: var(--ych-text-secondary); line-height: var(--ych-leading-body); }

.ych-live-content {
	overflow-wrap: anywhere;
	color: var(--ych-text-secondary);
}

.ych-live-content > * + * { margin-top: clamp(1.5rem, 3vw, 2.5rem); }
.ych-live-content > .alignfull {
	width: 100%;
	max-width: 100%;
	margin-inline: 0 !important;
}
.ych-live-content h2,
.ych-live-content h3,
.ych-live-content h4,
.ych-live-content h5 { color: var(--ych-text-primary) !important; font-family: var(--ych-font-heading); }
.ych-live-content p,
.ych-live-content li { color: var(--ych-text-secondary) !important; line-height: var(--ych-leading-body); }
.ych-live-content a:not(.ych-button, .wp-block-button__link) {
	color: var(--ych-accent-blue) !important;
	text-decoration-thickness: 0.1em;
	text-underline-offset: 0.2em;
}
.ych-live-content img { max-width: 100%; height: auto; border-radius: var(--ych-radius-card); object-fit: cover; }
.ych-live-content .elementor,
.ych-live-content .elementor-section,
.ych-live-content .e-con { max-width: 100%; background-color: transparent !important; }
.ych-live-content .elementor-section-wrap,
.ych-live-content .elementor-container { max-width: 100% !important; }
.ych-live-content [class*="elementor-element-"] { color: var(--ych-text-secondary); }
.ych-live-content iframe { max-width: 100%; }

.ych-page__detail a { color: var(--ych-page-purple); font-weight: 700; }

@media (min-width: 48rem) {
	.ych-directory-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
	.ych-directory-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
	.ych-directory-card,
	.ych-directory-card__media img { transition: none; }
	.ych-directory-card:hover,
	.ych-directory-card:hover .ych-directory-card__media img { transform: none; }
}

@media (max-width: 36rem) {
	.ych-page__actions { align-items: stretch; flex-direction: column; }
	.ych-button { width: 100%; }
}

/* CPT archive and single presentation shared by Programmes and Events. */
.post-type-archive-ych_programme,
.post-type-archive-ych_event,
.single-ych_programme,
.single-ych_event {
	background: var(--ych-bg-primary);
	color: var(--ych-text-primary);
	font-family: var(--ych-font-body);
}

.post-type-archive-ych_programme .entry-hero-container-inner,
.post-type-archive-ych_event .entry-hero-container-inner,
.single-ych_programme .entry-hero-container-inner,
.single-ych_event .entry-hero-container-inner {
	padding-block: clamp(3.5rem, 7vw, 6rem);
	background: linear-gradient(145deg, var(--ych-bg-primary), var(--ych-bg-secondary));
	color: var(--ych-text-primary);
}

.post-type-archive-ych_programme .entry-title,
.post-type-archive-ych_event .entry-title,
.single-ych_programme .entry-title,
.single-ych_event .entry-title {
	color: var(--ych-text-primary);
	font-family: var(--ych-font-heading);
	font-size: var(--ych-type-display);
	font-weight: 700;
	letter-spacing: -0.04em;
	line-height: var(--ych-leading-heading);
	text-wrap: balance;
}

.post-type-archive-ych_programme .entry-hero-container-inner .entry-title,
.post-type-archive-ych_event .entry-hero-container-inner .entry-title,
.single-ych_programme .entry-hero-container-inner .entry-title,
.single-ych_event .entry-hero-container-inner .entry-title {
	color: var(--ych-text-primary);
}

.post-type-archive-ych_programme .entry-hero-container-inner .archive-title,
.post-type-archive-ych_event .entry-hero-container-inner .archive-title {
	color: var(--ych-text-primary);
}

.post-type-archive-ych_programme .archive-description,
.post-type-archive-ych_event .archive-description {
	color: var(--ych-text-secondary);
	font-size: 1.0625rem;
	line-height: var(--ych-leading-body);
}

.post-type-archive-ych_programme #primary,
.post-type-archive-ych_event #primary,
.single-ych_programme #primary,
.single-ych_event #primary {
	background: var(--ych-bg-primary);
}

.post-type-archive-ych_programme #archive-container,
.post-type-archive-ych_event #archive-container {
	width: min(calc(100% - (var(--page-gutter) * 2)), var(--content-max-width));
	margin-inline: auto;
	gap: var(--ych-space-3);
	padding-block: var(--ych-space-6);
}

.post-type-archive-ych_programme .loop-entry,
.post-type-archive-ych_event .loop-entry {
	overflow: hidden;
	border: 0.0625rem solid var(--ych-border);
	border-radius: var(--ych-radius-card);
	background: var(--ych-bg-card);
	box-shadow: var(--ych-shadow-small);
	transition: border-color var(--ych-transition), box-shadow var(--ych-transition), transform var(--ych-transition);
}

.post-type-archive-ych_programme .loop-entry:hover,
.post-type-archive-ych_event .loop-entry:hover {
	border-color: var(--ych-border-strong);
	box-shadow: var(--ych-shadow-medium);
	transform: translateY(-0.25rem);
}

.post-type-archive-ych_programme .loop-entry .entry-title,
.post-type-archive-ych_event .loop-entry .entry-title {
	font-size: clamp(1.4rem, 2.4vw, 1.9rem);
	line-height: 1.15;
}

.post-type-archive-ych_programme .loop-entry .entry-title a,
.post-type-archive-ych_event .loop-entry .entry-title a {
	color: var(--ych-text-primary);
	text-decoration: none;
}

.post-type-archive-ych_programme .loop-entry .entry-summary,
.post-type-archive-ych_event .loop-entry .entry-summary {
	color: var(--ych-text-secondary);
	line-height: var(--ych-leading-body);
}

.post-type-archive-ych_programme .loop-entry img,
.post-type-archive-ych_event .loop-entry img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.post-type-archive-ych_programme a:focus-visible,
.post-type-archive-ych_event a:focus-visible,
.single-ych_programme a:focus-visible,
.single-ych_event a:focus-visible {
	outline: 0.1875rem solid var(--ych-focus);
	outline-offset: 0.25rem;
}

@media (prefers-reduced-motion: reduce) {
	.post-type-archive-ych_programme .loop-entry,
	.post-type-archive-ych_event .loop-entry { transition: none; }

	.post-type-archive-ych_programme .loop-entry:hover,
	.post-type-archive-ych_event .loop-entry:hover { transform: none; }
}
