/* Contact ambient WebGL stages — forced off (must beat guerin-tech-ghost / globe CSS).
   Radar is the allowed CTA background — do NOT hide .contact-radar-stage here. */
.contact-globe-stage,
.contact-ghost-stage,
.contact-hyperspeed-layer,
.contact-speeding-layer,
.contact-hyperspeed-hint,
.contact-overlay.is-active .contact-globe-stage,
.contact-overlay.is-active .contact-ghost-stage,
.contact-overlay.is-active .contact-hyperspeed-layer,
.contact-overlay.is-active .contact-speeding-layer,
.contact-overlay.is-active .contact-hyperspeed-hint,
.contact-overlay.is-active .contact-ghost-stage .guerin-tech-ghost-container {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  z-index: -1 !important;
}

/* Close + toast — reliable, never trapped under WebGL */

#guerin-submit-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(120%);
  z-index: 12000;
  margin: 0;
  padding: 0.85rem 1.25rem;
  border: 1px solid rgba(52, 211, 153, 0.45);
  background: rgba(8, 12, 10, 0.92);
  color: #ecfdf5;
  font-family: var(--font-body, 'IBM Plex Sans', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  max-width: min(92vw, 28rem);
  text-align: center;
}

#guerin-submit-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#guerin-submit-toast.is-local {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(28, 22, 8, 0.94);
  color: #fef3c7;
}

.contact-submit-btn.is-sending {
  position: relative;
  pointer-events: none;
  opacity: 0.92;
  letter-spacing: 0.1em;
}

.contact-submit-btn.is-sending::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.55em;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: contact-submit-spin 0.7s linear infinite;
}

@keyframes contact-submit-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .contact-submit-btn.is-sending::before {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.85);
  }
}

#contact-overlay-close {
  position: fixed !important;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 13000 !important;
  width: 48px !important;
  height: 48px !important;
  display: none !important;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  border: none !important;
  border-radius: 0 !important;
  background: rgba(0, 0, 0, 0.55) !important;
  color: #ff6b6b !important;
  box-shadow: none !important;
  cursor: pointer;
}

body.contact-overlay-open #contact-overlay-close {
  display: flex !important;
}

#contact-overlay-close:hover {
  color: #ff8f8f !important;
  background: rgba(0, 0, 0, 0.75) !important;
}

.contact-close-inline {
  display: inline;
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

/* Ensure enquiry controls stay clickable above any leftover layers */
.contact-overlay.is-active .contact-slide,
.contact-overlay.is-active .contact-query-panel,
.contact-overlay.is-active #rfq-form-content-overlay,
.contact-overlay.is-active #rfq-submit-btn-overlay,
.contact-overlay.is-active #rfq-success-panel-overlay {
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

/* ── Phone / tablet: full-screen success stage (no squished form behind) ── */
@media (max-width: 900px) {
  .contact-overlay.contact-overlay--success.is-active {
    overflow: hidden !important;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    background: #000000 !important;
  }

  .contact-overlay.contact-overlay--success.is-active::before {
    animation: contact-phone-green-breathe 4.5s ease-in-out infinite !important;
    background:
      radial-gradient(ellipse 78% 58% at 50% 40%, rgba(1, 151, 101, 0.28), transparent 62%),
      #000000 !important;
  }

  .contact-overlay.contact-overlay--success .contact-slide-left {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .contact-overlay.contact-overlay--success .contact-slide-right.contact-slide-enquiry {
    display: flex !important;
    visibility: visible !important;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    order: 1;
    margin: 0;
    padding: calc(52px + env(safe-area-inset-top, 0px)) var(--fluid-gutter)
      max(1.25rem, env(safe-area-inset-bottom, 0px));
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
  }

  .contact-overlay.contact-overlay--success .contact-query-panel {
    display: flex !important;
    visibility: visible !important;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    justify-content: center;
    align-items: center;
  }

  .contact-overlay.contact-overlay--success #rfq-success-panel-overlay {
    display: flex !important;
    visibility: visible !important;
    flex: 1 1 auto;
    width: 100%;
    max-width: 22rem;
    min-height: 0;
    justify-content: center;
    align-items: center;
    padding: var(--space-4) var(--space-2);
    box-sizing: border-box;
  }

  .contact-overlay.contact-overlay--success #rfq-form-content-overlay.is-fading-out {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
  }
}
