.wechat-contact {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 9vw, 8rem);
  padding-block: clamp(2.5rem, 7vw, 6rem);
}

.wechat-contact__lede {
  max-width: 40ch;
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.65;
}

.wechat-contact__code {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
}

.wechat-qr {
  display: block;
  inline-size: min(100%, 17.5rem);
  block-size: auto;
  object-fit: contain;
  -webkit-touch-callout: default;
}

.wechat-hints {
  max-width: 38ch;
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
}

.wechat-hint--mobile {
  display: none;
}

.wechat-dialog {
  position: fixed;
  inset: 0;
  inline-size: min(29rem, calc(100% - 2rem));
  max-inline-size: none;
  max-block-size: calc(100vh - 2rem);
  max-block-size: calc(100dvh - 2rem);
  margin: auto;
  padding: clamp(1rem, 4vw, 1.65rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  color: var(--ink);
}

.wechat-dialog:not([open]) {
  display: none;
}

.wechat-dialog::backdrop {
  background: rgb(18 35 29 / .64);
}

html:has(.wechat-dialog[open]) {
  overflow: hidden;
}

.wechat-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}

.wechat-dialog__header h2 {
  min-width: 0;
  font-size: clamp(1.35rem, 5vw, 1.95rem);
}

.wechat-dialog__close {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: .45rem .75rem;
}

.wechat-dialog__content {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: .75rem;
}

.wechat-dialog .wechat-qr {
  inline-size: auto;
  max-inline-size: min(100%, 17.5rem);
  max-block-size: 54vh;
  max-block-size: 54dvh;
}

@media (max-width: 767px) {
  .wechat-contact {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px), (pointer: coarse) {
  .wechat-hint--desktop {
    display: none;
  }

  .wechat-hint--mobile {
    display: block;
  }
}

@media (min-width: 500px) and (max-height: 490px) {
  .wechat-dialog {
    inline-size: min(38rem, calc(100% - 2rem));
    padding: 1rem;
  }

  .wechat-dialog__content {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .wechat-dialog .wechat-qr {
    max-block-size: 60vh;
    max-block-size: 60dvh;
  }
}
