/*
 * Floating social sidebar — permanent (always expanded) layout.
 *
 * The previous +/- toggle button was removed in favour of a static
 * pill that keeps every social link and the WeChat QR trigger
 * visible at all times. The root <nav> is rendered with the
 * `is-expanded` class so the panel never collapses.
 */

.floating-social {
  --floating-social-green: var(--green, #008c11);
  --floating-social-green-dark: #006f0d;
  position: fixed;
  z-index: 90;
  top: 50%;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 7px;
  border: 1px solid rgb(0 140 17 / 14%);
  border-radius: 999px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 18px 50px rgb(0 71 9 / 14%), 0 2px 8px rgb(0 71 9 / 8%);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transform: translateY(-50%);
}

.floating-social__panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: none;
  opacity: 1;
  pointer-events: auto;
}

.floating-social__link {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--floating-social-green);
  border-radius: 50%;
  color: #fff;
  background: var(--floating-social-green);
  text-decoration: none;
  transition: color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}

.floating-social__item {
  position: relative;
}

button.floating-social__link {
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.floating-social__link:link,
.floating-social__link:visited {
  color: #fff;
}

.floating-social__link:hover,
.floating-social__link:focus-visible {
  color: #fff;
  background: var(--floating-social-green-dark);
  box-shadow: 0 8px 20px rgb(0 140 17 / 25%);
}

.floating-social__link:focus-visible {
  outline: 3px solid rgb(0 140 17 / 20%);
  outline-offset: 3px;
}

.floating-social__link .iconfont {
  color: #fff !important;
  font-size: 21px;
  line-height: 1;
  -webkit-text-fill-color: #fff;
}

.floating-social__link .iconfont::before {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
}

.floating-social__custom-icon {
  width: 21px;
  height: 21px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.floating-social__link--top[hidden] {
  display: none;
}

.floating-social__link > span {
  position: absolute;
  right: calc(100% + 14px);
  width: max-content;
  max-width: 180px;
  padding: 9px 13px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  color: #fff;
  background: rgb(0 91 12 / 94%);
  box-shadow: 0 8px 24px rgb(0 71 9 / 18%);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px) scale(.97);
  transition: opacity 180ms ease, transform 180ms ease;
}

.floating-social__link:hover > span,
.floating-social__link:focus-visible > span {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.floating-social__qr {
  position: absolute;
  top: 50%;
  right: calc(100% + 16px);
  width: 178px;
  padding: 12px;
  border: 1px solid rgb(0 140 17 / 16%);
  border-radius: 14px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: #fff;
  box-shadow: 0 18px 44px rgb(0 71 9 / 20%);
  transform: translate(10px, -50%) scale(.96);
  transform-origin: right center;
  transition: visibility 0s linear 180ms, opacity 180ms ease, transform 180ms ease;
}

.floating-social__qr::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -7px;
  width: 12px;
  height: 12px;
  border-top: 1px solid rgb(0 140 17 / 16%);
  border-right: 1px solid rgb(0 140 17 / 16%);
  background: #fff;
  transform: translateY(-50%) rotate(45deg);
}

.floating-social__qr-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.floating-social__item--wechat:hover .floating-social__qr,
.floating-social__item--wechat:focus-within .floating-social__qr {
  visibility: visible;
  opacity: 1;
  transform: translate(0, -50%) scale(1);
  transition-delay: 0s;
}

@media (min-width: 1025px) and (max-width: 1440px) {
  .floating-social {
    right: 12px;
  }
}

@media (max-width: 767px) {
  .floating-social {
    top: auto;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    flex-direction: row;
    gap: 5px;
    max-width: calc(100vw - 24px);
    padding: 6px;
    transform: none;
  }

  .floating-social__link {
    /* 42 → 44：手机端底部浮动栏是主要转化入口（Get a quote / WhatsApp），
       取 WCAG 2.5.5 增强值 44×44；5 个 44 仍是 252px，窄屏（≥320）不挤不换行。 */
    width: 44px;
    height: 44px;
  }

  .floating-social__panel {
    flex-direction: row;
    gap: 5px;
    max-height: none;
    max-width: none;
  }

  .floating-social__link > span {
    display: none;
  }

  .floating-social__qr {
    top: auto;
    right: 0;
    bottom: calc(100% + 14px);
    transform: translateY(8px) scale(.96);
    transform-origin: right bottom;
  }

  .floating-social__qr::after {
    top: auto;
    right: 15px;
    bottom: -7px;
    transform: rotate(135deg);
  }

  .floating-social__item--wechat:hover .floating-social__qr,
  .floating-social__item--wechat:focus-within .floating-social__qr {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-social__link,
  .floating-social__link > span,
  .floating-social__qr {
    transition: none;
  }
}