/* Front Porch Business Consulting — Porch Guide
   In-browser navigation assistant. No remote APIs.
   Matches the navy / glass / electric-blue tech theme. */

.fpbc-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#fpbc-guide {
  position: relative;
  z-index: 9000;
  font-family: "Manrope", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink, #eef3fb);
  pointer-events: none;
}

#fpbc-guide * { pointer-events: auto; box-sizing: border-box; }

html.intro-pending #fpbc-guide {
  visibility: hidden;
  pointer-events: none;
}

.fpbc-guide-launcher {
  position: fixed;
  right: max(1.15rem, env(safe-area-inset-right));
  bottom: max(1.15rem, env(safe-area-inset-bottom));
  z-index: 9002;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid var(--glass-border, rgba(140, 190, 255, 0.22));
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(124, 199, 255, 0.35), transparent 55%),
    linear-gradient(160deg, rgba(22, 40, 74, 0.95), rgba(8, 14, 28, 0.95));
  box-shadow:
    0 0 0 1px rgba(77, 163, 255, 0.28),
    0 10px 28px -8px rgba(0, 0, 0, 0.7),
    0 0 36px -8px rgba(59, 140, 255, 0.7);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform 0.25s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)), box-shadow 0.25s;
}

.fpbc-guide-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 0 1px rgba(124, 199, 255, 0.5),
    0 14px 32px -8px rgba(0, 0, 0, 0.75),
    0 0 48px -6px rgba(59, 140, 255, 0.85);
}

.fpbc-guide-launcher:active { transform: translateY(0) scale(0.98); }

.fpbc-guide-launcher:focus-visible {
  outline: 3px solid var(--cyan, #7cc7ff);
  outline-offset: 3px;
}

.fpbc-guide-launcher.is-open {
  background: linear-gradient(160deg, #1d6ff2, #1248b8);
}

.fpbc-guide-launcher img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.fpbc-guide-launcher-x {
  display: none;
  width: 22px;
  height: 22px;
}

.fpbc-guide-launcher.is-open img { display: none; }
.fpbc-guide-launcher.is-open .fpbc-guide-launcher-x { display: block; }

.fpbc-guide-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 0 2px #0a1428, 0 0 10px #3ddc97;
}

.fpbc-guide-launcher.is-open .fpbc-guide-dot { display: none; }

.fpbc-guide-nudge {
  position: fixed;
  right: max(1.15rem, env(safe-area-inset-right));
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  z-index: 9001;
  max-width: min(22rem, calc(100vw - 5.5rem));
  padding: 0.8rem 2.1rem 0.8rem 0.95rem;
  border-radius: 16px 16px 4px 16px;
  background: var(--glass-strong, rgba(16, 27, 50, 0.78));
  border: 1px solid var(--glass-border, rgba(140, 190, 255, 0.22));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.7);
  color: var(--ink, #eef3fb);
  font-size: 0.92rem;
  line-height: 1.4;
  animation: fpbc-nudge-in 0.45s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.fpbc-guide-nudge[hidden] { display: none !important; }
.fpbc-guide-nudge p { margin: 0; }

.fpbc-guide-nudge-close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--slate, #b9c5d6);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.fpbc-guide-nudge-close:hover,
.fpbc-guide-nudge-close:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: 2px solid var(--cyan, #7cc7ff);
  outline-offset: 1px;
}

@keyframes fpbc-nudge-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.fpbc-guide-panel {
  container-type: size;
  container-name: porch-guide;
  position: fixed;
  right: max(1.15rem, env(safe-area-inset-right));
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  z-index: 9003;
  display: flex;
  flex-direction: column;
  width: min(24.5rem, calc(100vw - 1.5rem));
  height: min(36rem, calc(100vh - 7.25rem));
  max-height: calc(100vh - 7.25rem);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 28, 52, 0.94) 0%, rgba(8, 14, 28, 0.96) 100%);
  border: 1px solid var(--glass-border, rgba(140, 190, 255, 0.22));
  box-shadow:
    0 0 0 1px rgba(77, 163, 255, 0.12),
    0 24px 60px -16px rgba(0, 0, 0, 0.75),
    0 0 80px -24px rgba(59, 140, 255, 0.45);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  animation: fpbc-panel-in 0.35s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.fpbc-guide-panel[hidden] { display: none !important; }

@keyframes fpbc-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.fpbc-guide-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.85rem 0.85rem 1rem;
  border-bottom: 1px solid var(--line, rgba(160, 190, 230, 0.16));
  background: rgba(9, 16, 32, 0.55);
  flex-shrink: 0;
}

.fpbc-guide-head-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(140, 190, 255, 0.25);
}

.fpbc-guide-head h2 {
  margin: 0;
  font-family: var(--display, "Space Grotesk", "Manrope", sans-serif);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}

.fpbc-guide-tag {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  background: rgba(77, 163, 255, 0.16);
  border: 1px solid rgba(124, 199, 255, 0.28);
  color: var(--cyan, #7cc7ff);
  font-family: var(--display, "Space Grotesk", "Manrope", sans-serif);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fpbc-guide-head-text { flex: 1; min-width: 0; }

.fpbc-guide-close {
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--slate, #b9c5d6);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.fpbc-guide-close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.fpbc-guide-close:focus-visible {
  outline: 2px solid var(--cyan, #7cc7ff);
  outline-offset: 2px;
}

.fpbc-guide-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.9rem 1.1rem;
  display: block;
  scroll-behavior: auto;
}

.fpbc-guide-log > * + * {
  margin-top: 0.75rem;
}

.fpbc-guide-msg {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink, #eef3fb);
}

.fpbc-guide-msg p { margin: 0 0 0.55rem; }
.fpbc-guide-msg p:last-child { margin-bottom: 0; }

.fpbc-guide-msg.is-bot {
  background: rgba(18, 30, 54, 0.85);
  border: 1px solid var(--glass-border, rgba(140, 190, 255, 0.22));
  border-bottom-left-radius: 6px;
}

.fpbc-guide-msg.is-user {
  margin-left: auto;
  background: linear-gradient(160deg, rgba(37, 99, 220, 0.95), rgba(22, 70, 180, 0.95));
  border: 1px solid rgba(124, 199, 255, 0.25);
  border-bottom-right-radius: 6px;
  color: #fff;
}

.fpbc-guide-msg a {
  color: var(--cyan, #7cc7ff);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fpbc-guide-msg a:hover { color: #fff; }
.fpbc-guide-msg.is-user a { color: #fff; }

.fpbc-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.fpbc-guide-actions:empty { display: none; }

.fpbc-guide-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 199, 255, 0.35);
  background: rgba(77, 163, 255, 0.12);
  color: #e8f2ff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.fpbc-guide-action:hover,
.fpbc-guide-action:focus-visible {
  background: rgba(77, 163, 255, 0.28);
  color: #fff;
  outline: 2px solid var(--cyan, #7cc7ff);
  outline-offset: 2px;
}

.fpbc-guide-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 1.2em;
}

.fpbc-guide-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan, #7cc7ff);
  animation: fpbc-dot 1s ease-in-out infinite;
}

.fpbc-guide-typing span:nth-child(2) { animation-delay: 0.15s; }
.fpbc-guide-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fpbc-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.fpbc-guide-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.9rem 0.55rem;
  flex-shrink: 0;
}

.fpbc-guide-chip {
  appearance: none;
  border: 1px solid var(--line-strong, rgba(160, 190, 230, 0.38));
  background: rgba(255, 255, 255, 0.04);
  color: #e8eef8;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.fpbc-guide-chip:hover,
.fpbc-guide-chip:focus-visible {
  background: rgba(77, 163, 255, 0.16);
  border-color: var(--electric, #4da3ff);
  color: #fff;
  outline: 2px solid var(--cyan, #7cc7ff);
  outline-offset: 2px;
}

.fpbc-guide-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem 0.45rem;
  flex-shrink: 0;
  border-top: 1px solid var(--line, rgba(160, 190, 230, 0.16));
}

.fpbc-guide-form input[type="text"] {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 1px solid var(--line-strong, rgba(160, 190, 230, 0.38));
  background: rgba(5, 10, 22, 0.55);
  color: #fff;
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 0.92rem;
}

.fpbc-guide-form input[type="text"]::placeholder { color: #8d9bb0; }

.fpbc-guide-form input[type="text"]:focus-visible {
  outline: none;
  border-color: var(--electric, #4da3ff);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.35);
}

.fpbc-guide-send {
  appearance: none;
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #2468ea 0%, #1a56d0 100%);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px -6px rgba(59, 140, 255, 0.8);
}

.fpbc-guide-send:hover { background: linear-gradient(135deg, #2a72f0 0%, #1d5fe0 100%); }

.fpbc-guide-send:focus-visible {
  outline: 2px solid var(--cyan, #7cc7ff);
  outline-offset: 2px;
}

.fpbc-guide-send:disabled { opacity: 0.5; cursor: not-allowed; }

.fpbc-guide-note {
  margin: 0;
  padding: 0 0.9rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted, #a3b0c2);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .fpbc-guide-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: min(92vh, 40rem);
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation-name: fpbc-sheet-in;
  }

  .fpbc-guide-nudge {
    max-width: min(20rem, calc(100vw - 5.75rem));
  }

  @keyframes fpbc-sheet-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .fpbc-guide-launcher,
  .fpbc-guide-nudge,
  .fpbc-guide-panel,
  .fpbc-guide-chip,
  .fpbc-guide-action,
  .fpbc-guide-typing span {
    animation: none !important;
    transition: none !important;
  }
  .fpbc-guide-log { scroll-behavior: auto; }
}

@media print {
  #fpbc-guide { display: none !important; }
}


/* In-chat call request form */

.fpbc-guide-msg.has-form {
  max-width: 100%;
  padding-bottom: 0.85rem;
  overflow: visible;
  flex: 0 0 auto;
  min-height: min-content;
}

.fpbc-call-intro {
  margin: 0 0 0.65rem;
}

/* Default: one column, button at the end in normal flow.
   The 2-col viewport media query was applying inside a ~330px
   panel and, in a short flex log, crushed rows so the send
   button painted over the Name field. */
.fpbc-call-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  position: relative;
  height: auto;
  min-height: 0;
  overflow: visible;
}

.fpbc-call-form .field { margin: 0; }

.fpbc-call-form label,
.fpbc-call-form .field label {
  display: block;
  margin-bottom: 0.12rem;
  color: #e8eef8;
  font-size: 0.74rem;
  font-weight: 650;
}

.fpbc-call-form input[type="text"],
.fpbc-call-form input[type="email"],
.fpbc-call-form input[type="tel"],
.fpbc-call-form textarea {
  width: 100%;
  max-width: 100%;
  appearance: none;
  border: 1px solid var(--line-strong, rgba(160, 190, 230, 0.38));
  background: rgba(5, 10, 22, 0.55);
  color: #fff;
  border-radius: 10px;
  padding: 0.42rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
}

.fpbc-call-form textarea {
  min-height: 3.1rem;
  resize: vertical;
}

.fpbc-call-form input::placeholder,
.fpbc-call-form textarea::placeholder { color: #8d9bb0; }

.fpbc-call-form input:focus-visible,
.fpbc-call-form textarea:focus-visible {
  outline: none;
  border-color: var(--electric, #4da3ff);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.35);
}

.fpbc-call-form .honeypot {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.fpbc-call-form .btn,
.fpbc-call-form button[type="submit"] {
  position: static;
  inset: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.88rem;
  flex: 0 0 auto;
  justify-self: stretch;
  grid-column: auto;
  grid-row: auto;
}

.fpbc-call-status {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--slate, #b9c5d6);
}

.fpbc-call-status.is-error { color: #ffb4b4; }

.fpbc-guide-action[data-guide-call] {
  cursor: pointer;
}

#fpbc-guide.fpbc-guide-has-call .fpbc-guide-chips {
  display: none;
}
