/* Base page styling. */
:root {
	--bg: #f4f0e8;
	--panel: #ffffff;
	--ink: #17211c;
	--muted: #66746c;
	--accent: #2e6f57;
	--accent-dark: #1f4f3d;
	--border: #d7ded7;
	--shadow: 0 14px 40px rgba(23, 33, 28, 0.12);
}

/* Make sizing predictable throughout the app. */
* {
	box-sizing: border-box;
}

/* Set a soft natural background and readable default text. */
body {
	margin: 0;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	background: radial-gradient(circle at top left, #e8f2dd, var(--bg) 45%);
	color: var(--ink);
}

/* Keep the header compact but polished. */
.site-header {
	padding: 2rem clamp(1rem, 4vw, 3rem) 1rem;
}

/* Style the small intro label. */
.eyebrow {
	margin: 0 0 0.4rem;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent-dark);
}

/* Make the product title prominent. */
h1 {
	margin: 0;
	font-size: clamp(2rem, 6vw, 4rem);
	line-height: 0.95;
}

/* Limit the intro line width. */
.intro {
	max-width: 58rem;
	font-size: 1.1rem;
	color: var(--muted);
}

/* Constrain the application body. */
.app-shell {
	width: min(1180px, calc(100% - 2rem));
	margin: 0 auto 2rem;
}

/* Create horizontal mode buttons. */
.mode-tabs {
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	padding-bottom: 0.75rem;
}

/* Style each mode tab. */
.mode-tab {
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.72);
	color: var(--ink);
	border-radius: 999px;
	padding: 0.75rem 1rem;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
}

/* Highlight the active mode. */
.mode-tab.is-active {
	background: var(--accent);
	border-color: var(--accent);
	color: #ffffff;
}

.spinner {
	display: inline-block;
	width: 0.9em;
	height: 0.9em;
	margin-right: 0.45em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	vertical-align: -0.12em;
	animation: spin 0.7s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Card styling for the search panel. */
.panel {
	background: rgba(255, 255, 255, 0.9);
	border: 1px solid var(--border);
	border-radius: 1.25rem;
	box-shadow: var(--shadow);
	padding: 1rem;
}

/* Arrange search fields in a responsive grid. */
.search-form {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
	align-items: end;
}

/* Let selected form areas span the whole row. */
.full-width {
	grid-column: 1 / -1;
}

/* Hide mode-specific fields until needed. */
.is-hidden {
	display: none !important;
}

/* Stack labels above fields. */
.field-group {
	display: grid;
	gap: 0.35rem;
}

/* Improve label clarity. */
label,
legend {
	font-weight: 800;
}

/* De-emphasize optional text. */
.optional,
.planned {
	font-weight: 600;
	color: var(--muted);
	font-size: 0.85em;
}

/* Form field styling. */
input[type="text"],
input[type="number"] {
	width: 100%;
	border: 1px solid var(--border);
	border-radius: 0.85rem;
	padding: 0.85rem 1rem;
	font: inherit;
	background: #ffffff;
}

/* Checkbox filter block. */
.filters {
	border: 1px solid var(--border);
	border-radius: 1rem;
	padding: 0.85rem 1rem 1rem;
}

/* Lay filter checkboxes out as chips. */
.filters label {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin: 0.45rem 0.8rem 0 0;
	font-weight: 650;
}

/* Keep action area aligned and readable. */
.actions {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}

/* Primary button. */
button[type="submit"] {
	border: 0;
	border-radius: 999px;
	background: var(--accent);
	color: #ffffff;
	padding: 0.9rem 1.4rem;
	font: inherit;
	font-weight: 900;
	cursor: pointer;
}

/* Explanatory mode helper text. */
.mode-help {
	margin: 0;
	color: var(--muted);
}

/* Status messages. */
.status {
	min-height: 2rem;
	padding: 0.85rem 0.2rem;
	font-weight: 800;
	color: var(--accent-dark);
}

/* Results layout. */
.results-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
	gap: 1rem;
}

/* Leaflet map container. */
.map {
	min-height: 620px;
	border-radius: 1.25rem;
	border: 1px solid var(--border);
	overflow: hidden;
	box-shadow: var(--shadow);
	background: #dfe7df;
}

/* Right-side results panel. */
.results-panel {
	max-height: 620px;
	overflow: auto;
	background: rgba(255, 255, 255, 0.93);
	border: 1px solid var(--border);
	border-radius: 1.25rem;
	box-shadow: var(--shadow);
	padding: 1rem;
}

/* Results heading. */
.results-panel h2 {
	margin-top: 0;
}

/* Summary text. */
.summary {
	color: var(--muted);
	margin-bottom: 1rem;
}

/* Individual sighting card. */
.sighting-card {
	border: 1px solid var(--border);
	border-radius: 1rem;
	padding: 0.85rem;
	margin-bottom: 0.75rem;
	background: #ffffff;
}

/* Sighting title. */
.sighting-card h3 {
	margin: 0 0 0.25rem;
	font-size: 1rem;
}

/* Sighting metadata. */
.sighting-card p {
	margin: 0.2rem 0;
	color: var(--muted);
}

/* Compact badge. */
.badge {
	display: inline-block;
	border-radius: 999px;
	background: #e8f2dd;
	color: var(--accent-dark);
	padding: 0.15rem 0.5rem;
	font-size: 0.8rem;
	font-weight: 800;
}

/* Stack the layout on tablets and phones. */
@media (max-width: 860px) {
	.search-form,
	.results-grid {
		grid-template-columns: 1fr;
	}

	.map,
	.results-panel {
		min-height: 420px;
		max-height: none;
	}
}
