/* ============================================
   hexo-theme-linkpark 响应式样式
   基于现有项目的响应式断点
   ============================================ */

/* ---- 响应式断点 ---- */
/* Mobile:  < 768px  */
/* Tablet:  768px - 1024px */
/* Desktop: > 1024px */

/* ---- 桌面端样式 ---- */
@media (min-width: 1024px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

/* ---- 平板端样式 ---- */
@media (min-width: 768px) and (max-width: 1023px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
  }
  
  .main-layout {
    padding: 0 var(--space-6);
    gap: var(--space-6);
  }

  .sidebar {
    width: 240px;
  }
  
  .header-inner {
    padding: 0 var(--space-6);
  }
  
  .footer-inner {
    padding: var(--space-4) var(--space-6);
  }

  .breadcrumb {
    padding: var(--space-3) var(--space-6);
  }
}

/* ---- 移动端样式 ---- */
@media (max-width: 767px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
  
  .menu-toggle {
    display: flex;
  }
  
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: var(--space-2) 0;
  }
  
  .site-nav.active {
    display: flex;
  }
  
  .nav-link {
    border: none;
    padding: var(--space-4) var(--space-8);
    display: block;
    border-radius: 0;
    border-bottom: none;
  }
  
  .nav-link:last-child {
    border: none;
  }
  
  .container {
    padding: 0 var(--space-4);
  }
  
  .main-layout {
    flex-direction: column;
    padding: 0 var(--space-4);
    gap: 0;
  }

  .sidebar {
    width: 100%;
    padding: 0 var(--space-4) var(--space-4);
  }
  
  .header-inner {
    padding: 0 var(--space-4);
  }
  
  .footer-inner {
    padding: var(--space-4);
  }

  .breadcrumb {
    padding: var(--space-3) var(--space-4);
  }
  
  .post-list {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .post-card-image {
    height: 160px;
  }
  
  .post-detail-title {
    font-size: var(--text-3xl);
  }
  
  .post-detail-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  .post-nav {
    flex-direction: column;
  }
  
  .post-nav-prev {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  
  .archive-item,
  .category-item,
  .tag-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  .archive-categories,
  .category-tags,
  .tag-categories {
    margin-left: 0;
  }
  
  .footer-inner {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }
  
  .footer-info {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .footer-links {
    justify-content: center;
  }
  
  .home-header {
    padding: var(--space-8) 0 var(--space-6);
  }
  
  .home-title {
    font-size: var(--text-3xl);
  }
  
  .archive-title,
  .category-title,
  .tag-title,
  .page-detail-title {
    font-size: var(--text-3xl);
    padding: var(--space-8) 0 var(--space-3);
  }
  
  .toc-wrapper {
    width: 100%;
    position: static;
    max-height: none;
    margin-bottom: var(--space-6);
    padding: var(--space-4);
  }
  
  .page-nav-link,
  .page-nav-space {
    min-width: 2rem;
    height: 2rem;
    font-size: var(--text-xs);
    padding: 0 var(--space-2);
  }
}

/* ---- 小屏幕移动端 ---- */
@media (max-width: 480px) {
  html {
    font-size: 15px;
  }
  
  .site-title {
    font-size: var(--text-lg);
  }
  
  .post-card-title {
    font-size: var(--text-lg);
  }
  
  .post-card-excerpt {
    -webkit-line-clamp: 2;
  }
  
  .post-detail-title {
    font-size: var(--text-2xl);
  }
  
  .archive-year {
    font-size: var(--text-2xl);
  }
}

/* ---- 高分辨率屏幕 ---- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* 可以在这里添加高分辨率屏幕的特定样式 */
}

/* ---- 打印样式 ---- */
@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .site-header,
  .site-footer,
  .menu-toggle,
  .theme-toggle,
  .toc-wrapper,
  .post-nav,
  .comments,
  .pagination {
    display: none !important;
  }
  
  .site-main {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }
  
  .post-detail-content {
    font-size: 12pt;
    line-height: 1.6;
  }
  
  .post-detail-content a {
    color: black;
    text-decoration: underline;
  }
  
  .post-detail-content a::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }
  
  .post-detail-content img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  .post-detail-content pre,
  .post-detail-content code {
    background: #f5f5f5;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}

/* ---- 触摸设备优化 ---- */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备上的样式调整 */
  .post-card:hover {
    transform: none;
    box-shadow: none;
  }
  
  .nav-link:hover {
    background: transparent;
  }
  
  .post-card-tags a:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
  }
}

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

/* ---- 暗色模式偏好 ---- */
@media (prefers-color-scheme: dark) {
  /* 如果用户系统偏好暗色模式，且没有手动设置主题 */
  :root:not([data-theme]) {
    --color-primary: #C4A882;
    --color-primary-light: #D4B892;
    --color-primary-dark: #A88F6F;
    --color-secondary: #F6F4EF;
    --color-accent: #C4A882;

    --color-bg: #1a1a1a;
    --color-bg-secondary: #2a2a2a;
    --color-bg-tertiary: #3a3a3a;
    --color-surface: #2a2a2a;

    --color-text: #F6F4EF;
    --color-text-secondary: #C4BFB6;
    --color-text-muted: #9E9A91;

    --color-border: #3a3a3a;
    --color-border-light: #2a2a2a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);

    --header-bg: rgba(26, 26, 26, 0.95);
    --color-code-bg: #2a2a2a;
    --color-code-text: #F6F4EF;
  }
}

/* ---- 滚动条样式 ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---- 选择文本样式 ---- */
::selection {
  background: var(--color-primary);
  color: var(--color-bg);
}

::-moz-selection {
  background: var(--color-primary);
  color: var(--color-bg);
}

/* ---- 焦点样式 ---- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---- 链接下划线样式 ---- */
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
