/*
 * dreamwell.co contact form - shared styles
 * Used by the contact section at the foot of every page: a "Get in touch"
 * button in the Contact column opens the form in a full-width row beneath it.
 * Markup and behaviour: /js/contact-form.js   Handler: /contact.php
 *
 * Colours and fonts come from the tokens in /css/styles.css (--ink, --paper,
 * --accent). The wrapper is .dw-contact, not .contact-form, so the old
 * ".contact-form input" and ".contact-form button" rules cannot reach it.
 * After any edit, raise the ?v= number on this file's <link> tag in every
 * page, or Cloudflare keeps serving the old copy.
 */

/* ---- Contact column: heading, one line of copy and the button ---- */
.contact-section--cf {
	--cf-line: rgba(242, 236, 224, 0.4);
	/* Lets Follow and Links stay in the first row although the form's row
	   comes before them in the page (so on phones the form opens right
	   under its button). */
	grid-auto-flow: row dense;
}

.dw-contact {
	grid-column: 1;
	min-width: 0;
}

.dw-contact > h3 {
	margin: 0 0 22px;
	font-weight: 300;
	font-size: 15px;
	color: var(--ink, #f2ece0);
}

.dw-contact-intro {
	margin: 0 0 18px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ink-2, #cfc8b9);
}

.cf-noscript {
	font-size: 13px;
	line-height: 1.6;
	color: var(--ink-2, #cfc8b9);
}

.cf-toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 20px;
	border: 1px solid var(--ink, #f2ece0);
	border-radius: 10px;
	background: none;
	color: var(--ink, #f2ece0);
	font-family: inherit;
	font-size: 13px;
	letter-spacing: 0.04em;
	transition: background-color 240ms, color 240ms;
	/* Lands the button below the fixed logo when the form opens. */
	scroll-margin-top: 220px;
}

.cf-toggle:hover,
.cf-toggle[aria-expanded="true"] {
	background: var(--ink, #f2ece0);
	color: var(--paper, #0a0908);
}

.cf-toggle:focus-visible {
	outline: 2px solid var(--accent, #ffb400);
	outline-offset: 3px;
}

.cf-toggle-icon {
	flex: none;
	transition: transform 240ms;
}

.cf-toggle[aria-expanded="true"] .cf-toggle-icon {
	transform: rotate(180deg);
}

/* ---- Drop-down panel ---- */
.cf-panel {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	min-width: 0;
	transition: grid-template-rows 0.35s ease, visibility 0s linear 0.35s;
}

.contact-section--cf > .cf-panel {
	grid-column: 1 / -1;
}

.cf-panel.is-open {
	grid-template-rows: 1fr;
	visibility: visible;
	transition: grid-template-rows 0.35s ease, visibility 0s;
}

.cf-panel[hidden],
.cf-form[hidden],
.cf-success[hidden],
.cf-form fieldset[hidden] {
	display: none;
}

.cf-panel-inner {
	min-height: 0;
	max-width: 760px;
	overflow: hidden;
}

/* ---- The form ---- */
.cf-form,
.cf-success {
	padding: 4px 3px 8px 3px;
	color-scheme: dark;
	text-align: left;
}

.cf-form fieldset {
	border: 0;
	min-width: 0;
	margin: 0 0 24px;
	padding: 0;
}

.cf-form legend,
.cf-field label {
	display: block;
	margin-bottom: 10px;
	padding: 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--ink-2, #cfc8b9);
}

.cf-optional {
	color: var(--ink-mute, rgba(242, 236, 224, 0.55));
}

.cf-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.cf-chip {
	position: relative;
	display: inline-block;
}

.cf-chip input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: inherit;
}

.cf-chip span {
	display: inline-block;
	padding: 10px 18px;
	border: 1px solid var(--cf-line);
	border-radius: 60px;
	font-size: 13px;
	line-height: 1.2;
	color: var(--ink, #f2ece0);
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.cf-chip input:hover + span {
	border-color: var(--ink, #f2ece0);
}

.cf-chip input:checked + span {
	background-color: var(--ink, #f2ece0);
	border-color: var(--ink, #f2ece0);
	color: var(--paper, #0a0908);
}

.cf-chip input:focus-visible + span {
	outline: 2px solid var(--accent, #ffb400);
	outline-offset: 3px;
}

.cf-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 0 16px;
}

.cf-field {
	margin-bottom: 24px;
	min-width: 0;
}

/* 16px text keeps phones from zooming in when a field is tapped. */
.cf-field input,
.cf-field textarea,
.cf-field select {
	display: block;
	width: 100%;
	margin: 0;
	padding: 14px 16px;
	border: 1px solid var(--cf-line);
	border-radius: 10px;
	background-color: transparent;
	color: var(--ink, #f2ece0);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
	outline: none;
	transition: border-color 0.2s;
}

.cf-field textarea {
	min-height: 150px;
	resize: vertical;
}

.cf-field select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 44px;
	background-color: var(--paper, #0a0908);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23f2ece0' stroke-width='1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	cursor: inherit;
}

.cf-field input::placeholder,
.cf-field textarea::placeholder {
	color: var(--ink-mute, rgba(242, 236, 224, 0.55));
	opacity: 1;
}

.cf-field input:focus,
.cf-field textarea:focus,
.cf-field select:focus {
	border-color: var(--accent, #ffb400);
}

.cf-field [aria-invalid="true"] {
	border-color: #ff6b6b;
}

/* Trap field for bots: kept out of sight and out of the tab order */
.cf-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.cf-hold {
	position: relative;
	display: block;
	width: 100%;
	padding: 18px 22px;
	isolation: isolate;
	border: 1px solid var(--ink, #f2ece0);
	border-radius: 10px;
	/* The light fill is the button's own background, growing from the left.
	   Being part of the button it always follows the rounded corners; a
	   separate sliding layer could briefly poke its square corners out. */
	background-color: transparent;
	background-image: linear-gradient(var(--ink, #f2ece0), var(--ink, #f2ece0));
	background-repeat: no-repeat;
	background-position: left center;
	background-size: 0% 100%;
	transition: background-size 0.2s ease-out;
	color: var(--ink, #f2ece0);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: none;
}

.cf-hold:focus-visible {
	outline: 2px solid var(--accent, #ffb400);
	outline-offset: 3px;
}

.cf-hold.is-holding {
	background-size: 100% 100%;
	transition: background-size 1.1s linear;
}

.cf-hold.is-done {
	background-size: 100% 100%;
	transition: none;
}

/* Text turns dark where the fill has reached it. */
.cf-hold-label {
	position: relative;
	mix-blend-mode: difference;
	pointer-events: none;
}

.cf-status {
	min-height: 1.5em;
	margin: 12px 0 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--ink-2, #cfc8b9);
}

.cf-status.is-error {
	color: #ff8a8a;
}

.cf-note {
	margin: 4px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--ink-mute, rgba(242, 236, 224, 0.55));
}

.cf-success h3 {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 300;
	color: var(--ink, #f2ece0);
	outline: none;
}

.cf-success p {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--ink-2, #cfc8b9);
}

.cf-again {
	margin-top: 20px;
	padding: 10px 20px;
	border: 1px solid var(--ink, #f2ece0);
	border-radius: 10px;
	background: none;
	color: var(--ink, #f2ece0);
	font-family: inherit;
	font-size: 13px;
	letter-spacing: 0.04em;
	transition: background-color 240ms, color 240ms;
}

.cf-again:hover,
.cf-again:focus-visible {
	background: var(--ink, #f2ece0);
	color: var(--paper, #0a0908);
}

/* Matches the spacing the old form had when the section stacks on phones. */
@media (max-width: 768px) {
	.dw-contact {
		margin-bottom: 30px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cf-chip span,
	.cf-toggle,
	.cf-toggle-icon,
	.cf-again {
		transition: none;
	}

	.cf-panel,
	.cf-panel.is-open {
		transition: none;
	}
}
