/* ============================================================
   Lead Guard - swipe-to-send slider for the site forms (/js/lead-guard.js).
   Same look as the form inputs and the gold pill buttons in restyle.css:
   Jost, #c4b392 gold, #111424 ink, #faf9f7 / #d9d2c5 fields, 60px pill.
   ============================================================ */

/* Honeypot added by the script: hidden from people and screen readers. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

/* The submit button steps aside while the slider is shown
   (Tilda's display:flex would otherwise beat [hidden]). */
.js-form-proccess [type="submit"][hidden] { display: none !important; }

.slide-confirm {
  --pn: 0;             /* knob position 0..100, fades the label */
  --sc-height: 60px;
  --sc-knob: 52px;
  position: relative;
  width: 100%;
  animation: slide-confirm-in .22s ease-out both;
}
.slide-confirm[hidden] { display: none; }
/* step form (brief): below the "Back / 5 of 5" bar */
.t-form__screen > .slide-confirm { margin-top: 20px; }
@keyframes slide-confirm-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide-confirm__track {
  position: relative;
  height: var(--sc-height);
  box-sizing: border-box;
  border: 1.5px solid #d9d2c5;
  border-radius: 999px;
  background: #faf9f7;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* the page does not scroll while the knob is dragged */
}
.slide-confirm__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: calc(var(--sc-knob) + 8px);
  border-radius: 999px;
  background: rgba(196, 179, 146, .22);
  pointer-events: none;
}
.slide-confirm__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 18px 0 calc(var(--sc-knob) + 14px);
  font-family: 'Jost', 'TildaSans', Arial, sans-serif;
  font-size: 15px; font-weight: 500; letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: calc(1 - var(--pn) / 55); /* fades out by ~55% */
  /* a gold glint runs over the text: "drag me, don't click" */
  color: #6f685c;
  background: linear-gradient(90deg, #6f685c 0%, #6f685c 40%, #c4b392 50%, #6f685c 60%, #6f685c 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: slide-shimmer 2.4s linear infinite;
}
@keyframes slide-shimmer {
  from { background-position: 120% 0; }
  to   { background-position: -120% 0; }
}

/* The knob is the only thing that can be grabbed. */
.slide-confirm__knob {
  position: absolute; left: 2.5px; top: 2.5px;
  width: var(--sc-knob); height: var(--sc-knob);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  outline: none;
}
.slide-confirm.is-dragging .slide-confirm__knob { cursor: grabbing; }
.slide-confirm__knob-inner {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: #c4b392;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(17, 20, 36, .18);
  transition: background-color .18s ease, color .18s ease, transform .12s ease, box-shadow .2s ease;
}
.slide-confirm__knob:focus-visible .slide-confirm__knob-inner {
  box-shadow: 0 4px 14px rgba(17, 20, 36, .18), 0 0 0 4px rgba(196, 179, 146, .35);
}
.slide-confirm.is-dragging .slide-confirm__knob-inner { transform: scale(1.04); }
.slide-confirm__icon { display: none; width: 22px; height: 22px; }
.slide-confirm__icon svg { display: block; width: 22px; height: 22px; }
.slide-confirm__icon--arrow { display: block; }

/* Click on the track next to the knob: a short "grab me" nudge. */
.slide-confirm__knob-inner.is-hint { animation: slide-hint .45s ease; }
@keyframes slide-hint {
  0%   { transform: translateX(0); }
  35%  { transform: translateX(10px); }
  70%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* Confirmed: gold track, white knob with a check, "Sending..." */
.slide-confirm.is-confirmed .slide-confirm__track { background: #c4b392; border-color: #c4b392; }
.slide-confirm.is-confirmed .slide-confirm__fill { background: #c4b392; }
.slide-confirm.is-confirmed .slide-confirm__knob { cursor: default; }
.slide-confirm.is-confirmed .slide-confirm__knob-inner {
  background: #ffffff;
  color: #c4b392;
  box-shadow: 0 4px 14px rgba(17, 20, 36, .14);
}
.slide-confirm.is-confirmed .slide-confirm__icon--arrow { display: none; }
.slide-confirm.is-confirmed .slide-confirm__icon--check { display: block; }
.slide-confirm.is-confirmed .slide-confirm__label {
  opacity: 1;
  padding: 0 calc(var(--sc-knob) + 14px) 0 18px; /* the knob is on the right now */
  background: none;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  animation: none;
}

/* Button for screen readers: visually hidden, reachable by keyboard and AT. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

@media screen and (max-width: 480px) {
  .slide-confirm { --sc-height: 54px; --sc-knob: 46px; }
  .slide-confirm__label { font-size: 14px; letter-spacing: .01em; }
}

@media (prefers-reduced-motion: reduce) {
  .slide-confirm { animation: none; }
  .slide-confirm__label {
    animation: none;
    background: none;
    color: #6f685c;
    -webkit-text-fill-color: #6f685c;
  }
  .slide-confirm__knob-inner.is-hint { animation: none; }
  .slide-confirm__knob-inner { transition: none; }
}
