/*
===========================================
CONTACT PAGE STYLES - Craft Master Growlers
===========================================
Styles the Contact Form 7 form on page 1629 (form id 1631).

That form supplies its own markup rather than CF7's default output --
see the form template in the CF7 admin, and craftmaster_cf7_autop()
in functions.php which turns wpautop off for it. The class names below
(cmg-form / cmg-row / cmg-field / cmg-actions / cmg-submit) come from
that template, so the two need to stay in sync.
*/

/* ==========================================
   PAGE INTRO
   ========================================== */

.cmg-contact-intro {
    max-width: 720px;
    margin: 0 auto 28px;
    text-align: center;
}

.cmg-contact-intro p {
    font-size: 17px;
    line-height: 1.6;
    color: #556053;
    margin: 0;
}

/* ==========================================
   FORM CARD
   ========================================== */

/* CF7's own wrapper -- the card lives here so the response output and
   the form share one border. */
.wpcf7[data-wpcf7-id="1631"] {
    max-width: 720px;
    margin: 0 auto 48px;
    padding: 36px 40px 40px;
    background: #fff;
    border: 1px solid #e4e4e4;
    border-top: 3px solid #f2b01e;
    border-radius: 10px;
    box-shadow: 0 2px 14px rgba(41, 50, 39, 0.07);
}

.cmg-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* The template uses <p> for each field so the markup stays valid whether
   or not autop is on; reset the theme's paragraph spacing. */
.cmg-form p {
    margin: 0;
    padding: 0;
}

/* Name + Email sit side by side on desktop, stack on mobile. */
.cmg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

/* Grid blowout guard: grid items default to min-width auto, so a wide
   input can force the column past the viewport. Same fix as product.css. */
.cmg-row > * {
    min-width: 0;
}

/* ==========================================
   FIELDS
   ========================================== */

.cmg-field {
    display: flex;
    flex-direction: column;
}

.cmg-field label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #293227;
}

.cmg-req {
    color: #c0392b;
    text-decoration: none;
    border: 0;
    cursor: help;
}

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

.cmg-form input[type="text"],
.cmg-form input[type="email"],
.cmg-form textarea {
    /* CF7 emits size/cols attributes that would otherwise set the width */
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-family: 'roboto-regular', sans-serif;
    font-size: 16px; /* 16px avoids iOS Safari zooming on focus */
    line-height: 1.45;
    color: #1a1a1a;
    background: #fafafa;
    border: 1px solid #d9dcd8;
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.cmg-form textarea {
    min-height: 170px;
    resize: vertical;
}

.cmg-form input::placeholder,
.cmg-form textarea::placeholder {
    color: #9aa197;
    opacity: 1; /* Firefox dims placeholders by default */
}

.cmg-form input[type="text"]:hover,
.cmg-form input[type="email"]:hover,
.cmg-form textarea:hover {
    border-color: #b9bfb5;
}

.cmg-form input[type="text"]:focus,
.cmg-form input[type="email"]:focus,
.cmg-form textarea:focus {
    outline: none;
    background: #fff;
    border-color: #f2b01e;
    box-shadow: 0 0 0 3px rgba(242, 176, 30, 0.25);
}

/* ==========================================
   SUBMIT
   ========================================== */

.cmg-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
}

.cmg-form .cmg-submit {
    padding: 14px 38px;
    font-family: 'roboto-regular', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #1a1a1a;
    background: #f2b01e;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.cmg-form .cmg-submit:hover {
    background: #f7bb35;
    box-shadow: 0 4px 8px rgba(242, 176, 30, 0.35);
}

.cmg-form .cmg-submit:focus-visible {
    outline: 3px solid #293227;
    outline-offset: 2px;
}

/* CF7 disables the button while the request is in flight */
.cmg-form .cmg-submit:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* CF7 injects the spinner next to the submit button and toggles
   .is-active during submission. */
.cmg-form .wpcf7-spinner {
    margin: 0;
}

/* ==========================================
   VALIDATION + RESPONSE MESSAGES
   ========================================== */

.cmg-form input.wpcf7-not-valid,
.cmg-form textarea.wpcf7-not-valid {
    border-color: #c0392b;
    background: #fdf6f5;
}

.cmg-form input.wpcf7-not-valid:focus,
.cmg-form textarea.wpcf7-not-valid:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2);
}

.cmg-form .wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #c0392b;
}

/* CF7 keeps the response output in the DOM at all times and flips
   aria-hidden, so hide it until it actually carries a message. */
.wpcf7[data-wpcf7-id="1631"] .wpcf7-response-output {
    margin: 26px 0 0;
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.5;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: 6px;
}

/* Hide it until there is something to say. Keyed off the form status class,
   the way CF7's own stylesheet does it -- do NOT key off aria-hidden: CF7
   writes the message with innerText and leaves aria-hidden="true" on the
   element permanently, so an [aria-hidden="true"] rule hides it forever. */
.wpcf7[data-wpcf7-id="1631"] form.init .wpcf7-response-output,
.wpcf7[data-wpcf7-id="1631"] form.resetting .wpcf7-response-output,
.wpcf7[data-wpcf7-id="1631"] form.submitting .wpcf7-response-output {
    display: none;
}

/* ==========================================
   SUCCESS STATE
   ==========================================
   CF7 adds .sent to the form once the mail is away. Hide the fields and
   let the response output stand alone as a thank-you panel -- an empty
   form sitting under a success message reads like it didn't submit.
   The form element itself stays in the DOM: CF7 still owns it, and its
   script re-enables the inputs behind the scenes after a send. */

.wpcf7[data-wpcf7-id="1631"] form.sent .cmg-form {
    display: none;
}

.wpcf7[data-wpcf7-id="1631"] form.sent .wpcf7-response-output {
    margin: 0;
    padding: 34px 28px;
    text-align: center;
    font-size: 17px;
    line-height: 1.55;
    color: #1e4620;
    background: #edf7ee;
    border: 1px solid #46b450;
    border-left-width: 1px;
    border-radius: 8px;
}

/* Checkmark above the message. Decorative, so it stays out of the
   accessibility tree -- CF7 already announces the text via the
   role="status" region in .screen-reader-response. */
.wpcf7[data-wpcf7-id="1631"] form.sent .wpcf7-response-output::before {
    content: "";
    display: block;
    width: 46px;
    height: 46px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #46b450 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}

.wpcf7[data-wpcf7-id="1631"] form.invalid .wpcf7-response-output,
.wpcf7[data-wpcf7-id="1631"] form.unaccepted .wpcf7-response-output,
.wpcf7[data-wpcf7-id="1631"] form.payment-required .wpcf7-response-output {
    color: #6b4c00;
    background: #fdf8e8;
    border-color: #e0a20f;
}

.wpcf7[data-wpcf7-id="1631"] form.failed .wpcf7-response-output,
.wpcf7[data-wpcf7-id="1631"] form.aborted .wpcf7-response-output,
.wpcf7[data-wpcf7-id="1631"] form.spam .wpcf7-response-output {
    color: #7a2119;
    background: #fdf6f5;
    border-color: #c0392b;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media screen and (max-width: 700px) {
    .wpcf7[data-wpcf7-id="1631"] {
        padding: 26px 20px 30px;
        border-radius: 8px;
    }

    .cmg-row {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .cmg-form .cmg-submit {
        width: 100%;
        padding: 15px 20px;
    }

    .cmg-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .cmg-contact-intro p {
        font-size: 16px;
    }
}

/* Respect users who have asked for less motion */
@media (prefers-reduced-motion: reduce) {
    .cmg-form input[type="text"],
    .cmg-form input[type="email"],
    .cmg-form textarea,
    .cmg-form .cmg-submit {
        transition: none;
    }
}
