/**
 * cg/contact-form — frontend styles.
 *
 * Themed wrapper around a Gravity Forms embed. Three background modes:
 *   - solid: uses has-{slug}-background-color (no extra layout)
 *   - image: absolutely-positioned <img> + optional overlay <span>
 *   - none:  no background, transparent
 *
 * The inner container is centered with a configurable max-width.
 */

.cg-contact-form {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding-left: var(--wp--preset--spacing--6, 1.5rem);
    padding-right: var(--wp--preset--spacing--6, 1.5rem);
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
}

.cg-contact-form--py-small  { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.cg-contact-form--py-medium { padding-top: 4rem;   padding-bottom: 4rem; }
.cg-contact-form--py-large  { padding-top: 6rem;   padding-bottom: 6rem; }
.cg-contact-form--py-xlarge { padding-top: 8rem;   padding-bottom: 8rem; }

/* Image-mode layers. */
.cg-contact-form__image-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.cg-contact-form__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* Inner container — sits above background layers. */
.cg-contact-form__inner {
    position: relative;
    z-index: 2;
    width: 100%;
    margin: 0 auto;
}

.cg-contact-form__inner--w-narrow { max-width: 640px; }
.cg-contact-form__inner--w-medium { max-width: 768px; }
.cg-contact-form__inner--w-wide   { max-width: 1024px; }
.cg-contact-form__inner--w-full   { max-width: none; }

/* Alignment — applies to inline text + form children. */
.cg-contact-form--align-left   .cg-contact-form__inner { text-align: left; }
.cg-contact-form--align-center .cg-contact-form__inner { text-align: center; }
.cg-contact-form--align-left   .cg-contact-form__form  { text-align: left; }

/* Text elements. */
.cg-contact-form__headline { margin: 0; }
.cg-contact-form__body     { margin: 1rem 0 0; }

/* Form spacing. */
.cg-contact-form__form {
    margin-top: 2.5rem;
}
.cg-contact-form__form .gform_wrapper {
    margin: 0;
}

/* Editor/error placeholders. */
.cg-contact-form__missing,
.cg-contact-form__preview-note {
    padding: 1.5rem;
    border: 1px dashed currentColor;
    opacity: 0.7;
    font-style: italic;
}

/* ──────────────────────────────────────────────────────────────────────────
 * Gravity Forms field styling — Figma contact form (homepage node 2359:7461).
 *
 * Bordered, rounded inputs (border-2 theme-400, rounded-sm), a solid theme-900
 * submit button, and clean labels. Everything uses var(--color-theme-*) so the
 * form re-themes with the page palette (the Figma mock's pinkish borders are
 * just the cranberry fallback — the design token is theme-400). Scoped to
 * .cg-contact-form so it only touches forms rendered inside our wrapper.
 * ────────────────────────────────────────────────────────────────────────── */

/* Spacing between fields. */
.cg-contact-form .gform_wrapper .gform_fields {
    row-gap: 1.25rem;
    column-gap: 1rem;
}

/* Labels — small, clean, themed; sit above each field. */
.cg-contact-form .gform_wrapper .gfield_label {
    display: block;
    margin: 0 0 0.5rem;
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--color-theme-900);
}

/* Required asterisk. */
.cg-contact-form .gform_wrapper .gfield_required {
    color: var(--color-theme-700);
}

/* GF chrome the design never shows (carried over from the legacy theme):
   the form title, the "* indicates required fields" legend, and the
   "0 of 255 max characters" counter under capped text fields. */
.cg-contact-form .gform_heading .gform_title,
.cg-contact-form p.gform_required_legend,
.cg-contact-form .ginput_counter {
    display: none;
}

/* Sub-labels (e.g. First / Last under a Name field). */
.cg-contact-form .gform_wrapper .gform-field-label--type-sub,
.cg-contact-form .gform_wrapper .ginput_complex label {
    font-size: 0.8125rem;
    font-weight: 400;
    opacity: 0.7;
    color: var(--color-theme-900);
}

/* Text-style inputs, textarea and selects. */
.cg-contact-form .gform_wrapper .gfield input[type="text"],
.cg-contact-form .gform_wrapper .gfield input[type="email"],
.cg-contact-form .gform_wrapper .gfield input[type="tel"],
.cg-contact-form .gform_wrapper .gfield input[type="number"],
.cg-contact-form .gform_wrapper .gfield input[type="url"],
.cg-contact-form .gform_wrapper .gfield input[type="password"],
.cg-contact-form .gform_wrapper .gfield textarea,
.cg-contact-form .gform_wrapper .gfield select {
    box-sizing: border-box;
    width: 100%;
    padding: 1rem 1.5rem;
    background-color: transparent;
    border: 2px solid var(--color-theme-400);
    border-radius: 0.25rem;
    color: var(--color-theme-900);
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 1.125rem;
    line-height: 1.35;
}

.cg-contact-form .gform_wrapper .gfield textarea {
    min-height: 8rem;
    resize: vertical;
}

/* Placeholders carry the field hint (matches the Figma in-field text). */
.cg-contact-form .gform_wrapper .gfield input::placeholder,
.cg-contact-form .gform_wrapper .gfield textarea::placeholder {
    color: var(--color-theme-900);
    opacity: 0.6;
}

/* Focus ring. */
.cg-contact-form .gform_wrapper .gfield input:focus,
.cg-contact-form .gform_wrapper .gfield input:focus-visible,
.cg-contact-form .gform_wrapper .gfield textarea:focus,
.cg-contact-form .gform_wrapper .gfield textarea:focus-visible,
.cg-contact-form .gform_wrapper .gfield select:focus,
.cg-contact-form .gform_wrapper .gfield select:focus-visible {
    outline: 2px solid var(--color-theme-accent);
    outline-offset: 2px;
    border-color: var(--color-theme-700);
}

/* Submit button — solid theme-900, uppercase (matches valuation-cta button). */
.cg-contact-form .gform_wrapper .gform_footer {
    margin-top: 1.75rem;
}
.cg-contact-form .gform_wrapper .gform_footer input[type="submit"],
.cg-contact-form .gform_wrapper .gform_footer .gform_button {
    display: inline-block;
    width: auto;
    padding: 1rem 2rem;
    background-color: var(--color-theme-900);
    border: 2px solid var(--color-theme-900);
    border-radius: 0.25rem;
    color: var(--color-theme-100);
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.cg-contact-form .gform_wrapper .gform_footer input[type="submit"]:hover,
.cg-contact-form .gform_wrapper .gform_footer .gform_button:hover {
    background-color: var(--color-theme-accent);
    border-color: var(--color-theme-accent);
    color: var(--color-theme-900);
}

/* ──────────────────────────────────────────────────────────────────────────
 * Extended field types — selects, choices, time, HTML sections.
 * Added for the Carson Event Request Form (GF 157), which exercises field
 * types the original contact-form skin didn't cover; scoped like everything
 * else so all .cg-contact-form embeds pick them up.
 * ────────────────────────────────────────────────────────────────────────── */

/* Full-width controls — gravity-theme's per-field size classes (small/medium)
   otherwise shrink inputs/selects inside their grid cell (e.g.
   `.gform_wrapper.gravity-theme .gfield select.medium { width: calc(50% - 8px) }`,
   (0,4,1) and later in the cascade); the design sizes fields by column, not by
   control. The doubled .cg-contact-form class lifts these to (0,5,1) without
   !important. */
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container input[type="text"],
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container input[type="email"],
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container input[type="tel"],
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container input[type="number"],
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container input[type="url"],
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container select,
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .ginput_container textarea {
    width: 100%;
}

/* Selects — replace the native arrow with a themed chevron. The chevron is a
   border-drawn ::after on the container (no data URI, recolours with the
   theme). GF puts .ginput_container_select on every select's wrapper,
   including the time field's AM/PM column. */
.cg-contact-form .gform_wrapper .ginput_container_select {
    position: relative;
}
.cg-contact-form .gform_wrapper .ginput_container_select select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 3rem;
    cursor: pointer;
}
.cg-contact-form .gform_wrapper .ginput_container_select::after {
    content: "";
    position: absolute;
    right: 1.5rem;
    top: 50%;
    width: 0.625rem;
    height: 0.625rem;
    border-right: 2px solid var(--color-theme-900);
    border-bottom: 2px solid var(--color-theme-900);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

/* Radio / checkbox choices — themed controls at a legible size, label beside
   the control, breathing room between choices. */
.cg-contact-form .gform_wrapper .gfield_checkbox .gchoice,
.cg-contact-form .gform_wrapper .gfield_radio .gchoice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.cg-contact-form .gform_wrapper .gfield_checkbox .gchoice + .gchoice,
.cg-contact-form .gform_wrapper .gfield_radio .gchoice + .gchoice {
    margin-top: 0.75rem;
}
.cg-contact-form .gform_wrapper .gfield input[type="checkbox"],
.cg-contact-form .gform_wrapper .gfield input[type="radio"] {
    flex: none;
    box-sizing: border-box;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.125rem 0 0;
    accent-color: var(--color-theme-900);
    cursor: pointer;
}
.cg-contact-form .gform_wrapper .gfield_checkbox .gchoice label,
.cg-contact-form .gform_wrapper .gfield_radio .gchoice label {
    margin: 0;
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.35;
    color: var(--color-theme-900);
    cursor: pointer;
}

/* Time fields — HH : MM + AM/PM on one aligned row. GF marks the hour/minute
   columns with gfield_time_hour/_minute and the meridiem with gfield_time_ampm. */
.cg-contact-form .gform_wrapper .gfield--type-time .ginput_complex {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.cg-contact-form .gform_wrapper .gfield_time_hour,
.cg-contact-form .gform_wrapper .gfield_time_minute {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: auto;
}
/* Doubled class: ties with the full-width normalizer above and wins on source
   order, keeping the clock inputs compact. */
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .gfield_time_hour input,
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .gfield_time_minute input {
    width: 4.5rem;
    padding: 1rem 0.5rem;
    text-align: center;
}
.cg-contact-form .gform_wrapper .gfield_time_hour i {
    font-style: normal;
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 1.125rem;
}
.cg-contact-form.cg-contact-form .gform_wrapper .gfield .gfield_time_ampm select {
    width: auto;
    min-width: 6rem;
}

/* HTML content fields (section intros like "Requester Information") — match
   the label voice instead of inheriting the page's serif body type. Headings
   authored inside them (e.g. an <h4> used as a question label) would otherwise
   pick up the theme's big serif heading styles. */
.cg-contact-form .gform_wrapper .gfield--type-html {
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 1.125rem;
    line-height: 1.5;
    color: var(--color-theme-900);
}
.cg-contact-form .gform_wrapper .gfield--type-html :is(h1, h2, h3, h4, h5, h6) {
    margin: 0;
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.35;
    color: inherit;
}

/* Field descriptions (helper text under a label) — small sans, quiet. */
.cg-contact-form .gform_wrapper .gfield_description:not(.validation_message) {
    font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--color-theme-700);
}

/* Validation: keep error borders legible against the themed border. */
.cg-contact-form .gform_wrapper .gfield_error input,
.cg-contact-form .gform_wrapper .gfield_error textarea,
.cg-contact-form .gform_wrapper .gfield_error select {
    border-color: var(--color-theme-accent);
}

/* Confirmation message — rendered in place of the form after a successful
   submit. The form always sits on a light (theme-100) ground, but in chrome
   contexts the page's body text colour is theme-100, so the message would
   otherwise render light-on-light and look blank. Force a readable theme-900
   colour and match the card's serif voice. */
.cg-contact-form .gform_confirmation_wrapper,
.cg-contact-form .gform_confirmation_message {
    color: var(--color-theme-900);
}
.cg-contact-form .gform_confirmation_message {
    margin: 0;
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-size: clamp(1.25rem, 2.2vw, 1.5rem);
    line-height: 1.4;
}

/* ──────────────────────────────────────────────────────────────────────────
 * Chrome footer contact form — Figma 4307:12846.
 * Full-bleed background image with a centred light (theme-100) card; inside the
 * card the headline + body sit LEFT and the Gravity Form sits RIGHT. All colours
 * use var(--color-theme-*) so the card re-themes per page.
 * ────────────────────────────────────────────────────────────────────────── */

.cg-contact-form--chrome {
    padding-inline: clamp(1rem, 4vw, 5rem);
}

.cg-contact-form--chrome .cg-contact-form__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.cg-contact-form--chrome .cg-contact-form__bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cg-contact-form--chrome .cg-contact-form__card {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    max-width: 1124px;
    background: var(--color-theme-100);
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.cg-contact-form--chrome .cg-contact-form__cols {
    display: flex;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: flex-start;
}

.cg-contact-form--chrome .cg-contact-form__intro {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 4vw, 3rem);
    text-align: left;
}

.cg-contact-form--chrome .cg-contact-form__form {
    flex: 1 1 0;
    min-width: 0;
    margin-top: 0;
}

/* Headline (theme-700) + body (theme-900), serif, per Figma. */
.cg-contact-form--chrome .cg-contact-form__headline {
    margin: 0;
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-weight: 400;
    font-size: clamp(2.25rem, 4.5vw, 3.5rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--color-theme-700);
}

.cg-contact-form--chrome .cg-contact-form__body {
    margin: 0;
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-size: clamp(1.25rem, 2.2vw, 1.5rem);
    line-height: 1.25;
    color: var(--color-theme-900);
}

/* Stack the columns on narrow viewports (headline/body above the form). */
@media (max-width: 880px) {
    .cg-contact-form--chrome .cg-contact-form__cols {
        flex-direction: column;
    }
}

/* ──────────────────────────────────────────────────────────────────────────
 * Card layout — a contained, single-column version of the chrome card, for use
 * as page content (e.g. inside a media-text column beside an image). Light
 * card background (from the background_color utility class on __card), serif
 * theme-700 headline + theme-900 body, themed form. Sizes are tuned for a
 * narrower (column) context rather than the full-width chrome card.
 * ────────────────────────────────────────────────────────────────────────── */

.cg-contact-form--card {
    padding: 0;
    overflow: visible;
}

.cg-contact-form--card .cg-contact-form__card {
    box-sizing: border-box;
    width: 100%;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.cg-contact-form--card .cg-contact-form__intro {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 1.5rem);
    text-align: left;
}

.cg-contact-form--card .cg-contact-form__headline {
    margin: 0;
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-weight: 400;
    font-size: clamp(1.75rem, 3vw, 2.75rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--color-theme-700);
}

.cg-contact-form--card .cg-contact-form__body {
    margin: 0;
    font-family: var(--wp--preset--font-family--serif, Georgia, serif);
    font-size: clamp(1.125rem, 1.6vw, 1.375rem);
    line-height: 1.35;
    color: var(--color-theme-900);
}

.cg-contact-form--card .cg-contact-form__form {
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
}
