/**
 * Dispatch Forms — front end.
 *
 * Scoped under .df so the theme is never touched. Colours come from the
 * theme's own custom properties where they exist, with literals behind them
 * so a form looks right wherever it is dropped.
 */

/* The variables sit on both the shortcode wrapper and the form itself, so a
   form pasted into an HTML widget without the .df wrapper still has them. */
.df,
.df-form {
	--df-cream: var(--cream, #f2eeda);
	--df-ink: var(--ink, #181818);
	--df-gold: var(--gold, #c8b818);
	--df-gold-deep: var(--gold-deep, #8f8206);
	--df-line: var(--line, #d8d0b2);
	--df-paper: var(--paper, #fbf9f0);
	--df-serif: var(--serif, "Monument Extended", "Times New Roman", serif);
	--df-sans: var(--sans, "Helvetica Neue Dispatch", "Helvetica Neue", Arial, sans-serif);

	--df-muted: #6d6a5c;
	--df-red: #9c2f2f;
	--df-red-bg: #f4e2e0;
	--df-green: #2f4a2b;
	--df-green-bg: #e6ecdf;

	box-sizing: border-box;
	font-family: var(--df-sans);
	font-size: 15px;
	line-height: 1.55;
	color: var(--df-ink);
}

.df *,
.df-form *,
.df *::before,
.df-form *::before,
.df *::after,
.df-form *::after { box-sizing: inherit; }

.df-title {
	font-family: var(--df-serif);
	font-weight: 400;
	font-size: clamp(22px, 2.6vw, 29px);
	line-height: 1.15;
	letter-spacing: -0.01em;
	margin: 0 0 10px;
	color: var(--df-ink);
}

.df-intro {
	margin: 0 0 22px;
	max-width: 56ch;
	color: #4f4c44;
	font-size: 15px;
}

/* ------------------------------------------------------------ fields */

.df-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 18px;
}

.df-field { margin-bottom: 16px; }
.df-field--full { grid-column: 1 / -1; }

.df-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	margin-bottom: 6px;
}

.df-label--required::after {
	content: " *";
	color: var(--df-red);
	font-weight: 400;
}

.df-input,
.df-select,
.df-textarea {
	width: 100%;
	min-height: 46px;
	padding: 11px 13px;
	border: 1px solid var(--df-line);
	border-radius: 2px;
	background: #fff;
	color: var(--df-ink);
	font-family: var(--df-sans);
	font-size: 15px;
	line-height: 1.45;
	-webkit-appearance: none;
	appearance: none;
}

.df-textarea {
	min-height: 112px;
	resize: vertical;
}

.df-select {
	background-image:
		linear-gradient(45deg, transparent 50%, #6d6a5c 50%),
		linear-gradient(135deg, #6d6a5c 50%, transparent 50%);
	background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 34px;
}

.df-input:focus,
.df-select:focus,
.df-textarea:focus {
	outline: 2px solid var(--df-gold-deep);
	outline-offset: 1px;
	border-color: var(--df-gold-deep);
}

.df-hint {
	display: block;
	margin-top: 5px;
	font-size: 12.5px;
	color: var(--df-muted);
}

.df-error {
	display: none;
	margin-top: 5px;
	font-size: 12.5px;
	color: var(--df-red);
}

.df-field.is-error .df-error { display: block; }

.df-field.is-error .df-input,
.df-field.is-error .df-select,
.df-field.is-error .df-textarea {
	border-color: var(--df-red);
	background: #fffaf9;
}

/* ------------------------------------------------------------ checkboxes */

.df-checks {
	display: flex;
	flex-direction: column;
	gap: 9px;
	margin-top: 2px;
}

.df-check {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	font-size: 14.5px;
	line-height: 1.45;
	cursor: pointer;
}

.df-check input {
	width: 16px;
	height: 16px;
	margin: 3px 0 0;
	flex: none;
	accent-color: var(--df-gold-deep);
}

/* ------------------------------------------------------------ actions */

.df-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	margin-top: 6px;
}

.df-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 11px 26px;
	border: 1px solid var(--df-ink);
	border-radius: 2px;
	background: var(--df-ink);
	color: var(--df-cream);
	font-family: var(--df-sans);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.df-btn:hover {
	background: var(--df-gold-deep);
	border-color: var(--df-gold-deep);
	color: #fff;
}

.df-btn[disabled] {
	opacity: 0.55;
	cursor: progress;
}

.df-note {
	font-size: 12.5px;
	color: var(--df-muted);
}

/* ------------------------------------------------------------ messages */

.df-alert {
	border: 1px solid var(--df-line);
	border-left: 3px solid var(--df-gold-deep);
	border-radius: 2px;
	background: var(--df-paper);
	padding: 13px 16px;
	margin: 0 0 20px;
	font-size: 14.5px;
	line-height: 1.55;
}

.df-alert--ok {
	border-left-color: var(--df-green);
	background: var(--df-green-bg);
	color: var(--df-green);
}

.df-alert--bad {
	border-left-color: var(--df-red);
	background: var(--df-red-bg);
	color: var(--df-red);
}

/* The honeypot. Off-screen rather than display:none, because some bots
   skip anything that is hidden outright. */
.df-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.df-recaptcha { margin: 2px 0 4px; }

.df-oops {
	padding: 10px 14px;
	border: 1px dashed var(--df-red);
	background: var(--df-red-bg);
	color: var(--df-red);
	font-size: 14px;
}

/* ------------------------------------------------------------ compact */

/* The inline subscribe form: one row on a wide screen. */
.df--compact .df-fields {
	grid-template-columns: minmax(0, 1fr);
	gap: 0;
}

.df--compact .df-title { font-size: 19px; }
.df--compact .df-intro { margin-bottom: 16px; font-size: 14px; }
.df--compact .df-field { margin-bottom: 12px; }

@media (min-width: 720px) {
	.df--compact .df-form {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 0 12px;
		align-items: start;
	}

	.df--compact .df-title,
	.df--compact .df-intro,
	.df--compact .df-alert { grid-column: 1 / -1; }

	.df--compact .df-actions { margin-top: 0; }
	.df--compact .df-btn { min-height: 46px; }
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 680px) {
	.df-fields { grid-template-columns: minmax(0, 1fr); }
	.df-btn { width: 100%; }
	.df-actions { gap: 10px; }
}
