/**
 * Contact form -- [ato_contact_form]
 *
 * Loaded only on pages carrying the shortcode, via the `when` callback in
 * safaris.php::get_view_stylesheets(). Depends on ato-public.css, which already
 * supplies .ato-form-grid, .ato-form-group, .ato-message and .ato-button; this
 * sheet only adds what the contact view needs on top of those.
 *
 * All colours come from the existing --ato-* tokens. No framework.
 */

.ato-contact {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 0 40px;
}

.ato-contact__title {
    color: var(--ato-title-color, #0c332b);
    margin: 0 0 12px;
}

.ato-contact__intro {
    color: var(--ato-text-main, #5b615e);
    margin: 0 0 28px;
    font-size: 1.05rem;
    line-height: 1.65;
}

/* Result banner. .ato-message supplies the colour scheme. */
.ato-contact__notice {
    margin: 0 0 28px;
    line-height: 1.6;
    scroll-margin-top: 100px;
}

.ato-contact__notice:focus {
    outline: 2px solid var(--ato-primary, #12554b);
    outline-offset: 2px;
}

/* ── Spam trap ─────────────────────────────────────────────────────────────
   Hidden from sight and from assistive technology. Kept out of the layout
   without display:none, which some bots special-case. The input inside carries
   no `required` attribute: a required control in a hidden container makes the
   browser block submission with a validation bubble it cannot paint, which
   looks to the user like a dead button.
   ───────────────────────────────────────────────────────────────────────── */
.ato-contact__trap {
    position: absolute !important;
    left: -9999px !important;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ── Fields ───────────────────────────────────────────────────────────────── */

.ato-contact__grid {
    gap: 22px 26px;
    margin-bottom: 24px;
}

.ato-contact .ato-form-group label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.ato-contact__optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ato-text-muted, #7a817d);
    font-size: 13px;
}

.ato-contact .ato-form-group textarea {
    min-height: 190px;
    resize: vertical;
    line-height: 1.6;
}

/* Help text under a control. Associated with its field by aria-describedby,
   so it must stay visible and must not be read as a validation message --
   hence muted, not red. */
.ato-contact__hint {
    display: block;
    margin-top: 8px;
    color: var(--ato-text-muted, #7a817d);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ── Enquiry-type select ───────────────────────────────────────────────────
   The base sheet already gives select the field border, padding and radius.
   What it lacks is a control affordance: with the native arrow suppressed by
   `appearance: none`, the box reads as a text input. The arrow is an inline
   data: URI so the sheet stays one file with no extra request, and the right
   padding is widened to match so a long option label cannot run under it.

   The selector is deliberately `.ato-contact .ato-form-group select.<class>`
   rather than the class alone. ato-public.css styles these controls as
   `.ato-form-group select`, which is (0,1,1); a single class is (0,1,0) and
   loses on specificity no matter which sheet is enqueued last -- the arrow
   and the padding silently do not apply. This matches how the textarea rule
   above is already scoped.

   `background-color` is deliberately NOT set here: the base sheet's
   `background` shorthand supplies it, and claiming it at this specificity
   would beat the error-state tint below.
   ───────────────────────────────────────────────────────────────────────── */
.ato-contact .ato-form-group select.ato-contact__select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 100%;
    padding-right: 48px;
    cursor: pointer;
    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 1.5 6 6.5l5-5' fill='none' stroke='%237a817d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    text-overflow: ellipsis;
}

.ato-contact .ato-form-group select.ato-contact__select:focus {
    outline: none;
    border-color: var(--ato-primary, #12554b);
}

/* The type field spans the grid: its option labels are phrases, and a phrase
   in a half-width control truncates on every screen narrower than a laptop. */
.ato-contact__group--type {
    margin-bottom: 0;
}

/* Field-level validation message returned by the server. */
.ato-contact__error {
    display: block;
    margin-top: 8px;
    color: var(--ato-danger, #a8433a);
    font-size: 0.875rem;
    line-height: 1.5;
}

.ato-contact__group--error input,
.ato-contact__group--error select,
.ato-contact__group--error textarea {
    border-color: var(--ato-danger, #a8433a) !important;
    background-color: rgba(168, 67, 58, 0.04);
}

.ato-contact__group--error input:focus,
.ato-contact__group--error select:focus,
.ato-contact__group--error textarea:focus {
    border-color: var(--ato-danger, #a8433a) !important;
    box-shadow: 0 4px 12px rgba(168, 67, 58, 0.14);
}

/* ── Actions ──────────────────────────────────────────────────────────────── */

.ato-contact__actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
}

.ato-contact__actions .ato-button {
    min-width: 200px;
    justify-content: center;
}

.ato-contact__note {
    margin: 0;
    color: var(--ato-text-muted, #7a817d);
    font-size: 0.9rem;
    line-height: 1.6;
}

.ato-contact__note a {
    color: var(--ato-primary, #12554b);
    text-decoration: underline;
}

.ato-contact__note a:hover {
    color: var(--ato-primary-hover, #0c332b);
}

/* ── Narrow screens ───────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .ato-contact__grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    /* .full-width spans 2 columns in the base sheet; in one column that would
       overflow the grid. */
    .ato-contact .ato-form-group.full-width {
        grid-column: span 1;
    }

    .ato-contact__actions .ato-button {
        width: 100%;
    }
}
