/**
 * Find-sessions page (spec 6). Mobile first: one column, full-width controls,
 * large enough tap targets, widening to a row layout on bigger screens.
 *
 * Colours come from custom properties so a theme can restyle without
 * overriding rules. Everything is scoped to .fc-find.
 */

.fc-find {
	--fc-gap: 0.75rem;
	--fc-radius: 6px;
	--fc-border: #d6d3cd;
	--fc-muted: #5f5b55;
	--fc-accent: #7a4f2a;
	--fc-accent-contrast: #fff;
	--fc-surface: #faf8f5;
	--fc-cancelled: #a33;

	margin: 0 0 2rem;
}

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

/* The display rules below are class selectors, which outrank the browser's
   own [hidden] rule, so hidden elements need saying again here. */
.fc-find [hidden] {
	display: none;
}

/* Form */

.fc-find__form {
	background: var(--fc-surface);
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius);
	padding: var(--fc-gap);
	margin-bottom: 1.5rem;
}

.fc-find__row {
	display: flex;
	flex-direction: column;
	gap: var(--fc-gap);
	margin-bottom: var(--fc-gap);
}

.fc-find__field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.fc-find__field label {
	font-size: 0.875rem;
	font-weight: 600;
}

.fc-find__field input,
.fc-find__field select {
	width: 100%;
	padding: 0.6rem 0.5rem;
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius);
	background: #fff;
	/* 16px stops iOS zooming the page when a field is focused. */
	font-size: 1rem;
	line-height: 1.3;
}

.fc-find__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fc-gap);
}

.fc-find__submit,
.fc-find__near-me {
	flex: 1 1 auto;
	min-height: 44px;
	padding: 0.6rem 1rem;
	border-radius: var(--fc-radius);
	font-size: 1rem;
	cursor: pointer;
}

.fc-find__submit {
	background: var(--fc-accent);
	border: 1px solid var(--fc-accent);
	color: var(--fc-accent-contrast);
	font-weight: 600;
}

.fc-find__near-me {
	background: #fff;
	border: 1px solid var(--fc-border);
	color: inherit;
}

.fc-find__near-me[disabled] {
	opacity: 0.6;
	cursor: default;
}

.fc-find__status:empty {
	display: none;
}

.fc-find__status {
	margin: 0.5rem 0 0;
	font-size: 0.875rem;
	color: var(--fc-muted);
}

/* Filters */

.fc-find__filters {
	margin-bottom: var(--fc-gap);
}

.fc-find__filters summary {
	cursor: pointer;
	font-weight: 600;
	padding: 0.35rem 0;
}

/* The county filter is one select among checklists, so it is held to the width
   of a control rather than stretched across the panel. */
.fc-find__field--county {
	margin-bottom: var(--fc-gap);
	max-width: 22rem;
}

.fc-find__filter-group {
	border: 0;
	margin: 0 0 var(--fc-gap);
	padding: 0;
}

.fc-find__filter-group legend {
	font-size: 0.875rem;
	font-weight: 600;
	padding: 0;
	margin-bottom: 0.25rem;
}

.fc-find__checklist {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.fc-find__checklist label {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 32px;
	font-size: 0.9375rem;
}

/* Results */

.fc-find__summary,
.fc-find__notice,
.fc-find__empty {
	margin: 0 0 1rem;
}

.fc-find__notice {
	padding: 0.6rem 0.75rem;
	border-left: 3px solid var(--fc-accent);
	background: var(--fc-surface);
}

/* List and map together, the map above the results at every width and kept
   short so the list starts near the top of the screen. */

.fc-find__layout {
	display: grid;
	gap: 1rem;
	grid-template-areas:
		"map"
		"list";
}

.fc-find__results {
	grid-area: list;
	min-width: 0;
}

.fc-find__map {
	grid-area: map;
	height: 45vh;
	min-height: 240px;
	max-height: 380px;
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius);
}

/* The container is marked hidden in the HTML and unhidden by the script just
   before Leaflet builds in it: without JavaScript there is no empty grey box,
   and Leaflet always measures a container that is already laid out. */

.fc-find__popup strong {
	display: block;
	margin-bottom: 0.25rem;
}

.fc-find__popup ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fc-find__popup li + li {
	margin-top: 0.15rem;
}

.fc-find__day {
	margin-bottom: 1.5rem;
}

.fc-find__day-heading {
	position: sticky;
	top: 0;
	margin: 0 0 0.5rem;
	padding: 0.35rem 0;
	background: #fff;
	font-size: 1.0625rem;
	border-bottom: 1px solid var(--fc-border);
}

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

.fc-find__result {
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--fc-border);
}

.fc-find__result p {
	margin: 0 0 0.2rem;
}

.fc-find__result-name {
	font-size: 1.0625rem;
	font-weight: 600;
}

.fc-find__result-where,
.fc-find__result-time,
.fc-find__result-note {
	font-size: 0.9375rem;
	color: var(--fc-muted);
}

/* The venue line reads "Seven Stars, Falmouth, Cornwall" - its commas are in
   the markup, like the theme's listings. The distance is a different kind of
   fact, so it keeps a separator of its own. */
.fc-find__distance::before {
	content: " · ";
}

.fc-find__result--cancelled .fc-find__result-name a {
	text-decoration: line-through;
}

.fc-find__cancelled {
	color: var(--fc-cancelled);
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.fc-find__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	list-style: none;
	margin: 0.35rem 0 0;
	padding: 0;
}

.fc-find__tags li {
	padding: 0.1rem 0.45rem;
	border: 1px solid var(--fc-border);
	border-radius: 999px;
	font-size: 0.8125rem;
	color: var(--fc-muted);
}

/* Pagination */

.fc-find__pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--fc-gap);
	margin-top: 1rem;
}

.fc-find__page-link {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius);
}

.fc-find__page-number {
	color: var(--fc-muted);
	font-size: 0.9375rem;
}

/* Wider screens */

@media (min-width: 40em) {
	.fc-find__row {
		flex-direction: row;
		align-items: flex-end;
	}

	.fc-find__field--grow {
		flex: 1 1 60%;
	}

	.fc-find__submit,
	.fc-find__near-me {
		flex: 0 0 auto;
	}
}

/* The map stays above the list at every width rather than moving beside it.
   Whether there is room for two columns depends on the page's content
   measure, not the window: this theme caps text at about 42em, where a side
   by side layout leaves the results too narrow to read. A full width page
   template could support one, and that is the point at which to add it. */

@media (prefers-color-scheme: dark) {
	.fc-find {
		--fc-border: #4a463f;
		--fc-muted: #b3ada4;
		--fc-surface: #23211e;
		--fc-accent: #c98a53;
		--fc-accent-contrast: #1b1917;
		--fc-cancelled: #e4796f;
	}

	.fc-find__field input,
	.fc-find__field select,
	.fc-find__near-me {
		background: #1b1917;
		color: inherit;
	}

	.fc-find__day-heading {
		background: transparent;
	}
}

.fc-find__subscribe {
	margin: 1rem 0 0;
	font-size: 0.9375rem;
}

/* Cluster pins. A divIcon has no styling of its own, so all of it is here. */

.fc-find__cluster {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--fc-accent);
	color: var(--fc-accent-contrast);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
	font-weight: 700;
	font-size: 0.875rem;
	cursor: pointer;
}
