/* 通用组件样式 */

/* 返回顶部按钮 - 统一样式 */
.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background: var(--primary-color, #cc0000);
  color: white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 1000;
  -webkit-appearance: none;
  appearance: none;
}

.back-to-top-btn:hover {
  background: var(--primary-color-hover, #C53030);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.back-to-top-btn:active {
  transform: scale(0.95) translateY(-2px);
}

.back-to-top-btn i {
  font-size: 1.125rem;
  line-height: 1;
}

/* 移动端优化 */
@media (max-width: 768px) {
  .back-to-top-btn {
    width: 7rem;
    height: 7rem;
    bottom: calc(2.5rem + env(safe-area-inset-bottom));
    right: 2.5rem;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    /* 加强阴影使按钮更突出 */
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    border: 3px solid rgba(255,255,255,0.3);
  }
  
  .back-to-top-btn i {
    font-size: 2.25rem;
  }
  
  /* 移动端点击效果 */
  .back-to-top-btn:active {
    transform: scale(0.85);
    background: var(--primary-color-active, #B91C1C);
  }
}

/* 超小屏幕（小于480px）进一步放大 */
@media (max-width: 480px) {
  .back-to-top-btn {
    width: 8.5rem;
    height: 8.5rem;
    bottom: calc(2rem + env(safe-area-inset-bottom));
    right: 2rem;
    /* 更强的视觉突出 */
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    border: 4px solid rgba(255,255,255,0.4);
  }
  
  .back-to-top-btn i {
    font-size: 2.75rem;
  }
}

/* 加载动画 - 统一样式 */
.loading-overlay {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(60, 60, 60, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.loading-spinner {
  width: 4rem;
  height: 4rem;
  border: 0.5rem solid #eee;
  border-top: 0.5rem solid var(--primary-color, #E53E3E);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 移动端触摸优化 */
.touch-target {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 图片懒加载过渡 */
.lazy-image {
  transition: opacity 0.3s ease;
}

.lazy-image[data-loaded="true"] {
  opacity: 1;
}
/* 真正的桌面端（>=1024px 且非移动设备）强制每个主板块占满视窗 */
@media (min-width: 1024px) and (pointer: fine) {
  /* 针对常见主板块 selector，尽量不破坏已有 padding/margin，仅调整高度与溢出 */
  /* 保持 hero 原有定位（因为 hero-content 使用绝对定位、左侧布局） */
  .hero, header.with-bg {
     /* hero 高度考虑导航栏高度变量，默认 0px 回退 */
     height: calc(100vh - var(--navbar-height, 0px) - 10px) !important;
     min-height: calc(100vh - var(--navbar-height, 0px) - 10px) !important;
     max-height: calc(100vh - var(--navbar-height, 0px) - 10px) !important;
     overflow: hidden !important;
     position: relative !important;
     display: block !important;
  }

  /* 其它内容区（studios/works/news/cooperation）使用 flex 居中，便于缩放后视觉居中 */
  #studios, #works, #news, section.with-bg {
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 合作区不应强制占满整个视窗，恢复为常规内容区高度并居中显示 */
  #cooperation, .cooperation-section {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    align-items: initial !important;
    justify-content: initial !important;
    padding: 60px 0 !important; /* 保持原有 spacing */
  }

  /* 确保背景图/图片覆盖 */
  .hero .hero-img, header.with-bg .header-bg, section.with-bg .header-bg {
     width: 100% !important;
     /* 桌面：背景图铺满 hero 高度并 cover，移动端样式不受影响（mobile media queries 会覆盖） */
     height: 100% !important;
     object-fit: cover !important;
     display: block !important;
  }

  /* 内部可缩放容器统一命名 .section-scale-wrapper（不改变现有结构，仅提供一致的 transform origin） */
  .section > .container,
  .section > .scale-\[0\.9\],
  .section > .scale-\[0\.85\],
  #studios > .scale-\[0\.9\],
  #studios > div,
  .hero > .hero-content,
  .hero > .with-bg,
  header.with-bg > .header-content {
    transform-origin: center center !important;
  }
}

.lazy-image[data-loaded="false"] {
  opacity: 0;
}

/* JS 控制的硬件加速类：仅声明 will-change，避免直接设置 transform 导致父容器被栅格化 */
.js-hw-accelerate {
  will-change: transform, opacity, filter;
  /* 不设置 transform，保持元素可被 GPU 合成但避免 rasterize 父容器 */
}
