/* ==========================================================================
   Floating Contact Widget — "Get a Custom Quote"
   Uses the site's theme tokens (--accent, --espresso, --surface-*) so it
   follows light / dark mode automatically.
   ========================================================================== */

.cw-root {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.875rem;
  font-family: 'Inter', system-ui, sans-serif;
  pointer-events: none;
}

.cw-root>* {
  pointer-events: auto;
}

/* ---------- Launcher pill ---------- */
.cw-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem 0.5rem 0.5rem;
  border: 1px solid rgb(var(--espresso) / 0.08);
  border-radius: 9999px;
  background: rgb(var(--surface-900) / 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  color: rgb(var(--espresso));
  cursor: pointer;
  box-shadow:
    0 10px 30px -10px rgb(var(--accent-dark) / 0.35),
    0 2px 6px rgb(0 0 0 / 0.08);
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), box-shadow 0.35s ease, background 0.3s ease;
  animation: cw-enter 0.7s cubic-bezier(.2, .8, .2, 1) 1.2s both;
}

.cw-launcher:hover {
  transform: translateY(-3px);
  box-shadow:
    0 18px 40px -12px rgb(var(--accent-dark) / 0.5),
    0 2px 6px rgb(0 0 0 / 0.08);
}

.cw-launcher:focus-visible,
.cw-close:focus-visible,
.cw-submit:focus-visible,
.cw-chip:focus-visible {
  outline: 2px solid rgb(var(--accent));
  outline-offset: 3px;
}

.cw-launcher-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgb(var(--accent-light)), rgb(var(--accent-dark)));
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.45s cubic-bezier(.2, .8, .2, 1);
}

.cw-launcher-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  position: absolute;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(.2, .8, .2, 1);
}

.cw-launcher-icon .cw-ico-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

/* Pulsing halo */
.cw-launcher-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgb(var(--accent) / 0.55);
  animation: cw-pulse 2.6s ease-out infinite;
}

.cw-launcher-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}

.cw-launcher-text strong {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.cw-launcher-text small {
  font-size: 0.72rem;
  color: rgb(var(--espresso) / 0.6);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.15rem;
}

.cw-online-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: rgb(var(--teal));
  box-shadow: 0 0 0 3px rgb(var(--teal) / 0.2);
}

/* Open state on launcher */
.cw-root.is-open .cw-launcher-icon .cw-ico-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.cw-root.is-open .cw-launcher-icon .cw-ico-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.cw-root.is-open .cw-launcher-icon::after {
  animation: none;
}

/* ---------- Panel ---------- */
.cw-panel {
  position: relative;
  width: min(360px, calc(100vw - 2rem));
  max-height: calc(100vh - 11rem);
  max-height: calc(100dvh - 11rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-radius: 1.5rem;
  border: 1px solid rgb(var(--espresso) / 0.08);
  background: rgb(var(--surface-900) / 0.94);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  color: rgb(var(--espresso));
  box-shadow:
    0 30px 60px -20px rgb(0 0 0 / 0.35),
    0 0 0 1px rgb(255 255 255 / 0.03) inset;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.94);
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(.2, .8, .2, 1), visibility 0s linear 0.45s;
}

.cw-root.is-open .cw-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}

.cw-panel::-webkit-scrollbar {
  display: none;
}

.cw-panel:focus {
  outline: none;
}

.cw-panel-head {
  position: relative;
  padding: 1.25rem 1.25rem 1rem;
  overflow: hidden;
  border-bottom: 1px solid rgb(var(--espresso) / 0.06);
}

.cw-panel-head::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 9999px;
  background: radial-gradient(circle, rgb(var(--accent) / 0.28), transparent 65%);
  pointer-events: none;
}

.cw-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(var(--accent));
  margin-bottom: 0.6rem;
}

.cw-eyebrow svg {
  width: 0.7rem;
  height: 0.7rem;
}

.cw-title {
  position: relative;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
}

.cw-title em {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 600;
  color: rgb(var(--accent));
}

.cw-sub {
  position: relative;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgb(var(--espresso) / 0.65);
  margin: 0;
}

.cw-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 0;
  background: rgb(var(--espresso) / 0.06);
  color: rgb(var(--espresso) / 0.7);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.3s ease;
}

.cw-close:hover {
  background: rgb(var(--espresso) / 0.12);
  transform: rotate(90deg);
}

.cw-close svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* ---------- Form ---------- */
.cw-form {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cw-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(var(--espresso) / 0.55);
  margin-bottom: 0.35rem;
}

.cw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cw-chip {
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid rgb(var(--espresso) / 0.12);
  background: transparent;
  color: rgb(var(--espresso) / 0.8);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cw-chip:hover {
  border-color: rgb(var(--accent) / 0.6);
  color: rgb(var(--espresso));
}

.cw-chip[aria-pressed="true"] {
  background: rgb(var(--accent));
  border-color: rgb(var(--accent));
  color: #fff;
}

.cw-input,
.cw-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid rgb(var(--espresso) / 0.12);
  background: rgb(var(--surface-800) / 0.45);
  color: rgb(var(--espresso));
  font: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cw-input::placeholder,
.cw-textarea::placeholder {
  color: rgb(var(--espresso) / 0.4);
}

.cw-input:focus,
.cw-textarea:focus {
  outline: none;
  border-color: rgb(var(--accent) / 0.7);
  box-shadow: 0 0 0 4px rgb(var(--accent) / 0.15);
  background: rgb(var(--surface-800) / 0.7);
}

.cw-textarea {
  resize: none;
  height: 72px;
}

.cw-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgb(var(--accent-light)), rgb(var(--accent-dark)));
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 24px -10px rgb(var(--accent) / 0.7);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cw-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 0.35) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s ease;
}

.cw-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -12px rgb(var(--accent) / 0.8);
}

.cw-submit:hover::before {
  transform: translateX(100%);
}

.cw-submit svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.25s ease;
}

.cw-submit:hover svg {
  transform: translateX(3px);
}

.cw-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: rgb(var(--espresso) / 0.5);
  margin-top: -0.2rem;
}

.cw-foot a {
  color: rgb(var(--espresso) / 0.75);
  text-decoration: none;
  border-bottom: 1px dashed rgb(var(--espresso) / 0.3);
}

.cw-foot a:hover {
  color: rgb(var(--accent));
}

/* ---------- Extra form parts ---------- */
.cw-root [hidden] {
  display: none !important;
}

.cw-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.cw-req {
  color: rgb(var(--accent));
}

.cw-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cw-input[aria-invalid="true"],
.cw-textarea[aria-invalid="true"] {
  border-color: #d9534f;
  box-shadow: 0 0 0 4px rgb(217 83 79 / 0.15);
}

.cw-error {
  margin: -0.15rem 0 0;
  padding: 0.55rem 0.8rem;
  border-radius: 0.7rem;
  background: rgb(217 83 79 / 0.1);
  color: #c9423d;
  font-size: 0.78rem;
  line-height: 1.4;
}

.dark .cw-error {
  color: #f08a85;
}

.cw-error a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.cw-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  border: 2px solid rgb(255 255 255 / 0.35);
  border-top-color: #fff;
  animation: cw-spin 0.7s linear infinite;
}

.cw-submit.is-loading {
  cursor: progress;
  opacity: 0.85;
  transform: none;
}

.cw-submit.is-loading .cw-spinner {
  display: inline-block;
}

.cw-submit.is-loading .cw-submit-arrow {
  display: none;
}

/* ---------- Success view ---------- */
.cw-success {
  padding: 1.75rem 1.5rem 1.75rem;
  text-align: center;
  animation: cw-fade-up 0.5s cubic-bezier(.2, .8, .2, 1) both;
}

.cw-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
}

.cw-success-icon svg {
  width: 100%;
  height: 100%;
  stroke: rgb(var(--accent));
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cw-success-icon circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: cw-draw 0.7s ease-out 0.1s forwards;
}

.cw-success-icon path {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: cw-draw 0.4s ease-out 0.7s forwards;
}

.cw-success-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 0.4rem;
}

.cw-success-text {
  font-size: 0.85rem;
  line-height: 1.55;
  color: rgb(var(--espresso) / 0.7);
  margin: 0 0 1.25rem;
  word-break: break-word;
}

.cw-success-text strong {
  color: rgb(var(--espresso));
}

/* ---------- Animations ---------- */
@keyframes cw-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cw-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes cw-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cw-pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(var(--accent) / 0.55);
  }

  70%,
  100% {
    box-shadow: 0 0 0 14px rgb(var(--accent) / 0);
  }
}

@keyframes cw-enter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .cw-root {
    right: 1rem;
    bottom: 1rem;
  }

  .cw-launcher {
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    gap: 0.6rem;
  }

  .cw-launcher-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .cw-launcher-text small {
    display: none;
  }

  .cw-launcher-text strong {
    font-size: 0.875rem;
  }
}

@media (max-height: 860px) {
  .cw-sub {
    display: none;
  }

  .cw-title {
    margin-bottom: 0;
  }

  .cw-panel-head {
    padding-bottom: 0.9rem;
  }

  .cw-textarea {
    height: 52px;
  }

  .cw-form {
    gap: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  .cw-launcher,
  .cw-launcher-icon::after,
  .cw-panel {
    animation: none !important;
    transition: none !important;
  }
}
