html.zrh-loading-active,
html.zrh-loading-active body {
  overflow: hidden !important;
}

/* Loading owns the whole viewport; do not leave the shared navigation's
   Back control visible above the page beneath it. */
html.zrh-loading-active .zrh-back-direct,
html.zrh-loading-active .zrh-border-nav-html-layer {
  visibility: hidden !important;
  pointer-events: none !important;
}

html.zrh-loading-active::before,
html.zrh-loading-active::after {
  position: fixed;
  z-index: 2147484600;
  pointer-events: all;
}

html.zrh-loading-active::before {
  content: "";
  inset: 0;
  background:
    linear-gradient(90deg, rgba(221, 55, 55, 0) 0%, #dd3737 18%, #e6ac47 52%, #8ac0b1 84%, rgba(138, 192, 177, 0) 100%)
      center calc(50% + clamp(58px, 6vw, 82px)) / clamp(120px, 18vw, 260px) 2px no-repeat,
    linear-gradient(180deg, rgba(240, 231, 214, 0.045), rgba(240, 231, 214, 0)) 0 0 / 100% 42% no-repeat,
    #111111;
  box-shadow:
    inset 0 0 0 1px rgba(240, 231, 214, 0.12),
    inset 0 clamp(30px, 5vw, 78px) clamp(72px, 12vw, 150px) rgba(255, 247, 235, 0.035);
  opacity: 1;
  animation: zrh-loading-line 1.45s cubic-bezier(.42, 0, .2, 1) infinite;
}

html.zrh-loading-active::after {
  content: "PORTFOLIO\A LOADING";
  left: 50%;
  top: 50%;
  width: min(68vw, 420px);
  transform: translate3d(-50%, -50%, 0);
  color: #f4ebdd;
  white-space: pre;
  text-align: center;
  font-family: "ZRH_B", "ZRHSourceHan", "Source Han Sans CN", "Microsoft YaHei", sans-serif;
  font-size: clamp(18px, 2.1vw, 34px);
  line-height: 1.55;
  letter-spacing: 0.18em;
  text-shadow: 0 0 18px rgba(244, 235, 221, 0.12);
  opacity: 0.94;
  animation: zrh-loading-breathe 1.45s cubic-bezier(.42, 0, .2, 1) infinite;
}

html.zrh-loading-leave::before,
html.zrh-loading-leave::after {
  opacity: 0;
  transition:
    opacity 520ms cubic-bezier(.22, 1, .36, 1),
    transform 520ms cubic-bezier(.22, 1, .36, 1);
}

html.zrh-loading-leave::after {
  transform: translate3d(-50%, calc(-50% - 8px), 0);
}

@keyframes zrh-loading-line {
  0%,
  100% {
    background-size:
      clamp(120px, 18vw, 260px) 2px,
      100% 42%,
      auto;
    filter: brightness(0.92);
  }
  50% {
    background-size:
      clamp(170px, 24vw, 360px) 2px,
      100% 42%,
      auto;
    filter: brightness(1.08);
  }
}

@keyframes zrh-loading-breathe {
  0%,
  100% {
    opacity: 0.78;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.zrh-loading-active::before,
  html.zrh-loading-active::after {
    animation: none;
  }
}

@media (max-width: 760px) {
  html.zrh-loading-active::after {
    width: min(76vw, 320px);
    font-size: clamp(17px, 5vw, 26px);
  }
}
