.footer-inner.has-footer-social {
  position: relative;
  min-height: 44px;
  align-items: flex-start;
}

.footer-inner.has-footer-social > :is(span, a) {
  display: flex;
  align-items: flex-start;
  min-height: 44px;
  top: 0 !important;
}

.footer-social-group {
  --footer-control-width: 152px;
  position: absolute;
  left: 50%;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px 24px;
  /* Place the two middle labels at one third and two thirds of the footer. */
  width: calc(100% / 3 + var(--footer-control-width));
  max-width: 100%;
  transform: translateX(-50%);
  text-align: center;
}

.footer-social { flex: 0 0 auto; width: var(--footer-control-width); }

.footer-social-switch {
  position: relative;
  width: 100%;
  height: 44px;
  margin-inline: auto;
  border-radius: 4px;
  --social-ease: cubic-bezier(.45, 0, .25, 1);
}

.footer-social-trigger {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.footer-social-label {
  display: block;
  white-space: nowrap;
  transition: transform 750ms var(--social-ease), opacity 550ms var(--social-ease);
}
.footer-social-trigger:is(:hover, :focus-visible) { color: var(--accent); }

.footer-social-links {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.footer-social-link {
  position: relative;
  display: grid;
  place-items: start center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms var(--social-ease), color 200ms ease, visibility 0s 750ms;
}

.footer-social-link:nth-child(2) { transition-delay: 35ms, 0s, 785ms; }
/* Text and icons occupy the same first line; the separate hit area stays 44px tall. */
.footer-social-icon-mask {
  display: grid;
  place-items: center;
  width: 100%;
  height: 1.4em;
  overflow: clip;
}
.footer-social-icon {
  display: block;
  width: 1.4em;
  height: 1.4em;
  background: currentColor;
  -webkit-mask: var(--social-icon) center / contain no-repeat;
  mask: var(--social-icon) center / contain no-repeat;
  transform: translateY(150%);
  transition: transform 750ms var(--social-ease);
}
.footer-social-link:nth-child(2) .footer-social-icon { transition-delay: 35ms; }
.footer-social-link[data-platform="xiaohongshu"] .footer-social-icon { width: 2.2em; }

.footer-social[data-open="true"] .footer-social-label { transform: translateY(-150%); opacity: 0; }
.footer-social[data-open="true"] .footer-social-link {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.footer-social[data-open="true"] .footer-social-link:nth-child(2) { transition-delay: 35ms, 0s, 0s; }
.footer-social[data-open="true"] .footer-social-icon { transform: translateY(0); }
.footer-inner .footer-social-link:is(:hover, :focus-visible) { color: var(--accent); text-decoration: none; }
.footer-social-trigger:focus-visible { outline: none; }
.footer-social-switch:has(.footer-social-trigger:focus-visible) { outline: 2px solid currentColor; outline-offset: 3px; }
.footer-social-link:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; border-radius: 4px; }

.footer-social-link::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: 6px 9px;
  border-radius: 4px;
  background: #20221f;
  color: #f3f4ee;
  font-size: var(--chrome-display-size);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 220ms ease, transform 220ms ease;
}
.footer-social-link:is(:hover, :focus-visible)::after { opacity: 1; transform: translate(-50%, 0); }

/* Keep the center control clear of long copyright text and narrow windows. */
.footer-inner.footer-social-new-row { row-gap: 20px; }
.footer-social-new-row .footer-social-group {
  position: static;
  order: -1;
  flex: 0 0 100%;
  width: 100%;
  justify-content: space-evenly;
  flex-wrap: wrap;
  transform: none;
}

/* Touch, editing and reduced motion show the destinations directly. */
.footer-social-group:has(.footer-social[data-static="true"]) {
  --footer-control-width: max(152px, calc(8em + 116px));
}
.footer-social[data-static="true"] .footer-social-switch {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 100%;
}
.footer-social[data-static="true"] .footer-social-trigger {
  position: static;
  flex: 0 0 auto;
  cursor: default;
  opacity: 1;
  min-height: 44px;
}
.footer-social[data-static="true"] .footer-social-label { transform: none; opacity: 1; }
.footer-social[data-static="true"] .footer-social-links { position: static; }
.footer-social[data-static="true"] .footer-social-link { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
.footer-social[data-static="true"] .footer-social-icon { transform: none; }
.footer-social[data-static="true"] :is(.footer-social-label, .footer-social-link, .footer-social-icon) { transition: none; }

.footer-copy-status {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  width: max-content;
  max-width: min(360px, calc(100vw - 40px));
  margin: 0;
  padding: 9px 13px;
  border-radius: 5px;
  background: #20221f;
  color: #f3f4ee;
  font: inherit;
  font-weight: 500;
  overflow-wrap: anywhere;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 0s 220ms;
}
.footer-copy-status[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.footer-copy-status[data-failed="true"] { pointer-events: auto; user-select: text; }

@media (prefers-reduced-motion: reduce) {
  .footer-social-group *, .footer-social-group *::after { transition: none !important; }
}
