/* 移动端字体和排版优化 */

/* 移动端字体基础设置 */
@media (max-width: 768px) {
  /* 基础字体优化 */
  html {
    font-size: 16px; /* 防止iOS缩放 */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.6;
    letter-spacing: 0.01em;
  }

  /* 标题字体优化 */
  h1, .hero-content h1 {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
  }

  h2, .section-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 0.625rem;
  }

  h3, .video-info h3 {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  h4 {
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.45;
    margin-bottom: 0.5rem;
  }

  h5, h6 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 0.375rem;
  }

  /* 段落文本优化 */
  p, .hero-content p, .video-info p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
  }

  .subtitle, .video-meta {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #da1b01;
  }

  /* 小文本优化 */
  small, .stat-content p, .info-item {
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  /* 按钮文字优化 */
  .btn, .login-btn, .register-btn, .nav-link {
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
  }

  .btn-sm {
    font-size: 0.8125rem;
  }

  .btn-lg {
    font-size: 1.0625rem;
  }

  /* 表单文字优化 */
  .form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.75rem;
  }

  /* 导航文字优化 */
  .nav-logo {
    font-size: 1.125rem;
    font-weight: 600;
  }

  .nav-menu .nav-link {
    font-size: 1rem;
    font-weight: 400;
    padding: 0.875rem 0;
  }

  /* 卡片文字优化 */
  .stat-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
  }

  .stat-content p {
    font-size: 0.8125rem;
    font-weight: 400;
  }

  /* 表格文字优化 */
  .table th {
    font-size: 0.875rem;
    font-weight: 600;
  }

  .table td {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  /* 列表文字优化 */
  .dropdown-menu a {
    font-size: 0.9375rem;
    line-height: 1.4;
    padding: 0.625rem 1rem;
  }

  /* 标签文字优化 */
  .badge, .filter-tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
  }

  /* 提示文字优化 */
  .tooltip {
    font-size: 0.8125rem;
    line-height: 1.3;
  }

  /* 加载状态文字 */
  .loading-text {
    font-size: 0.9375rem;
    color: #666;
  }

  /* 错误信息文字 */
  .error-text {
    font-size: 0.875rem;
    color: #dc3545;
  }

  /* 成功信息文字 */
  .success-text {
    font-size: 0.875rem;
    color: #28a745;
  }
}

/* 超小屏幕字体优化 */
@media (max-width: 480px) {
  h1, .hero-content h1 {
    font-size: 1.5rem;
  }

  h2, .section-title {
    font-size: 1.375rem;
  }

  h3, .video-info h3 {
    font-size: 1.125rem;
  }

  p, .hero-content p, .video-info p {
    font-size: 0.9375rem;
  }

  .btn, .login-btn, .register-btn {
    font-size: 0.875rem;
  }

  .nav-logo {
    font-size: 1rem;
  }

  /* 分类标签文字优化 */
  .category-tab,
  .filter-btn {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
  }
}

/* 超小屏幕分类标签优化 */
@media (max-width: 375px) {
  .category-tab,
  .filter-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    font-weight: 500;
  }
}

/* 横向滚动分类导航文字优化 */
@media (max-width: 768px) {
  .category-tabs .category-tab,
  .product-filters .filter-btn {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 500;
    letter-spacing: 0.02em;
    word-break: keep-all;
    white-space: nowrap;
  }
}
  }

  .subtitle, .video-meta {
    font-size: 0.8125rem;
    color: #da1b01;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* 防止iOS缩放 */
  }
}

/* 平板端字体优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  h1, .hero-content h1 {
    font-size: 2rem;
  }

  h2, .section-title {
    font-size: 1.75rem;
  }

  h3, .video-info h3 {
    font-size: 1.5rem;
  }

  p, .hero-content p {
    font-size: 1rem;
  }

  .btn {
    font-size: 1rem;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  @media (max-width: 768px) {
    body {
      font-weight: 500;
    }
    
    h1, h2, h3, h4, h5, h6 {
      font-weight: 700;
    }
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* 中文排版优化 */
@media (max-width: 768px) {
  /* 中文引号优化 */
  blockquote {
    font-size: 1rem;
    line-height: 1.7;
    padding-left: 1rem;
    border-left: 3px solid #8B4513;
  }

  /* 代码块优化 */
  code, pre {
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.5;
  }

  pre {
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
  }

  /* 链接文字优化 */
  a {
    text-decoration: none;
    transition: color 0.2s ease;
  }

  a:hover {
    text-decoration: underline;
  }

  /* 强调文字优化 */
  strong {
    font-weight: 600;
  }

  em {
    font-style: italic;
  }

  /* 列表文字优化 */
  ul, ol {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
  }

  li {
    margin-bottom: 0.375rem;
  }

  /* 表格文字优化 */
  table {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  caption {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }

  /* 辅助文字优化 */
  .text-muted {
    font-size: 0.875rem;
    color: #6c757d;
  }

  .text-small {
    font-size: 0.8125rem;
  }

  .text-large {
    font-size: 1.125rem;
  }

  /* 文字截断优化 */
  .text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 多行文字截断 */
  .text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .text-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}