/* 竖屏仿横屏模式样式 - 通过旋转实现真正的横屏视觉效果 */

/* 竖屏仿横屏模式激活时的基础样式 */
body.vertical-horizontal-mode {
  /* 禁用竖屏提示遮罩 */
}

body.vertical-horizontal-mode::before {
  display: none !important;
}

/* 竖屏仿横屏模式 - 核心旋转实现 */
@media screen and (orientation: portrait) {
  body.vertical-horizontal-mode {
    overflow: hidden;
  }

  body.vertical-horizontal-mode .scroll-container {
    /* 旋转90度，让横屏内容在竖屏中显示 */
    transform: rotate(90deg);
    transform-origin: center center;

    /* 调整尺寸：交换宽高 */
    width: 100vh;
    height: 100vw;

    /* 居中定位 */
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -50vw;
    margin-left: -50vh;

    /* 移除模糊效果 */
    filter: none !important;
    pointer-events: auto !important;
  }

  body.vertical-horizontal-mode .scroll-wrapper {
    /* 保持原有的横屏布局 */
    height: 100vh;
    /* 这里的vh实际上是旋转后的宽度 */
    width: 3500vw;
    /* 保持原有宽度 */

    /* 移除模糊效果 */
    filter: none !important;
    pointer-events: auto !important;

    /* 在竖屏模式下，支持垂直变换 */
    transition: transform 0.3s ease-out;
  }


  /* 导航元素需要反向旋转以保持正确方向 */
  body.vertical-horizontal-mode .nav-arrows {
    transform: rotate(-90deg);
    position: fixed;
    bottom: 50%;
    right: 1rem;
    left: auto;
    transform-origin: center center;
    margin-bottom: -25px;
  }

  body.vertical-horizontal-mode .nav-dots {
    transform: rotate(-90deg);
    position: fixed;
    right: 50%;
    top: 1rem;
    left: auto;
    transform-origin: center center;
    margin-right: -50px;
    flex-direction: row;
    width: 100px;
    height: auto;
  }

  body.vertical-horizontal-mode .position-indicator {
    transform: rotate(-90deg);
    position: fixed;
    top: 1rem;
    left: 50%;
    transform-origin: center center;
    margin-left: -50px;
  }

  /* 方向切换按钮也需要反向旋转 */
  body.vertical-horizontal-mode .orientation-toggle {
    transform: rotate(-90deg);
    transform-origin: center center;
    top: 1rem;
    right: 50%;
    margin-right: -50px;
  }

  /* 开幕页也需要旋转 */
  body.vertical-horizontal-mode .opening-screen {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -50vw;
    margin-left: -50vh;
  }

  /* 开幕页也需要旋转 */
  body.vertical-horizontal-mode .page {
    width: 100vh;
    height: 100vw;
  }

  /* 开幕页内的元素需要反向旋转文字 */
  body.vertical-horizontal-mode .opening-screen .subtitle-line,
  body.vertical-horizontal-mode .opening-screen .main-title,
  body.vertical-horizontal-mode .opening-screen .corner-hint {
    /* 文字保持可读性，不需要额外旋转 */
  }

  /* 画轴展开页面也需要旋转 */
  body.vertical-horizontal-mode .scroll-reveal-screen {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -50vw;
    margin-left: -50vh;
  }

  /* 视频模态框需要特殊处理 */
  body.vertical-horizontal-mode .video-modal {
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
    height: 100vw;
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -50vw;
    margin-left: -50vh;
  }

  body.vertical-horizontal-mode .video-modal .modal-content {
    transform: rotate(-90deg);
    transform-origin: center center;
    width: 90vh;
    height: auto;
    max-height: 90vw;
  }

  body.vertical-horizontal-mode .video-modal video {
    width: 100%;
    max-height: 70vw;
  }

  /* 对比模态框 */
  body.vertical-horizontal-mode .comparison-modal {
    width: 100vh !important;
    height: 100vw !important;
  }

  body.vertical-horizontal-mode .comparison-modal .modal-content {
    width: 90vh;
    height: auto;
    max-height: 90vw;
    max-width: 90vh !important;
  }

  /* 提示信息 */
  body.vertical-horizontal-mode .swipe-hint {
    transform: rotate(90deg);
    transform-origin: center center;
    bottom: 50%;
    right: 5%;
    left: auto;
    margin-bottom: -25px;
    
    /* 调整位置以适应旋转后的布局 */
    position: fixed;
    z-index: 1000;
  }

  /* 竖屏模式下的滑动提示显示和隐藏动画 */
  body.vertical-horizontal-mode .swipe-hint.show {
    opacity: 1;
    transform: rotate(90deg) translateX(0);
  }

  body.vertical-horizontal-mode .swipe-hint.hide {
    opacity: 0;
    transform: rotate(90deg) translateX(100px);
  }

  /* 竖屏模式下的滑动提示箭头动画调整 */
  body.vertical-horizontal-mode .swipe-hint .swipe-arrow {
    /* 在旋转的容器内，箭头方向需要相应调整 */
    display: inline-block;
    animation: arrow-bounce-vertical 2s infinite;
  }

  /* 移动端竖屏模式下的滑动提示位置调整 */
  @media (max-width: 768px) {
    body.vertical-horizontal-mode .swipe-hint {
      bottom: 50%;
      right: 10%;
      transform: rotate(90deg);
      margin-bottom: -30px;
    }
    
    body.vertical-horizontal-mode .swipe-hint.show {
      transform: rotate(90deg) translateX(0);
    }
    
    body.vertical-horizontal-mode .swipe-hint.hide {
      transform: rotate(90deg) translateY(100px);
    }
  }

  /* 海鸥动画也需要适配 */
  body.vertical-horizontal-mode .seagull {
    /* 海鸥在竖屏模式下的特殊处理 */
    transform-origin: center center;
    transition: transform 0.3s ease-out;
  }

  /* 海鸥群动画在竖屏模式下的适配 */
  body.vertical-horizontal-mode .seagull-flock,
  body.vertical-horizontal-mode .seagull-flock-vertical {
    /* 海鸥群在竖屏模式下需要调整动画路径 */
    transform-origin: center center;
  }

  /* 竖屏模式下的海鸥群飞行动画 */
  @keyframes seagull-fly-diagonal-vertical {
    0% {
      opacity: 0;
      transform: translateX(-100px) translateY(-50px) rotate(135deg) scale(0.8);
    }
    20% {
      opacity: 1;
    }
    100% {
      opacity: 0;
      transform: translateX(calc(100vh + 100px)) translateY(calc(100vw + 50px)) rotate(135deg) scale(1.2);
    }
  }

  @keyframes seagull-fly-vertical-vertical {
    0% {
      opacity: 0;
      transform: translateY(-100px) translateX(0) rotate(180deg) scale(0.8);
    }
    20% {
      opacity: 1;
    }
    100% {
      opacity: 0;
      transform: translateY(calc(100vw + 100px)) translateX(20px) rotate(180deg) scale(1.1);
    }
  }
}

/* 横屏模式下的标准样式（保持原有逻辑） */
@media screen and (orientation: landscape) {
  body.vertical-horizontal-mode .scroll-container {
    /* 横屏时恢复正常 */
    transform: none;
    width: 100vw;
    height: 100vh;
    position: relative;
    top: auto;
    left: auto;
    margin: 0;
  }

  body.vertical-horizontal-mode .nav-arrows,
  body.vertical-horizontal-mode .nav-dots,
  body.vertical-horizontal-mode .position-indicator,
  body.vertical-horizontal-mode .orientation-toggle {
    transform: none;
    /* 恢复原有位置 */
  }

  body.vertical-horizontal-mode .opening-screen,
  body.vertical-horizontal-mode .scroll-reveal-screen {
    transform: none;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
  }

  body.vertical-horizontal-mode .video-modal,
  body.vertical-horizontal-mode .comparison-modal {
    transform: none;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
  }

  body.vertical-horizontal-mode .video-modal .modal-content,
  body.vertical-horizontal-mode .comparison-modal .modal-content {
    transform: none;
    width: 800px;
    max-width: 90vw;
    height: auto;
    max-height: 90vh;
  }
}

/* 竖屏仿横屏模式切换按钮 - 已禁用 */
.orientation-toggle {
  display: none !important; /* 完全隐藏切换按钮 */
}

.orientation-toggle:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.orientation-toggle.show {
  display: block;
}

/* 竖屏时不再显示切换按钮 */
@media screen and (orientation: portrait) {
  .orientation-toggle {
    display: none !important;
  }
}

/* 竖屏仿横屏模式提示 */
.vertical-mode-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  z-index: 10002;
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  max-width: 90vw;
  display: none;
}

.vertical-mode-hint.show {
  display: block;
  animation: hint-fade-in 0.5s ease-out;
}

.vertical-mode-hint h3 {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
  color: #4CAF50;
}

.vertical-mode-hint p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0.9;
}

.vertical-mode-hint .hint-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.vertical-mode-hint button {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.vertical-mode-hint button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.vertical-mode-hint button.primary {
  background: #4CAF50;
  border-color: #4CAF50;
}

.vertical-mode-hint button.primary:hover {
  background: #45a049;
}

@keyframes hint-fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 旋转过渡动画 */
body.vertical-horizontal-mode .scroll-container,
body.vertical-horizontal-mode .opening-screen,
body.vertical-horizontal-mode .scroll-reveal-screen {
  transition: transform 0.6s ease-in-out;
}

body.vertical-horizontal-mode .nav-arrows,
body.vertical-horizontal-mode .nav-dots,
body.vertical-horizontal-mode .position-indicator,
body.vertical-horizontal-mode .orientation-toggle {
  transition: transform 0.6s ease-in-out;
}

/* 滚动包装器的平滑过渡 */
.scroll-wrapper.smooth-transition {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 防止旋转时的滚动条 */
@media screen and (orientation: portrait) {
  body.vertical-horizontal-mode {
    overflow: hidden;
  }

  html.vertical-horizontal-mode {
    overflow: hidden;
  }
}