/* Site-wide header IB World School emblem and bilingual Back to Top comfort tab. */
.huamao-header-actions {
  align-items: center;
}

.huamao-ib-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding-right: 18px;
  margin-right: -4px;
  border-right: 1px solid var(--wp--preset--color--rule, #ded7cb);
  text-decoration: none;
  cursor: pointer;
}

.huamao-ib-badge img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.huamao-ib-badge:hover img {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px #fff, 0 3px 10px rgba(46, 41, 39, 0.18);
}

.huamao-ib-badge:focus-visible {
  outline: none;
}

.huamao-ib-badge:focus-visible img {
  outline: 3px solid var(--wp--preset--color--muted-gold, #b5a269);
  outline-offset: 2px;
}

.huamao-footer-top-link a {
  color: var(--wp--preset--color--huamao-red, #cf2925);
  font-weight: 500;
}

.huamao-back-to-top {
  position: fixed;
  right: clamp(16px, 2.5vw, 32px);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 15px;
  background: rgba(255, 254, 250, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--wp--preset--color--deep-red, #8e2521);
  border: 1px solid var(--wp--preset--color--muted-gold, #b5a269);
  border-top: 2px solid var(--wp--preset--color--huamao-red, #cf2925);
  border-radius: 2px;
  box-shadow: 0 6px 20px rgba(46, 41, 39, 0.12);
  font: 600 12px/1.2 var(--wp--preset--font-family--sans, "Helvetica Neue", Arial, "PingFang SC", sans-serif);
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.huamao-back-to-top[hidden] {
  display: inline-flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
}

.huamao-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.huamao-back-to-top:hover {
  background: var(--wp--preset--color--deep-red, #8e2521);
  border-color: var(--wp--preset--color--deep-red, #8e2521);
  color: #fff;
}

.huamao-back-to-top:focus-visible {
  outline: 3px solid var(--wp--preset--color--muted-gold, #b5a269);
  outline-offset: 3px;
}

.huamao-back-to-top__icon {
  flex: 0 0 auto;
}

body:has(.wp-block-navigation__responsive-container.is-menu-open) .huamao-back-to-top,
body:has(.huamao-wx-lightbox:not([hidden])) .huamao-back-to-top {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 720px) {
  .huamao-back-to-top {
    min-height: 44px;
    padding: 9px 13px;
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .huamao-site-footer.huamao-footer-compact {
    padding-bottom: 76px;
  }
}

@media (max-width: 620px) {
  .huamao-header-actions {
    gap: 14px;
  }

  .huamao-ib-badge {
    margin-right: auto;
    padding-right: 10px;
    border-right: 0;
  }

  .huamao-ib-badge img {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .huamao-ib-badge img,
  .huamao-back-to-top {
    transition: none;
  }
}

@media print {
  .huamao-back-to-top,
  .huamao-footer-top-link {
    display: none !important;
  }
}
