/**
 * Global modal — layout, show/hide, and webform theming.
 *
 * The sticky nav is z-50 (= 50). Modal sits at z-40 so the nav stays above it,
 * creating the "slides under the header" appearance.
 *
 * Arbitrary-value Tailwind classes that the scanner can't see at build time
 * are defined here directly (.modal-wrapper, .modal-close-btn, etc.).
 */

/* ── Show / hide ─────────────────────────────────────────────────────────── */

#inclind-global-modal-overlay[hidden] {
  display: none !important;
}

body.modal-is-open {
  overflow: hidden;
}

/* ── Overlay wrapper ─────────────────────────────────────────────────────── */

.modal-wrapper {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  /* below nav z-50 so nav stays visible */
  margin-top: 65px;
  /* clear mobile nav */
  width: 100vw;
  height: calc(100vh - 65px);
  overflow-y: auto;
  background: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@media (min-width: 1024px) {
  .modal-wrapper {
    margin-top: 80px;
    height: calc(100vh - 80px);
  }
}

.dark .modal-wrapper {
  background: #222222;
}

.toolbar-fixed.modal-is-open .modal-wrapper {
  top: 2.4375rem;
}

.toolbar-fixed.modal-is-open.toolbar-tray-open .modal-wrapper {
  top: 4.875rem;
}

/* ── Close button ────────────────────────────────────────────────────────── */

.modal-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  cursor: pointer;
  color: #2A3342;
  /* text-secondary-700 */
  text-decoration: none;
  border-radius: 0.25rem;
  transition: opacity 0.15s ease;
}

.modal-close-btn:hover {
  opacity: 0.6;
}

.dark .modal-close-btn {
  color: #fff;
}

/* ── Modal heading ───────────────────────────────────────────────────────── */

.inclind-modal__title {
  font-size: 2.25rem;
  /* text-4xl */
  font-weight: 400;
  line-height: 1.15;
  color: #111827;
  margin: 0 0 1.5rem;
  padding-right: 3rem;
  /* clear the close button */
}

.dark .inclind-modal__title {
  color: #f9fafb;
}

/* ── Two-column form layout ──────────────────────────────────────────────── */
/*
  hook_webform_submission_form_alter() injects:
    .modal-form-layout  — grid wrapper added via #prefix/#suffix on <form>
    .modal-form-left    — wraps Name, Email, Phone, Organization
    .modal-form-right   — wraps Textarea, Submit, quick-chat CTA
*/

.modal-form-layout {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .modal-form-layout {
    grid-template-columns: 1fr 1fr;
    gap: 0 3rem;
    align-items: start;
  }
}

.modal-form-left,
.modal-form-right {
  min-width: 0;
}

/* Submit right-aligned inside its column */
.modal-form-right .form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

/* Textarea fills the column height */
.modal-form-right .webform-type-textarea textarea {
  min-height: 180px;
}

/* ── Form field styling ──────────────────────────────────────────────────── */

.inclind-modal__body .form-item {
  margin-bottom: 1.25rem;
}

.inclind-modal__body label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.375rem;
}

.inclind-modal__body input::placeholder,
.inclind-modal__body textarea::placeholder {
  color: #9ca3af;
  /* gray-400 */
  opacity: 1;
  /* Firefox resets opacity on placeholders */
}

.dark .inclind-modal__body label {
  color: #d1d5db;
}

.inclind-modal__body input[type="text"],
.inclind-modal__body input[type="email"],
.inclind-modal__body input[type="tel"],
.inclind-modal__body textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.inclind-modal__body input[type="text"]:focus,
.inclind-modal__body input[type="email"]:focus,
.inclind-modal__body input[type="tel"]:focus,
.inclind-modal__body textarea:focus {
  outline: none;
  border-color: var(--theme-color-accent, #2C62B9);
  box-shadow: 0 0 0 3px rgba(44, 98, 185, 0.15);
}

.dark .inclind-modal__body input[type="text"],
.dark .inclind-modal__body input[type="email"],
.dark .inclind-modal__body input[type="tel"],
.dark .inclind-modal__body textarea {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

.inclind-modal__body textarea {
  min-height: 160px;
  resize: vertical;
}

/* ── Submit button — red primary ─────────────────────────────────────────── */

.inclind-modal__body .webform-button--submit,
.inclind-modal__body input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background-color: var(--theme-color-primary, #D51920);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.15s ease;
  white-space: nowrap;
  margin-bottom: 1.25rem;
  margin-left: auto;
}

.inclind-modal__body .webform-button--submit:hover,
.inclind-modal__body input[type="submit"]:hover {
  background-color: color-mix(in srgb, var(--theme-color-primary, #D51920) 85%, black);
}

.banner-single-graphic__rule {
  margin: 4rem 0;
  background-color: var(--color-accents-red, #ed1c24);
  flex-shrink: 0;
  width: 60px;
  height: 3px;
}

/* ── "In Need of a Quick Chat?" — injected after submit via CSS + a real element ── */
/*
  We inject this block via a <div class="modal-quick-chat"> that we add in the
  form-actions area using JS (see global-modal.js), so it only appears once the
  modal is first opened (avoids the DOM being populated before the webform AJAX
  attaches). Styled here.
*/

.modal-quick-chat {
  border-top: 1px solid #e5e7eb;
  padding-top: 1.25rem;
  width: 100%;
}

/* .modal-quick-chat is injected by JS after .form-actions inside .modal-form-right
   so no padding offset needed — it naturally sits in the right column. */

.dark .modal-quick-chat {
  border-color: #374151;
}

.modal-quick-chat__heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem;
}

.dark .modal-quick-chat__heading {
  color: #f9fafb;
}

.modal-quick-chat__phone {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: #374151;
  text-decoration: none;
  font-weight: 500;
}

.modal-quick-chat__phone:hover {
  text-decoration: underline;
}

.dark .modal-quick-chat__phone {
  color: #d1d5db;
}

/* WCAG 2.4.7 / 2.4.11 — Ensure focus-visible ring on all .btn elements.
   Tailwind's focus-visible utilities don't apply to .btn via btn-theme-*
   because those classes are in theme-utilities.css, not Tailwind-scanned
   files. This rule ensures keyboard focus is always visible on CTAs. */
.btn:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgb(42 51 66);
}