/* =============================================
   contact.css - Contact Page Styles
   Used on: contact.html
   ============================================= */

/* Wider card for contact form to give the message field more room */
/* The page fills the window, so the footer sits at the bottom of tall
   screens too (the pattern success.css and the auth pages use) */
.contact-page {
    display: flex;
    flex-direction: column;
}

.contact-page > .auth-layout {
    flex: 1 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.contact-card {
    max-width: 560px;
}

.contact-card .auth-title {
    font-family: var(--font-display);
}

/* Support line (email, and phone/address once set) under the subtitle */
.contact-support-line {
    margin: 0 0 var(--spacing-lg) 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.contact-support-line a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    /* At least a 24px target (44px on phones, below) */
    display: inline-flex;
    align-items: center;
    min-height: 24px;
}

.contact-support-line a:hover,
.contact-support-line a:focus-visible {
    text-decoration: underline;
}

/* General question / Dealers tabs */
.contact-tabs {
    display: flex;
    gap: 4px;
    background: var(--panel-muted);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: var(--spacing-lg);
}

.contact-tab {
    flex: 1;
    min-height: 44px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-md) - 4px);
    color: var(--text-muted);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.contact-tab:hover {
    color: var(--text);
}

/* The accent bar marks the selected tab clearly (the lighter panel alone
   was only 1.1:1 against the tab strip) */
.contact-tab[aria-selected="true"] {
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-sm), inset 0 -2px 0 var(--accent);
}

.contact-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* .contact-tabs sets its own `display`, which would otherwise beat the
   browser's default `[hidden] { display: none }` rule at equal specificity
   and leave it visible after js/contact.js hides it on success. */
.contact-tabs[hidden] {
    display: none;
}

/* Inline, persistent alert for validation and server errors (replaces the
   old 5-second corner pop-up for this page, per the pre-launch audit). */
.form-alert {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #FCA5A5;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    font-size: 0.92rem;
    line-height: 1.5;
}

.form-alert:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Focus: a solid ring that appears at once, no glow (same as the fields
   in css/auth.css, which this page doesn't load) */
.contact-card .form-input:focus {
    border-color: var(--field-border);
    box-shadow: none;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Field-level invalid state (mirrors css/auth.css's .auth-page pattern,
   defined here too since that stylesheet is scoped to .auth-page). */
.contact-card .form-input.is-invalid,
.contact-card .form-input[aria-invalid="true"] {
    border-color: rgba(248, 113, 113, 0.92);
    background: rgba(127, 29, 29, 0.09);
}

.contact-card .form-input.is-invalid:focus,
.contact-card .form-input[aria-invalid="true"]:focus {
    border-color: #F87171;
    outline-color: #F87171;
}

.contact-card .field-error {
    margin: 6px 0 0;
    color: #FCA5A5;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
}

.contact-card .field-error[hidden] {
    display: none;
}

.contact-optional {
    color: var(--text-muted);
    font-weight: 400;
}

/* Side-by-side name and email (or name and dealership) row */
.contact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* Textarea styling to match .form-input */
.contact-textarea {
    min-height: 160px;
    resize: vertical;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Honeypot: a hidden field bots fill in but sighted, keyboard and screen
   reader users never encounter (off-screen, not in the tab order). */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Contrast fix for the audit's "Send Message" finding: white text on the
   accent orange (#FF6B3D) is ~2.8:1. The deeper --accent-strong (already
   used for white text in transactional emails, see
   server_methods/email/email.js) passes 4.5:1.
   One flat button: full width with its label centered, no shadow, no lift. */
.contact-submit {
    justify-content: center;
    background: var(--accent-strong);
    color: var(--text);
    border-radius: var(--radius-btn);
    box-shadow: none;
    transform: none;
    transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}

.contact-submit:hover,
.contact-submit:active {
    background: var(--accent-strong-hover);
    box-shadow: none;
    transform: none;
}

.contact-submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Persistent success confirmation. Replaces the tabs and forms entirely
   instead of a toast, so it survives a refresh-free visit and screen readers
   land on it (see js/contact.js showSuccess()). */
.contact-success {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-sm);
}

.contact-success h2 {
    color: var(--text);
    margin: 0 0 var(--spacing-sm);
    font-size: 1.3rem;
}

.contact-success p {
    color: var(--text-muted);
    margin: 4px 0;
}

.contact-success strong {
    color: var(--text);
}

.contact-success:focus {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: var(--radius-md);
}

/* Stack name/email (or name/dealership) on mobile, keep the card compact */
@media (max-width: 768px) {
    .contact-row {
        grid-template-columns: 1fr;
    }

    .contact-tabs {
        margin-bottom: var(--spacing-md);
    }

    /* Keep "General question" from wrapping to two lines in the narrower
       mobile card. */
    .contact-tab {
        font-size: 0.82rem;
        padding: 10px 6px;
    }

    .contact-support-line a {
        min-height: 44px;
    }
}
