/*
 * Antillean Dream Forms — front-end styles.
 *
 * Follows the layout of the form this plugin replaces: one bordered sheet, grey
 * section bars, and rows of "bold label left, control right". Scoped to
 * .adf-form-wrap throughout and inheriting the theme's typography, so only
 * layout, borders and the submit button carry an opinion.
 */

.adf-form-wrap {
	--adf-accent: #1a6a9c;
	--adf-border: #dcdcdc;
	--adf-field-border: #d5d5d5;
	--adf-bar: #f5f5f5;
	--adf-error: #e2401c;
	--adf-check: #5cb85c;
	--adf-muted: #8a8a8a;
	--adf-label-width: 200px;
	width: 100%;
}

.adf-form-wrap * {
	box-sizing: border-box;
}

/* Notices ---------------------------------------------------------------- */

.adf-notice {
	border-left: 4px solid var(--adf-accent);
	padding: 0.75em 1em;
	margin: 0 0 1.5em;
	background: #f2f6f9;
}

.adf-notice p {
	margin: 0;
}

.adf-notice--success {
	border-left-color: #2e7d32;
	background: #f1f7f1;
}

.adf-notice--error {
	border-left-color: var(--adf-error);
	background: #fdf3f1;
}

/* The sheet and its section bars ----------------------------------------- */

.adf-sheet {
	border: 1px solid var(--adf-border);
	border-bottom: 0;
	background: #fff;
}

.adf-sheet > .adf-panel {
	border-bottom: 1px solid var(--adf-border);
}

.adf-legend {
	margin: 0;
	padding: 0.75em 1.1em;
	background: var(--adf-bar);
	border-bottom: 1px solid var(--adf-border);
	font-size: 0.95em;
	font-weight: 400;
	line-height: 1.3;
	color: #555;
}

.adf-rows {
	padding: 1.4em 1.1em;
}

/* A conditional panel nested inside a section is just more rows: no bar, no
   padding of its own, so its fields line up with the ones above. */
.adf-rows .adf-panel .adf-rows {
	padding: 0;
}

.adf-panel--conditional[hidden] {
	display: none;
}

/* Rows ------------------------------------------------------------------- */

.adf-field {
	display: grid;
	grid-template-columns: var(--adf-label-width) minmax(0, 1fr);
	gap: 0 1.2em;
	align-items: start;
	margin: 0 0 1.1em;
}

.adf-field:last-child {
	margin-bottom: 0;
}

.adf-label-col {
	padding-top: 0.6em;
}

.adf-label {
	display: block;
	font-weight: 700;
	font-size: 0.92em;
	line-height: 1.3;
	color: #333;
}

.adf-req {
	color: var(--adf-error);
}

/* Controls --------------------------------------------------------------- */

.adf-control {
	position: relative;
	display: block;
}

.adf-field--narrow .adf-control {
	max-width: 250px;
}

.adf-input {
	display: block;
	width: 100%;
	padding: 0.65em 0.8em;
	border: 1px solid var(--adf-field-border);
	border-radius: 2px;
	background: #fff;
	font: inherit;
	font-size: 0.95em;
	line-height: 1.4;
	color: #333;
}

.adf-input::placeholder {
	color: #aaa;
	opacity: 1;
}

.adf-input:focus {
	outline: 0;
	border-color: var(--adf-accent);
	box-shadow: 0 0 0 1px var(--adf-accent);
}

textarea.adf-input {
	min-height: 8em;
	resize: vertical;
}

/* Leading icon: an inline-start gutter inside the field, like the original. */

.adf-control--icon .adf-input {
	padding-left: 3em;
}

.adf-icon {
	position: absolute;
	top: 0;
	left: 0;
	width: 2.6em;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #6f6f6f;
	pointer-events: none;
}

.adf-icon svg {
	display: block;
}

/* Radios: real inputs, visually replaced by a circle that turns into a green
   check when selected. The input stays focusable and screen-reader visible. */

.adf-radio-group {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em 1.6em;
	padding-top: 0.55em;
}

.adf-radio {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	font-weight: 400;
	font-size: 0.95em;
	cursor: pointer;
}

.adf-radio-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	margin: 0;
}

.adf-radio-mark {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border: 1px solid #c8c8c8;
	border-radius: 50%;
	background: #fff;
	transition: background-color 0.12s ease, border-color 0.12s ease;
}

.adf-radio-input:checked + .adf-radio-mark {
	background: var(--adf-check);
	border-color: var(--adf-check);
}

/* The checkmark: two borders of an empty box, rotated. */
.adf-radio-input:checked + .adf-radio-mark::after {
	content: "";
	display: block;
	width: 5px;
	height: 9px;
	margin: 3px auto 0;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(43deg);
}

.adf-radio-input:focus-visible + .adf-radio-mark {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--adf-accent);
}

/* Notes and errors ------------------------------------------------------- */

.adf-note {
	display: block;
	margin-top: 0.4em;
	font-size: 0.85em;
	color: var(--adf-muted);
}

.adf-error {
	display: block;
	margin-top: 0.4em;
	font-size: 0.88em;
	color: var(--adf-error);
}

.adf-field--error .adf-input {
	border-color: var(--adf-error);
	box-shadow: inset 0 0 0 1px var(--adf-error);
}

/* Honeypot — hidden from humans, still reachable for bots that read the DOM */

.adf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Submit ----------------------------------------------------------------- */

.adf-actions {
	margin: 1.5em 0 0;
}

.adf-submit {
	display: inline-block;
	padding: 0.75em 1.8em;
	border: 0;
	border-radius: 2px;
	background: var(--adf-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.adf-submit:hover,
.adf-submit:focus {
	background: #155780;
}

/* Stack the two columns once the label gutter stops paying for itself. */

@media (max-width: 700px) {
	.adf-field {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
		margin-bottom: 1.3em;
	}

	.adf-label-col {
		padding-top: 0;
		margin-bottom: 0.35em;
	}

	.adf-radio-group {
		padding-top: 0;
	}

	.adf-field--narrow .adf-control {
		max-width: none;
	}
}
