/* ═══════════════════════════════════════════════════════
   ALENA BUBBLE — CoExpera design system
   ═══════════════════════════════════════════════════════ */

/* ── Bubble ──────────────────────────────────────────── */
#alena-bubble {
  position: fixed;
  top: 28px;
  left: 28px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: visible;
  cursor: pointer;
  /* Поверх любого открытого модала, чтобы пузырёк всегда можно было открыть */
  z-index: 2147483000;
  display: none;
  touch-action: none;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

#alena-bubble:hover { transform: scale(1.07); }
#alena-bubble:active { transform: scale(0.94); }

/* Entrance — JS adds this class */
#alena-bubble.bubble-visible {
  display: block;
  animation: bubbleRise 0.72s cubic-bezier(0.34, 1.42, 0.64, 1) forwards;
}

/* Attention pulse — runs after entrance */
#alena-bubble.bubble-pulse {
  animation: bubbleAttract 2.6s ease-in-out 3;
}

@keyframes bubbleRise {
  0%   { opacity: 0; transform: translateY(32px) scale(0.5); }
  60%  { opacity: 1; transform: translateY(-7px) scale(1.07); }
  80%  { transform: translateY(3px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bubbleAttract {
  0%, 100% {
    box-shadow: 0 6px 22px rgba(40,35,30,0.16);
  }
  50% {
    box-shadow:
      0 8px 32px rgba(40,35,30,0.24),
      0 0 0 7px rgba(206,196,184,0.22);
  }
}

/* Photo */
#alena-bubble-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 10%;
  border: 2.5px solid #CEC4B8;
  box-shadow:
    0 6px 20px rgba(40,35,30,0.18),
    0 2px 6px  rgba(40,35,30,0.10);
  display: block;
  pointer-events: none;
  transition: box-shadow 0.2s ease;
}

#alena-bubble:hover #alena-bubble-img {
  box-shadow:
    0 10px 30px rgba(40,35,30,0.24),
    0 3px 10px  rgba(40,35,30,0.12);
}

/* Bubble close — subtle × without heavy background */
#alena-bubble-close {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(242,237,228,0.94);
  color: #A89E96;
  border: 1px solid rgba(206,196,184,0.5);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

#alena-bubble-close:hover {
  color: #4A4440;
  background: rgba(242,237,228,0.96);
  transform: scale(1.12);
}
#alena-bubble-close .cex-icon {
  width: 9px;
  height: 9px;
  stroke-width: 2.2;
}

/* ── Modal overlay ───────────────────────────────────── */
#alena-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(195, 180, 160, 0.30);
  /* Всегда выше любого другого открытого модала (макс. z-index в приложении ~99999) */
  z-index: 2147483600;
  /* Слегка размываем всё вокруг — включая модал под пузырьком */
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.22s ease;
}

#alena-modal.modal-opening {
  display: flex;
  opacity: 1;
}

#alena-modal.modal-closing {
  opacity: 0;
}

/* ── Modal box ──────────────────────────────────────── */
#alena-modal-box {
  background: #F7F2EA;
  border-radius: 24px;
  padding: 36px 28px 30px;
  max-width: 356px;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow:
    0  2px  4px rgba(40,35,30,0.04),
    0  8px 20px rgba(40,35,30,0.10),
    0 20px 40px rgba(40,35,30,0.10),
    0  0   0 1px rgba(206,196,184,0.55);
  transform-origin: center center;
  will-change: transform, opacity;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity   0.26s ease,
    transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-opening #alena-modal-box {
  opacity: 1;
  transform: translateY(0);
}

.modal-closing #alena-modal-box {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity   0.16s ease-in,
    transform 0.16s ease-in;
}

/* Photo in modal */
#alena-modal-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 10%;
  border: 2.5px solid #CEC4B8;
  margin-bottom: 14px;
  flex-shrink: 0;
  box-shadow:
    0 10px 30px rgba(40,35,30,0.16),
    0  3px  8px rgba(40,35,30,0.08);
  animation: photoIn 0.52s cubic-bezier(0.34, 1.36, 0.64, 1) 0.16s both;
}

@keyframes photoIn {
  from { opacity: 0; transform: scale(0.68) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Name */
#alena-modal-name {
  font-family: 'Jost', sans-serif;
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #28231E;
  margin-bottom: 6px;
  animation: fadeUp 0.45s ease 0.22s both;
}

/* Subtitle under name */
#alena-modal-subtitle {
  font-family: 'Jost', sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  color: #7A6E68;
  margin-bottom: 12px;
  text-align: center;
  animation: fadeUp 0.45s ease 0.26s both;
}

#alena-modal-subtitle a {
  color: #7A6E68;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}
#alena-modal-subtitle a:hover { color: #28231E; }

/* Thin divider */
#alena-modal-divider {
  width: 36px;
  height: 1px;
  background: linear-gradient(to right, transparent, #CEC4B8, transparent);
  margin: 0 auto 16px;
  animation: fadeUp 0.4s ease 0.30s both;
}

/* Text block */
#alena-modal-text {
  font-family: 'Jost', sans-serif;
  font-size: 13.5px;
  color: #3A342E;
  line-height: 1.72;
  text-align: center;
  animation: fadeUp 0.48s ease 0.34s both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#alena-modal-text p { margin: 0 0 11px; }
#alena-modal-text p:last-child { margin-bottom: 0; }

#alena-modal-text a {
  color: #5A5049;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s;
}
#alena-modal-text a:hover { color: #28231E; }

/* Modal close button */
#alena-modal-close {
  position: absolute;
  top: 13px;
  right: 15px;
  background: none;
  border: none;
  font-size: 19px;
  line-height: 1;
  color: #B8AFA7;
  cursor: pointer;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

#alena-modal-close:hover {
  color: #4A4440;
  background: rgba(206,196,184,0.22);
  transform: scale(1.1);
}
#alena-modal-close .cex-icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

/* ── Accessibility ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #alena-modal-box,
  #alena-modal,
  #alena-modal-photo,
  #alena-modal-name,
  #alena-modal-subtitle,
  #alena-modal-divider,
  #alena-modal-text {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
  #alena-bubble { width: 56px; height: 56px; top: 16px; left: 16px; }
  #alena-bubble-img { width: 56px; height: 56px; }
  #alena-modal-box { border-radius: 20px; padding: 30px 20px 26px; }
  #alena-modal-photo { width: 82px; height: 82px; margin-bottom: 12px; }
  #alena-modal-name { font-size: 14.5px; }
  #alena-modal-text { font-size: 13px; }
}
