/* Structure only: colors and type come from the theme. */

.foten-event-cards,
.foten-event-rows,
.foten-event-minis {
	margin: 0;
	padding: 0;
	list-style: none;
}

.foten-event-cards,
.foten-event-minis {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr));
	gap: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-events > * + * {
	margin-top: var(--wp--preset--spacing--30, 1rem);
}

/* Cards: the whole card is clickable through its title link. */
.foten-event-card {
	position: relative;
	display: flex;
	flex-direction: column;
}

.foten-event-card__title a::after,
.foten-event-mini__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.foten-event-card__image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.foten-event-card__excerpt {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

/* Rows: poster on the left, never cropped; text centred beside it. Stacked below 1000px. */
.foten-event-rows > li + li {
	margin-top: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-event-row {
	display: grid;
	grid-template-columns: 3fr 2fr;
	grid-template-rows: auto 1fr;
	grid-template-areas:
		"image body"
		"more  body";
}

.foten-event-row__image {
	grid-area: image;
}

/* The details column spans poster and summary, its content centred on their height. */
.foten-event-row__body {
	grid-area: body;
	justify-content: center;
}


.foten-event-row__more {
	grid-area: more;
	padding: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-event-row__more > * {
	margin: 0;
}

.foten-event-row__more > * + * {
	margin-top: 0.75rem;
}

.foten-event-row__image img {
	display: block;
	width: 100%;
	height: auto;
}

.foten-event-row__body {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-event-row__body > * {
	margin: 0;
}

.foten-event-row__head {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
}

.foten-event-row__head .foten-event-date {
	flex: none;
}

.foten-event-row__head > div > * {
	margin: 0;
}

.foten-event-row__head > div > * + * {
	margin-top: 0.25rem;
}

.foten-event-row__excerpt {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

.foten-event-row__actions {
	margin-top: 0.5rem;
}

/*
 * Wide screens: a line between the two columns, as tall as the row, and more
 * room between the groups of the column (title, date and price, buttons),
 * which has height to spare beside poster and summary.
 */
@media (min-width: 1000px) {
	.foten-event-row__body {
		gap: 1rem;
		padding-inline: var(--wp--preset--spacing--50, 2.5rem);
		border-left-width: 1px;
		border-left-style: solid;
	}

	.foten-event-row__head > div > * + * {
		margin-top: 0.4rem;
	}

	.foten-event-row .foten-event-row__actions {
		margin-top: 1rem;
	}
}

@media (max-width: 999px) {
	.foten-event-row {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		grid-template-areas:
			"image"
			"body"
			"more";
	}

	.foten-event-row__more {
		padding-top: 0;
	}
}

/* Phones: the two buttons one per line, full width. */
@media (max-width: 599px) {
	/* Beats the layout gap of the site styles, which load later with the same weight. */
	.foten-event-row .foten-event-row__actions {
		row-gap: 0.5rem;
	}

	.foten-event-row__actions > .wp-block-button {
		flex-basis: 100%;
	}

	.foten-event-row__actions .wp-block-button__link {
		width: 100%;
		text-align: center;
	}
}

/* Filter by kind: a row of toggle buttons. */
.foten-event-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.foten-event-filter[hidden] {
	display: none;
}

.foten-event-filter button {
	padding: 0.5em 1em;
	border: 1px solid currentcolor;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

/* Calendar badge: the day and month sit in the box below the rings. */
.foten-event-date {
	position: relative;
	width: 4rem;
	height: 4rem;
}

.foten-event-date svg {
	display: block;
	width: 100%;
	height: 100%;
}

.foten-event-date span {
	position: absolute;
	inset: 35% 0 0;
	display: grid;
	place-items: center;
	line-height: 1;
}

/* Past events by year: the cards clear the year's line. */
.foten-events__year > summary + .foten-event-cards {
	margin-block-start: var(--wp--preset--spacing--30, 1rem);
}

/* Event page. */
.foten-event-header {
	display: flex;
	gap: var(--wp--preset--spacing--40, 1.5rem);
	align-items: flex-start;
}

.foten-event-header .foten-event-date {
	flex: none;
}

/* The sign-up button on the right of the title; on phones the details box, with its button, comes right after the poster. */
.foten-event-header .foten-event-actions {
	flex: none;
	margin: 0 0 0 auto;
	align-self: center;
}

@media (max-width: 781px) {
	.foten-event-header .foten-event-actions {
		display: none;
	}
}

/*
 * Phones: the badge, smaller, shares the line of the kind; the title and what
 * follows take the full width instead of the narrow column beside the badge.
 */
@media (max-width: 599px) {
	:is(.foten-event-header, .foten-event-row__head) {
		display: grid;
		grid-template-columns: auto 1fr;
		gap: 0.25rem 0.75rem;
		align-items: center;
	}

	:is(.foten-event-header, .foten-event-row__head) > div:not(.foten-event-date) {
		display: contents;
	}

	:is(.foten-event-header, .foten-event-row__head) > div:not(.foten-event-date) > :not(.is-style-overline) {
		grid-column: 1 / -1;
	}

	:is(.foten-event-header, .foten-event-row__head) .foten-event-date {
		width: 3rem;
		height: 3rem;
		font-size: 0.875rem;
	}
}

.foten-event-details__audience {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
}

.foten-event-details__audience svg {
	flex: none;
	margin-top: 0.15em;
}

.foten-event-header__text > * {
	margin: 0;
}

.foten-event-header__text > * + * {
	margin-top: 0.5rem;
}

.foten-event-details dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.5rem 1rem;
	margin: 0;
}

.foten-event-details dd {
	margin: 0;
}

.foten-event-details > * + * {
	margin-top: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-event-speaker + .foten-event-speaker {
	margin-top: var(--wp--preset--spacing--30, 1rem);
}

/*
 * Event body: the details box comes first in the page, so on phones it sits
 * right after the poster; on wider screens it moves to the right and stays in
 * view while the description scrolls.
 */
@media (min-width: 782px) {
	.foten-event-body {
		flex-direction: row-reverse;
	}

	.foten-event-body__aside .foten-event-details {
		position: sticky;
		top: calc(var(--header-offset, 0px) + 1.5rem);
	}
}

.foten-event-poster img {
	width: 100%;
	height: auto;
}

.foten-event-details .foten-event-actions {
	margin-top: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-event-calendar a {
	display: inline-flex;
	gap: 0.4rem;
	align-items: center;
}

.foten-event-details__calendar {
	margin-top: 0.75rem;
}

/* Related events: a band across the page, short text cards inside. */
.foten-events-related__inner {
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-inline: auto;
}

.foten-events-related__inner > * + * {
	margin-top: var(--wp--preset--spacing--40, 1.5rem);
}

.foten-event-mini {
	position: relative;
	box-sizing: border-box;
	height: 100%;
}

.foten-event-mini > * {
	margin: 0;
}

.foten-event-mini > * + * {
	margin-top: 0.5rem;
}

/* Sign-up bar on phones (events.js); content and focus stay clear of it. */
.foten-event-bar {
	position: fixed;
	inset: auto 0 0;
	z-index: 20;
	/* Only the phone's home bar area, if any: the button itself is the bar. */
	padding: 0 0 env(safe-area-inset-bottom, 0px);
}

.foten-event-bar .wp-block-buttons {
	margin: 0;
}

.foten-event-bar[hidden] {
	display: none;
}

.foten-event-bar .wp-block-button {
	flex-basis: 100%;
}

.foten-event-bar .wp-block-button__link {
	width: 100%;
	text-align: center;
}

html {
	scroll-padding-bottom: var(--foten-bottom-bar, 0px);
}

body.single-evento {
	padding-bottom: var(--foten-bottom-bar, 0px);
}

/*
 * Cards in a row line up part by part (subgrid): each part has its own row,
 * sized by the tallest card, so titles, dates and summaries start at the same
 * height. A missing part leaves its row empty. Browsers without subgrid keep
 * the plain stacked cards.
 */
@supports (grid-template-rows: subgrid) {
	/* The list's row gap would fall between the parts too: cards are spaced by a margin instead. */
	:is(.foten-event-cards, .foten-event-minis) {
		row-gap: 0;
	}

	:is(.foten-event-cards, .foten-event-minis) > li {
		margin-bottom: var(--wp--preset--spacing--40, 1.5rem);
	}

	.foten-event-cards > li {
		display: grid;
		grid-row: span 8;
		grid-template-rows: subgrid;
		row-gap: 0;
	}

	.foten-event-card {
		display: grid;
		grid-row: 1 / -1;
		grid-template-rows: subgrid;
		row-gap: 0;
		height: auto;
		padding-bottom: 1rem;
	}

	.foten-event-card .foten-post-card__body {
		display: contents;
	}

	.foten-event-card .foten-post-card__body > * {
		margin: 0;
		padding: 0.5rem 1rem 0;
	}

	.foten-event-card .foten-post-card__body > .is-style-overline {
		padding-top: 1rem;
	}

	.foten-event-card__image { grid-row: 1; }
	.foten-event-card .is-style-overline { grid-row: 2; }
	.foten-event-card__title { grid-row: 3; }
	/* The grid sizes the row on the full text, not the clamped three lines. */
	.foten-event-card__excerpt {
		max-height: 3lh;
	}

	.foten-event-card__when { grid-row: 4; }
	.foten-event-card__excerpt { grid-row: 5; }
	.foten-event-card__place { grid-row: 6; }
	.foten-event-card__price { grid-row: 7; }
	.foten-event-card__series { grid-row: 8; }

	/* The short text cards of the related events band. */
	.foten-event-minis > li {
		display: grid;
		grid-row: span 5;
		grid-template-rows: subgrid;
		row-gap: 0;
	}

	.foten-event-mini {
		display: grid;
		grid-row: 1 / -1;
		grid-template-rows: subgrid;
		row-gap: 0.5rem;
		height: auto;
	}

	.foten-event-mini > * + * {
		margin-top: 0;
	}
}

/* Series: a small label above the name. */
.foten-event-series__label,
.foten-event-series__name {
	display: block;
}

/* Set apart from the event's own details above it, the price last among them. */
.foten-event-card .foten-post-card__body > .foten-event-series,
:is(.foten-event-row__series, .foten-event-mini__series) {
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top-width: 1px;
	border-top-style: solid;
}
