/* ============================================================================
   ASK A PRO — floating request widget
   Self-contained. Loaded after styles.css so it inherits the design tokens
   defined there; it does not override any existing site rule except the
   position of the back-to-top button, which has to make room for the
   floating button in the same corner.
   ============================================================================ */

/* ==========================================================================
   Floating button
   ========================================================================== */

/* Semantic wrapper only: both children position themselves, so it needs no
   box of its own — but it must not pick one up from a future rule either. */
.page-tools { display: contents; }

/* Without JS the widget cannot open, so the button never appears. */
.askpro-fab { display: none; }

.js .askpro-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--cedar);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .005em;
  box-shadow: 0 10px 30px -12px rgba(17, 24, 25, .7);
  transition: background var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.js .askpro-fab:hover {
  background: var(--cedar-deep);
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -14px rgba(17, 24, 25, .8);
}
.js .askpro-fab:active { transform: translateY(0); }
.askpro-fab svg { width: 19px; height: 19px; flex: none; }

/* The widget is open, so its own trigger steps out of the way. */
.js .askpro-fab[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* Back-to-top shares this corner — stack it above the floating button. */
.js .to-top { bottom: 84px; }


/* ==========================================================================
   Dialog shell
   ========================================================================== */
.askpro {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 13, 14, .72);
  -webkit-backdrop-filter: blur(5px);
          backdrop-filter: blur(5px);
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), visibility 0s linear var(--dur);
}
.askpro.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--dur) var(--ease), visibility 0s linear 0s;
}

.askpro__panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: min(88dvh, 780px);
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(14px) scale(.98);
  transition: transform var(--dur) var(--ease);
}
.askpro.is-open .askpro__panel { transform: none; }


/* ==========================================================================
   Header: progress + close
   ========================================================================== */
.askpro__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.askpro__progress { flex: 1; min-width: 0; }
.askpro__step {
  display: block;
  margin-bottom: 9px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.askpro__bars { display: flex; gap: 5px; }
.askpro__bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--fog-200);
  transition: background var(--dur) var(--ease);
}
.askpro__bar.is-done { background: var(--cedar); }

.askpro__close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.askpro__close:hover { color: var(--text); border-color: var(--line-strong); }
.askpro__close svg { width: 19px; height: 19px; }


/* ==========================================================================
   Scrolling body
   ========================================================================== */
.askpro__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 26px 22px 24px;
}
.askpro__panel[data-state="sent"] .askpro__body { padding-block: 46px; }

.askpro__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-stretch: var(--stretch-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: var(--track-tight);
}
.askpro__sub {
  margin: 0 0 22px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.askpro__pane[hidden] { display: none; }


/* ==========================================================================
   Step 1 — service cards
   ========================================================================== */
.askpro__services {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.askpro__service {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: left;
  line-height: 1.3;
  color: var(--text);
  transition: border-color var(--dur) var(--ease),
              background var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.askpro__service:hover {
  border-color: var(--cedar);
  transform: translateY(-1px);
}
.askpro__service::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.askpro__service[aria-pressed="true"] {
  border-color: var(--cedar);
  background: var(--cedar-wash);
}
.askpro__service[aria-pressed="true"]::before {
  border-color: var(--cedar);
  background: var(--cedar);
  box-shadow: inset 0 0 0 3px var(--cedar-wash);
}


/* ==========================================================================
   Step 2 — description and photos
   ========================================================================== */
.askpro__field { display: grid; gap: 8px; margin-bottom: 22px; }
.askpro__label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.askpro__optional { color: var(--fog-500); }

.askpro__field input,
.askpro__field textarea {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 1rem;             /* 16px keeps iOS from zooming on focus */
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.askpro__field textarea { min-height: 122px; resize: vertical; line-height: 1.6; }
.askpro__field input:focus,
.askpro__field textarea:focus {
  outline: none;
  border-color: var(--cedar);
  box-shadow: 0 0 0 3px rgba(168, 92, 42, .14);
}
.askpro__field input[aria-invalid="true"],
.askpro__field textarea[aria-invalid="true"] {
  border-color: #c0392b;
  background: #fdf5f4;
}
.askpro__error {
  display: none;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: #a52c1e;
}
.askpro__error:not(:empty) { display: block; }

/* --- drop zone --- */
.askpro__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 22px 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.askpro__drop:hover,
.askpro__drop.is-dragging {
  border-color: var(--cedar);
  background: var(--cedar-wash);
}
.askpro__drop svg { width: 22px; height: 22px; color: var(--cedar-text); }
.askpro__drop strong { color: var(--text); font-weight: 600; }
.askpro__drop span { font-size: var(--fs-xs); }
.askpro__file { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* --- previews --- */
.askpro__shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.askpro__shots:empty { display: none; }
.askpro__shot {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--fog-100);
  aspect-ratio: 1;
}
.askpro__shot img { width: 100%; height: 100%; object-fit: cover; }
.askpro__drop-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(9, 13, 14, .78);
  color: #fff;
}
.askpro__drop-remove svg { width: 13px; height: 13px; }
.askpro__drop-remove:hover { background: rgba(9, 13, 14, .95); }

.askpro__hint {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  color: var(--fog-500);
}


/* ==========================================================================
   Step 3 — contact + summary
   ========================================================================== */
.askpro__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.askpro__row .askpro__field { margin-bottom: 0; }
.askpro__grid { display: grid; gap: 16px; margin-bottom: 22px; }

.askpro__summary {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cedar);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--fog-50);
}
.askpro__summary dl { display: grid; gap: 9px; margin: 0; }
.askpro__summary div {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  align-items: baseline;
}
.askpro__summary dt {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fog-500);
}
.askpro__summary dd {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text);
  overflow-wrap: anywhere;
}


/* ==========================================================================
   Footer controls
   ========================================================================== */
.askpro__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--white);
}
.askpro__back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.askpro__back:hover { color: var(--text); border-color: var(--line-strong); }
.askpro__back svg { width: 15px; height: 15px; }
.askpro__back[hidden] { display: none; }

.askpro__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 1;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--cedar);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #fff;
  transition: background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.askpro__next:hover:not(:disabled) { background: var(--cedar-deep); }
.askpro__next:disabled { opacity: .45; cursor: not-allowed; }
.askpro__next svg { width: 16px; height: 16px; }
.askpro__next[hidden] { display: none; }
.askpro__next svg[hidden] { display: none; }

.askpro__status {
  display: none;
  margin: 0 0 16px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.askpro__status--bad {
  display: block;
  background: #fdecea;
  border: 1px solid #f2c2bc;
  color: #96271a;
}
.askpro__status--note {
  display: block;
  background: var(--fog-50);
  border: 1px solid var(--line);
  color: var(--text-muted);
}


/* ==========================================================================
   Success state
   ========================================================================== */
.askpro__done { text-align: center; }
.askpro__tick {
  width: 62px;
  height: 62px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--basalt-950);
  color: var(--cedar-soft);
}
.askpro__tick svg { width: 30px; height: 30px; }
.askpro__done h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-stretch: var(--stretch-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: var(--track-tight);
}
.askpro__done p {
  margin: 0 auto 6px;
  max-width: 38ch;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.askpro__done .askpro__hint { margin-top: 18px; }


/* ==========================================================================
   Mobile — the dialog becomes a bottom sheet
   ========================================================================== */
@media (max-width: 620px) {
  .js .askpro-fab {
    right: 14px;
    bottom: 14px;
    min-height: 50px;
    padding: 13px 18px;
  }
  .js .to-top { right: 14px; bottom: 76px; }

  .askpro { padding: 0; align-items: flex-end; }
  .askpro__panel {
    max-width: none;
    max-height: 94dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(24px);
  }
  .askpro__head { padding: 16px 14px 14px 18px; }
  .askpro__body { padding: 22px 18px; }
  .askpro__foot { padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .askpro__title { font-size: 1.32rem; }
  .askpro__summary div { grid-template-columns: 92px 1fr; gap: 10px; }
}

/* Below ~360px two columns would squeeze the labels to three lines. */
@media (max-width: 360px) {
  .askpro__services { grid-template-columns: 1fr; }
  .askpro__row { grid-template-columns: 1fr; }
  .js .askpro-fab { padding: 13px 16px; font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .askpro__panel { transform: none; }
}

@media print {
  .askpro, .askpro-fab { display: none !important; }
}
