/**
 * Forms - single source of truth for all form styling.
 *
 * Covers Gravity Forms (2.10 "Orbital" theme and the legacy "gravity-theme"
 * markup) plus native form controls, everywhere on the site. Loaded on every
 * front-end view by deer-camp-fuse's enqueue, so a form is styled the same
 * whether it sits on a plugin-rendered template, a block page, or inside the
 * property inquiry drawer.
 *
 * Why this file exists: Gravity Forms 2.10 drives its appearance from
 * `--gf-*` custom properties whose defaults are built for a LIGHT page.
 * `--gf-ctrl-label-color-primary` resolves to #112337, so on this dark site
 * every field label rendered as dark-on-dark and was effectively invisible.
 * The fix is to restate those tokens rather than fight the cascade: overriding
 * the documented token API is the mechanism Gravity Forms provides, and it
 * reaches every field type at once, including the <legend> labels that complex
 * fields (name, email-with-confirm, address) emit instead of <label>.
 *
 * Specificity note: Gravity Forms declares its defaults on a single class
 * (`.gform-theme--framework`). Every override here is anchored on two or more
 * classes, so it wins on specificity alone and does not depend on stylesheet
 * order. That is why this file needs no `!important`.
 *
 * The site is dark-only, so there are deliberately no light-mode fallbacks.
 * The palette below is self-contained: forms keep their own tokens rather than
 * reading the Site Editor's, so a palette change there cannot silently drop a
 * label back to an unreadable color.
 */

/* ==========================================================================
   1. Palette
   Mirrors the dcd-property-manager dark tokens so forms read as part of the
   same system. Declared on :root so they are available to every form on the
   site regardless of which template renders it.
   ========================================================================== */

:root {
	--dcf-input-bg:      #1a2436;
	--dcf-input-bg-hover:#1e2a3f;
	--dcf-border:        #2e3d52;
	--dcf-border-hover:  #3d5070;
	--dcf-focus:         #7a9bc6;
	--dcf-focus-ring:    rgba(122, 155, 198, 0.22);
	--dcf-text:          #e8edf5;
	--dcf-label:         #e8edf5;
	--dcf-muted:         #8aa0c2;
	--dcf-danger:        #e5674f;
	--dcf-danger-bg:     rgba(229, 103, 79, 0.08);
	--dcf-btn-bg:        #d7dce3;
	--dcf-btn-bg-hover:  #ffffff;
	--dcf-btn-text:      #0f1722;
	--dcf-radius:        8px;
	--dcf-field-gap:     22px;
}

/* ==========================================================================
   2. Gravity Forms token overrides (2.10 Orbital / framework)
   This block alone fixes the invisible labels and the light-theme controls.
   ========================================================================== */

.gform_wrapper.gform-theme,
.gform_wrapper.gform-theme--framework,
.gform_wrapper.gform-theme--api {
	/* Labels: the actual bug. Primary and secondary both defaulted to #112337. */
	--gf-ctrl-label-color-primary:    var(--dcf-label);
	--gf-ctrl-label-color-secondary:  var(--dcf-label);
	--gf-ctrl-label-color-tertiary:   var(--dcf-muted);
	--gf-ctrl-label-color-quaternary: var(--dcf-muted);
	--gf-ctrl-label-color-req:        var(--dcf-muted);

	/* Controls */
	--gf-ctrl-color:              var(--dcf-text);
	--gf-ctrl-bg-color:           var(--dcf-input-bg);
	--gf-ctrl-bg-color-hover:     var(--dcf-input-bg-hover);
	--gf-ctrl-bg-color-focus:     var(--dcf-input-bg);
	--gf-ctrl-bg-color-error:     var(--dcf-input-bg);
	--gf-ctrl-bg-color-disabled:  #141c29;
	--gf-ctrl-border-color:          var(--dcf-border);
	--gf-ctrl-border-color-hover:    var(--dcf-border-hover);
	--gf-ctrl-border-color-focus:    var(--dcf-focus);
	--gf-ctrl-border-color-error:    var(--dcf-danger);
	--gf-ctrl-border-color-disabled: var(--dcf-border);
	--gf-ctrl-radius:             var(--dcf-radius);
	--gf-ctrl-accent-color:       var(--dcf-focus);
	--gf-ctrl-desc-color:         var(--dcf-muted);

	/* Buttons.
	   Size and padding go through the token API rather than a `padding`
	   declaration: Gravity Forms sets those on a four-class selector that
	   outranks anything reasonable we could write, and the tokens are the
	   supported way in. 46px clears the 44px minimum touch target. */
	--gf-ctrl-btn-bg-color-primary:        var(--dcf-btn-bg);
	--gf-ctrl-btn-bg-color-hover-primary:  var(--dcf-btn-bg-hover);
	--gf-ctrl-btn-bg-color-focus-primary:  var(--dcf-btn-bg-hover);
	--gf-ctrl-btn-color-primary:           var(--dcf-btn-text);
	--gf-ctrl-btn-border-color-primary:    transparent;
	--gf-ctrl-btn-radius:                  var(--dcf-radius);
	--gf-ctrl-btn-size:                    46px;
	--gf-ctrl-btn-size-md:                 46px;
	--gf-ctrl-btn-padding-x:               28px;
	--gf-ctrl-btn-padding-x-md:            28px;
	--gf-ctrl-btn-font-size:               15px;
	--gf-ctrl-btn-font-size-md:            15px;
	--gf-ctrl-btn-font-weight:             600;

	/* Status */
	--gf-color-danger: var(--dcf-danger);
}

/* ==========================================================================
   3. Field labels and helper text
   ========================================================================== */

/* Matches <label> and the <legend> that complex fields emit. */
.gform_wrapper.gform-theme .gform-field-label,
.gform_wrapper.gform-theme .gfield_label,
.gform_wrapper.gravity-theme .gfield_label {
	color: var(--dcf-label);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.01em;
	margin-bottom: 7px;
}

/* Sub-labels ("First", "Last", "Email Address") stay quiet and secondary. */
.gform_wrapper.gform-theme .gform-field-label--type-sub,
.gform_wrapper.gravity-theme .ginput_complex label {
	color: var(--dcf-muted);
	font-size: 0.8125rem;
	font-weight: 400;
	letter-spacing: 0.01em;
	margin-top: 6px;
}

.gform_wrapper.gform-theme .gfield_description,
.gform_wrapper.gravity-theme .gfield_description {
	color: var(--dcf-muted);
	font-size: 0.8125rem;
	line-height: 1.5;
}

/* "(Required)" is guidance, not an alarm. Red is reserved for real errors. */
.gform_wrapper.gform-theme .gfield_required,
.gform_wrapper.gform-theme .gfield_required_text,
.gform_wrapper.gravity-theme .gfield_required_text {
	color: var(--dcf-muted);
	font-size: 0.8125rem;
	font-weight: 400;
}

/* ==========================================================================
   4. Controls
   ========================================================================== */

.gform_wrapper.gform-theme input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
.gform_wrapper.gform-theme select,
.gform_wrapper.gform-theme textarea,
.gform_wrapper.gravity-theme input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
.gform_wrapper.gravity-theme select,
.gform_wrapper.gravity-theme textarea {
	background-color: var(--dcf-input-bg);
	border: 1px solid var(--dcf-border);
	border-radius: var(--dcf-radius);
	color: var(--dcf-text);
	/* 16px keeps iOS Safari from zooming the viewport on focus. */
	font-size: 1rem;
	line-height: 1.5;
	padding: 11px 14px;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	box-shadow: none;
}

.gform_wrapper.gform-theme input:not([type="submit"]):not([type="button"]):hover,
.gform_wrapper.gform-theme select:hover,
.gform_wrapper.gform-theme textarea:hover {
	border-color: var(--dcf-border-hover);
	background-color: var(--dcf-input-bg-hover);
}

.gform_wrapper.gform-theme input:not([type="submit"]):not([type="button"]):focus,
.gform_wrapper.gform-theme select:focus,
.gform_wrapper.gform-theme textarea:focus,
.gform_wrapper.gravity-theme input:not([type="submit"]):not([type="button"]):focus,
.gform_wrapper.gravity-theme select:focus,
.gform_wrapper.gravity-theme textarea:focus {
	border-color: var(--dcf-focus);
	box-shadow: 0 0 0 3px var(--dcf-focus-ring);
	outline: none;
}

.gform_wrapper.gform-theme ::placeholder,
.gform_wrapper.gravity-theme ::placeholder {
	color: var(--dcf-muted);
	opacity: 0.65;
}

.gform_wrapper.gform-theme textarea,
.gform_wrapper.gravity-theme textarea {
	min-height: 140px;
	resize: vertical;
}

/* Checkboxes and radios pick up the accent rather than the UA default. */
.gform_wrapper.gform-theme input[type="checkbox"],
.gform_wrapper.gform-theme input[type="radio"] {
	accent-color: var(--dcf-focus);
}

/* ==========================================================================
   5. Rhythm and section headers
   ========================================================================== */

.gform_wrapper.gform-theme .gform_fields {
	row-gap: var(--dcf-field-gap);
}

.gform_wrapper.gform-theme .gsection,
.gform_wrapper.gravity-theme .gsection {
	border-bottom: 1px solid var(--dcf-border);
	margin-bottom: 6px;
	padding-bottom: 10px;
}

.gform_wrapper.gform-theme .gsection_title,
.gform_wrapper.gravity-theme .gsection_title {
	color: var(--dcf-text);
	margin: 0 0 4px;
}

.gform_wrapper.gform-theme .gsection_description,
.gform_wrapper.gravity-theme .gsection_description {
	color: var(--dcf-muted);
	font-size: 0.9375rem;
	line-height: 1.5;
}

/* ==========================================================================
   6. Submit button
   Kept on the site's established light-on-dark button treatment so forms
   match the buttons already used on profile and property templates.
   ========================================================================== */

.gform_wrapper .gform_footer input[type="submit"],
.gform_wrapper .gform-footer input[type="submit"],
.gform_wrapper .gform_footer button[type="submit"],
.gform_wrapper .gform-footer button[type="submit"],
.gform_wrapper .gform_button {
	background-color: var(--dcf-btn-bg);
	border: 1px solid var(--dcf-btn-bg);
	border-radius: var(--dcf-radius);
	color: var(--dcf-btn-text);
	cursor: pointer;
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	padding: 12px 30px;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.gform_wrapper .gform_footer input[type="submit"]:hover,
.gform_wrapper .gform-footer input[type="submit"]:hover,
.gform_wrapper .gform_footer button[type="submit"]:hover,
.gform_wrapper .gform-footer button[type="submit"]:hover,
.gform_wrapper .gform_button:hover {
	background-color: var(--dcf-btn-bg-hover);
	border-color: var(--dcf-btn-bg-hover);
}

.gform_wrapper .gform_button:focus-visible {
	outline: 2px solid var(--dcf-focus);
	outline-offset: 2px;
}

.gform_wrapper .gform_button:active {
	transform: translateY(1px);
}

/* ==========================================================================
   7. Validation and confirmation
   ========================================================================== */

.gform_wrapper .gfield_error .gform-field-label,
.gform_wrapper .gfield_error .gfield_label {
	color: var(--dcf-label);
}

.gform_wrapper .validation_message,
.gform_wrapper .gfield_validation_message {
	background-color: var(--dcf-danger-bg);
	border: 1px solid var(--dcf-danger);
	border-radius: 6px;
	color: var(--dcf-danger);
	font-size: 0.8125rem;
	margin-top: 8px;
	padding: 8px 12px;
}

.gform_wrapper .gform_validation_errors {
	background-color: var(--dcf-danger-bg);
	border: 1px solid var(--dcf-danger);
	border-radius: var(--dcf-radius);
	box-shadow: none;
}

.gform_wrapper .gform_validation_errors > h2,
.gform_wrapper .gform_validation_errors .gform_submission_error {
	color: var(--dcf-danger);
	font-size: 1rem;
}

.gform_confirmation_message {
	background-color: var(--dcf-input-bg);
	border: 1px solid var(--dcf-border);
	border-left: 3px solid var(--dcf-focus);
	border-radius: var(--dcf-radius);
	color: var(--dcf-text);
	padding: 18px 20px;
}

/* Anti-spam honeypot must never be visible or focusable. */
.gform_wrapper .gform_validation_container,
.gform_wrapper .gfield--type-honeypot {
	display: none !important;
}

/* ==========================================================================
   8. Native (non-Gravity Forms) controls
   Replaces the dark-mode-only input rule that used to live in style.css, so
   search fields, comment forms and block-editor form blocks match. Unscoped
   because the site renders dark on every view.
   ========================================================================== */

input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
textarea,
select {
	background-color: var(--dcf-input-bg);
	border: 1px solid var(--dcf-border);
	border-radius: var(--dcf-radius);
	color: var(--dcf-text);
	/* Matches the Gravity Forms controls above so a native field and a form
	   field sitting on the same page are the same size. */
	padding: 11px 14px;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover {
	border-color: var(--dcf-border-hover);
}

input:not([type="submit"]):not([type="button"]):focus-visible,
textarea:focus-visible,
select:focus-visible {
	border-color: var(--dcf-focus);
	box-shadow: 0 0 0 3px var(--dcf-focus-ring);
	outline: none;
}

/* ==========================================================================
   9. Narrow screens
   ========================================================================== */

@media (max-width: 640px) {
	.gform_wrapper.gform-theme .gform_fields {
		row-gap: 18px;
	}

	.gform_wrapper .gform_footer input[type="submit"],
	.gform_wrapper .gform_button {
		width: 100%;
	}
}
