/* ============================================================
   SOCIAL SHARE MENU COMPONENT
   Floating bottom-left, mirrors scroll-button style.
   Web-only (screen-only class), hidden in print via @media print.
   ============================================================ */

.share-stack {
  position: fixed;
  bottom: 24px;
  left: 20px;
  z-index: 100;
}

.share-trigger {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.share-trigger svg {
  width: 18px;
  height: 18px;
}

.share-trigger:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: var(--primary-glow);
}

.share-trigger:active {
  transform: scale(0.92);
}

/* Menu panel: absolute positioned above trigger, slides in from bottom */
.share-menu {
  position: absolute;
  bottom: 60px;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: slideUp 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.share-menu[hidden] {
  display: none;
}

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

/* Individual share options */
.share-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-align: left;
}

.share-option:hover {
  border-color: rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.06);
  color: var(--primary);
}

.share-option:active {
  transform: scale(0.98);
}

/* Icons: 18×18 for consistency */
.share-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-color: currentColor;
}

/* Inline SVG icons (generic: email, copy, print) */
.share-option svg.share-icon {
  background: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Brand icons via mask-image + CDN */
.share-icon--linkedin,
.share-icon--twitter,
.share-icon--whatsapp,
.share-icon--reddit,
.share-icon--hackernews {
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

/* jsDelivr CDN paths for Simple Icons — auto-updated */
.share-icon--linkedin {
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/linkedin.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/linkedin.svg');
}

.share-icon--twitter {
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/x.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/x.svg');
}

.share-icon--whatsapp {
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/whatsapp.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/whatsapp.svg');
}

/* Brand color on hover */
.share-option:hover .share-icon--linkedin {
  background-color: #0A66C2;
}

.share-option:hover .share-icon--twitter {
  background-color: #ffffff;
}

.share-option:hover .share-icon--whatsapp {
  background-color: #25D366;
}

.share-icon--reddit {
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/reddit.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/reddit.svg');
}

.share-icon--hackernews {
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/ycombinator.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/ycombinator.svg');
}

.share-option:hover .share-icon--reddit {
  background-color: #FF4500;
}

.share-option:hover .share-icon--hackernews {
  background-color: #FF6600;
}

/* Web-only and print suppression */
@media print {
  .share-stack {
    display: none !important;
  }
}

/* Smaller on mobile */
@media (max-width: 600px) {
  .share-stack {
    bottom: 16px;
    left: 14px;
  }

  .share-trigger {
    width: 40px;
    height: 40px;
  }

  .share-trigger svg {
    width: 16px;
    height: 16px;
  }

  .share-menu {
    min-width: min(260px, calc(100vw - 40px));
  }
}

/* Reduced motion: skip animations */
@media (prefers-reduced-motion: reduce) {
  .share-menu {
    animation: none;
  }
}
