/**
 * Event sections (night sky): the home page panel, and the event page header,
 * details and closing. Colours come from the event leaflet and live in
 * theme.json under settings.custom.event, so they don't widen the editor's
 * colour palette.
 *
 * The home panel is a rounded banner of its own, set apart from the welcome
 * header by a gap.
 */

.ebc-event {
	--ev-midnight: var(--wp--custom--event--midnight);
	--ev-midnight-deep: var(--wp--custom--event--midnight-deep);
	--ev-horizon: var(--wp--custom--event--horizon);
	--ev-star: var(--wp--custom--event--star);
	--ev-gold: var(--wp--custom--event--gold);
	--ev-gold-soft: var(--wp--custom--event--gold-soft);
	--ev-sky: linear-gradient(170deg, var(--ev-midnight) 0%, var(--ev-midnight-deep) 55%, var(--ev-horizon) 100%);
	--ebc-outline: var(--wp--preset--color--off-white);
	--ebc-focus: var(--ev-gold-soft);
	color: var(--wp--preset--color--white);
}

.ebc-event :is(h1, h2, h3) {
	color: var(--ev-star);
	text-wrap: balance;
}

.ebc-event a:not(.wp-element-button) {
	color: var(--wp--preset--color--white);
	text-decoration-color: var(--ev-gold);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.ebc-event a:not(.wp-element-button):hover {
	color: var(--ev-star);
}

.ebc-event :focus-visible {
	outline-color: var(--ev-gold-soft);
}

/* Lantern-gold buttons with midnight text (about 6:1). */
.ebc-event .wp-block-button:not(.is-style-outline-light) > .wp-block-button__link {
	background: var(--ev-gold);
	border-color: var(--ev-gold);
	color: var(--ev-midnight-deep);
}

.ebc-event .wp-block-button:not(.is-style-outline-light) > .wp-block-button__link:hover {
	background: var(--ev-gold-soft);
	border-color: var(--ev-gold-soft);
}

.ebc-event__title {
	font-weight: 800;
	text-wrap: balance;
	letter-spacing: -0.03em;
	line-height: 0.95;
	margin: 0;
}

.ebc-event p {
	text-wrap: pretty;
}

.ebc-event__when {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	letter-spacing: var(--wp--custom--letter-spacing--title);
	line-height: 1.3;
	margin: 0;
}

/* ------------------------------------------------------------------------
 * Home page panel
 * --------------------------------------------------------------------- */

.ebc-event-feature {
	/* The star: width and distance from the right edge. */
	--sw: clamp(130px, 70px + 7vw, 190px);
	--sr: clamp(2.5rem, 0.5rem + 6vw, 7.5rem);
	background: url("../../images/event/sky-panel.svg") right center / cover no-repeat, var(--ev-sky);
	/* Same corners as the Service times card below it. */
	border-radius: var(--wp--custom--radius--xl);
	box-sizing: border-box;
	isolation: isolate;
	margin-top: var(--wp--preset--spacing--50) !important;
	overflow: hidden;
	padding: clamp(2.25rem, 1rem + 3vw, 3.75rem) calc(var(--sw) + var(--sr) + 2rem) clamp(2.5rem, 1rem + 3.25vw, 4rem) clamp(1.75rem, 0.5rem + 5vw, 5.5rem);
}

/* The star of Bethlehem, on its own in the night sky. */
.ebc-event-feature::after {
	aspect-ratio: 1;
	background: url("../../images/event/star.svg") center / contain no-repeat;
	content: "";
	pointer-events: none;
	position: absolute;
	right: var(--sr);
	top: 50%;
	translate: 0 -50%;
	width: var(--sw);
	z-index: -1;
}

.ebc-event-feature__text {
	max-width: 34rem;
}

.ebc-event-feature .ebc-event__title {
	font-size: clamp(2.25rem, 1.3rem + 3vw, 3.5rem);
	margin-top: 0.5rem;
}

.ebc-event-feature .ebc-event__summary {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.55;
	margin: 1rem 0 0;
}

.ebc-event-feature .ebc-event__buttons {
	margin-top: var(--wp--preset--spacing--30);
}

/* The whole panel is one link: the button's link stretches over it. */
.ebc-event-feature .ebc-event__more .wp-block-button__link::after {
	content: "";
	inset: 0;
	position: absolute;
}

.ebc-event-feature:hover .ebc-event__more .wp-block-button__link {
	background: var(--ev-gold-soft);
	border-color: var(--ev-gold-soft);
}

.ebc-event-feature .ebc-event__more .wp-block-button__link:focus-visible {
	outline: 0;
}

.ebc-event-feature:has(.ebc-event__more a:focus-visible) {
	outline: 3px solid var(--ev-gold-soft);
	outline-offset: 4px;
}

/* ------------------------------------------------------------------------
 * Event page: the template makes <main> one continuous night sky.
 * --------------------------------------------------------------------- */

.ebc-night-page {
	--ev-midnight: var(--wp--custom--event--midnight);
	--ev-midnight-deep: var(--wp--custom--event--midnight-deep);
	--ev-horizon: var(--wp--custom--event--horizon);
	background:
		url("../../images/event/sky-tile.svg") center top / 600px repeat,
		linear-gradient(180deg, var(--ev-midnight) 0, var(--ev-midnight-deep) 45%, var(--ev-horizon) 100%);
	border-radius: var(--wp--custom--radius--hero) var(--wp--custom--radius--hero) 0 0;
	margin-top: var(--ebc-hero-gap, 1.5rem);
	overflow: hidden;
}

/* Each section carries its own night if it's used on an ordinary page. */
.ebc-event:is(.ebc-event-hero, .ebc-event-details, .ebc-event-stable) {
	background-color: var(--ev-midnight-deep);
}

.ebc-night-page .ebc-event:is(.ebc-event-hero, .ebc-event-details, .ebc-event-stable) {
	background-color: transparent;
}

/* ---------- Header ---------- */

.ebc-event-hero {
	background: url("../../images/event/sky.svg") center / cover no-repeat;
	padding: clamp(8rem, 5rem + 8vw, 11.5rem) var(--wp--preset--spacing--30) clamp(3.5rem, 2rem + 5vw, 6rem);
}

/* The star glints once as the page opens. */
.ebc-event-hero::before {
	animation: ebc-star-glint 2.2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both;
	aspect-ratio: 1;
	background: url("../../images/event/star.svg") center / contain no-repeat;
	content: "";
	left: 50%;
	pointer-events: none;
	position: absolute;
	top: clamp(1.5rem, 0.5rem + 3vw, 3rem);
	translate: -50% 0;
	width: clamp(84px, 60px + 4vw, 128px);
}

@keyframes ebc-star-glint {
	0% {
		opacity: 0;
		scale: 0.3;
		rotate: -25deg;
	}

	55% {
		opacity: 1;
		scale: 1.15;
		rotate: 4deg;
	}

	100% {
		opacity: 1;
		scale: 1;
		rotate: 0deg;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ebc-event-hero::before {
		animation: none;
	}
}

.ebc-event-hero .ebc-event__title {
	font-size: clamp(3rem, 1.5rem + 6vw, 6.25rem);
}

.ebc-event-hero .ebc-event__when {
	font-size: var(--wp--preset--font-size--x-large);
	margin-top: var(--wp--preset--spacing--40);
}

.ebc-event-hero .ebc-event__summary {
	font-size: var(--wp--preset--font-size--large);
	margin-top: 0.5rem;
}

.ebc-event-hero .ebc-event__buttons {
	margin-top: var(--wp--preset--spacing--40);
}

/* ---------- Details along the trail ---------- */

.ebc-event-details {
	padding-block: clamp(2.5rem, 1rem + 4vw, 4.5rem) clamp(2rem, 1rem + 3vw, 3.5rem);
}

.ebc-event-trail {
	--trail-x: 11px;
	padding-left: clamp(2.75rem, 2rem + 2vw, 3.75rem);
	position: relative;
}

/* The dotted trail, fading out as it heads for the stable. */
.ebc-event-trail::before {
	background: radial-gradient(circle, var(--ev-gold) 2.25px, transparent 2.75px) center top / 8px 16px repeat-y;
	bottom: calc(-1 * clamp(2rem, 1rem + 3vw, 3.5rem));
	content: "";
	left: calc(var(--trail-x) - 4px);
	mask-image: linear-gradient(180deg, transparent 0, #000 2.5rem, #000 80%, transparent);
	position: absolute;
	top: 0;
	width: 8px;
}

.ebc-event-trail > h2 {
	font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
	margin: var(--wp--preset--spacing--60) 0 var(--wp--preset--spacing--20);
}

.ebc-event-trail > h2:first-child {
	margin-top: 0;
}

/* A sparkle on the trail beside each heading. */
.ebc-event-trail > h2::before {
	aspect-ratio: 1;
	background: url("../../images/event/waypoint.svg") center / contain no-repeat;
	content: "";
	left: calc(var(--trail-x) - 13px);
	margin-top: 0.05em;
	position: absolute;
	width: 26px;
}

.ebc-event-trail p {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.65;
}

/* What's happening: three columns split by gold rules, as on the leaflet. */
.ebc-event .is-variant-tiles {
	--ebc-columns: 3;
	gap: 0;
	margin-top: var(--wp--preset--spacing--40);
}

.ebc-event .is-variant-tiles .wp-block-emmanuel-collection-item {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 0.25rem 1.25rem;
	text-align: center;
}

.ebc-event .is-variant-tiles .wp-block-emmanuel-collection-item + .wp-block-emmanuel-collection-item {
	border-left: 2px solid var(--ev-gold);
}

.ebc-event .is-variant-tiles .wp-block-emmanuel-collection-item:first-child {
	padding-left: 0;
}

.ebc-event .is-variant-tiles .wp-block-icon {
	color: var(--ev-gold-soft);
	margin: 0;
}

.ebc-event .is-variant-tiles .wp-block-icon svg {
	height: 56px;
	width: 56px;
}

.ebc-event .is-variant-tiles p {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
}

/* Plan your visit: label and detail side by side. */
.ebc-event .is-variant-rows {
	border-top: 1px solid var(--wp--custom--color--hairline-light);
	margin-top: var(--wp--preset--spacing--30);
}

.ebc-event .is-variant-rows .wp-block-emmanuel-collection-item {
	border-bottom: 1px solid var(--wp--custom--color--hairline-light);
	display: grid;
	gap: 0.25rem 1.5rem;
	grid-template-columns: 9rem minmax(0, 1fr);
	padding-block: 1rem;
}

.ebc-event .is-variant-rows h3 {
	color: var(--ev-gold-soft);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	line-height: 1.65;
	margin: 0;
}

.ebc-event .is-variant-rows p {
	margin: 0;
}

.ebc-event-trail p.ebc-event__leaflet {
	font-size: var(--wp--preset--font-size--medium);
	margin-top: 1.25rem;
}

/* ---------- Closing: the stable on the hill ---------- */

.ebc-event-stable {
	background: url("../../images/event/stable-hill.svg") center bottom / max(100%, 900px) auto no-repeat;
	/* The drawing is 1440 × 440; keep the text clear of the star above the stable. */
	padding: clamp(2.5rem, 1rem + 4vw, 4rem) var(--wp--preset--spacing--30) max(262px, 29.5%);
}

.ebc-event-stable h2 {
	font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
	margin: 0;
}

/* ---------- Tablets and phones ---------- */

@media (max-width: 781px) {
	.ebc-event-feature {
		border-radius: var(--wp--custom--radius--lg);
	}
}

@media (max-width: 1024px) {
	.ebc-event .is-variant-tiles {
		--ebc-columns: 3;
	}
}

@media (max-width: 767px) {
	/* The star moves to the top right; the text runs underneath it. */
	.ebc-event-feature {
		--sw: 104px;
		--sr: 1.25rem;
		/* Dots only: big sparkles would land on the text at this width. */
		background: url("../../images/event/sky-tile.svg") center top / 600px repeat, var(--ev-sky);
		padding: calc(var(--sw) + 1.5rem) 1.75rem 2.75rem;
	}

	.ebc-event-feature::after {
		top: 1.25rem;
		translate: none;
	}

	.ebc-event-feature .ebc-event__summary {
		font-size: var(--wp--preset--font-size--medium);
	}

	.ebc-night-page {
		border-radius: var(--wp--custom--radius--hero-sm) var(--wp--custom--radius--hero-sm) 0 0;
	}

	.ebc-event .is-variant-tiles {
		--ebc-columns: 1;
	}

	.ebc-event .is-variant-tiles .wp-block-emmanuel-collection-item,
	.ebc-event .is-variant-tiles .wp-block-emmanuel-collection-item:first-child {
		border-left: 0;
		flex-direction: row;
		gap: 1rem;
		padding: 0.85rem 0;
		text-align: left;
	}

	.ebc-event .is-variant-tiles .wp-block-emmanuel-collection-item + .wp-block-emmanuel-collection-item {
		border-left: 0;
		border-top: 2px solid var(--ev-gold);
	}

	.ebc-event .is-variant-tiles .wp-block-icon svg {
		height: 40px;
		width: 40px;
	}

	.ebc-event .is-variant-rows .wp-block-emmanuel-collection-item {
		grid-template-columns: minmax(0, 1fr);
	}
}
