/**
 * Public report form styles.
 *
 * Deliberately restrained: this is a public-health intake form, and it should
 * read as careful and clinical rather than sensational. Colours are defined as
 * custom properties so a theme can override them in one place.
 */

.sitim-form-wrap {
	--sitim-ink: #16212b;
	--sitim-muted: #5d6b7a;
	--sitim-line: #d9e0e7;
	--sitim-bg: #ffffff;
	--sitim-soft: #f4f7f9;
	--sitim-accent: #1f6f5c;
	--sitim-accent-ink: #ffffff;
	--sitim-error: #a02c2c;
	--sitim-error-bg: #fdf0f0;
	--sitim-ok: #1f6f5c;
	--sitim-ok-bg: #eef6f3;
	--sitim-radius: 8px;

	max-width: 42rem;
	margin: 0 auto;
	color: var(--sitim-ink);
	font-size: 1rem;
	line-height: 1.6;
}

.sitim-form-wrap *,
.sitim-form-wrap *::before,
.sitim-form-wrap *::after {
	box-sizing: border-box;
}

/*
 * Make the hidden attribute actually hide things.
 *
 * The browser's own `[hidden] { display: none }` is a user-agent rule, so ANY
 * author rule that sets a display value beats it outright -- specificity does
 * not come into it. `.sitim-chosen { display: flex }` was therefore leaving the
 * "chosen restaurant" panel permanently on screen, empty, above the map. The
 * JavaScript was toggling `hidden` correctly the whole time and nothing
 * happened. One rule fixes it for every panel in the form, and stops the same
 * trap being reset the next time someone adds a display property.
 */
.sitim-form-wrap [hidden] {
	display: none !important;
}

.sitim-form-title {
	margin: 0 0 0.75rem;
	font-size: 1.5rem;
	line-height: 1.25;
}

.sitim-intro {
	margin: 0 0 1.5rem;
	color: var(--sitim-muted);
}

/* Step indicator ------------------------------------------------------- */

.sitim-steps {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0 0 1.5rem;
	padding: 0;
	counter-reset: sitim-step;
}

.sitim-steps li {
	flex: 1 1 7rem;
	position: relative;
	padding: 0.4rem 0 0;
	border-top: 3px solid var(--sitim-line);
	font-size: 0.8125rem;
	color: var(--sitim-muted);
	counter-increment: sitim-step;
}

.sitim-steps li::before {
	content: counter(sitim-step) ". ";
	font-variant-numeric: tabular-nums;
}

.sitim-steps li.is-done {
	border-top-color: var(--sitim-accent);
}

.sitim-steps li.is-active {
	border-top-color: var(--sitim-accent);
	color: var(--sitim-ink);
	font-weight: 600;
}

/* Steps ---------------------------------------------------------------- */

.sitim-step {
	display: none;
	margin: 0;
	padding: 0;
	border: 0;
}

.sitim-step.is-active {
	display: block;
}

.sitim-legend {
	display: block;
	width: 100%;
	margin: 0 0 1.25rem;
	padding: 0;
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.3;
}

/* Fields --------------------------------------------------------------- */

.sitim-field {
	margin: 0 0 1.25rem;
	position: relative;
}

.sitim-field label,
.sitim-label {
	display: block;
	margin: 0 0 0.35rem;
	font-weight: 600;
	font-size: 0.9375rem;
}

.sitim-input {
	display: block;
	width: 100%;
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--sitim-line);
	border-radius: var(--sitim-radius);
	background: var(--sitim-bg);
	color: var(--sitim-ink);
	font: inherit;
	font-size: 1rem; /* 16px stops iOS zooming on focus. */
}

.sitim-input:focus {
	outline: 2px solid var(--sitim-accent);
	outline-offset: 1px;
	border-color: var(--sitim-accent);
}

.sitim-input-sm {
	max-width: 7rem;
}

textarea.sitim-input {
	resize: vertical;
	min-height: 4.5rem;
}

.sitim-help {
	margin: 0.35rem 0 0;
	font-size: 0.8125rem;
	color: var(--sitim-muted);
	line-height: 1.5;
}

.sitim-help-block {
	background: var(--sitim-soft);
	border-radius: var(--sitim-radius);
	padding: 0.75rem 0.9rem;
	margin-bottom: 1.25rem;
}

.sitim-field-inline {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: flex-start;
}

.sitim-code {
	max-width: 9rem;
	font-size: 1.375rem;
	letter-spacing: 0.35em;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* Checkboxes ----------------------------------------------------------- */

.sitim-checks {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 0.4rem 1rem;
}

.sitim-check {
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	font-weight: 400;
	margin: 0 0 0.35rem;
	cursor: pointer;
}

.sitim-check input {
	margin: 0.3rem 0 0;
	flex: 0 0 auto;
	width: 1rem;
	height: 1rem;
}

.sitim-check-consent {
	background: var(--sitim-soft);
	border-radius: var(--sitim-radius);
	padding: 0.85rem 0.9rem;
	font-size: 0.9375rem;
}

/* Autocomplete --------------------------------------------------------- */

.sitim-results {
	list-style: none;
	margin: 0.35rem 0 0;
	padding: 0;
	border: 1px solid var(--sitim-line);
	border-radius: var(--sitim-radius);
	background: var(--sitim-bg);
	max-height: 17rem;
	overflow-y: auto;
	box-shadow: 0 6px 18px rgba(22, 33, 43, 0.08);
}

.sitim-result {
	display: block;
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--sitim-line);
	cursor: pointer;
}

.sitim-result:last-child {
	border-bottom: 0;
}

.sitim-result:hover,
.sitim-result:focus {
	background: var(--sitim-soft);
	outline: none;
}

.sitim-result strong {
	display: block;
	font-size: 0.9375rem;
}

.sitim-result span {
	display: block;
	font-size: 0.8125rem;
	color: var(--sitim-muted);
}

.sitim-result-empty {
	padding: 0.75rem;
	color: var(--sitim-muted);
	font-size: 0.875rem;
}

.sitim-chosen {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.85rem 0.9rem;
	margin: 0 0 1.25rem;
	background: var(--sitim-soft);
	border-left: 3px solid var(--sitim-accent);
	border-radius: 0 var(--sitim-radius) var(--sitim-radius) 0;
}

.sitim-chosen strong {
	display: block;
}

.sitim-chosen span {
	display: block;
	font-size: 0.8125rem;
	color: var(--sitim-muted);
}

/* Buttons -------------------------------------------------------------- */

.sitim-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: 1.5rem;
}

.sitim-btn {
	appearance: none;
	border: 1px solid var(--sitim-accent);
	background: var(--sitim-accent);
	color: var(--sitim-accent-ink);
	padding: 0.65rem 1.25rem;
	border-radius: var(--sitim-radius);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	line-height: 1.4;
}

.sitim-btn:hover:not(:disabled) {
	filter: brightness(1.08);
}

.sitim-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.sitim-btn:focus-visible {
	outline: 2px solid var(--sitim-ink);
	outline-offset: 2px;
}

.sitim-btn-ghost {
	background: transparent;
	color: var(--sitim-ink);
	border-color: var(--sitim-line);
}

.sitim-link {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: var(--sitim-accent);
	text-decoration: underline;
	cursor: pointer;
}

/* Alerts and panels ---------------------------------------------------- */

.sitim-alert {
	padding: 0.75rem 0.9rem;
	border-radius: var(--sitim-radius);
	margin: 0 0 1.25rem;
	font-size: 0.9375rem;
}

.sitim-alert-error {
	background: var(--sitim-error-bg);
	color: var(--sitim-error);
	border-left: 3px solid var(--sitim-error);
}

.sitim-alert-ok {
	background: var(--sitim-ok-bg);
	color: var(--sitim-ok);
	border-left: 3px solid var(--sitim-ok);
}

.sitim-panel {
	border: 1px solid var(--sitim-line);
	border-radius: var(--sitim-radius);
	padding: 1.5rem;
	background: var(--sitim-bg);
}

.sitim-panel-done {
	border-color: var(--sitim-accent);
	background: var(--sitim-ok-bg);
}

.sitim-ref {
	font-size: 0.9375rem;
}

.sitim-ref strong {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	letter-spacing: 0.05em;
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.sitim-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

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

@media (prefers-color-scheme: dark) {
	.sitim-form-wrap {
		--sitim-ink: #e8eef3;
		--sitim-muted: #9aa8b6;
		--sitim-line: #33414f;
		--sitim-bg: #131c24;
		--sitim-soft: #1a242e;
		--sitim-accent: #3fae91;
		--sitim-accent-ink: #08120f;
		--sitim-error: #f0908d;
		--sitim-error-bg: #2c1a1a;
		--sitim-ok: #6fd0b4;
		--sitim-ok-bg: #16261f;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sitim-form-wrap * {
		scroll-behavior: auto !important;
	}
}

/* Manual restaurant entry ------------------------------------------------ */

.sitim-manual-prompt {
	margin-top: 0.75rem;
}

.sitim-manual {
	border: 1px solid var(--sitim-line);
	border-left: 3px solid var(--sitim-accent);
	border-radius: 0 var(--sitim-radius) var(--sitim-radius) 0;
	padding: 1.1rem 1.15rem 0.35rem;
	margin: 0.75rem 0 1.25rem;
	background: var(--sitim-soft);
}

.sitim-manual-title {
	margin: 0 0 0.5rem;
	font-size: 1.0625rem;
	font-weight: 600;
}

.sitim-manual .sitim-input {
	background: var(--sitim-bg);
}

/* -------------------------------------------------------------------------
 * Map picker
 *
 * Leaflet insists on its own stacking context and a measured height, so the
 * canvas gets an explicit one. Everything else here is drawn with divIcons
 * rather than image markers, which keeps the pins crisp on any screen and
 * saves five HTTP requests.
 * ---------------------------------------------------------------------- */

.sitim-map-prompt {
	margin-top: 0.5rem;
}

.sitim-map-panel {
	margin: 0.75rem 0 1rem;
	border: 1px solid var(--sitim-line);
	border-radius: var(--sitim-radius);
	overflow: hidden;
	background: var(--sitim-soft);
}

.sitim-map-canvas {
	height: 26rem;
	width: 100%;
	background: var(--sitim-soft);
}

/* On a phone the map has to be big enough to aim a thumb at. svh rather than
 * vh so the browser's collapsing address bar does not resize it mid-pinch. */
@media (max-width: 40rem) {
	.sitim-map-canvas {
		height: 58svh;
		min-height: 17rem;
		max-height: 30rem;
	}
}

.sitim-map-canvas.is-dropping {
	cursor: crosshair;
}

.sitim-map-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem 0.75rem;
	border-top: 1px solid var(--sitim-line);
	background: var(--sitim-bg);
}

.sitim-map-status {
	margin: 0;
	font-size: 0.875rem;
	color: var(--sitim-muted);
}

.sitim-map-status.is-busy::after {
	content: "";
	display: inline-block;
	width: 0.6em;
	height: 0.6em;
	margin-left: 0.4em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: sitim-spin 0.7s linear infinite;
	vertical-align: baseline;
}

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

@media (prefers-reduced-motion: reduce) {
	.sitim-map-status.is-busy::after {
		animation: none;
	}
}

/* Cluster bubbles ------------------------------------------------------- */

.sitim-cluster {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba( 31, 111, 92, 0.88 );
	color: #fff;
	font-weight: 600;
	font-size: 0.8125rem;
	line-height: 1;
	box-shadow: 0 0 0 3px rgba( 31, 111, 92, 0.20 );
	cursor: pointer;
	transition: transform 0.12s ease;
}

.sitim-cluster:hover,
.sitim-cluster:focus {
	transform: scale( 1.08 );
}

.sitim-cluster-xs {
	font-size: 0.75rem;
}

.sitim-cluster-lg,
.sitim-cluster-xl {
	font-size: 0.9375rem;
}

/* The heaviest bubbles get a little more contrast so a glance at the map
 * reads density before it reads numbers. */
.sitim-cluster-xl {
	background: rgba( 20, 84, 69, 0.92 );
}

/* Individual pins -------------------------------------------------------- */

.sitim-pin {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: 3px solid #fff;
	background: var(--sitim-accent);
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.35 );
	cursor: pointer;
}

.sitim-pin-stack {
	background: #b4530f;
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

/* Popups ----------------------------------------------------------------- */

.sitim-map-popup {
	max-height: 15rem;
	overflow-y: auto;

	/* A ghost-kitchen address can hold thirty brands. Force a visible
	 * scrollbar so a list cut off at the fold reads as "there is more"
	 * rather than as a rendering fault. */
	scrollbar-width: thin;
	scrollbar-color: #c3ccd4 transparent;
}

.sitim-map-popup::-webkit-scrollbar {
	width: 8px;
}

.sitim-map-popup::-webkit-scrollbar-thumb {
	border-radius: 4px;
	background: #c3ccd4;
}

.sitim-map-popup-head {
	margin: 0 0 0.375rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--sitim-muted);
}

.sitim-map-choice {
	display: block;
	width: 100%;
	padding: 0.4rem 0.5rem;
	margin: 0 0 0.25rem;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.sitim-map-choice:hover,
.sitim-map-choice:focus {
	border-color: var(--sitim-line);
	background: var(--sitim-soft);
}

.sitim-map-choice strong {
	display: block;
	line-height: 1.3;
}

.sitim-map-choice span {
	display: block;
	font-size: 0.8125rem;
	color: var(--sitim-muted);
}

.sitim-drop-note code {
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	background: var(--sitim-soft);
	font-size: 0.875rem;
}

/* Leaflet's own furniture, toned down to match the form. */

.sitim-map-panel .leaflet-container {
	font: inherit;
}

.sitim-map-panel .leaflet-popup-content {
	margin: 0.625rem 0.75rem;
}

.sitim-map-panel .leaflet-control-attribution {
	font-size: 0.6875rem;
}


/* -------------------------------------------------------------------------
 * Map furniture: the two-finger hint and the locate button
 * ---------------------------------------------------------------------- */

.sitim-map-frame {
	position: relative;
}

.sitim-map-hint {
	position: absolute;
	inset: 0;
	z-index: 500;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 1rem;
	background: rgba( 21, 23, 27, 0.55 );
	color: #fff;
	font-weight: 600;
	text-align: center;
	pointer-events: none;
}

.sitim-map-locate {
	position: absolute;
	right: 0.625rem;
	bottom: 1.75rem;
	z-index: 500;
	width: 2.75rem;
	height: 2.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba( 0, 0, 0, 0.2 );
	border-radius: 50%;
	background: var(--sitim-bg);
	color: var(--sitim-accent);
	font-size: 1.25rem;
	line-height: 1;
	box-shadow: 0 1px 5px rgba( 0, 0, 0, 0.3 );
	cursor: pointer;
}

.sitim-map-locate:disabled {
	opacity: 0.6;
	cursor: progress;
}

.sitim-btn-sm {
	padding: 0.45rem 0.85rem;
	font-size: 0.875rem;
}

/* -------------------------------------------------------------------------
 * Touch sizing
 *
 * Two conditions, not one. Keying purely on the pointer looked right until a
 * browser was caught reporting "(pointer: coarse)" as false on a touch device,
 * which silently left every target thumb-hostile. A narrow viewport is
 * overwhelmingly a phone, and bigger targets never hurt a mouse — so either
 * signal is enough to switch them on.
 * ---------------------------------------------------------------------- */

@media (pointer: coarse), (max-width: 40rem) {
	.sitim-pin {
		width: 30px !important;
		height: 30px !important;
		margin-left: -15px !important;
		margin-top: -15px !important;
	}

	.sitim-cluster {
		font-size: 0.875rem;
	}

	.sitim-map-choice {
		padding: 0.7rem 0.6rem;
	}

	.sitim-result {
		padding: 0.85rem 0.75rem;
	}

	/* Leaflet's own zoom buttons are 30px, below the 44px anyone can reliably
	 * hit while holding a phone one-handed. */
	.sitim-map-panel .leaflet-touch .leaflet-bar a {
		width: 40px;
		height: 40px;
		line-height: 40px;
		font-size: 1.375rem;
	}
}

/* -------------------------------------------------------------------------
 * Small screens
 * ---------------------------------------------------------------------- */

@media (max-width: 40rem) {
	.sitim-form-wrap {
		font-size: 1.0625rem;
	}

	/* Four labelled steps do not fit across a phone. Keep the progress bar,
	 * drop the words, and let the legend on each step say where you are. */
	.sitim-steps li {
		flex: 1 1 0;
		font-size: 0;
		padding-top: 0.25rem;
	}

	.sitim-steps li::before {
		font-size: 0.75rem;
	}

	.sitim-steps li.is-active::before {
		font-size: 0.8125rem;
	}

	/* Full-width, thumb-sized actions, and Continue before Back in the
	 * reading order it is drawn in. */
	.sitim-actions {
		gap: 0.5rem;
	}

	.sitim-actions .sitim-btn {
		flex: 1 1 100%;
		min-height: 3rem;
		padding: 0.8rem 1rem;
	}

	.sitim-actions .sitim-btn-ghost {
		order: 2;
	}

	.sitim-check {
		min-height: 2.75rem;
		align-items: center;
	}

	.sitim-map-bar {
		gap: 0.5rem;
	}

	.sitim-map-bar .sitim-btn-sm {
		width: 100%;
		min-height: 2.75rem;
	}

	/*
	 * Inline text links inside a form are real controls -- "Change" the chosen
	 * restaurant, "Add the restaurant yourself" -- and at their natural line
	 * height they are a 20px target. Give them a thumb-sized box without
	 * turning them into buttons.
	 */
	.sitim-link {
		display: inline-block;
		min-height: 2.75rem;
		padding: 0.7rem 0.15rem;
		line-height: 1.4;
	}

	.sitim-chosen {
		align-items: center;
	}
}

/* The "showing N of M" line at the foot of a truncated result list. It is
 * styled as information rather than as another option, so nobody tries to
 * tap it expecting a restaurant. */
.sitim-result-more {
	padding: 0.6rem 0.75rem;
	background: var(--sitim-soft);
	border-top: 1px solid var(--sitim-line);
	color: var(--sitim-muted);
	font-size: 0.8125rem;
	cursor: default;
}

/* A longer list needs to stay a list rather than becoming the page. */
.sitim-results {
	max-height: 22rem;
	overflow-y: auto;
}
