/* ================================================================
   CONTACT.CSS — Compact contact section + Floating chat widget
   ================================================================ */

#contact {
  background: var(--bg-secondary);
}

/* ── Big editorial header ── */
.contact-center {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 4rem;
}

.contact-big-title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.contact-big-title .text-accent {
  color: var(--accent);
}

.contact-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Email CTA big ── */
.contact-email-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.contact-email-link {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 2px;
  transition: border-color var(--duration-mid), color var(--duration-mid);
}
.contact-email-link:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ── Contact cards row ── */
.contact-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  max-width: 1100px;
  margin: 0 auto;
}

.contact-card {
  background: var(--bg-card);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
  cursor: none;
  transition: background var(--duration-mid);
  position: relative;
  overflow: hidden;
}

.contact-card:hover {
  background: var(--bg-elevated);
}

.contact-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  flex-shrink: 0;
  transition: border-color var(--duration-mid), color var(--duration-mid), background var(--duration-mid);
}

.contact-card:hover .contact-card-icon {
  border-color: var(--card-border, var(--accent));
  color: var(--card-border, var(--accent));
  background: var(--bg-primary);
}

.contact-card-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-card-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.contact-card-hint {
  font-size: 0.75rem;
  color: var(--card-border, var(--accent));
  margin-top: auto;
  padding-top: 0.75rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--duration-mid), transform var(--duration-mid) var(--ease-spring);
}
.contact-card:hover .contact-card-hint {
  opacity: 1;
  transform: translateY(0);
}

/* Per-card themes */
.contact-card--email     { --card-border: var(--accent); }
.contact-card--email .contact-card-value {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.contact-card--github    { --card-border: #8b949e; }
.contact-card--instagram { --card-border: #E1306C; }
.contact-card--discord   { --card-border: #5865F2; }
.contact-card--chat      { --card-border: #4ade80; }

@media (max-width: 900px) {
  .contact-cards {
    grid-template-columns: repeat(3, 1fr);
    border-radius: var(--border-radius);
  }
}
@media (max-width: 600px) {
  .contact-cards { grid-template-columns: repeat(2, 1fr); }
  .contact-card:last-child:nth-child(odd) { grid-column: span 2; }
}
@media (max-width: 400px) {
  .contact-cards { grid-template-columns: 1fr; }
  .contact-card:last-child:nth-child(odd) { grid-column: span 1; }
}

/* ================================================================
   FLOATING CHAT WIDGET
   ================================================================ */

.chat-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--z-modal);
}

/* Floating bubble button */
.chat-float-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  box-shadow: 0 8px 32px rgba(79,124,130,0.28), 0 2px 8px rgba(0,0,0,0.12);
  transition: transform var(--duration-mid) var(--ease-spring),
              box-shadow var(--duration-mid);
  position: relative;
  flex-shrink: 0;
}

.chat-float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(79,124,130,0.40), 0 4px 16px rgba(0,0,0,0.12);
}

.chat-float-icon--close { display: none; }
.chat-float.is-open .chat-float-icon--open  { display: none; }
.chat-float.is-open .chat-float-icon--close { display: block; }

/* Notification badge */
.chat-float-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ff5555;
  border: 2px solid var(--bg-primary);
  display: none;
}
.chat-float-badge.show { display: block; animation: badge-pulse 2s ease-in-out infinite; }

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.3); }
}

/* Chat popup window */
.chat-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  width: 340px;
  height: 480px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15), 0 0 0 1px rgba(79,124,130,0.12);

  /* Hidden state */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out),
              transform 0.35s var(--ease-spring);
  transform-origin: bottom right;
}

.chat-float.is-open .chat-window {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.chat-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-glow-lg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-header-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.chat-header-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-header-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

.chat-close-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-left: auto;
  cursor: none;
  transition: all var(--duration-fast);
}
.chat-close-btn:hover { border-color: #ff5555; color: #ff5555; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

.chat-msg {
  display: flex;
  max-width: 82%;
  animation: msg-in 0.35s var(--ease-spring) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg--bot  { align-self: flex-start; }
.chat-msg--user { align-self: flex-end; }

.chat-msg-bubble {
  padding: 0.65rem 0.9rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.chat-msg--bot  .chat-msg-bubble { background: var(--bg-elevated); color: var(--text-primary); border-bottom-left-radius: 4px; }
.chat-msg--user .chat-msg-bubble { background: var(--accent); color: var(--bg-primary); font-weight: 500; border-bottom-right-radius: 4px; }

/* Typing */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.9rem;
  background: var(--bg-elevated);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.chat-typing span {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-dot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* Chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.1rem 0.75rem;
}
.chat-chip {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  transition: all var(--duration-fast);
  cursor: none;
}
.chat-chip:hover { border-color: var(--accent); color: var(--accent); }

/* Input */
.chat-input-area {
  display: flex;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  padding: 0.55rem 1rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color var(--duration-fast);
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-spring);
}
.chat-send-btn:hover { transform: scale(1.12); }

/* Success state */
.chat-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 100%;
  padding: 2rem;
  text-align: center;
}
.chat-success-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-glow-lg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  animation: pop-in 0.5s var(--ease-spring) both;
}
@keyframes pop-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Pulse on load */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.6; }
}

@media (max-width: 480px) {
  .chat-float { bottom: 16px; right: 16px; }

  /* Full-screen chat on mobile, fixed to visual viewport */
  .chat-window {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }

  /* Hide the float button when chat is open on mobile */
  .chat-float.is-open .chat-float-btn { display: none; }
}
