/*
 * Mary H. Weir Public Library — forms (library card registration, volunteer application)
 * Loaded only on pages that show a form. Uses WordPress preset variables.
 */

.mhw-form { margin: 1.4em 0 0; font-size: 16px; line-height: 1.5; }
.mhw-form-intro { font-size: 15px; color: var(--wp--preset--color--text-muted); }

.mhw-form fieldset {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--slag-gray);
	border-radius: 4px;
	padding: 20px 24px 8px;
	margin: 0 0 20px;
	min-width: 0;
}
.mhw-form legend {
	display: flex; align-items: center; gap: 10px;
	float: left; width: 100%;           /* keeps the legend inside the box */
	margin: 0 0 14px; padding: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 19px; font-weight: 700; line-height: 1.3;
	color: var(--wp--preset--color--river-navy);
}
.mhw-form legend + * { clear: both; }
.mhw-form legend .step {
	display: inline-flex; align-items: center; justify-content: center;
	flex: none; width: 26px; height: 26px; border-radius: 4px;
	background: var(--wp--preset--color--river-navy); color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--body); font-size: 14px;
}
.mhw-form legend .optional { font-family: var(--wp--preset--font-family--body); font-size: 14px; font-weight: 400; color: var(--wp--preset--color--text-muted); }
.mhw-legend-note { clear: both; font-size: 15px; color: var(--wp--preset--color--text-muted); margin: 0 0 14px; }

/* Fields */
.mhw-field { margin: 0 0 16px; }
.mhw-field[hidden] { display: none; }
.mhw-field label { display: block; font-weight: 700; font-size: 15px; color: var(--wp--preset--color--text-dark); margin: 0 0 6px; }
.mhw-form .req { font-weight: 400; font-size: 13px; color: var(--wp--preset--color--text-muted); }
.mhw-hint { font-size: 14px; color: var(--wp--preset--color--text-muted); margin: -2px 0 8px; }

.mhw-form input[type="text"],
.mhw-form input[type="tel"],
.mhw-form input[type="email"],
.mhw-form input[type="date"],
.mhw-form input[type="url"],
.mhw-form select,
.mhw-form textarea {
	display: block; width: 100%; box-sizing: border-box;
	font: inherit; font-size: 16px; /* 16px+ keeps phones from zooming in */
	color: var(--wp--preset--color--text-dark);
	background: var(--wp--preset--color--white);
	border: 1px solid #b8c2d0;
	border-radius: 4px;
	padding: 11px 12px;
	min-height: 46px;
}
.mhw-form textarea { min-height: 84px; resize: vertical; }
.mhw-form select { appearance: auto; }
.mhw-form .is-narrow input { max-width: 240px; }
.mhw-form :is(input, select, textarea):focus {
	outline: 3px solid rgba(24, 48, 89, 0.25);
	outline-offset: 0;
	border-color: var(--wp--preset--color--river-navy);
}

.mhw-row { display: grid; gap: 0 16px; }
@media (min-width: 640px) {
	.mhw-row-2 { grid-template-columns: 1fr 1fr; }
	.mhw-row-3 { grid-template-columns: 1fr 1fr 1fr; }
	.mhw-row-city { grid-template-columns: 1fr 130px 150px; }
}

/* Checkbox */
.mhw-check { display: grid; grid-template-columns: 24px 1fr; gap: 4px 12px; align-items: start; }
.mhw-check .mhw-field-error { grid-column: 1 / -1; }
.mhw-check input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--wp--preset--color--river-navy); }
.mhw-check label { font-weight: 400; font-size: 16px; margin: 0; }

.mhw-agreement {
	font-size: 15px; line-height: 1.6;
	background: var(--wp--preset--color--vellum-cream);
	border-radius: 4px; padding: 14px 16px; margin: 0 0 16px;
}
.mhw-agreement p { margin: 0 0 0.6em; }
.mhw-agreement p:last-child { margin: 0; }

/* Groups of checkboxes / radio buttons (volunteer form) */
.mhw-choices-label { font-weight: 700; font-size: 15px; color: var(--wp--preset--color--text-dark); margin: 0 0 8px; }
.mhw-choices-label .req { font-weight: 400; }
.mhw-choices-list { display: grid; gap: 8px; }
.mhw-choices-list .mhw-check { margin: 0; }
@media (min-width: 640px) {
	.mhw-choices-list.is-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.mhw-check.is-radio input[type="radio"] { width: 20px; height: 20px; margin: 3px 0 0 1px; accent-color: var(--wp--preset--color--river-navy); }
.mhw-choices.has-error { border-left: 3px solid #b42318; padding-left: 12px; }

/* A section that appears inside a step (service-hours details) */
.mhw-subsection {
	border-top: 1px solid var(--wp--preset--color--slag-gray);
	padding-top: 16px; margin: 4px 0 16px;
}
.mhw-subsection[hidden], .mhw-form fieldset[hidden], .mhw-agreement p[hidden] { display: none; }
.mhw-subsection-title { font-weight: 700; color: var(--wp--preset--color--river-navy); margin: 0 0 12px; }

/* Errors */
.mhw-field.has-error :is(input, select, textarea) { border-color: #b42318; border-width: 2px; }
.mhw-field-error { color: #b42318; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.mhw-form-errors {
	border: 2px solid #b42318; border-radius: 4px;
	background: #fff; padding: 16px 20px; margin: 1.2em 0;
}
.mhw-form-errors p { margin: 0 0 6px; color: #b42318; }
.mhw-form-errors ul { margin: 0; }
.mhw-form-errors a { color: #b42318; }
.mhw-form-errors:focus, .mhw-form-success:focus { outline: 3px solid rgba(24, 48, 89, 0.25); outline-offset: 2px; }

/* An explanation inside a form step (e.g. 3D print pricing) */
.mhw-form-note {
	background: var(--wp--preset--color--vellum-cream);
	border-left: 4px solid var(--wp--preset--color--burnished-amber);
	border-radius: 0 4px 4px 0; padding: 14px 18px; margin: 0 0 18px; font-size: 16px;
}
.mhw-form-note p { margin: 0 0 8px; }
.mhw-form-note p:last-child { margin-bottom: 0; }

/* Thank-you + not-available notes */
.mhw-form-success, .mhw-form-notice {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--slag-gray);
	border-left: 4px solid var(--wp--preset--color--mill-forest);
	border-radius: 4px; padding: 20px 24px; margin: 1.4em 0;
}
.wp-block-post-content .mhw-form-success h3 { margin-top: 0; color: var(--wp--preset--color--mill-forest); }
.mhw-form-success p:last-child, .mhw-form-notice p:last-child { margin-bottom: 0; }

/* Bot trap: invisible to people, still in the page for scripts to find */
.mhw-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.mhw-form .wp-block-buttons { margin-top: 8px; }
.mhw-form button[disabled] { opacity: 0.7; cursor: progress; }

@media (max-width: 600px) {
	.mhw-form fieldset { padding: 16px 16px 4px; }
}

/* ---------- Program sign-ups ([mhw_program_signup]) ---------- */
.mhw-signup-status:empty { display: none; }
.mhw-signup-status { margin: 10px 0 0; font-size: 15px; color: var(--wp--preset--color--text-muted); }
.mhw-signup-status.is-full {
	padding: 12px 14px; border-radius: 4px; color: var(--wp--preset--color--text-dark);
	background: var(--wp--preset--color--vellum-cream);
	border-left: 4px solid var(--wp--preset--color--burnished-amber);
}
.mhw-signup [hidden] { display: none !important; }
