/**
 * Arbor — reusable contact / enquiry dialog (inc/arbor-contact-modal.php).
 *
 * Design language: no borders, no lines. Separation is surface fill + 32px radius
 * + spacing. One shadow is allowed on the panel — it is a floating layer, and the
 * backdrop alone doesn't read as "lifted" on a light page.
 *
 * NB on specificity: the site's Customizer CSS (wp_options, printed inline AFTER
 * every enqueued sheet) styles `.wpcf7 input[...]` and `.wpcf7 input[type=submit]`
 * with !important — white fill, 1px border, max-width 400px, bordered dark submit.
 * Every form rule below is therefore selector-deeper than that AND !important, so
 * it wins regardless of load order. Do not shorten these selectors.
 */

/* Scroll lock while open (mirrors the PDP lightbox: html-level, so the sticky
   header's `overflow-x: clip` on <body> is left alone). */
html.arbor-cmodal-lock { overflow: hidden; }

.arbor-cmodal {
    position: fixed;
    inset: 0;
    z-index: 100001; /* above the PDP lightbox (100000) and the sticky header (1000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--ds-space-3);
    font-family: var(--ds-font-body);
}
.arbor-cmodal[hidden] { display: none; }

.arbor-cmodal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 24, 24, .55);
    animation: arbor-cmodal-fade .18s ease;
}

.arbor-cmodal__panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - var(--ds-space-5));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--ds-space-4) var(--ds-space-4);
    background: var(--ds-page);
    border: 0;
    border-radius: var(--ds-radius);
    box-shadow: 0 24px 60px rgba(24, 24, 24, .22);
    animation: arbor-cmodal-rise .22s ease;
}

@keyframes arbor-cmodal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes arbor-cmodal-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .arbor-cmodal__backdrop,
    .arbor-cmodal__panel { animation: none; }
}

/* ------------------------------- Close ---------------------------------- */
.arbor-cmodal__close {
    position: absolute;
    top: var(--ds-space-2);
    right: var(--ds-space-2);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    color: var(--ds-body);
    background: var(--ds-surface);
    border: 0;
    border-radius: var(--ds-radius-pill);
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}
.arbor-cmodal__close:hover {
    background: var(--ds-ink);
    color: var(--ds-on-dark);
}

/* -------------------------------- Head ---------------------------------- */
.arbor-cmodal__kicker {
    margin: 0 0 var(--ds-space-1);
    font-family: var(--ds-font-head);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ds-brand);
}
.arbor-cmodal__title {
    margin: 0 0 var(--ds-space-1) !important;
    font-family: var(--ds-font-head);
    font-size: 28px;
    font-weight: var(--ds-fw-heading);
    line-height: 1.2;
    color: var(--ds-ink);
    padding-right: 44px; /* clear of the close button */
}
.arbor-cmodal__lede {
    margin: 0 0 var(--ds-space-2);
    font-size: 15px;
    line-height: var(--ds-lh-body);
    color: var(--ds-body);
}
.arbor-cmodal__lede:empty { display: none; }

/* -------------------------------- Form ---------------------------------- */
.arbor-cmodal .wpcf7 { margin: 0; }
.arbor-cmodal .wpcf7-form p { margin: 0 0 12px; }
.arbor-cmodal .wpcf7-form p:last-of-type { margin-bottom: 0; }

.arbor-cmodal .wpcf7-form label {
    display: block !important;
    font-family: var(--ds-font-head);
    font-size: 13px !important;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--ds-ink) !important;
}
.arbor-cmodal .wpcf7-form label br { display: none; }

.arbor-cmodal .wpcf7 input[type="text"],
.arbor-cmodal .wpcf7 input[type="email"],
.arbor-cmodal .wpcf7 input[type="tel"],
.arbor-cmodal .wpcf7 textarea {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 6px !important;
    padding: 13px 18px !important;
    font-family: var(--ds-font-body) !important;
    font-size: 15px !important;
    color: var(--ds-ink) !important;
    background-color: var(--ds-surface) !important;
    border: 0 !important;
    border-radius: calc(var(--ds-radius) / 2) !important;
    box-shadow: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: background-color .18s ease;
}
.arbor-cmodal .wpcf7 input[type="text"]:focus,
.arbor-cmodal .wpcf7 input[type="email"]:focus,
.arbor-cmodal .wpcf7 input[type="tel"]:focus,
.arbor-cmodal .wpcf7 textarea:focus {
    background-color: var(--ds-surface-overlay) !important;
    border: 0 !important;
    box-shadow: none !important;
}
.arbor-cmodal .wpcf7 textarea {
    /* CF7 emits rows="10" — ~200px of empty box that pushed the submit off screen.
       An explicit height overrides the attribute; the field is still resizable. */
    height: 118px !important;
    min-height: 118px !important;
    resize: vertical !important;
    line-height: 1.6 !important;
}

/* Submit — the canonical DS pill: ink, crimson on hover. */
.arbor-cmodal .wpcf7 input[type="submit"] {
    width: 100% !important;
    margin-top: var(--ds-space-2) !important;
    padding: 16px 32px !important;
    font-family: var(--ds-font-head) !important;
    font-size: var(--ds-fs-button) !important;
    font-weight: var(--ds-fw-button) !important;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
    color: var(--ds-on-dark) !important;
    background: var(--ds-ink) !important;
    border: 0 !important;
    border-radius: var(--ds-radius-pill) !important;
    cursor: pointer !important;
    transition: background-color .18s ease !important;
}
.arbor-cmodal .wpcf7 input[type="submit"]:hover {
    background: var(--ds-brand) !important;
    color: var(--ds-on-dark) !important;
}

/* CF7 feedback — surface pills, never bordered boxes. */
.arbor-cmodal .wpcf7-response-output {
    margin: var(--ds-space-2) 0 0 !important;
    padding: 12px 18px !important;
    font-size: 14px;
    color: var(--ds-ink);
    background: var(--ds-surface);
    border: 0 !important;
    border-radius: calc(var(--ds-radius) / 2);
}
.arbor-cmodal .wpcf7-not-valid-tip {
    margin-top: 6px;
    font-size: 13px;
    color: var(--ds-brand);
}
.arbor-cmodal .wpcf7-spinner { margin: 0 auto; display: block; }

/* ---------------------------- Direct channels --------------------------- */
.arbor-cmodal__alt {
    margin-top: var(--ds-space-2);
    text-align: center;
}
.arbor-cmodal__alt-label {
    display: block;
    font-size: 13px;
    color: var(--ds-body);
}
.arbor-cmodal__alt-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ds-space-1);
    margin-top: var(--ds-space-1);
}
.arbor-cmodal__alt-link {
    padding: 8px 18px;
    font-family: var(--ds-font-head);
    font-size: 14px;
    font-weight: 600;
    color: var(--ds-ink) !important;
    background: var(--ds-surface);
    border-radius: var(--ds-radius-pill);
    text-decoration: none !important;
    transition: background-color .18s ease, color .18s ease;
}
.arbor-cmodal__alt-link:hover {
    background: var(--ds-ink);
    color: var(--ds-on-dark) !important;
}
.arbor-cmodal__alt-hours {
    display: block;
    margin-top: var(--ds-space-1);
    font-size: 12px;
    color: var(--ds-body);
}

/* ------------------------------ Sent state ------------------------------ */
.arbor-cmodal__sent { display: none; text-align: center; padding: var(--ds-space-3) 0; }
.arbor-cmodal.is-sent .arbor-cmodal__head,
.arbor-cmodal.is-sent .arbor-cmodal__form,
.arbor-cmodal.is-sent .arbor-cmodal__alt { display: none; }
.arbor-cmodal.is-sent .arbor-cmodal__sent { display: block; }

.arbor-cmodal__sent-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 26px;
    color: var(--ds-on-brand);
    background: var(--ds-brand);
    border-radius: var(--ds-radius-pill);
}
.arbor-cmodal__sent-title {
    margin: var(--ds-space-2) 0 var(--ds-space-1) !important;
    font-family: var(--ds-font-head);
    font-size: 24px;
    font-weight: var(--ds-fw-heading);
    color: var(--ds-ink);
}
.arbor-cmodal__sent-text {
    margin: 0 auto var(--ds-space-3);
    max-width: 34em;
    font-size: 15px;
    line-height: var(--ds-lh-body);
    color: var(--ds-body);
}
.arbor-cmodal__sent-btn {
    padding: 14px 36px;
    font-family: var(--ds-font-head);
    font-size: var(--ds-fs-button);
    font-weight: var(--ds-fw-button);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ds-on-dark);
    background: var(--ds-ink);
    border: 0;
    border-radius: var(--ds-radius-pill);
    cursor: pointer;
    transition: background-color .18s ease;
}
.arbor-cmodal__sent-btn:hover { background: var(--ds-brand); }

/* --------------------- Homepage band trigger + fallback ----------------- */
/* The band's CTA. Sits where the inline form used to, so it keeps the block's
   left alignment and gets the same crimson pill as every other primary CTA. */
.arbor-contact__cta { margin-top: var(--ds-space-3); }
.arbor-contact__cta-btn {
    display: inline-block;
    padding: 16px 36px;
    font-family: var(--ds-font-head);
    font-size: var(--ds-fs-button);
    font-weight: var(--ds-fw-button);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ds-on-brand) !important;
    background: var(--ds-brand);
    border-radius: var(--ds-radius-pill);
    text-decoration: none !important;
    transition: background-color .18s ease;
}
.arbor-contact__cta-btn:hover {
    background: var(--ds-ink);
    color: var(--ds-on-dark) !important;
}
.arbor-contact__cta-note {
    margin: var(--ds-space-2) 0 0;
    font-size: 13px;
    color: var(--ds-body);
}

/* ------------------------------ Responsive ------------------------------ */
@media (max-width: 768px) {
    .arbor-cmodal { padding: var(--ds-space-2); align-items: flex-end; }
    .arbor-cmodal__panel {
        max-width: none;
        max-height: calc(100vh - var(--ds-space-4));
        padding: var(--ds-space-4) var(--ds-space-3) var(--ds-space-3);
        border-radius: calc(var(--ds-radius) * .75);
    }
    .arbor-cmodal__title { font-size: 24px; }
}
