/* 六爻占断APP官网主页 - 响应式布局样式 */

/* ===== 移动端优先设计 ===== */

/* 超小屏幕 (手机竖屏) - 默认样式 */
/* 320px - 575px */

/* 移动端导航菜单 */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }
  
  .nav-menu {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-dark);
    flex-direction: column;
    padding: var(--spacing-lg);
    gap: var(--spacing-md);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
  }
  
  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
}

/* 英雄区域移动端适配 */
@media (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
  }
  
  .hero-text {
    order: 2;
  }
  
  .hero-visual {
    order: 1;
  }
  
  .title-main {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  
  .title-sub {
    font-size: clamp(1rem, 4vw, 1.4rem);
  }
  
  .hero-cta {
    justify-content: center;
  }
  
  .cta-button {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1rem;
  }
  
  .app-screenshot {
    max-width: 280px;
  }
  
  .preview-decoration {
    width: 60px;
    height: 60px;
    top: -15px;
    right: -15px;
  }
  
  .bagua-symbol::before {
    font-size: 1.5rem;
  }
}

/* 关于我们区域移动端适配 */
@media (max-width: 768px) {
  .about-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
  
  .about-visual {
    order: -1;
  }
  
  .culture-elements {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .element-item {
    flex: 1;
    min-width: 120px;
    flex-direction: column;
    text-align: center;
    padding: var(--spacing-sm);
  }
  
  .element-item:hover {
    transform: translateY(-5px);
  }
}

/* 功能特色区域移动端适配 */
@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
  
  .feature-card {
    padding: var(--spacing-lg);
  }
  
  .feature-icon {
    width: 60px;
    height: 60px;
    margin-bottom: var(--spacing-md);
  }
  
  .feature-icon svg {
    width: 30px;
    height: 30px;
  }
  
  .feature-title {
    font-size: 1.3rem;
  }
}

/* 下载区域移动端适配 */
@media (max-width: 768px) {
  .download-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    text-align: center;
  }
  
  .download-info {
    order: -1;
  }
  
  .app-stats {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .stat-item {
    flex-direction: row;
    justify-content: center;
    gap: var(--spacing-sm);
  }
  
  .stat-number {
    font-size: 1.5rem;
    margin-bottom: 0;
  }
  
  .download-btn {
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  .qr-code {
    width: 100px;
    height: 100px;
  }
  
  .qr-code img {
    width: 80px;
    height: 80px;
  }
}

/* 页脚移动端适配 */
@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-md);
  }
  
  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .copyright {
    font-size: 0.8rem;
  }
}

/* ===== 小屏幕 (手机横屏/小平板) ===== */
/* 576px - 767px */
@media (min-width: 576px) and (max-width: 767px) {
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .hero-content {
    padding: var(--spacing-xxl) var(--spacing-md);
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .culture-elements {
    flex-direction: row;
  }
  
  .element-item {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== 中等屏幕 (平板) ===== */
/* 768px - 991px */
@media (min-width: 768px) and (max-width: 991px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
  
  .nav-container {
    padding: var(--spacing-sm) var(--spacing-lg);
  }
  
  .hero-content {
    gap: var(--spacing-xl);
    padding: var(--spacing-xxl) var(--spacing-lg);
  }
  
  .title-main {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .download-content {
    gap: var(--spacing-xl);
  }
  
  .app-stats {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ===== 大屏幕 (桌面) ===== */
/* 992px - 1199px */
@media (min-width: 992px) and (max-width: 1199px) {
  .container {
    max-width: 960px;
  }
  
  .hero-content {
    gap: var(--spacing-xxl);
  }
  
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .about-content {
    gap: var(--spacing-xxl);
  }
}

/* ===== 超大屏幕 (大桌面) ===== */
/* 1200px+ */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  .hero-content {
    gap: var(--spacing-xxl);
  }
  
  .title-main {
    font-size: 4rem;
  }
  
  .title-sub {
    font-size: 1.8rem;
  }
  
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== 超宽屏幕 ===== */
/* 1400px+ */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .hero-content {
    gap: 5rem;
  }
  
  .features-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== 横屏适配 ===== */
@media (orientation: landscape) and (max-height: 600px) {
  .hero {
    min-height: auto;
    padding: var(--spacing-xl) 0;
  }
  
  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) var(--spacing-md);
  }
  
  .title-main {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
  }
  
  .title-sub {
    font-size: clamp(1rem, 2vw, 1.3rem);
  }
  
  .hero-description {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
  }
  
  .app-screenshot {
    max-width: 200px;
  }
}

/* ===== 高分辨率屏幕适配 ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .logo,
  .footer-logo,
  .store-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ===== 打印样式 ===== */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }
  
  .header,
  .nav-toggle,
  .hero-cta,
  .download-section,
  .footer-social {
    display: none !important;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .hero-visual {
    order: -1;
  }
  
  .app-screenshot {
    max-width: 200px;
  }
  
  .section-title {
    color: black !important;
    page-break-after: avoid;
  }
  
  .feature-card {
    break-inside: avoid;
    margin-bottom: var(--spacing-md);
  }
  
  .footer {
    border-top: 1px solid black;
    padding: var(--spacing-md) 0;
  }
  
  .footer-content {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .footer-links {
    display: none;
  }
}

/* ===== 容器查询支持 (实验性) ===== */
@supports (container-type: inline-size) {
  .features-section {
    container-type: inline-size;
  }
  
  @container (max-width: 600px) {
    .features-grid {
      grid-template-columns: 1fr;
    }
  }
  
  @container (min-width: 601px) and (max-width: 900px) {
    .features-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  @container (min-width: 901px) {
    .features-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}

/* ===== 动态视口单位支持 ===== */
@supports (height: 100dvh) {
  .hero {
    min-height: 100dvh;
  }
}

/* ===== 触摸设备优化 ===== */
@media (hover: none) and (pointer: coarse) {
  .cta-button,
  .download-btn,
  .nav-menu a,
  .footer-links a,
  .social-link {
    min-height: 44px;
    min-width: 44px;
  }
  
  .feature-card:hover,
  .element-item:hover {
    transform: none;
  }
  
  .cta-button:hover,
  .download-btn:hover {
    transform: none;
  }
  
  .cta-button:active,
  .download-btn:active {
    transform: scale(0.98);
  }
}

/* ===== 鼠标设备优化 ===== */
@media (hover: hover) and (pointer: fine) {
  .feature-card,
  .element-item,
  .cta-button,
  .download-btn,
  .social-link {
    cursor: pointer;
  }
}

/* ===== 响应式配色适配 ===== */

/* 移动端配色优化 - 提高对比度和可读性 */
@media (max-width: 768px) {
  :root {
    /* 移动端使用更高对比度的颜色 */
    --text-body: #1a1a1a;
    --text-muted: #4a4a4a;
    --bg-secondary: #f8f8f8;
  }
  
  /* 移动端按钮增强 */
  .cta-button,
  .download-btn {
    min-height: 48px;
    font-weight: 600;
    border-width: 2px;
  }
  
  /* 移动端文字对比度增强 */
  .section-title,
  .feature-title {
    color: var(--text-primary);
    font-weight: 700;
  }
}

/* 平板端配色优化 */
@media (min-width: 768px) and (max-width: 1024px) {
  :root {
    /* 平板端平衡的配色 */
    --text-body: #2c2c2c;
    --text-muted: #666666;
  }
}

/* 暗色模式系统偏好支持 */
@media (prefers-color-scheme: dark) {
  :root:not(.theme-default):not(.theme-eye-care):not(.theme-bright-environment) {
    /* 自动暗色模式变量 */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-dark: #0f0f0f;
    --text-primary: #ffffff;
    --text-body: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-inverse: #1a1a1a;
    --accent-primary: #d4af37;
    --accent-secondary: #8b7355;
    --accent-tertiary: #b8860b;
  }
}

/* ===== 高对比度模式支持 ===== */
@media (prefers-contrast: high) {
  :root:not(.theme-default):not(.theme-dark):not(.theme-eye-care) {
    /* 高对比度模式变量 */
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --bg-dark: #000000;
    --text-primary: #000000;
    --text-body: #000000;
    --text-muted: #333333;
    --text-inverse: #ffffff;
    --accent-primary: #0000ff;
    --accent-secondary: #000080;
    --accent-tertiary: #4169e1;
  }
  
  /* 高对比度边框增强 */
  .cta-button,
  .download-btn,
  .feature-card,
  .nav-menu a {
    border: 2px solid var(--text-primary);
  }
  
  /* 高对比度焦点指示器 */
  *:focus {
    outline: 3px solid var(--accent-primary);
    outline-offset: 2px;
  }
}

/* ===== 减少动画模式 ===== */
@media (prefers-reduced-motion: reduce) {
  .ink-wash-bg,
  .bagua-symbol,
  .loading-screen,
  .ink-circle {
    animation: none;
  }
  
  .hero-text,
  .hero-visual {
    animation: none;
  }
  
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ===== 透明度偏好 ===== */
@media (prefers-reduced-transparency: reduce) {
  .header {
    background: var(--bg-dark);
    backdrop-filter: none;
  }
  
  .nav-menu {
    background: var(--bg-dark);
  }
  
  /* 移除所有透明效果 */
  .hero-background,
  .ink-wash-bg {
    opacity: 1;
  }
}

/* ===== 数据节省模式 ===== */
@media (prefers-reduced-data: reduce) {
  .ink-wash-bg,
  .hero-background {
    background: none;
  }
  
  .app-screenshot,
  .qr-code img {
    display: none;
  }
  
  .app-screenshot::after {
    content: '应用截图';
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-xl);
  }
}

/* ===== 环境光线适配 ===== */
@media (prefers-color-scheme: light) and (min-resolution: 2dppx) {
  /* 高分辨率设备的亮色模式优化 */
  :root {
    --text-body: #1f1f1f;
    --text-muted: #555555;
  }
}

/* ===== 触摸设备配色优化 ===== */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备使用更明显的交互反馈 */
  .cta-button:active,
  .download-btn:active {
    background: var(--accent-secondary);
    transform: scale(0.98);
  }
  
  /* 触摸设备的链接样式 */
  .nav-menu a:active,
  .footer-links a:active {
    background: var(--accent-primary);
    color: var(--text-inverse);
  }
}

/* ===== 小屏幕高对比度优化 ===== */
@media (max-width: 768px) and (prefers-contrast: high) {
  .feature-card,
  .cta-button,
  .download-btn {
    border-width: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

/* ===== 横屏模式配色适配 ===== */
@media (orientation: landscape) and (max-height: 600px) {
  /* 横屏模式下的紧凑配色 */
  .section-title {
    font-size: 1.8rem;
  }
  
  .hero-text {
    padding: var(--spacing-md) 0;
  }
}