/* ═══════════════════════════════════════════════════════════════
   REACH OUT — persistent fixed contact widget (all pages)
   ═══════════════════════════════════════════════════════════════ */

:root {
  --reach-out-max: var(--site-max, 1360px);
  --reach-out-pad-x: clamp(20px, 4vw, 64px);
}

.reach-out {
  position: fixed;
  z-index: 10050;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  pointer-events: none;
  /* Desktop: align to site column, bottom-right */
  left: 0;
  right: 0;
  bottom: clamp(16px, 3vh, 24px);
}

.reach-out-shell {
  position: relative;
  max-width: var(--reach-out-max);
  margin: 0 auto;
  padding: 0 var(--reach-out-pad-x);
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  min-height: 52px;
  pointer-events: none;
}

.reach-out-shell > * {
  pointer-events: auto;
}

/* ── Floating trigger (always visible) ── */
.reach-out-fab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 999px;
  background: linear-gradient(145deg, #0f1f16 0%, #0a1510 100%);
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.28s, border-color 0.28s;
  animation: reachOutPulse 3.2s ease-in-out infinite;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.reach-out-fab:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: rgba(34, 197, 94, 0.75);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(34, 197, 94, 0.2);
  animation: none;
}

.reach-out-fab img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.reach-out-fab span {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding-right: 4px;
  white-space: nowrap;
}

.reach-out.is-open .reach-out-fab {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  animation: none;
}

/* ── Panel (unified) ── */
.reach-out-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - var(--reach-out-pad-x) * 2));
  height: min(72vh, 580px);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, #0f1f16 0%, #0a120e 100%);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.94);
  transform-origin: bottom right;
  transition:
    opacity 0.32s ease,
    transform 0.38s cubic-bezier(0.34, 1.35, 0.64, 1),
    visibility 0.32s;
}

.reach-out.is-open .reach-out-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── Yee-Ha moment ── */
.reach-out-yeeha {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(circle at 50% 40%, rgba(34, 197, 94, 0.22) 0%, rgba(8, 15, 11, 0.97) 68%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.reach-out-yeeha.is-playing {
  opacity: 1;
  visibility: visible;
}

.reach-out-yeeha-burst {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.35) 0%, transparent 70%);
  animation: yeehaBurst 0.9s ease-out forwards;
}

.reach-out-yeeha-mascot {
  width: clamp(100px, 28vw, 130px);
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  animation: yeehaMascot 0.85s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
}

.reach-out-yeeha-text {
  font-family: 'Bebas Neue', 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2.8rem, 12vw, 3.6rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: #fff;
  margin: 0;
  line-height: 1;
  position: relative;
  z-index: 1;
  text-shadow: 0 4px 20px rgba(34, 197, 94, 0.45);
  animation: yeehaText 0.75s cubic-bezier(0.34, 1.45, 0.64, 1) 0.08s forwards;
  transform: scale(0.2) rotate(-8deg);
  opacity: 0;
}

.reach-out-yeeha-sub {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(34, 197, 94, 0.9);
  margin: 0;
  position: relative;
  z-index: 1;
  animation: yeehaSub 0.5s ease 0.35s forwards;
  opacity: 0;
  transform: translateY(8px);
}

@keyframes yeehaBurst {
  from { transform: scale(0.3); opacity: 0.9; }
  to { transform: scale(1.6); opacity: 0; }
}

@keyframes yeehaMascot {
  0% { transform: translateY(40px) scale(0.5) rotate(-12deg); opacity: 0; }
  55% { transform: translateY(-8px) scale(1.08) rotate(4deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes yeehaText {
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes yeehaSub {
  to { transform: translateY(0); opacity: 1; }
}

.reach-out-yeeha::before,
.reach-out-yeeha::after {
  content: '✦';
  position: absolute;
  font-size: 1.4rem;
  color: #86efac;
  opacity: 0;
  animation: yeehaSpark 0.7s ease 0.2s forwards;
}

.reach-out-yeeha::before { top: 18%; left: 14%; }
.reach-out-yeeha::after { bottom: 22%; right: 12%; animation-delay: 0.35s; }

@keyframes yeehaSpark {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.6; transform: scale(1); }
}

/* ── Main content (after yeeha) ── */
.reach-out-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.reach-out-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.reach-out-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
}

.reach-out-tab {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px 10px 0 0;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.reach-out-tab.is-active {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #ecfdf5;
}

.reach-out-pane {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.reach-out-pane.is-active {
  display: flex;
}

.reach-out-disclaimer {
  margin: 0;
  padding: 10px 16px 0;
  font-size: 10px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.42);
  flex-shrink: 0;
}

.reach-out-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.reach-out-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.reach-out-msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
}

.reach-out-msg--user {
  align-self: flex-end;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #ecfdf5;
}

.reach-out-msg--typing {
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
}

.reach-out-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.reach-out-chip {
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 11px;
  cursor: pointer;
}

.reach-out-chip:hover {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.55);
}

.reach-out-cta {
  display: none;
  margin: 0 16px 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}

.reach-out-cta.is-visible {
  display: block;
}

.reach-out-cta p {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
}

.reach-out-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 999px;
  background: #22c55e;
  color: #041208;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-decoration: none;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.reach-out-cta a:hover {
  background: #4ade80;
}

.reach-out-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  margin-top: auto;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 18, 14, 0.92) 18%);
}

.reach-out-compose-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(134, 239, 172, 0.9);
}

.reach-out-compose-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.reach-out-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 11px 12px;
  resize: none;
  min-height: 42px;
  max-height: 96px;
}

.reach-out-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.reach-out-input:focus {
  outline: none;
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.reach-out-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: #22c55e;
  color: #041208;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.reach-out-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@keyframes reachOutPulse {
  0%, 100% { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(34, 197, 94, 0); }
  50% { box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(34, 197, 94, 0.12); }
}

.reach-out-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.reach-out-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.reach-out-body {
  padding: 18px 20px 20px;
  overflow-y: auto;
}

.reach-out-body h2 {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #fff;
  margin: 0 28px 8px 0;
  line-height: 1.2;
}

.reach-out-body > p {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 18px;
}

.reach-out-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reach-out-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transition: background 0.22s, border-color 0.22s, transform 0.22s;
}

.reach-out-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.reach-out-btn--primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-color: rgba(34, 197, 94, 0.5);
  color: #052e14;
}

.reach-out-btn--primary:hover {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  border-color: rgba(74, 222, 128, 0.6);
  color: #052e14;
}

/* Widget always visible and usable — do not tie to homepage loader */
.reach-out {
  opacity: 1;
}

/* Mobile: bottom-left — clear footer mascot, stay fixed */
@media (max-width: 640px) {
  .reach-out {
    left: max(12px, env(safe-area-inset-left));
    right: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: auto;
  }

  .reach-out-shell {
    max-width: none;
    margin: 0;
    padding: 0;
    justify-content: flex-start;
  }

  .reach-out-fab span {
    display: none;
  }

  .reach-out-fab {
    padding: 6px;
    border-radius: 50%;
  }

  .reach-out-fab img {
    width: 52px;
    height: 52px;
  }

  .reach-out-panel {
    left: 0;
    right: auto;
    width: min(320px, calc(100vw - 24px - env(safe-area-inset-left, 0px)));
    height: min(78vh, 560px);
    min-height: 360px;
    transform-origin: bottom left;
  }

  .reach-out.is-open .reach-out-panel {
    transform: translateY(0) scale(1);
  }

  .reach-out-topbar {
    padding: 10px 10px 0 12px;
    gap: 8px;
  }

  .reach-out-tab {
    font-size: 11px;
    padding: 9px 8px;
  }

  .reach-out-disclaimer,
  .reach-out-messages,
  .reach-out-suggestions,
  .reach-out-compose {
    padding-left: 12px;
    padding-right: 12px;
  }

  .reach-out-cta {
    margin: 0 12px 10px;
    padding: 10px 12px;
  }

  .reach-out-cta a,
  .reach-out-btn {
    font-size: 11px;
    padding: 10px 12px;
    letter-spacing: 0.02em;
  }

  .reach-out-body {
    padding: 16px 14px 16px;
  }

  .reach-out-compose {
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .reach-out-fab { animation: none; }
  .reach-out-yeeha-mascot,
  .reach-out-yeeha-text,
  .reach-out-yeeha-sub,
  .reach-out-yeeha-burst { animation: none !important; opacity: 1 !important; transform: none !important; }
  .reach-out-yeeha { transition: opacity 0.2s; }
}
