/* Contact actions v6
 *
 * Adds a persistent in-page contact entry and stronger action affordances.
 * This is a new immutable asset so returning visitors receive the update.
 */

html:has(.contact-float) {
  scroll-behavior: smooth;
}

.contact-float {
  position: fixed;
  z-index: 72;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  isolation: isolate;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 11px;
  min-width: 168px;
  padding: 10px 10px 10px 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, .16), transparent 35%),
    linear-gradient(135deg, #d11c2b 0%, var(--red) 52%, #8e0812 100%);
  box-shadow: 0 18px 48px rgba(115, 5, 14, .28), 0 3px 10px rgba(72, 4, 10, .18);
  opacity: 1;
  visibility: visible;
  transform: translateZ(0);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, opacity 180ms ease, visibility 0s linear 0s;
  animation: contact-float-arrive 560ms cubic-bezier(.2, .8, .2, 1) backwards;
}

.contact-float.is-contact-area-visible {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(.94);
  transition-delay: 0s, 0s, 0s, 0s, 180ms;
}

.contact-float::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, .18) 48%, transparent 72%);
  transform: translateX(-130%);
  transition: transform 520ms ease;
}

.contact-float > * {
  position: relative;
  z-index: 1;
}

.contact-float-signal {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6f8e3;
  box-shadow: 0 0 0 4px rgba(214, 248, 227, .14);
}

.contact-float-signal::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(214, 248, 227, .42);
  border-radius: inherit;
  animation: contact-signal 2.2s ease-out infinite;
}

.contact-float-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.contact-float-copy small {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .2em;
  opacity: .62;
}

.contact-float-copy strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .05em;
  white-space: nowrap;
}

.contact-float-arrow {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--red);
  background: #fffdfa;
  box-shadow: 0 7px 18px rgba(3, 34, 37, .18);
  font-size: 16px;
  transition: transform 220ms ease, background-color 220ms ease;
}

.contact-float:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.site-nav .nav-contact {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 9px 24px rgba(122, 7, 16, .16);
  transition: transform 200ms ease, background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.site-header.scrolled .nav-contact,
.inner-page .nav-contact {
  border-color: var(--red);
}

.nav-contact span {
  color: currentColor;
  transition: transform 200ms ease;
}

.nav-contact:active {
  transform: scale(.97);
}

.contact-action {
  isolation: isolate;
  overflow: hidden;
  cursor: pointer;
  border-width: 1.5px;
  box-shadow: 0 14px 34px rgba(3, 39, 42, .17);
  transition: transform 200ms ease, background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.contact-action::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(108deg, transparent 24%, rgba(255, 255, 255, .28) 49%, transparent 74%);
  transform: translateX(-125%);
  transition: transform 520ms ease;
}

.contact-action > * {
  position: relative;
  z-index: 1;
}

.contact-action-call {
  background: linear-gradient(145deg, #fff 0%, #fffaf1 100%);
  box-shadow: 0 17px 42px rgba(3, 37, 40, .22);
}

.contact-action-wecom {
  border-color: rgba(205, 248, 223, .58);
  background: linear-gradient(145deg, rgba(10, 200, 101, .22), rgba(4, 80, 68, .24));
}

.contact-action-copy strong {
  font-size: 18px;
  letter-spacing: .02em;
}

.contact-action-copy small {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
  opacity: .76;
}

.contact-action-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 15px;
  transition: transform 200ms ease, color 200ms ease, background-color 200ms ease;
}

.contact-action-call .contact-action-arrow {
  color: #fff;
  background: #0c6267;
  border-color: #0c6267;
}

.contact-action-wecom .contact-action-arrow {
  color: #0b6850;
  background: #eafbef;
  border-color: #eafbef;
}

.contact-action:active {
  transform: translateY(-1px) scale(.985);
  box-shadow: 0 9px 22px rgba(3, 39, 42, .2);
}

.contact-qr-card {
  border-color: rgba(255, 255, 255, .3);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 14px 34px rgba(3, 39, 42, .16);
  transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}

.contact-qr-media {
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .92);
}

.contact-qr-media::after {
  content: "点击保存";
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(5, 68, 72, .92);
  box-shadow: 0 6px 16px rgba(2, 34, 37, .22);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.contact-qr-fallbacks a {
  cursor: pointer;
  transition: transform 180ms ease, color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.contact-qr-fallbacks a:active {
  transform: scale(.97);
}

.contact-section:target .contact-panel {
  animation: contact-target-arrive 900ms ease-out both;
}

@media (hover: hover) {
  .contact-float:hover {
    border-color: rgba(255, 255, 255, .74);
    box-shadow: 0 23px 58px rgba(115, 5, 14, .36), 0 4px 12px rgba(72, 4, 10, .2);
    transform: translateY(-4px);
  }

  .contact-float:hover::before,
  .contact-action:hover::before {
    transform: translateX(125%);
  }

  .contact-float:hover .contact-float-arrow {
    background: #fff;
    transform: translateY(3px);
  }

  .site-nav .nav-contact:hover {
    color: #fff;
    background: #940a14;
    border-color: #940a14;
    box-shadow: 0 13px 30px rgba(122, 7, 16, .24);
    transform: translateY(-2px);
  }

  .site-nav .nav-contact:hover span {
    transform: translate(2px, -2px);
  }

  .contact-action:hover {
    border-color: rgba(255, 255, 255, .78);
    box-shadow: 0 22px 48px rgba(3, 39, 42, .25);
    transform: translateY(-5px);
  }

  .contact-action:hover .contact-action-arrow {
    transform: translate(2px, -2px);
  }

  .contact-qr-card:hover {
    border-color: rgba(216, 249, 228, .56);
    background: rgba(4, 44, 48, .3);
    box-shadow: inset 0 1px rgba(255, 255, 255, .1), 0 20px 42px rgba(3, 39, 42, .22);
  }

  .contact-qr-media:hover {
    transform: translateY(-3px) scale(1.01);
  }

  .contact-qr-media:hover::after,
  .contact-qr-media:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
  }

  .contact-qr-fallbacks a:hover {
    border-color: rgba(255, 255, 255, .56);
    color: #fff;
    background: rgba(255, 255, 255, .1);
    transform: translateY(-2px);
  }
}

@media (max-width: 760px) {
  .contact-float {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    grid-template-columns: 8px minmax(0, 1fr) 34px;
    gap: 9px;
    min-width: 142px;
    padding: 8px 8px 8px 13px;
    box-shadow: 0 14px 34px rgba(115, 5, 14, .3), 0 3px 8px rgba(72, 4, 10, .18);
  }

  .contact-float-copy small {
    display: none;
  }

  .contact-float-copy strong {
    font-size: 14px;
  }

  .contact-float-arrow {
    width: 34px;
    height: 34px;
  }

  .contact-action {
    min-height: 88px;
    padding: 18px;
  }

  .contact-action-copy strong {
    font-size: 19px;
  }

  .contact-action-copy small {
    font-size: 11px;
  }

  .contact-qr-media::after {
    display: none;
  }

  .contact-qr-fallbacks a {
    border-color: rgba(255, 255, 255, .38);
    background: rgba(255, 255, 255, .06);
    font-weight: 700;
  }
}

@keyframes contact-float-arrive {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes contact-signal {
  0% { opacity: .8; transform: scale(.55); }
  70%, 100% { opacity: 0; transform: scale(1.55); }
}

@keyframes contact-target-arrive {
  0% { box-shadow: inset 0 0 0 4px rgba(219, 250, 231, .74); }
  100% { box-shadow: inset 0 0 0 0 rgba(219, 250, 231, 0); }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.contact-float) {
    scroll-behavior: auto;
  }

  .contact-float,
  .contact-float-signal::after,
  .contact-section:target .contact-panel {
    animation: none;
  }

  .contact-float,
  .contact-float::before,
  .contact-float-arrow,
  .site-nav .nav-contact,
  .nav-contact span,
  .contact-action,
  .contact-action::before,
  .contact-action-arrow,
  .contact-qr-card,
  .contact-qr-media,
  .contact-qr-media::after,
  .contact-qr-fallbacks a {
    transition: none;
  }
}
