/* 移动端优化样式 */

/* 基础移动端适配 */
@media (max-width: 768px) {
  /* 容器优化 */
  .container-max {
    padding: 0 1rem;
  }
  
  /* 导航栏优化 */
  header {
    position: sticky;
    top: 0;
    z-index: 1000;
  }
  
  header nav {
    padding: 0.5rem 0;
  }
  
  /* 移动端菜单优化 */
  #mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  #mobile-menu.show {
    transform: translateY(0);
  }
  
  .dark #mobile-menu {
    background: rgba(17, 24, 39, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* Hero区域移动端优化 */
  .hero-section {
    padding: 2rem 0 3rem;
    text-align: center;
  }
  
  .hero-section h1 {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  
  .hero-section p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
  }
  
  /* 社交链接移动端优化 */
  .social-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
  }
  
  .social-links a {
    padding: 0.75rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  .dark .social-links a {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* 按钮移动端优化 */
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }
  
  .btn-group .btn {
    width: 100%;
    max-width: 280px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }
  
  /* 博客卡片移动端优化 */
  .blog-card {
    margin-bottom: 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
  }
  
  .blog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }
  
  .blog-card-content {
    padding: 1.25rem;
  }
  
  .blog-card h3 {
    font-size: 1.125rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }
  
  .blog-card p {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
  }
  
  /* 标签移动端优化 */
  .tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
  }
  
  .dark .tag {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.2);
  }
  
  /* 文章内容移动端优化 */
  .prose {
    font-size: 0.95rem;
    line-height: 1.7;
  }
  
  .prose h1 {
    font-size: 1.75rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
  }
  
  .prose h2 {
    font-size: 1.5rem;
    margin-top: 1.75rem;
    margin-bottom: 0.875rem;
  }
  
  .prose h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .prose p {
    margin-bottom: 1.25rem;
  }
  
  /* 代码块移动端优化 */
  .prose pre {
    margin: 1.5rem -1rem;
    border-radius: 0;
    padding: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .prose code:not(pre code) {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    word-break: break-word;
  }
  
  /* 表格移动端优化 */
  .prose table {
    font-size: 0.875rem;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  
  .prose th,
  .prose td {
    padding: 0.5rem;
    min-width: 100px;
  }
  
  /* 图片移动端优化 */
  .prose img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
  }
  
  /* 视频移动端优化 */
  .video-container {
    margin: 1.5rem -1rem;
    border-radius: 0;
  }
  
  .video-responsive {
    padding-bottom: 56.25%; /* 16:9 */
  }
  
  /* 分页移动端优化 */
  .pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
  }
  
  .pagination-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 8px;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Footer移动端优化 */
  footer {
    padding: 1.5rem 0;
    text-align: center;
  }
  
  footer .container-max {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  
  /* 触摸优化 */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 滚动优化 */
  .scroll-smooth {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 输入框优化 */
  input, textarea, select {
    font-size: 16px; /* 防止iOS缩放 */
  }
}

/* 小屏幕手机优化 (iPhone SE等) */
@media (max-width: 375px) {
  .container-max {
    padding: 0 0.75rem;
  }
  
  .hero-section h1 {
    font-size: 1.75rem;
  }
  
  .hero-section p {
    font-size: 0.9rem;
  }
  
  .btn-group .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
  
  .blog-card-content {
    padding: 1rem;
  }
  
  .prose {
    font-size: 0.9rem;
  }
  
  .prose h1 {
    font-size: 1.5rem;
  }
  
  .prose h2 {
    font-size: 1.25rem;
  }
  
  .prose h3 {
    font-size: 1.125rem;
  }
  
  .prose pre {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    padding: 1rem 0 2rem;
  }
  
  .hero-section h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .hero-section p {
    font-size: 0.875rem;
    margin-bottom: 1rem;
  }
  
  .social-links {
    margin-bottom: 1rem;
  }
  
  .btn-group {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
  }
  
  .btn-group .btn {
    width: auto;
    min-width: 120px;
  }
}

/* 平板优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .container-max {
    padding: 0 2rem;
  }
  
  .hero-section {
    padding: 3rem 0 4rem;
  }
  
  .hero-section h1 {
    font-size: 2.5rem;
  }
  
  .hero-section p {
    font-size: 1.125rem;
  }
  
  .btn-group {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
  }
  
  .btn-group .btn {
    width: auto;
    min-width: 160px;
  }
  
  .blog-card {
    margin-bottom: 2rem;
  }
  
  .prose {
    font-size: 1rem;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .blog-card {
    border: 0.5px solid rgba(0, 0, 0, 0.1);
  }
  
  .dark .blog-card {
    border: 0.5px solid rgba(255, 255, 255, 0.1);
  }
  
  .tag {
    border: 0.5px solid rgba(59, 130, 246, 0.2);
  }
  
  .dark .tag {
    border: 0.5px solid rgba(96, 165, 250, 0.2);
  }
}

/* 减少动画的用户偏好 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 深色模式移动端优化 */
@media (max-width: 768px) {
  .dark .blog-card {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.3);
  }
  
  .dark .blog-card:hover {
    background: rgba(31, 41, 55, 0.9);
    border: 1px solid rgba(75, 85, 99, 0.5);
  }
  
  .dark .prose pre {
    background: #0d1117;
    border: 1px solid #30363d;
  }
  
  .dark .prose code:not(pre code) {
    background: rgba(55, 65, 81, 0.8);
    color: #fbbf24;
    border: 1px solid rgba(107, 114, 128, 0.3);
  }
}

/* 安全区域适配 (iPhone X等) */
@supports (padding: max(0px)) {
  .container-max {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  header {
    padding-top: env(safe-area-inset-top);
  }
  
  footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* 触摸反馈优化 */
.touch-feedback {
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
  tap-highlight-color: rgba(59, 130, 246, 0.2);
}

.touch-feedback:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* 滚动条优化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 加载状态优化 */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.dark .loading-skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

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

/* 性能优化 */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}