/*
 * Events Archive Filter
 * Inherits fonts and text colour from the host theme. Override the custom
 * properties below (in your theme CSS) to restyle.
 */
.eaf {
	--eaf-accent: #bf5700;
	--eaf-accent-contrast: #fff;
	--eaf-badge-bg: #bf5700;          /* date badge */
	--eaf-badge-year-bg: #9a4600;     /* darker strip behind the year */
	--eaf-badge-text: #fff;
	--eaf-line: rgba(0, 0, 0, 0.15);
	--eaf-muted: #5a6872;
	--eaf-radius: 4px;
	--eaf-bar-bg: transparent;        /* filter bar background (set a colour to add a band) */
	--eaf-control-border: #8c8c8c;    /* border of inputs and dropdowns */
	--eaf-control-text: #2b3a42;      /* text inside inputs and selects */
	--eaf-placeholder: #6f6f6f;
	--eaf-title: #2b3a42;             /* event title colour */
	--eaf-title-hover: var(--eaf-badge-year-bg); /* title colour on hover/focus (#9a4600) */
	--eaf-gutter: 2rem;               /* left/right padding of bar and list */
	--eaf-badge-w: 6rem;
	--eaf-media-w: clamp(14rem, 31%, 27rem);

	color: inherit;
	font: inherit;
}

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

.eaf-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---- Filter bar -------------------------------------------------------- */

.eaf-form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1rem 2.6rem;
	padding: 0 var(--eaf-gutter) 1.5rem;
	background: var(--eaf-bar-bg);
}

.eaf-search {
	position: relative;
	flex: 2.1 1 18rem;
	min-width: 0;
}

.eaf-field { flex: 1 1 14rem; min-width: 0; }

.eaf-input,
.eaf-select {
	display: block;
	width: 100%;
	font: inherit;
	color: var(--eaf-control-text);
	background-color: #fff;
	border: 1px solid var(--eaf-control-border);
	border-radius: 0;
}

.eaf-input {
	height: 2.5rem;
	padding: 0 2.75rem 0 0.6rem;
	-webkit-appearance: none;
	appearance: none;
}
.eaf-input::placeholder { color: var(--eaf-placeholder); opacity: 1; }
.eaf-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

.eaf-search__submit {
	position: absolute;
	top: 0; right: 0;
	display: grid;
	place-items: center;
	width: 2.5rem; height: 2.5rem;
	padding: 0;
	color: var(--eaf-control-text);
	background: transparent;
	border: 0;
	cursor: pointer;
}
.eaf-search__submit svg { width: 1.125rem; height: 1.125rem; }
.eaf-search__submit:hover { color: var(--eaf-accent); }

.eaf-select {
	height: 2.5rem;
	padding: 0 2.5rem 0 0.6rem;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10' fill='none' stroke='%232b3a42' stroke-width='1.5'%3E%3Cpath d='M1 1.5l7 7 7-7'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 1rem 0.625rem;
	text-overflow: ellipsis;
}

/* Border colour and zero bottom margin, specific enough to beat theme form styles. */
.eaf .eaf-input,
.eaf .eaf-select {
	margin-bottom: 0;
	border: 1px solid var(--eaf-control-border);
}

.eaf-btn {
	height: 2.5rem;
	padding: 0 1.25rem;
	font: inherit;
	font-weight: 600;
	color: var(--eaf-accent-contrast);
	background: var(--eaf-accent);
	border: 0;
	border-radius: var(--eaf-radius);
	cursor: pointer;
}
.eaf-btn:hover { filter: brightness(0.92); }

.eaf-active {
	display: flex;
	flex: 0 0 100%;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 0.25rem;
	color: var(--eaf-control-text);
}
.eaf-active[hidden] { display: none; }
.eaf-active__text { margin: 0; font-size: 0.9375rem; }

.eaf-clear {
	flex: none;
	color: var(--eaf-accent);
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	text-decoration: none;
}
.eaf-clear:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* First option ("By Event Type") clears the filter */
.eaf-select option:first-child { font-weight: 700; }

.eaf-input:focus-visible,
.eaf-select:focus-visible,
.eaf-btn:focus-visible,
.eaf-search__submit:focus-visible,
.eaf-clear:focus-visible,
.eaf-page:focus-visible,
.eaf-item__link:focus-visible {
	outline: 3px solid var(--eaf-accent);
	outline-offset: 2px;
}

/* ---- Results ----------------------------------------------------------- */

.eaf-results {
	position: relative;
	padding: 0 var(--eaf-gutter) 3rem;
	transition: opacity 0.15s ease;
}
.eaf-results:focus { outline: none; }
.eaf.is-loading .eaf-results { opacity: 0.45; }

.eaf-list { margin: 0; padding: 0; list-style: none; }

/* One row per event: date badge | content | image */
.eaf-item {
	display: grid;
	grid-template-columns: var(--eaf-badge-w) minmax(0, 1fr) var(--eaf-media-w);
	column-gap: 2.5rem;
	align-items: start;
	margin: 0;
	padding: 2.25rem 0;
	border-bottom: 1px solid var(--eaf-line);
}
.eaf-item:first-child { padding-top: 0.5rem; }
.eaf-item:last-child { border-bottom: 0; }
.eaf-item.no-image { grid-template-columns: var(--eaf-badge-w) minmax(0, 1fr); }

/* ---- Date badge ---- */

.eaf-item__date { grid-column: 1; }

.eaf .eaf-badge {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	margin: 0;
	padding: 0;
	overflow: hidden;
	text-align: center;
	color: var(--eaf-badge-text);
	background: var(--eaf-badge-bg);
	font-family: "1883-Sans", sans-serif;
	font-weight: 800;
	text-transform: uppercase;
	line-height: 1;
}
.eaf-badge__month {
	padding: 0.85rem 0.25rem 0;
	font-size: 1.25rem;
	letter-spacing: 0.02em;
}
.eaf-badge__day {
	padding: 0.15rem 0.25rem 0.6rem;
	font-size: 3rem;
	letter-spacing: -0.01em;
}
.eaf-badge__year {
	padding: 0.3rem 0.25rem;
	font-size: 1.125rem;
	background: var(--eaf-badge-year-bg);
}
/* Two months: smaller type so "MAR APR" and "30-2" fit the badge. A range within one month keeps the single-date month and year size. */
.eaf-badge.is-pair .eaf-badge__month { font-size: 0.95rem; }
/* Two months: each in its own span, spread evenly across the badge. */
.eaf-badge__month--pair { display: flex; justify-content: space-around; }
.eaf-badge.is-range .eaf-badge__day { font-size: 2rem; padding-bottom: 0.7rem; }
.eaf-badge.is-pair .eaf-badge__year { font-size: 0.9rem; }

/* ---- Content ---- */

.eaf-item__body { grid-column: 2; min-width: 0; }

.eaf-item__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
	margin: 0 0 1rem;
	line-height: 1.3;
}

/* Each tag is a small label. */
.eaf-item__tag {
	padding: 3px 8px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #2b3a42;
	background: #f2f1ed;
	border-radius: 3px;
}

.eaf .eaf-item__title {
	margin: 0 0 1.25rem;
	font-family: "1883-Sans", sans-serif;
	font-size: 1.7rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.15;
	color: var(--eaf-title);
}

.eaf-item__link { color: inherit; text-decoration: none; }
.eaf .eaf-item__link,
.eaf .eaf-item__link:focus { text-decoration: none; }
.eaf .eaf-item__link:hover,
.eaf .eaf-item__link:focus-visible {
	color: var(--eaf-title-hover);
	text-decoration: underline;
}

.eaf-item__icon {
	display: inline-block;
	margin-left: 0.5rem;
	color: var(--eaf-accent);
	vertical-align: -0.05em;
	transition: transform 0.15s ease;
}
.eaf-item__icon--internal { width: 1.4rem; height: 0.95rem; }
.eaf-item__icon--external { width: 1.35rem; height: 1.35rem; vertical-align: -0.15em; }
.eaf-item__link:hover .eaf-item__icon--internal,
.eaf-item__link:focus-visible .eaf-item__icon--internal { transform: translateX(4px); }
.eaf-item__link:hover .eaf-item__icon--external,
.eaf-item__link:focus-visible .eaf-item__icon--external { transform: translate(2px, -2px); }

.eaf-item__teaser {
	margin: 0 0 1.1rem;
	max-width: 65ch;
	font-size: 1.125rem;
	line-height: 1.45;
	color: var(--eaf-control-text);
}

.eaf-item__meta {
	/* Inline flow: the location starts right after the pipe and wraps within its own text. */
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--eaf-control-text);
}
.eaf-item__sep { margin: 0 0.15rem; color: var(--eaf-muted); font-weight: 400; }

/* ---- Image ---- */

.eaf-item__media {
	grid-column: 3;
	grid-row: 1;
	position: relative;
	align-self: start;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--eaf-line);
}
/*
 * The image fills the 4:3 box but is taken out of the layout flow, so its own
 * (intrinsic) size, including WordPress's lazy-loading placeholder size
 * (contain-intrinsic-size: 3000px 1500px), can never make the row taller or
 * cause a layout shift.
 */
.eaf .eaf-item__media img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

/* Empty / error states */
.eaf-empty,
.eaf-error { padding-top: 1.5rem; }
.eaf-empty p { margin: 0 0 0.5rem; }
.eaf-empty a { color: var(--eaf-accent); font-weight: 600; }
.eaf-error { color: #b32d2e; }

/* ---- Pagination -------------------------------------------------------- */

.eaf-pagination { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--eaf-line); }
.eaf-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin: 0; padding: 0;
	list-style: none;
}
.eaf-page,
.eaf-pagination__gap {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0 0.75rem;
}
.eaf-page {
	color: inherit;
	text-decoration: none;
	border: 1px solid var(--eaf-line);
	border-radius: var(--eaf-radius);
}
a.eaf-page:hover { border-color: var(--eaf-accent); color: var(--eaf-accent); }
.eaf-page.is-current {
	color: var(--eaf-accent-contrast);
	background: var(--eaf-accent);
	border-color: var(--eaf-accent);
	font-weight: 600;
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 64em) {
	.eaf { --eaf-media-w: 14rem; }
	.eaf-item { column-gap: 1.75rem; }
}

@media (max-width: 40em) {
	.eaf { --eaf-gutter: 1rem; }
	.eaf-form { padding-bottom: 1rem; gap: 0.75rem; }
	.eaf-search,
	.eaf-field { flex-basis: 100%; }

	/* Phones: badge, then content, then image, in one column. */
	.eaf-item,
	.eaf-item.no-image { grid-template-columns: minmax(0, 1fr); row-gap: 1rem; }
	.eaf-item__date,
	.eaf-item__body,
	.eaf-item__media { grid-column: 1; grid-row: auto; }
	.eaf .eaf-badge { width: var(--eaf-badge-w); }
	.eaf .eaf-item__title { font-size: 1.5rem; }
	.eaf-item__meta { font-size: 1.125rem; }
}

@media (prefers-reduced-motion: reduce) {
	.eaf-results,
	.eaf-item__icon { transition: none; }

	/* No icon nudge for visitors who prefer reduced motion. */
	.eaf-item__link:hover .eaf-item__icon,
	.eaf-item__link:focus-visible .eaf-item__icon { transform: none; }
}
