/* Folio Harbor & Kestrel AI - Luxury Messenger & Magnetic Draggable Launcher */
#folio-messenger [hidden], #folio-messenger[hidden] { display:none !important; }

/* The Proactive Teaser Bubble */
#folio-teaser {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 100;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 0 20px rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
  font-size: 12.5px;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  cursor: pointer;
  max-width: 290px;
  animation: folio-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.2s ease, transform 0.2s ease, left 0.35s ease, right 0.35s ease;
  user-select: none;
}
#folio-teaser:hover {
  transform: translateY(-2px);
  border-color: #06b6d4;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(6, 182, 212, 0.3);
}
#folio-teaser.is-dragging {
  opacity: 0 !important;
  pointer-events: none;
}
#folio-teaser .teaser-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  flex-shrink: 0;
  animation: folio-pulse 2s infinite;
}
#folio-teaser .teaser-text {
  flex: 1;
  line-height: 1.4;
}
#folio-teaser .teaser-text strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
#folio-teaser .teaser-text span {
  font-size: 11px;
  color: #94a3b8;
}
#folio-teaser .teaser-close {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
}
#folio-teaser .teaser-close:hover {
  color: #fff;
}
#folio-messenger.is-open #folio-teaser {
  display: none !important;
}

/* The Floating Launcher Button (Draggable & Magnetic Snapping) */
#folio-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 60px;
  height: 60px;
  padding: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 50%, #06b6d4 100%);
  color: #fff;
  border: none;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 0 rgba(255, 255, 255, 0.25), 0 0 24px rgba(99, 102, 241, 0.45);
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}
#folio-launcher.is-dragging {
  cursor: grabbing !important;
  transition: none !important;
  transform: scale(1.08) !important;
  box-shadow: 0 16px 40px rgba(99, 102, 241, 0.7), 0 0 35px rgba(6, 182, 212, 0.5) !important;
}
#folio-launcher.is-snapping {
  transition: left 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.25), top 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.25), transform 0.2s ease !important;
}
#folio-launcher::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(6, 182, 212, 0.35));
  z-index: -1;
  opacity: 0.6;
  animation: folio-ripple 2.5s infinite;
}
#folio-launcher:hover:not(.is-dragging) {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 38px rgba(99, 102, 241, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.4);
}
#folio-launcher svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
#folio-messenger.is-open #folio-launcher svg {
  transform: rotate(90deg) scale(0.9);
}

.folio-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 2.5px solid #06090e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  pointer-events: none;
}

/* Floating Messenger Dialog Window */
#folio-panel {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 96px;
  width: 420px;
  height: min(700px, calc(100dvh - 120px));
  min-height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(13, 18, 28, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 48px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 0 rgba(255, 255, 255, 0.12), 0 0 35px rgba(99, 102, 241, 0.25);
  display: flex;
  flex-direction: column;
  animation: folio-reveal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}
#folio-messenger.is-wide #folio-panel {
  width: min(700px, calc(100vw - 48px));
}

.folio-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
  height: 56px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 24, 39, 0.8);
}
.folio-panel-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.folio-panel-header img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}
.folio-panel-header strong {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}
.folio-panel-header > div:last-child {
  display: flex;
  align-items: center;
  gap: 4px;
}
.folio-panel-header button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 15px;
  color: #94a3b8;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.folio-panel-header button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

#folio-frame-slot {
  flex: 1;
  min-height: 0;
  background: transparent;
}
#folio-frame-slot iframe {
  border: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

#folio-announcement {
  /* Remain available to screen readers without extending the document. */
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@keyframes folio-reveal {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes folio-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: none; }
}
@keyframes folio-ripple {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes folio-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

@media (max-width: 600px) {
  #folio-launcher { width: 48px; height: 48px; padding: 12px; }
  #folio-teaser { display: none !important; }
  #folio-panel, #folio-messenger.is-wide #folio-panel {
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #folio-messenger.is-open #folio-launcher { display: none; }
  #folio-expand { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #folio-panel { animation: none; }
  #folio-launcher { transition: none; }
  #folio-launcher::after { animation: none; }
}
