/**
 * iPhone 设备框组件
 * 用于展示移动端产品界面截图
 */

/* iPhone 框容器 */
.iphone-frame {
  --iphone-frame-bg: #1a1a1a;
  --iphone-frame-border: #2a2a2a;
  --iphone-frame-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --iphone-notch-bg: #1a1a1a;

  position: relative;
  display: inline-block;
  background: var(--iphone-frame-bg);
  border-radius: 36px;
  padding: 10px;
  box-shadow: var(--iphone-frame-shadow);
  transform: translateZ(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.iphone-frame:hover {
  transform: translateY(-6px) translateZ(0);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}

/* 屏幕内容区 */
.iphone-frame-content {
  position: relative;
  background: var(--bg-secondary, #f7fafc);
  border-radius: 28px;
  overflow: hidden;
  display: block;
  /* 强制锁定宽高比 (9:19.5 是现代 iPhone 的典型比例) */
  aspect-ratio: 9 / 19.5;
}

.iphone-frame-content img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* 刘海 (Dynamic Island / Notch) */
.iphone-frame::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 26px;
  background: var(--iphone-notch-bg);
  border-radius: 0 0 18px 18px;
  z-index: 5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 侧边按钮 */
.iphone-frame::after {
  content: '';
  position: absolute;
  top: 80px;
  right: -2px;
  width: 3px;
  height: 40px;
  background: linear-gradient(180deg, #2a2a2a, #1a1a1a, #2a2a2a);
  border-radius: 0 2px 2px 0;
}

/* 音量按钮 */
.iphone-frame-vol {
  position: absolute;
  top: 100px;
  left: -2px;
  width: 3px;
  height: 30px;
  background: linear-gradient(180deg, #2a2a2a, #1a1a1a, #2a2a2a);
  border-radius: 2px 0 0 2px;
}

.iphone-frame-vol:last-of-type {
  top: 140px;
}

/* 尺寸变体 - 模拟不同 iPhone 型号 */
.iphone-frame-se {
  width: 200px;
  border-radius: 28px;
  padding: 8px;
}

.iphone-frame-se .iphone-frame-content {
  border-radius: 22px;
}

.iphone-frame-se::before {
  width: 60px;
  height: 18px;
  border-radius: 0 0 12px 12px;
}

.iphone-frame-mini {
  width: 220px;
  border-radius: 32px;
}

.iphone-frame-mini .iphone-frame-content {
  border-radius: 24px;
}

.iphone-frame-mini::before {
  width: 70px;
  height: 20px;
  border-radius: 0 0 14px 14px;
}

.iphone-frame-standard {
  width: 260px;
  border-radius: 36px;
}

.iphone-frame-standard .iphone-frame-content {
  border-radius: 28px;
}

.iphone-frame-standard::before {
  width: 90px;
  height: 26px;
  border-radius: 0 0 18px 18px;
}

.iphone-frame-pro-max {
  width: 280px;
  border-radius: 38px;
}

.iphone-frame-pro-max .iphone-frame-content {
  border-radius: 30px;
}

.iphone-frame-pro-max::before {
  width: 100px;
  height: 28px;
  border-radius: 0 0 20px 20px;
}

/* 横向布局网格 */
.iphone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  justify-items: center;
  padding: 1rem 0;
}

/* 3D 透视效果 */
.iphone-frame-3d {
  perspective: 1000px;
}

.iphone-frame-3d .iphone-frame {
  transform: rotateY(-15deg) rotateX(5deg);
  transition: transform 0.5s ease;
}

.iphone-frame-3d:hover .iphone-frame {
  transform: rotateY(0deg) rotateX(0deg);
}

/* 响应式 */
@media (max-width: 768px) {
  .iphone-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
  }

  .iphone-frame-standard,
  .iphone-frame-pro-max {
    width: 220px;
  }
}

/* 加载状态 */
.iphone-frame.loading .iphone-frame-content {
  min-height: 400px;
  background: linear-gradient(90deg, #000 25%, #1a1a1a 50%, #000 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 多图轮播容器 */
.iphone-carousel {
  position: relative;
}

.iphone-carousel-track {
  display: flex;
  transition: transform 0.5s ease;
}

.iphone-carousel-slide {
  flex: 0 0 auto;
  padding: 0 5px;
}

/* 轮播导航 */
.iphone-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 10;
}

.iphone-carousel-nav:hover {
  background: white;
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.iphone-carousel-nav.prev {
  left: -15px;
}

.iphone-carousel-nav.next {
  right: -15px;
}

/* 轮播指示点 */
.iphone-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 1rem;
}

.iphone-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.iphone-carousel-dot.active {
  width: 20px;
  border-radius: 4px;
  background: #3182ce;
}

/* 书籍封面效果 (用于创始人页面) */
.book-cover {
  position: relative;
  display: inline-block;
  perspective: 1000px;
}

.book-cover-inner {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(-20deg);
  transition: transform 0.5s ease;
}

.book-cover:hover .book-cover-inner {
  transform: rotateY(0deg);
}

.book-cover-front {
  position: relative;
  background: white;
  border-radius: 4px 8px 8px 4px;
  box-shadow:
    -2px 0 0 #ccc,
    -4px 0 0 #999,
    0 10px 30px rgba(0, 0, 0, 0.3);
}

.book-cover-spine {
  position: absolute;
  top: 0;
  left: -20px;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, #666, #999, #ccc);
  transform-origin: right;
  transform: rotateY(-90deg);
  border-radius: 4px 0 0 4px;
}
