/* 首屏加载：默认骨架屏；全屏遮罩仅 showSitePageLoading() 显式调用时展示 */

#sitePageLoading:not(.is-forced-visible) {
  display: none !important;
}

body.is-site-loading:not(:has(#sitePageLoading.is-forced-visible)) {
  overflow: auto;
}

body.is-site-loading:has(#sitePageLoading.is-forced-visible) {
  overflow: hidden;
}

.site-page-loading {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.site-page-loading.is-forced-visible {
  display: flex !important;
}

.site-page-loading[hidden]:not(.is-forced-visible) {
  display: none !important;
}

.site-page-loading.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.site-page-loading__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(3, 105, 161, 0.28), transparent 70%),
    linear-gradient(165deg, #0B1220 0%, #0F172A 48%, #0C4A6E 100%);
}

.site-page-loading__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  padding: 48px 40px 42px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-page-loading__mark {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 18px;
}

.site-page-loading__orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-top-color: #38BDF8;
  border-right-color: rgba(14, 165, 233, 0.15);
  animation: site-page-loading-orbit 1.6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.site-page-loading__core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: linear-gradient(145deg, #7DD3FC, #0369A1);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.55);
  animation: site-page-loading-core 1.6s ease-in-out infinite;
}

.site-page-loading__pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.55);
  animation: site-page-loading-pulse 1.6s ease-out infinite;
}

.site-page-loading__brand {
  margin: 0;
  font-family: var(--font-heading, 'PingFang SC', 'Microsoft YaHei', sans-serif);
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #F8FAFC;
}

.site-page-loading__text {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #BAE6FD;
}

.site-page-loading__hint {
  margin: 8px 0 0;
  max-width: 20em;
  font-size: 0.875rem;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: rgba(203, 213, 225, 0.88);
}

@keyframes site-page-loading-orbit {
  to { transform: rotate(360deg); }
}

@keyframes site-page-loading-core {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.86); opacity: 0.85; }
}

@keyframes site-page-loading-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  70%, 100% { transform: scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .site-page-loading__orbit,
  .site-page-loading__core,
  .site-page-loading__pulse {
    animation: none;
  }

  .site-page-loading__orbit {
    border-color: rgba(56, 189, 248, 0.45);
  }
}

/* ========== 骨架屏（替代全屏遮罩，首屏先展示布局占位） ========== */

@keyframes site-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  display: block;
  background: linear-gradient(90deg, #e8edf3 25%, #f4f7fb 50%, #e8edf3 75%);
  background-size: 200% 100%;
  animation: site-skeleton-shimmer 1.45s ease-in-out infinite;
  border-radius: 10px;
}

.skeleton--on-dark {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 25%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.06) 75%
  );
  background-size: 200% 100%;
}

.site-header--skeleton .navbar--skeleton {
  display: flex;
  align-items: center;
  gap: 20px;
}

.skeleton-navbar-brand {
  width: 168px;
  height: 36px;
  flex-shrink: 0;
}

.skeleton-navbar-nav {
  flex: 1;
  max-width: 420px;
  height: 28px;
  margin: 0 auto;
}

.skeleton-nav-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.skeleton-navbar-btn {
  width: 88px;
  height: 36px;
}

body[data-page="index"] .site-header--skeleton:not(.scrolled) .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 25%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.06) 75%
  );
  background-size: 200% 100%;
}

.site-footer--skeleton {
  padding: 48px 0 32px;
  border-top: 1px solid var(--color-border, #e2e8f0);
}

.site-footer--skeleton .skeleton-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  max-width: var(--container-width, 1200px);
  margin: 0 auto;
  padding: 0 24px;
}

.skeleton-footer-block {
  height: 120px;
}

.skeleton-footer-bar {
  height: 20px;
  max-width: 480px;
  margin: 32px auto 0;
}

.hero-skeleton {
  min-height: 520px;
  position: relative;
  display: flex;
  align-items: center;
  background: #0f172a;
}

.hero-skeleton__bg {
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.hero-skeleton__content {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  padding: 48px 64px;
}

.skeleton-hero-title {
  height: 44px;
  width: 72%;
  margin-bottom: 16px;
}

.skeleton-hero-subtitle {
  height: 22px;
  width: 56%;
  margin-bottom: 28px;
}

.skeleton-hero-actions {
  display: flex;
  gap: 12px;
}

.skeleton-hero-btn {
  width: 132px;
  height: 44px;
  border-radius: 999px;
}

.skeleton-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skeleton-filter-pill {
  width: 88px;
  height: 36px;
  border-radius: 999px;
}

.product-card--skeleton {
  pointer-events: none;
  cursor: default;
}

.product-card--skeleton:hover {
  transform: none;
  box-shadow: none;
}

.skeleton-product-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.skeleton-product-pill {
  width: 72px;
  height: 22px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.skeleton-product-title {
  height: 22px;
  width: 78%;
  margin-bottom: 8px;
}

.skeleton-product-desc {
  height: 14px;
  width: 100%;
  margin-bottom: 6px;
}

.skeleton-product-desc--short {
  width: 64%;
  margin-bottom: 16px;
}

.skeleton-product-meta {
  height: 16px;
  width: 100%;
  margin: auto 0 16px;
}

.skeleton-product-actions {
  display: flex;
  gap: 8px;
}

.skeleton-product-btn {
  flex: 1;
  height: 36px;
  border-radius: 8px;
}

.skeleton-article-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skeleton-article-card {
  background: #fff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 16px;
  padding: 24px;
}

.skeleton-article-head {
  height: 24px;
  width: 48%;
  margin-bottom: 20px;
}

.skeleton-article-line {
  height: 14px;
  width: 100%;
  margin-bottom: 10px;
}

.skeleton-article-line--short {
  width: 70%;
}

@media (max-width: 1024px) {
  .skeleton-navbar-nav {
    display: none;
  }

  .skeleton-article-columns {
    grid-template-columns: 1fr;
  }

  .site-footer--skeleton .skeleton-footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .hero-skeleton__content {
    padding: 32px 24px;
  }

  .site-footer--skeleton .skeleton-footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  body[data-page="index"] .site-header--skeleton:not(.scrolled) .skeleton {
    animation: none;
    background: #e8edf3;
  }

  .hero-skeleton .skeleton--on-dark {
    background: rgba(255, 255, 255, 0.1);
  }
}
