/* ============================================
   Caleb 个人网站 - 响应式样式
   ============================================ */

/* ============================================
   Large Desktop (> 1440px)
   ============================================ */
@media (min-width: 1441px) {
  .section-container {
    max-width: 1400px;
  }
  
  .works-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .movies-grid,
  .tvshows-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================
   Desktop (1024px - 1440px)
   ============================================ */
@media (min-width: 1024px) and (max-width: 1440px) {
  :root {
    --text-h1: 60px;
    --text-h2: 40px;
  }
}

/* ============================================
   Tablet (640px - 1024px)
   ============================================ */
@media (min-width: 640px) and (max-width: 1024px) {
  :root {
    --text-h1: 48px;
    --text-h2: 36px;
    --text-h3: 28px;
    --text-h4: 20px;
  }
  
  /* 平板上的侧边栏适配 - 稍微窄一点 */
  .sidebar {
    width: 35vw;
  }
  
  .sidebar:hover {
    width: 40vw;
  }
  
  .sidebar.shrink {
    width: 28vw;
  }
  
  .main-content {
    margin-left: 33vw;
  }
  
  .main-content:hover {
    margin-left: 26vw;
  }
  
  .sidebar-content {
    max-width: 200px;
    padding: var(--space-xl);
  }
  
  .tab-item {
    padding: var(--space-md) var(--space-lg);
  }
  
  .tab-item .tab-text {
    font-size: 12px;
    letter-spacing: 0.15em;
  }
  
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
  
  .work-card {
    height: 420px;
  }
  
  .work-image {
    height: 220px;
  }
  
  .movies-grid,
  .tvshows-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .music-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .bio-stats {
    gap: var(--space-xl);
  }
}

/* ============================================
   Mobile (< 640px)
   ============================================ */
@media (max-width: 639px) {
  :root {
    /* 字号缩放 0.8x */
    --text-h1: 42px;
    --text-h2: 32px;
    --text-h3: 24px;
    --text-h4: 20px;
    --text-body-l: 16px;
    --text-body-m: 14px;
    --text-caption: 13px;
    --text-label: 11px;
  }
  
  /* 隐藏桌面端导航 */
  .sidebar {
    display: none;
  }
  
  .nav-dots {
    display: none;
  }
  
  /* 显示移动端组件 */
  .mobile-header {
    display: flex;
  }
  
  .mobile-menu {
    display: block;
  }
  
  /* 主内容区域调整 */
  .main-content {
    margin-left: 0;
    margin-right: 0;
    padding-top: 56px;
    scroll-snap-type: none;
  }
  
  .page-section {
    min-height: auto;
    padding: var(--space-lg);
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-3xl);
  }
  
  /* Hero 调整 */
  .hero-container {
    height: calc(100vh - 56px);
  }
  
  .hero-title {
    font-size: var(--text-h1);
  }
  
  .hero-subtitle {
    font-size: var(--text-body-m);
  }
  
  /* 区块标题 */
  .section-title {
    font-size: var(--text-h2);
    margin-bottom: var(--space-xl);
  }
  
  /* 二级导航 */
  .sub-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-lg);
    -webkit-overflow-scrolling: touch;
  }
  
  .sub-nav-item {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-caption);
  }
  
  /* 卡片调整 */
  .glass-card .card-content {
    padding: var(--space-lg);
  }
  
  .location-card {
    max-width: 100%;
    min-height: 350px;
  }
  
  .bio-card {
    max-width: 100%;
  }
  
  .bio-stats {
    flex-direction: column;
    gap: var(--space-lg);
  }
  
  .stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-align: left;
  }
  
  .stat-number {
    font-size: var(--text-h4);
    margin-bottom: 0;
  }
  
  /* 作品网格 */
  .works-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .work-card {
    height: auto;
  }
  
  .work-image {
    height: 200px;
  }
  
  .work-info {
    padding: var(--space-lg);
  }
  
  /* 媒体网格 */
  .movies-grid,
  .tvshows-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  
  .music-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  
  .media-poster {
    padding-bottom: 140%;
  }
  
  .media-info {
    padding: var(--space-sm);
  }
  
  .media-rank {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
  
  .media-title {
    font-size: var(--text-label);
  }
  
  /* 足球页面 */
  .football-card {
    min-height: 300px;
  }
  
  .football-card .card-title {
    font-size: var(--text-h3);
  }
  
  /* 联系方式 */
  .contact-content {
    max-width: 100%;
  }
  
  .contact-link {
    padding: var(--space-md);
  }
  
  .contact-icon {
    font-size: 20px;
  }
  
  .contact-text {
    font-size: var(--text-caption);
  }
  
  /* 模态框 */
  .modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .modal-body {
    padding: var(--space-lg);
  }
  
  .modal-image {
    height: 200px;
    margin-bottom: var(--space-lg);
  }
  
  .modal-title {
    font-size: var(--text-h4);
  }
  
  .modal-subtitle {
    font-size: var(--text-body-m);
  }
  
  /* 子区块标题 */
  .subsection-title {
    font-size: var(--text-body-l);
    margin-bottom: var(--space-lg);
  }
  
  /* 标签 */
  .tag {
    font-size: 10px;
    padding: 3px 8px;
  }
  
  .card-tags {
    gap: var(--space-xs);
  }
}

/* ============================================
   触摸设备优化
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* 增大触摸目标 */
  .tab-item,
  .nav-dot,
  .sub-nav-item,
  .contact-link {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 触摸反馈 */
  .touch-target {
    -webkit-tap-highlight-color: rgba(255, 138, 105, 0.2);
    touch-action: manipulation;
  }
  
  .touch-target:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* 禁用 hover 效果 */
  .glass-card:hover {
    transform: none;
  }
  
  .media-card:hover {
    transform: none;
    box-shadow: none;
  }
  
  .nav-dot:hover {
    transform: none;
  }
}

/* ============================================
   横屏移动设备
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-container {
    height: auto;
    min-height: 100vh;
    padding: var(--space-xl) 0;
  }
  
  .hero-title {
    font-size: 36px;
  }
  
  .scroll-indicator {
    display: none;
  }
  
  .page-section {
    min-height: auto;
  }
}

/* ============================================
   高对比度模式
   ============================================ */
@media (prefers-contrast: high) {
  :root {
    --text-primary: rgba(255, 255, 255, 1);
    --text-secondary: rgba(255, 255, 255, 0.85);
    --text-tertiary: rgba(255, 255, 255, 0.7);
    --border-color: rgba(255, 255, 255, 0.3);
  }
  
  .glass-card {
    border-width: 2px;
  }
}

/* ============================================
   深色模式强制（已是深色主题，保持一致）
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* 保持当前设计 */
}

/* ============================================
   打印样式
   ============================================ */
@media print {
  .sidebar,
  .nav-dots,
  .mobile-header,
  .mobile-menu,
  .scroll-indicator {
    display: none !important;
  }
  
  .main-content {
    margin: 0;
    height: auto;
    overflow: visible;
  }
  
  .page-section {
    break-inside: avoid;
    page-break-inside: avoid;
    min-height: auto;
    opacity: 1;
    transform: none;
  }
  
  .glass-card {
    background: white;
    border: 1px solid #ccc;
    box-shadow: none;
  }
  
  body {
    color: black;
    background: white;
  }
}
