/* ===== Sig4 "Start a Project" modal =========================================
   Chrome only. Everything inside the dialog is the real form markup lifted
   from /contact/, so it inherits s4-contact.css and this file must not
   restyle fields - if the two ever disagree, s4-contact.css wins and this
   file is the bug.

   The dialog itself plays the part of the card: on /contact/ the panel
   background, border and radius come from #start-a-project, so those are
   flattened here and re-applied to .s4-qm-dialog. That keeps one card, not
   a card inside a card. */

/* Showit's base reset does not set border-box, so every box here declares
   it. Without this the dialog's 40px padding sits OUTSIDE max-width and the
   card renders 800px wide against a 720px cap.

   Chrome only - deliberately not `.s4-qm *`. The transplanted markup gets
   border-box from s4-contact.css itself (`#s4-contact *`), via the host
   wrapper the modal builds, and should keep taking it from there. */
.s4-qm,.s4-qm-dialog,.s4-qm-close,.s4-qm-wait{box-sizing:border-box}

/* Scroll lock. html AND body, because which one scrolls varies, plus
   overscroll-behavior on the overlay so reaching the end of the form does
   not hand the scroll to the page underneath. */
.s4-qm-open,.s4-qm-open body{overflow:hidden}

.s4-qm{
  position:fixed;inset:0;z-index:2147483000;
  display:flex;align-items:flex-start;justify-content:center;
  padding:40px 20px;overflow-y:auto;overscroll-behavior:contain;
  /* No backdrop-filter here, deliberately. A blurred backdrop composited
     wrongly over the Showit pages - the page painted ON TOP of the dialog
     while hit-testing still said the dialog was in front, so the form was
     there but unreadable. Showit layers are full of transforms and 3D
     contexts, which is a known trigger for that. The flat scrim below does
     the same job and cannot misrender. */
  background:rgba(0,0,0,.78);
  opacity:0;transition:opacity .18s ease;
  font-family:'Inter Tight','Helvetica Neue',Helvetica,Arial,sans-serif;
}
.s4-qm[data-open="1"]{opacity:1}

.s4-qm-dialog{
  position:relative;width:100%;max-width:720px;margin:auto;
  background:#141414;color:#fff;
  border:1px solid rgba(255,255,255,.14);border-radius:14px;
  padding:40px;
  box-shadow:0 30px 80px rgba(0,0,0,.6);
  transform:translateY(8px);transition:transform .18s ease;
}
.s4-qm[data-open="1"] .s4-qm-dialog{transform:none}

/* Flatten the page-layout rules the transplanted markup carries with it.
   These selectors repeat #s4-contact deliberately: what is being overridden
   is `#s4-contact #start-a-project` - two ids - and one id plus a class
   loses to that wherever it sits in the file. Drop the second id and the
   card silently re-pads itself inside the dialog, at 40px on desktop and
   28px under the 720px breakpoint. */
.s4-qm #s4-contact{display:block;width:auto;background:transparent}
.s4-qm #s4-contact #start-a-project{
  flex:none;min-width:0;background:transparent;
  border:0;border-radius:0;padding:0;scroll-margin-top:0;
}

.s4-qm-close{
  position:absolute;top:14px;right:14px;z-index:2;
  width:38px;height:38px;padding:0;
  display:flex;align-items:center;justify-content:center;
  background:transparent;color:#fff;
  border:1px solid rgba(255,255,255,.22);border-radius:999px;
  font:400 22px/1 'Inter Tight',Helvetica,Arial,sans-serif;
  cursor:pointer;transition:background .15s ease,border-color .15s ease;
}
.s4-qm-close:hover{background:rgba(255,255,255,.1);border-color:rgba(255,255,255,.4)}
.s4-qm-close:focus-visible{outline:2px solid #e9e037;outline-offset:2px}

/* Shown only while the form is being fetched, and only if that takes long
   enough to notice. */
.s4-qm-wait{
  display:flex;align-items:center;gap:12px;
  min-height:120px;color:rgba(255,255,255,.62);font-size:15px;
}
.s4-qm-wait::before{
  content:"";width:17px;height:17px;flex:none;border-radius:50%;
  border:2px solid rgba(255,255,255,.25);border-top-color:#e9e037;
  animation:s4-qm-spin .7s linear infinite;
}
@keyframes s4-qm-spin{to{transform:rotate(360deg)}}

@media (max-width:720px){
  .s4-qm{padding:0}
  .s4-qm-dialog{
    max-width:none;min-height:100%;margin:0;
    border:0;border-radius:0;padding:56px 20px 28px;
  }
  .s4-qm-close{top:10px;right:10px}
}

@media (prefers-reduced-motion:reduce){
  .s4-qm,.s4-qm-dialog{transition:none}
  .s4-qm-dialog{transform:none}
  .s4-qm-wait::before{animation:none}
}
