/**
 * Manuscript form.
 *
 * Tokens (override these on .hb-panel or :root):
 * --hb-font-display  Uncial Antiqua, bundled locally
 * --hb-font-text     IM Fell English, bundled locally
 * --hb-parchment
 * --hb-ink
 * --hb-accent
 * --hb-gold
 * --hb-texture       Optional image URL, set when a page texture is chosen
 */

@font-face {
	font-family: "Uncial Antiqua";
	src: url("../fonts/uncial-antiqua.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "IM Fell English";
	src: url("../fonts/im-fell-english.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

.hb-panel {
	--hb-font-display: "Uncial Antiqua", Palatino, "Palatino Linotype", serif;
	--hb-font-text: "IM Fell English", Georgia, "Times New Roman", serif;
	--hb-parchment: #f3e6c8;
	--hb-parchment-deep: #e4d0aa;
	--hb-ink: #3a2a1a;
	--hb-accent: #3d5344;
	--hb-gold: #8d7040;
	--hb-error: #6e3228;

	position: relative;
	max-width: 40rem;
	margin: 1.5rem auto;
	padding: 2rem 1.5rem 1.75rem;
	color: var(--hb-ink);
	font-family: var(--hb-font-text);
	font-size: 1.125rem;
	line-height: 1.45;
	background-color: var(--hb-parchment);
	background-image:
		var(--hb-texture, none),
		radial-gradient(ellipse at top, rgba(255, 250, 240, 0.7), transparent 55%),
		linear-gradient(165deg, #f7edd6 0%, var(--hb-parchment) 42%, var(--hb-parchment-deep) 100%);
	background-size: cover, auto, auto;
	background-position: center, center, center;
	border: 1px solid rgba(58, 42, 26, 0.35);
	border-radius: 2px 12px 8px 3px;
	box-shadow:
		inset 0 0 0 1px rgba(141, 112, 64, 0.25),
		inset 0 0 42px rgba(90, 58, 24, 0.12),
		0 12px 28px rgba(40, 24, 12, 0.08);
}

.hb-title {
	margin: 0 0 0.4rem;
	font-family: var(--hb-font-display);
	font-size: 2.1rem;
	font-weight: 400;
	line-height: 1.15;
	color: var(--hb-ink);
}

.hb-lead,
.hb-hint {
	margin: 0;
	color: var(--hb-ink);
}

.hb-lead {
	font-size: 1.15rem;
}

.hb-rule {
	height: 1px;
	margin: 1.1rem 0 1.25rem;
	border: 0;
	background: linear-gradient(90deg, transparent, var(--hb-gold), transparent);
}

.hb-form {
	display: grid;
	gap: 1.1rem;
}

.hb-hp {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

.hb-label,
.hb-consent {
	font-family: var(--hb-font-text);
	font-size: 1.15rem;
	color: var(--hb-ink);
}

.hb-label {
	display: block;
	margin-bottom: 0.35rem;
}

.hb-optional {
	font-size: 0.95rem;
}

.hb-form input[type="text"],
.hb-form textarea {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 0.7rem 0.8rem;
	border: 1px solid rgba(58, 42, 26, 0.35);
	border-radius: 2px;
	background: rgba(255, 252, 245, 0.72);
	color: var(--hb-ink);
	font-family: var(--hb-font-text);
	font-size: 1.125rem;
	line-height: 1.4;
}

.hb-form textarea {
	min-height: 6.5rem;
	resize: vertical;
}

.hb-form input[type="text"]:focus,
.hb-form textarea:focus,
.hb-consent input:focus {
	outline: 2px solid var(--hb-accent);
	outline-offset: 2px;
}

.hb-form input[aria-invalid="true"],
.hb-form textarea[aria-invalid="true"] {
	border-color: var(--hb-error);
}

.hb-hint {
	margin-top: 0.35rem;
	font-size: 1rem;
}

.hb-consent {
	display: flex;
	gap: 0.7rem;
	align-items: flex-start;
}

.hb-consent input {
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.28rem;
	flex: 0 0 auto;
	accent-color: var(--hb-accent);
}

.hb-status {
	min-height: 1.4em;
	margin: 0;
	font-size: 1.05rem;
}

.hb-status.is-success {
	color: var(--hb-accent);
}

.hb-status.is-error {
	color: var(--hb-error);
}

.hb-submit {
	justify-self: start;
	margin: 0;
	padding: 0.75rem 1.35rem;
	border: 1px solid var(--hb-gold);
	border-radius: 2px;
	background: transparent;
	color: var(--hb-ink);
	font-family: var(--hb-font-display);
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
}

.hb-submit:hover,
.hb-submit:focus-visible {
	background: var(--hb-accent);
	color: #f6edd8;
}

.hb-submit:focus-visible {
	outline: 2px solid var(--hb-ink);
	outline-offset: 3px;
}

.hb-submit:disabled {
	cursor: progress;
	opacity: 0.7;
}

@media (max-width: 640px) {
	.hb-panel {
		margin: 1rem 0;
		padding: 1.35rem 1rem 1.25rem;
	}

	.hb-title {
		font-size: 1.8rem;
	}
}
