/* ============================================================
   Quote modal - the 14-step conversational lead form.
   Extracted from the homepage so every page hosts the same form.
   Selector set derived from the modal markup, not guessed.
   ============================================================ */
/* ─── MODAL OVERLAY ─── */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,0.85);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
  }
.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease;
  }
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
.modal-box {
    background: var(--white);
    border-radius: 8px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 80px rgba(10,22,40,0.5);
    animation: slideUp 0.3s ease;
  }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }
.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--white);
    font-size: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
  }
.modal-close:hover { background: rgba(255,255,255,0.3); }
.form-header {
    background: var(--navy-deep);
    padding: 24px 32px;
  }
.form-header-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--white);
    margin-bottom: 4px;
  }
.form-header-sub {
    font-size:0.95rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em;
  }
.form-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    margin-top: 16px;
    border-radius: 2px;
    overflow: hidden;
  }
.form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 7.14%; /* 1/14 */
  }
.form-body {
    padding: 32px;
    min-height: 220px;
    position: relative;
  }
.form-step {
    display: none;
    animation: stepIn 0.3s ease;
  }
.form-step.active { display: block; }
@keyframes stepIn {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: translateX(0); }
  }
.form-question {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--navy-deep);
    margin-bottom: 6px;
    line-height: 1.4;
  }
.form-hint {
    font-size:0.95rem;
    color: var(--text-mid);
    margin-bottom: 20px;
  }
.form-input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--navy-deep);
    background: var(--white);
    transition: border-color var(--transition);
    outline: none;
    -webkit-appearance: none;
  }
.form-input:focus { border-color: var(--gold); }
.form-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
  }
.form-option {
    padding: 10px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--navy-deep);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
    user-select: none;
  }
.form-option:hover {
    border-color: var(--gold);
    background: var(--gold-pale);
  }
.form-option.selected {
    border-color: var(--gold);
    background: var(--gold-pale);
    color: var(--navy-deep);
    font-weight: 600;
  }
.form-textarea {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--navy-deep);
    background: var(--white);
    transition: border-color var(--transition);
    outline: none;
    resize: vertical;
    min-height: 90px;
  }
.form-textarea:focus { border-color: var(--gold); }
.form-footer {
    padding: 20px 32px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f0ebe0;
    gap: 12px;
  }
.form-back {
    background: none;
    border: none;
    color: var(--text-mid);
    font-family: var(--font-body);
    font-size:0.98rem;
    cursor: pointer;
    padding: 8px 0;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
  }
.form-back:hover { color: var(--navy-deep); }
.form-step-count {
    font-size:0.95rem;
    color: var(--text-mid);
    letter-spacing: 0.06em;
  }
.form-next {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--navy-deep);
    font-family: var(--font-body);
    font-weight: 700;
    font-size:0.98rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 12px 28px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-gold);
  }
.form-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(201,168,76,0.4);
  }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
  }
/* Thank you screen */
  .form-thankyou {
    display: none;
    text-align: center;
    padding: 48px 32px;
    animation: stepIn 0.4s ease;
  }
.form-thankyou.active { display: block; }
.thankyou-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
  }
.thankyou-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--navy-deep);
    margin-bottom: 12px;
  }
.thankyou-sub {
    color: var(--text-mid);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 24px;
  }
.thankyou-phone {
    display: inline-block;
    color: var(--navy-deep);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
  }
/* Form */
  .form-question { font-size: clamp(1rem, 1.8vw, 1.15rem); }
.form-input, .form-textarea { font-size: clamp(0.95rem, 1.2vw, 1rem); }
.form-option { font-size: clamp(0.875rem, 1.2vw, 0.9rem); }
.addr-suggestion:hover, .addr-suggestion.active { background:var(--cream,#faf6ec); }


/* ---- Inline mode ---------------------------------------------------
   The form rendered in the flow of the page rather than as an overlay.
   #quoteModal IS the overlay; the panel inside it is .modal-box, which
   carries max-width:540px and max-height:90vh. Both need overriding
   here, and the box needs centring since the overlay is no longer a
   full-viewport flex container.
   -------------------------------------------------------------------- */
.modal-overlay.is-inline{
  position:static!important;
  display:flex!important;
  justify-content:center!important;
  align-items:flex-start!important;
  opacity:1!important;
  visibility:visible!important;
  background:none!important;
  padding:0!important;
  overflow:visible!important;
  z-index:auto!important;
  animation:none!important;
  inset:auto!important;
}
.modal-overlay.is-inline .modal-box{
  transform:none!important;
  margin:0 auto!important;
  width:100%!important;
  max-width:720px!important;
  max-height:none!important;
  overflow:visible!important;
  box-shadow:0 18px 50px rgba(10,22,40,.10)!important;
  animation:none!important;
}
.modal-overlay.is-inline .modal-close{display:none!important}

@media (max-width:760px){
  .modal-overlay.is-inline .modal-box{max-width:100%!important}
}


/* ── FULL-SCREEN ON PHONES ─────────────────────────────────────────
   A 540px card floating in 20px of margin wastes a phone screen, and
   once the keyboard opens the Next button ends up below the fold.
   Below 680px the form takes the whole viewport instead: header
   pinned, body scrolls, footer always reachable.

   .is-inline is excluded — /request-preliminary-quote renders this
   same form in the flow of the page and must stay in the flow.
   ------------------------------------------------------------------ */
@media (max-width:680px){
  .modal-overlay:not(.is-inline){
    padding:0;
    align-items:stretch;
    backdrop-filter:none;
  }
  .modal-overlay:not(.is-inline) .modal-box{
    width:100%;
    max-width:none;
    max-height:none;
    height:100vh;
    height:100dvh;          /* iOS: 100vh sits under the URL bar */
    border-radius:0;
    display:flex;
    flex-direction:column;
    animation:none;
  }
  .modal-overlay:not(.is-inline) .form-header{
    flex:0 0 auto;
    padding:calc(16px + env(safe-area-inset-top)) 20px 16px;
  }
  .modal-overlay:not(.is-inline) .form-body{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    padding:24px 20px;
  }
  .modal-overlay:not(.is-inline) .form-footer{
    flex:0 0 auto;
    padding:14px 20px calc(14px + env(safe-area-inset-bottom));
    background:#fff;
  }
  .modal-overlay:not(.is-inline) .modal-close{
    top:calc(12px + env(safe-area-inset-top));
    right:12px;
    width:40px;
    height:40px;
    font-size:1.15rem;
  }
  .modal-overlay:not(.is-inline) .form-thankyou{
    padding:56px 24px calc(24px + env(safe-area-inset-bottom));
  }

  /* iOS Safari zooms the entire page when a focused input renders
     below 16px. The clamp() above resolves to ~15.2px on a phone,
     which is why the form jumped and had to be pinched back. Nothing
     focusable here may drop under 16px. */
  .form-input,
  .form-textarea{font-size:16px;padding:15px 16px;}
  .form-option{font-size:16px;padding:13px 18px;}
  .form-question{font-size:1.25rem;}
  .form-hint{font-size:0.95rem;}
  .form-next{font-size:0.95rem;padding:14px 24px;min-height:48px;}
  .form-back{font-size:0.95rem;min-height:44px;}
  .form-step-count{font-size:0.98rem;}
}


/* ── AUTOFILL DETECTION HOOK ───────────────────────────────────────
   Safari exposes no event when it autofills a field, but it does
   re-run CSS animations on the element. Naming an animation here
   gives quote-modal.js an animationstart it can listen for, which is
   the earliest point the value can be captured. Do not remove: without
   it the form cannot tell an autofilled field from an empty one, and
   Next silently refuses to advance.
   The keyframes are intentionally a no-op. */
@keyframes sunriseAutofill { from { opacity: 1; } to { opacity: 1; } }
.form-input:-webkit-autofill,
.form-textarea:-webkit-autofill{
  animation-name: sunriseAutofill;
  animation-duration: 1ms;
}


/* Inline validation message, injected by quote-modal.js. Only the four
   contact fields can trigger it; every project question can be skipped. */
.form-problem{
  display:none;
  margin:14px 0 0;
  padding:11px 14px;
  border-left:3px solid #b3261e;
  background:#fdf3f2;
  color:#8c1d18;
  font-size:0.95rem;
  line-height:1.5;
}
