/*
 * Form card (inc/form-card.php): the one form component, styled like the service
 * pages' hero form (.tr-hero__form in content-page.css): a cream card on a dark
 * ground, an 18px Syne heading, compact fields and a full-width hire-orange button.
 * Self-contained: it carries its own token fallbacks and overrides the template
 * form styles (content, location, industry, blog) inside the card. Loaded on every
 * page, after the template stylesheets.
 */

.tr-form-card {
    --tr-fc-radius-card: var(--tr-radius-card, 12px);
    --tr-fc-radius-field: var(--tr-radius-field, 8px);
    padding: clamp(20px, 3vw, 32px);
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-cream, #FFFDF7);
    border-radius: var(--tr-fc-radius-card);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    text-align: left;
}

.tr-form-card :focus-visible {
    outline: 3px solid var(--tr-black, #1C1C1C);
    outline-offset: 3px;
}

/* Heading: like .tr-hero__form-title */
.tr-form-card .tr-form-card__title {
    margin: 0 0 12px;
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--tr-black, #1C1C1C);
    text-wrap: balance;
}

.tr-form-card .tr-form-card__intro {
    margin: 0 0 16px;
    font-size: 0.9375rem;
    max-width: none;
}

/* "What happens next": short, quiet, with small terracotta markers */
.tr-form-card .tr-form-card__next {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    font-size: 0.9375rem;
    line-height: 1.45;
}

.tr-form-card .tr-form-card__next li {
    position: relative;
    margin: 0 0 6px;
    padding-left: 18px;
}

.tr-form-card .tr-form-card__next li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.55em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--tr-terracotta, #D68A5C);
}

/* Template rules that would leak in: the closing band's tan <strong> and large <p>,
   cream links on dark grounds */
.tr-form-card strong,
.tr-cta .tr-form-card strong {
    color: var(--tr-black, #1C1C1C);
    font-weight: 500;
}

.tr-form-card p,
.tr-cta .tr-form-card p {
    max-width: none;
    font-size: inherit;
}

.tr-form-card a,
.tr-cta .tr-form-card a:not(.wp-block-button__link),
.tr-loc .tr-loc__hero .tr-form-card a,
.tr-ind .tr-ind__hero .tr-form-card a {
    color: var(--tr-black, #1C1C1C);
    text-decoration-line: underline;
    text-decoration-color: var(--tr-terracotta, #D68A5C);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.22em;
}

/* --- The form --- */

.tr-form-card .wpcf7 {
    max-width: none;
}

.tr-form-card .wpcf7 form {
    margin: 0;
}

/* Discovery form: CF7's auto-paragraphs, a label wrapping each field */
.tr-form-card .wpcf7 form > p {
    margin: 0 0 12px;
}

.tr-form-card .wpcf7 label {
    display: grid;
    gap: 4px;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tr-black, #1C1C1C);
}

.tr-form-card .wpcf7 label br {
    display: none;
}

/* Visibility form: hand-built grid (.tr-form), stacked in the card like the hero form */
.tr-form-card .tr-form,
.tr-form-card .tr-form--check {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    max-width: none;
}

.tr-form-card .tr-form__field {
    display: grid;
    gap: 4px;
    margin: 0;
}

.tr-form-card .tr-form__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tr-black, #1C1C1C);
}

.tr-form-card .tr-form__actions {
    display: grid;
    gap: 10px;
    grid-column: 1 / -1;
}

.tr-form-card .tr-form__note {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--tr-driftwood, #6B5D4A);
}

.tr-form-card .wpcf7-form-control-wrap {
    display: block;
}

/* Compact fields, as on the hero form: two-thirds of the usual 52px */
.tr-form-card .wpcf7 input[type="text"],
.tr-form-card .wpcf7 input[type="email"],
.tr-form-card .wpcf7 input[type="tel"],
.tr-form-card .wpcf7 input[type="url"],
.tr-form-card .wpcf7 textarea {
    width: 100%;
    height: 35px;
    min-height: 35px;
    margin: 0;
    padding: 4px 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-warm-white, #F9F6F0);
    border: 1px solid var(--tr-driftwood, #6B5D4A);
    border-radius: var(--tr-fc-radius-field);
    box-shadow: none;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.tr-form-card .wpcf7 textarea {
    height: auto;
    min-height: 96px;
    padding-block: 8px;
    resize: vertical;
}

.tr-form-card .wpcf7 input::placeholder {
    color: var(--tr-driftwood, #6B5D4A);
    opacity: 1;
}

.tr-form-card .wpcf7 input:not([type="submit"]):hover,
.tr-form-card .wpcf7 textarea:hover {
    border-color: var(--tr-black, #1C1C1C);
}

.tr-form-card .wpcf7 input:not([type="submit"]):focus,
.tr-form-card .wpcf7 textarea:focus {
    background-color: var(--tr-cream, #FFFDF7);
    border-color: var(--tr-black, #1C1C1C);
}

.tr-form-card .wpcf7 [aria-invalid="true"],
.tr-form-card .wpcf7 [aria-invalid="true"]:hover,
.tr-form-card .wpcf7 [aria-invalid="true"]:focus {
    border-color: var(--tr-error, #A3341B);
    border-width: 2px;
}

.tr-form-card .wpcf7-not-valid-tip {
    margin-top: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tr-error, #A3341B);
}

/* Full-width hire-orange button with an Ink Black label (5.1:1).
   :focus is listed so GeneratePress's grey/white button:focus rule never wins. */
.tr-form-card .wpcf7-submit,
.tr-form-card .wpcf7-submit:focus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    margin: 4px 0 0;
    padding: 12px 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    text-wrap: balance;
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-hire-orange, #E8632A);
    border: 0;
    border-radius: var(--tr-fc-radius-field);
    cursor: pointer;
    transition: background-color 180ms ease, transform 180ms var(--tr-ease-out, ease-out);
}

.tr-form-card .wpcf7-submit:hover {
    color: var(--tr-black, #1C1C1C);
    background-color: var(--tr-hire-hover, #F07A45);
}

.tr-form-card .wpcf7-submit:active {
    transform: translateY(1px);
}

.tr-form-card .wpcf7-submit:disabled {
    cursor: progress;
    opacity: 0.7;
}

/* The spinner sits inside the full-width button's row instead of wrapping below it */
.tr-form-card .wpcf7 form > p:has(.wpcf7-submit),
.tr-form-card .tr-form__actions {
    position: relative;
}

.tr-form-card .wpcf7-spinner {
    position: absolute;
    top: 16px;
    right: 14px;
    margin: 0;
    background-color: var(--tr-black, #1C1C1C);
}

.tr-form-card .wpcf7 form:not(.submitting) .wpcf7-spinner {
    display: none;
}

.tr-form-card .tr-recaptcha-note,
.tr-form-card .wpcf7 form > p.tr-recaptcha-note {
    margin: 14px 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--tr-driftwood, #6B5D4A);
}

.tr-form-card .wpcf7 form .wpcf7-response-output {
    margin: 12px 0 0;
    padding: 12px 14px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--tr-black, #1C1C1C);
    border: 1px solid var(--tr-driftwood, #6B5D4A);
    border-radius: var(--tr-fc-radius-field);
    background-color: var(--tr-warm-white, #F9F6F0);
}

.tr-form-card .wpcf7 form.sent .wpcf7-response-output {
    border-color: var(--tr-green-text, #1A5C3A);
    background-color: var(--tr-green-tint, #D4EDDF);
    color: var(--tr-green-text, #1A5C3A);
}

.tr-form-card .wpcf7 form.invalid .wpcf7-response-output,
.tr-form-card .wpcf7 form.unaccepted .wpcf7-response-output,
.tr-form-card .wpcf7 form.failed .wpcf7-response-output,
.tr-form-card .wpcf7 form.aborted .wpcf7-response-output,
.tr-form-card .wpcf7 form.spam .wpcf7-response-output {
    border-color: var(--tr-error, #A3341B);
    background-color: var(--tr-error-tint, #FBEAE4);
    color: var(--tr-error-text, #7A2614);
}

/* --- Placements --- */

/* Location and industry hero: under the intro, as wide as the intro text */
.tr-form-card--hero {
    max-width: 560px;
    margin-top: 8px;
}

/* Closing band (R15): the band's text on the left, the card on the right */
.tr-cta__inner--form > .wp-block-group__inner-container,
.tr-cta__inner--form:not(:has(> .wp-block-group__inner-container)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
    gap: clamp(24px, 4vw, 56px);
    align-items: center;
}

.tr-cta__text > :last-child {
    margin-bottom: 0;
}

@media (max-width: 899px) {
    .tr-cta__inner--form > .wp-block-group__inner-container,
    .tr-cta__inner--form:not(:has(> .wp-block-group__inner-container)) {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tr-form-card .wpcf7-submit {
        transition-property: background-color;
    }

    .tr-form-card .wpcf7-submit:active {
        transform: none;
    }
}
