/**
 * Home Stats Lookup front-end styles.
 *
 * Typography is inherited from the active theme on purpose. Everything you are
 * likely to want to change is a custom property, so a theme can restyle this
 * without overriding selectors:
 *
 *   .hsl-widget { --hsl-accent: #7a3b2e; --hsl-rule: #ddd; }
 */

.hsl-widget {
	--hsl-accent: #2f5169;
	--hsl-rule: rgba( 0, 0, 0, 0.12 );
	--hsl-muted: rgba( 0, 0, 0, 0.6 );
	--hsl-error: #96261c;
	--hsl-gap: 1.25rem;
	--hsl-radius: 3px;

	max-width: 46rem;
}

.hsl-heading {
	margin: 0 0 0.5rem;
}

.hsl-intro {
	color: var( --hsl-muted );
	margin-bottom: var( --hsl-gap );
}

.hsl-intro p:last-child {
	margin-bottom: 0;
}

/* Form
   ------------------------------------------------------------------------- */

.hsl-label {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 600;
}

.hsl-input-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.hsl-input {
	flex: 1 1 18rem;
	min-width: 0;
	padding: 0.6rem 0.7rem;
	border: 1px solid var( --hsl-rule );
	border-radius: var( --hsl-radius );
	font: inherit;
	color: inherit;
	background: transparent;
}

.hsl-input:focus-visible,
.hsl-submit:focus-visible {
	outline: 2px solid var( --hsl-accent );
	outline-offset: 2px;
}

.hsl-submit {
	flex: 0 0 auto;
	padding: 0.6rem 1.1rem;
	border: 1px solid var( --hsl-accent );
	border-radius: var( --hsl-radius );
	background: var( --hsl-accent );
	color: #fff;
	font: inherit;
	cursor: pointer;
}

.hsl-submit:hover:not( :disabled ) {
	filter: brightness( 1.1 );
}

.hsl-submit:disabled {
	cursor: progress;
	opacity: 0.65;
}

/* Honeypot: off-screen rather than display:none, which some bots detect. */
.hsl-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Status
   ------------------------------------------------------------------------- */

.hsl-status {
	margin: 0.75rem 0 0;
	min-height: 1.4em;
	color: var( --hsl-muted );
}

.hsl-status[ data-tone='error' ] {
	color: var( --hsl-error );
}

.hsl-status[ data-tone='busy' ]::after {
	content: '';
	display: inline-block;
	width: 0.4em;
	animation: hsl-ellipsis 1.2s steps( 4, end ) infinite;
}

@keyframes hsl-ellipsis {
	0% { content: ''; }
	25% { content: '.'; }
	50% { content: '..'; }
	75% { content: '...'; }
}

@media ( prefers-reduced-motion: reduce ) {
	.hsl-status[ data-tone='busy' ]::after {
		animation: none;
		content: '...';
	}
}

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

.hsl-result {
	margin-top: var( --hsl-gap );
}

.hsl-result-address {
	margin: 0 0 var( --hsl-gap );
	padding-bottom: 0.6rem;
	border-bottom: 2px solid var( --hsl-accent );
	font-size: 1.15em;
	font-weight: 600;
}

.hsl-result-address:focus {
	outline: none;
}

.hsl-group + .hsl-group {
	margin-top: var( --hsl-gap );
}

.hsl-group-title {
	margin: 0 0 0.5rem;
	font-size: 1em;
	font-weight: 700;
}

.hsl-stats {
	margin: 0;
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 14rem, 1fr ) );
	/* Rows butt up against each other so the hairlines read as one ruled list.
	   Columns need a real gutter or the value collides with the next label. */
	column-gap: 2.5rem;
	row-gap: 0;
}

.hsl-stat {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var( --hsl-rule );
}

.hsl-stat-label {
	color: var( --hsl-muted );
}

.hsl-stat-value {
	margin: 0;
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

/* Long prose values, like the flood insurance note, read badly in a narrow
   right-aligned column. Give them the full row. */
.hsl-stat[ data-field='flood_insurance' ],
.hsl-stat[ data-field='crime_note' ],
.hsl-stat[ data-field='flood_zone_detail' ] {
	grid-column: 1 / -1;
	display: block;
}

.hsl-stat[ data-field='flood_insurance' ] .hsl-stat-value,
.hsl-stat[ data-field='crime_note' ] .hsl-stat-value,
.hsl-stat[ data-field='flood_zone_detail' ] .hsl-stat-value {
	text-align: left;
	font-weight: 400;
	margin-top: 0.15rem;
}

/* Footnotes
   ------------------------------------------------------------------------- */

.hsl-partial,
.hsl-disclaimer,
.hsl-timestamp,
.hsl-empty {
	color: var( --hsl-muted );
	font-size: 0.9em;
}

.hsl-partial {
	margin-top: var( --hsl-gap );
	padding-left: 0.9rem;
	border-left: 2px solid var( --hsl-rule );
}

.hsl-partial-title {
	margin: 0 0 0.25rem;
}

.hsl-partial ul {
	margin: 0;
	padding-left: 1.1rem;
}

.hsl-disclaimer {
	margin-top: var( --hsl-gap );
}

.hsl-timestamp {
	margin-top: 0.35rem;
	font-size: 0.82em;
}

.hsl-notice {
	padding: 0.8rem 1rem;
	border-left: 3px solid var( --hsl-accent, #2f5169 );
	background: rgba( 0, 0, 0, 0.03 );
}

@media ( max-width: 480px ) {
	.hsl-submit {
		flex: 1 1 100%;
	}

	.hsl-stat {
		display: block;
	}

	.hsl-stat-value {
		text-align: left;
	}
}
