/* ===================================
   高级特效：3D 倾斜卡片 + 视差滚动 + 语言切换器
   =================================== */

/* —— 让卡片网格具备 3D 透视空间 —— */
.products-grid,
.features-grid,
.products-full-grid {
  perspective: 1100px;
}

/* —— 倾斜卡片基础 —— */
/* 注意：保留 opacity 过渡，避免覆盖 .fade-up 的入场淡入 */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(.22,.61,.36,1),
              box-shadow 0.4s ease,
              opacity 0.65s ease;
  will-change: transform;
}
.tilt-card.is-tilting {
  transition: transform 0.1s linear, box-shadow 0.3s ease;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.12);
  z-index: 5;
}

/* 倾斜时让卡片内容轻微抬起，增强景深 */
.tilt-card.is-tilting .product-info,
.tilt-card.is-tilting .feature-icon {
  transform: translateZ(34px);
  transform-style: preserve-3d;
}

/* —— 光泽层（跟随鼠标的高光）—— */
.tilt-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
  mix-blend-mode: soft-light;
}
.tilt-card.is-tilting .tilt-glare { opacity: 1; }

/* —— 视差元素默认开启硬件加速 —— */
.hero-bg,
.hero-content,
[data-parallax] {
  will-change: transform;
}
.hero-bg { transition: transform 0.05s linear; }

/* 进入视区时给区块一个柔和的 3D 浮现（叠加在已有 fade-up 之上）*/
.reveal-3d {
  opacity: 0;
  transform: perspective(1200px) rotateX(8deg) translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.22,.61,.36,1);
}
.reveal-3d.visible {
  opacity: 1;
  transform: perspective(1200px) rotateX(0) translateY(0);
}

/* ===================================
   语言切换器
   =================================== */
.lang-switch {
  position: relative;
  margin-left: 10px;
  font-size: 0.82rem;
}
.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37,99,235,.1);
  border: 1px solid rgba(37,99,235,.25);
  color: var(--accent);
  text-shadow: none;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1;
  transition: all 0.35s ease;
  white-space: nowrap;
}
.lang-switch-btn:hover {
  background: rgba(37,99,235,.2);
  border-color: rgba(37,99,235,.4);
}
.lang-switch-btn svg { width: 15px; height: 15px; flex: none; }
/* 滚动后切换为深色 */
/* hover 毛玻璃时去阴影 */
.navbar:not(.scrolled):hover .lang-switch-btn { text-shadow: none !important; }
/* scrolled 保持蓝色调 */
.navbar.scrolled .lang-switch-btn {
  background: rgba(37,99,235,.1) !important;
  border-color: rgba(37,99,235,.25) !important;
  color: var(--accent) !important;
  text-shadow: none !important;
}
.navbar.scrolled .lang-switch-btn:hover {
  background: rgba(37,99,235,.2) !important;
  border-color: rgba(37,99,235,.4) !important;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  max-height: 340px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  box-shadow: 0 24px 50px -12px rgba(0,0,0,.1);
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(.98);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1200;
}
.lang-switch.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.lang-menu button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #333;
  text-align: left;
  transition: background 0.15s ease;
}
.lang-menu button:hover { background: var(--bg-light, #f5f5f5); }
.lang-menu button.active {
  background: var(--accent, #2563eb);
  color: #fff;
  font-weight: 600;
}
.lang-menu .lang-flag { font-size: 1rem; line-height: 1; }

/* ===================================
   RTL（阿拉伯语等）适配
   =================================== */
html[dir="rtl"] .nav-links,
html[dir="rtl"] .mobile-menu { text-align: right; }
html[dir="rtl"] .lang-switch { margin-left: 0; margin-right: 18px; }
html[dir="rtl"] .lang-menu { right: auto; left: 0; transform-origin: top left; }
html[dir="rtl"] .breadcrumb,
html[dir="rtl"] .product-footer,
html[dir="rtl"] .footer-bottom .container { direction: rtl; }
html[dir="rtl"] .product-arrow { transform: scaleX(-1); }
html[dir="rtl"] .hero-content,
html[dir="rtl"] .section-header { text-align: center; }

/* ===================================
   减弱动效偏好：尊重用户设置
   =================================== */
@media (prefers-reduced-motion: reduce) {
  .tilt-card,
  .hero-bg,
  .hero-content,
  [data-parallax] { transition: none !important; transform: none !important; }
  .tilt-glare { display: none; }
}

/* 移动端关闭 3D 倾斜（触屏无悬停，避免误触）*/
@media (max-width: 768px) {
  .tilt-card { transform: none !important; }
  .tilt-glare { display: none; }
  .lang-menu { grid-template-columns: 1fr; width: 200px; }
}
