/* Floating social bar — self-contained widget styles.
   All selectors are scoped under .sfb; variables live on .sfb (no globals). */

.sfb {
  --sfb-accent: #ED1C0E;   /* brand red */
  --sfb-size: 44px;        /* social button size */
  --sfb-gap: 10px;         /* spacing between icons */

  position: fixed;
  right: 32px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: row;
  align-items: center;
}

/* frosted-glass boxed social buttons */
.sfb-item {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sfb-size);
  height: var(--sfb-size);
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  background: rgba(22, 20, 19, 0.30);
  -webkit-backdrop-filter: blur(13px) saturate(1.4);
  backdrop-filter: blur(13px) saturate(1.4);
  border: 1.5px solid color-mix(in srgb, var(--sfb-accent) 60%, transparent);

  /* closed (collapsed) state */
  opacity: 0;
  transform: scale(0.2) rotate(-120deg);
  margin-right: calc(var(--sfb-size) * -1);   /* removes its footprint */
  pointer-events: none;

  transition:
    transform .52s cubic-bezier(.34,1.56,.64,1),
    opacity .34s ease,
    margin-right .46s cubic-bezier(.5,0,.18,1),
    background .22s ease,
    border-color .22s ease;
}
.sfb-item svg { width: 21px; height: 21px; }

/* hover: solid red fill */
.sfb-item:hover {
  background: var(--sfb-accent);
  border-color: var(--sfb-accent);
  transform: scale(1.12) !important;
}

/* --- visible state --- */
/* desktop: primary socials always shown */
.sfb-primary {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  margin-right: var(--sfb-gap);
  pointer-events: auto;
}
/* when open: every item shows, staggered by --i (nearest the button first) */
.sfb[data-open="true"] .sfb-item {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  margin-right: var(--sfb-gap);
  pointer-events: auto;
  transition-delay: calc(var(--i) * 0.055s);
}

/* red share / toggle button */
.sfb-toggle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  color: #fff;
  cursor: pointer;
  background: var(--sfb-accent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--sfb-accent) 44%, transparent);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
  -webkit-tap-highlight-color: transparent;
}
.sfb-toggle svg {
  width: 22px; height: 22px;
  transition: transform .42s cubic-bezier(.34,1.56,.64,1);
}
.sfb-toggle:hover { transform: scale(1.09); }
.sfb-toggle:active { transform: scale(0.92); }
.sfb[data-open="true"] .sfb-toggle svg { transform: rotate(90deg) scale(1.05); }

/* MOBILE: primary socials hide until opened */
@media (max-width: 767px) {
  .sfb-primary {
    opacity: 0;
    transform: scale(0.2) rotate(-120deg);
    margin-right: calc(var(--sfb-size) * -1);
    pointer-events: none;
  }
}

/* NARROW (<500px): fan the icons out vertically (stacked above the button).
   Collapse footprint with margin-bottom instead of margin-right. */
@media (max-width: 499px) {
  .sfb {
    flex-direction: column;
    align-items: center;
  }

  /* closed: remove the item's vertical footprint */
  .sfb-item,
  .sfb-primary {
    margin-right: 0;
    margin-bottom: calc(var(--sfb-size) * -1);
    transition:
      transform .52s cubic-bezier(.34,1.56,.64,1),
      opacity .34s ease,
      margin-bottom .46s cubic-bezier(.5,0,.18,1),
      background .22s ease,
      border-color .22s ease;
  }

  /* open: stack with vertical spacing */
  .sfb[data-open="true"] .sfb-item {
    margin-right: 0;
    margin-bottom: var(--sfb-gap);
  }
}
