/*
 * Building blocks for editor-built pages.
 * Every selector is scoped to an xb- class or an is-style-xestro-* block style,
 * so existing posts and pages are untouched. Colours and sizes come from
 * theme.json presets, so a redesign changes them there.
 */

/* Sections: full-width bands with a centred inner column */
.xb-section {
	padding: 5rem 1.5rem;
	font-family: var(--wp--preset--font-family--inter);
	color: var(--wp--preset--color--ink);
}

.xb-section--sky {
	background: var(--wp--preset--color--sky);
}

.xb-section--mist {
	background: var(--wp--preset--color--mist);
}

.xb-inner {
	max-width: 1200px;
	margin: 0 auto;
}

.xb-inner--narrow {
	max-width: 760px;
}

/* style.css zeroes every margin, so blocks in a section need their own rhythm */
.xb-inner > * + *,
.xb-card > * + *,
.xb-media .wp-block-media-text__content > * + * {
	margin-top: 1.25rem;
}

.xb-inner > .xb-grid,
.xb-inner > .xb-logos,
.xb-inner > .xb-stats,
.xb-inner > .xb-faq,
.xb-inner > .xb-table,
.xb-inner > .wp-block-buttons {
	margin-top: 2.5rem;
}

.xb-section p,
.xb-section li {
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.6;
	color: var(--wp--preset--color--slate);
}

.xb-section ul,
.xb-section ol {
	padding-left: 1.25rem;
}

.xb-section a:not(.wp-element-button) {
	color: var(--wp--preset--color--navy);
	text-decoration: underline;
}

/* Headings */
.xb-page-title,
.xb-title {
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--ink);
}

.xb-page-title {
	font-size: var(--wp--preset--font-size--page-title);
}

.xb-title {
	font-size: var(--wp--preset--font-size--section-title);
}

.xb-centred {
	text-align: center;
}

.xb-centred .xb-lead,
.xb-lead.xb-centred {
	margin-left: auto;
	margin-right: auto;
}

.xb-section .xb-lead {
	max-width: 700px;
	font-size: var(--wp--preset--font-size--lead);
}

.xb-section .xb-caption {
	font-size: var(--wp--preset--font-size--caption);
}

.xb-kicker {
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--navy);
}

.xb-section h3 {
	font-size: var(--wp--preset--font-size--card-title);
	font-weight: 500;
	line-height: 1.3;
	color: var(--wp--preset--color--ink);
}

/* Buttons */
.wp-block-buttons.xb-centred {
	justify-content: center;
}

.wp-block-button[class*="is-style-xestro-"] .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0.85rem 1.75rem;
	border: 1px solid transparent;
	border-radius: 50px;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.wp-block-button.is-style-xestro-primary .wp-block-button__link {
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
}

.wp-block-button.is-style-xestro-primary .wp-block-button__link:hover {
	background: var(--wp--preset--color--indigo);
	transform: translateY(-1px);
}

.wp-block-button.is-style-xestro-outline .wp-block-button__link {
	background: transparent;
	border-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--navy);
}

.wp-block-button.is-style-xestro-outline .wp-block-button__link:hover {
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--surface);
}

.wp-block-button.is-style-xestro-white .wp-block-button__link {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--navy);
}

.wp-block-button.is-style-xestro-white .wp-block-button__link:hover {
	transform: translateY(-1px);
}

/* Card grid */
.xb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 2rem;
}

.xb-grid > * {
	margin-top: 0;
}

/* For cards with a full paragraph each */
.xb-grid--two {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* For sets of three or six, which split unevenly four to a row */
.xb-grid--three {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1024px) {
	.xb-grid--three {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.xb-card {
	padding: 2rem 1.5rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 1rem;
	background: var(--wp--preset--color--surface);
	transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.xb-card:hover {
	border-color: var(--wp--preset--color--navy);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
	transform: translateY(-4px);
}

/* Partner and integration logos */
/* Flex rather than grid so a part-filled last row sits centred */
.xb-logos {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1.5rem;
}

.xb-logos > * {
	flex: 0 1 160px;
	margin-top: 0;
}

.xb-logos .wp-block-image,
.xb-card .xb-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
}

.xb-logos .wp-block-image {
	height: 110px;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 0.75rem;
	background: var(--wp--preset--color--surface);
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.xb-logos .wp-block-image:hover {
	border-color: var(--wp--preset--color--navy);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.xb-logos .wp-block-image a,
.xb-card .xb-logo a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.xb-logos .wp-block-image img {
	width: auto;
	max-width: 100%;
	max-height: 64px;
	object-fit: contain;
}

.xb-card .xb-logo {
	height: 96px;
}

.xb-card .xb-logo img {
	width: auto;
	max-width: 70%;
	max-height: 80px;
	object-fit: contain;
}

/* Screenshot with text */
.xb-media.wp-block-media-text {
	gap: 3rem;
}

.xb-media .wp-block-media-text__content {
	padding: 0;
}

.xb-media .wp-block-media-text__media img {
	border-radius: 1rem;
	box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

/* Hero with a badge or logo beside the heading, not a screenshot */
.xb-hero-media .wp-block-media-text__media {
	text-align: center;
}

.xb-hero-media .wp-block-media-text__media img {
	max-width: 260px;
	border-radius: 0;
	box-shadow: none;
}

.xb-hero-media .wp-block-media-text__media figcaption,
.xb-hero-media .xb-caption {
	font-size: var(--wp--preset--font-size--caption);
	color: var(--wp--preset--color--slate);
}

/* Rows of screenshot-with-text need more room between them than other blocks */
.xb-inner > .xb-media + .xb-media {
	margin-top: 4rem;
}

/* Proof bar */
.xb-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 2rem;
	text-align: center;
}

.xb-stats > * {
	margin-top: 0;
}

/* Scoped to .xb-section so it outranks the section paragraph size */
.xb-section .xb-stat-number {
	font-size: var(--wp--preset--font-size--section-title);
	font-weight: 600;
	line-height: 1.1;
	color: var(--wp--preset--color--navy);
}

.xb-section .xb-stat-number + p {
	margin-top: 0.5rem;
}

/* FAQ */
.xb-faq .wp-block-details {
	border-bottom: 1px solid var(--wp--preset--color--line);
	padding: 1.25rem 0;
}

.xb-faq .wp-block-details summary {
	cursor: pointer;
	font-size: 1.125rem;
	font-weight: 500;
	color: var(--wp--preset--color--ink);
}

.xb-faq .wp-block-details > * + * {
	margin-top: 0.75rem;
}

/* Customer quote */
.xb-quote.wp-block-quote {
	max-width: 760px;
	margin-left: auto;
	margin-right: auto;
	padding: 2.5rem;
	border: 1px solid var(--wp--preset--color--line);
	border-top: 4px solid var(--wp--preset--color--navy);
	border-radius: 1.25rem;
	background: var(--wp--preset--color--surface);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.xb-quote.wp-block-quote p {
	font-size: var(--wp--preset--font-size--lead);
	color: var(--wp--preset--color--ink);
}

.xb-quote.wp-block-quote cite {
	display: block;
	margin-top: 1.25rem;
	font-size: var(--wp--preset--font-size--caption);
	font-style: normal;
	color: var(--wp--preset--color--slate);
}

/* Comparison table */
.xb-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--body);
}

.xb-table thead {
	border-bottom: 0;
}

.xb-table th,
.xb-table td {
	padding: 0.9rem 1rem;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
	text-align: left;
	vertical-align: top;
}

.xb-table thead th {
	background: var(--wp--preset--color--sky);
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

/* Call-to-action band */
.xb-cta {
	background: linear-gradient(135deg, var(--wp--preset--color--navy) 0%, var(--wp--preset--color--indigo) 100%);
}

.xb-cta .xb-title,
.xb-cta p {
	color: var(--wp--preset--color--surface);
}

/* Upcoming events, listed by month by the [xestro_events] shortcode */
.xb-inner > .xb-events,
.xb-inner > .xb-events-empty {
	margin-top: 2.5rem;
}

.xb-events-group + .xb-events-group {
	margin-top: 2.5rem;
}

.xb-section .xb-events-month {
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--wp--preset--color--navy);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--navy);
}

.xb-section .xb-events-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.xb-event {
	display: grid;
	grid-template-columns: 4.5rem minmax(0, 1fr) 9rem 10rem;
	grid-template-areas: "date details booking button";
	align-items: center;
	gap: 1.5rem;
	padding: 1.25rem 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.xb-event-date {
	grid-area: date;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0.6rem 0.25rem;
	border-radius: 0.75rem;
	background: var(--wp--preset--color--sky);
	line-height: 1.1;
	color: var(--wp--preset--color--navy);
}

.xb-event-day {
	font-size: 1.75rem;
	font-weight: 600;
}

.xb-event-month {
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.xb-event-weekday {
	margin-top: 0.25rem;
	font-size: var(--wp--preset--font-size--caption);
	color: var(--wp--preset--color--slate);
}

.xb-event-details {
	grid-area: details;
}

.xb-section .xb-event-title {
	font-size: 1.125rem;
	font-weight: 500;
	line-height: 1.35;
	color: var(--wp--preset--color--ink);
}

.xb-section .xb-event-title a {
	color: inherit;
	text-decoration: none;
}

.xb-section .xb-event-title a:hover {
	color: var(--wp--preset--color--navy);
	text-decoration: underline;
}

.xb-section .xb-event-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin-top: 0.35rem;
	font-size: var(--wp--preset--font-size--caption);
}

.xb-event-meta span + span::before {
	content: "\00B7";
	margin-right: 0.75rem;
}

.xb-event-booking {
	grid-area: booking;
	text-align: right;
}

.xb-section .xb-event-price {
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

.xb-section .xb-event-status {
	margin-top: 0.15rem;
	font-size: var(--wp--preset--font-size--caption);
}

.xb-event-status::before {
	content: "";
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	margin-right: 0.4rem;
	border-radius: 50%;
	background: var(--wp--preset--color--navy);
	vertical-align: 0.05em;
}

.xb-section .xb-event--few .xb-event-status {
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

.xb-event--few .xb-event-status::before {
	background: var(--wp--preset--color--orange);
}

.xb-event--full .xb-event-status::before,
.xb-event--closed .xb-event-status::before {
	background: var(--wp--preset--color--slate);
}

.xb-event-button {
	grid-area: button;
}

.xb-event-button.wp-block-button .wp-block-button__link {
	justify-content: center;
	width: 100%;
	padding: 0.6rem 1.25rem;
	font-size: 0.9375rem;
}

.xb-section .xb-events-empty {
	padding: 2rem;
	border: 1px dashed var(--wp--preset--color--line);
	border-radius: 1rem;
	text-align: center;
}

@media (max-width: 768px) {
	.xb-section {
		padding: 3rem 1rem;
	}

	.xb-media.wp-block-media-text {
		gap: 2rem;
	}

	.xb-media.is-stacked-on-mobile .wp-block-media-text__content {
		margin-top: 1.5rem;
	}

	.xb-grid--two,
	.xb-grid--three {
		grid-template-columns: 1fr;
	}

	.xb-logos {
		gap: 0.75rem;
	}

	.xb-logos > * {
		flex-basis: calc(50% - 0.375rem);
	}

	.xb-logos .wp-block-image {
		height: 88px;
		padding: 0.75rem;
	}

	.xb-hero-media .wp-block-media-text__media img {
		max-width: 200px;
	}

	.xb-quote.wp-block-quote {
		padding: 1.75rem;
	}

	/* Wide tables scroll sideways inside their box rather than squeezing words apart */
	.xb-table {
		overflow-x: auto;
	}

	.xb-table table {
		min-width: 640px;
	}

	.xb-table th,
	.xb-table td {
		padding: 0.65rem 0.75rem;
		font-size: var(--wp--preset--font-size--caption);
	}

	.xb-event {
		grid-template-columns: 4rem minmax(0, 1fr);
		grid-template-areas:
			"date details"
			"date booking"
			"button button";
		align-items: start;
		gap: 0.75rem 1rem;
	}

	.xb-section .xb-event-meta {
		display: block;
	}

	.xb-event-meta span {
		display: block;
	}

	.xb-event-meta span + span::before {
		content: none;
	}

	.xb-event-booking {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		gap: 0.25rem 0.75rem;
		text-align: left;
	}

	.xb-section .xb-event-status {
		margin-top: 0;
	}
}

/* WordPress stacks media-and-text at 600px with the image first; a hero reads heading first */
@media (max-width: 600px) {
	.xb-hero-media.is-stacked-on-mobile .wp-block-media-text__content {
		grid-row: 1;
	}

	.xb-hero-media.is-stacked-on-mobile .wp-block-media-text__media {
		grid-row: 2;
		margin-top: 2rem;
	}
}
