/* ========================================
   Mobile Optimization Styles
   Peach Lover - 移动端优化
   ======================================== */

/* ===== 基础优化 (所有移动设备) ===== */
@media (max-width: 767px) {
    /* 字体大小优化 - 确保可读性 */
    html {
        font-size: 15px;
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        line-height: 1.6;
    }
    
    /* 优化触摸体验 */
    * {
        -webkit-tap-highlight-color: rgba(255, 183, 197, 0.3);
    }
    
    a, button {
        min-height: 44px; /* iOS 推荐点击区域 */
        touch-action: manipulation;
    }
    
    /* 导航栏优化 - 网站名居中，菜单按钮左侧 */
    .nav-container {
        height: 56px;
        padding: 0 var(--spacing-sm);
        justify-content: space-between;
        position: relative;
    }
    
    /* 网站名居中 */
    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1.25rem;
        z-index: 10;
    }
    
    .logo-icon {
        font-size: 1.75rem;
    }
    
    /* 汉堡菜单按钮最左边 */
    .nav-toggle {
        width: 36px;
        height: 36px;
        order: -1;
        z-index: 20;
    }
    
    /* 侧滑菜单（抽屉式） */
    .nav-menu {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        max-width: 80vw !important;
        height: 100vh !important;
        padding: var(--spacing-lg) !important;
        transform: translateX(-100%) !important;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 1000 !important;
        background: var(--color-bg) !important;
        transition: transform 0.3s ease !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .nav-menu.active {
        transform: translateX(0) !important;
    }
    
    /* 菜单遮罩层 */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 998;
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* 菜单项优化 */
    .nav-menu li {
        margin-bottom: var(--spacing-md);
        text-align: left;
    }
    
    .nav-link {
        display: block;
        padding: var(--spacing-md);
        font-size: 1.125rem;
        border-radius: var(--radius-md);
        transition: all 0.3s;
    }
    
    .nav-link:hover,
    .nav-link.active {
        background: rgba(255, 107, 157, 0.1);
    }
    
    /* 触摸优化 */
    .btn,
    .nav-toggle,
    .share-btn {
        min-height: 44px; /* 触摸区域≥44px */
        touch-action: manipulation; /* 禁用双击缩放 */
    }
    
    /* 触摸反馈 */
    .btn:active,
    .nav-link:active {
        transform: scale(0.95);
    }
    
    /* Hero 区域优化 */
    .hero {
        padding: calc(56px + var(--spacing-lg)) var(--spacing-md) var(--spacing-lg);
        min-height: auto;
        gap: var(--spacing-md);
    }
    
    .hero-title {
        font-size: 1.875rem;
        letter-spacing: -0.3px;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: var(--spacing-md);
        line-height: 1.6;
    }
    
    .hero-cta {
        gap: var(--spacing-sm);
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
        min-height: 48px;
    }
    
    .hero-avatar {
        width: 120px;
        height: 120px;
        margin: var(--spacing-md) auto 0;
    }
    
    .avatar-emoji {
        font-size: 3.5rem;
    }
    
    .avatar-ring {
        width: 100px;
        height: 100px;
    }
    
    .avatar-ring-2 {
        width: 140px;
        height: 140px;
    }
    
    /* 标题优化 */
    .section-title {
        font-size: 1.625rem;
        margin-bottom: var(--spacing-md);
        line-height: 1.2;
    }
    
    .section-desc {
        font-size: 0.9375rem;
        margin-bottom: var(--spacing-lg);
        line-height: 1.5;
    }
    
    /* 卡片网格 - 两列显示 */
    .features-grid,
    .products-grid,
    .apps-grid {
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
        grid-template-columns: repeat(2, 1fr) !important; /* 强制两列 */
    }
    
    /* 特征卡片 - 两列优化 */
    .feature-card {
        padding: var(--spacing-sm);
        margin-bottom: 0;
    }
    
    .feature-icon {
        font-size: 2rem;
        margin-bottom: var(--spacing-xs);
        display: block;
    }
    
    .feature-card h3 {
        font-size: 0.9375rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }
    
    .feature-card p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    /* 产品/博客卡片 - 两列优化 */
    .product-card,
    .app-card {
        padding: var(--spacing-sm);
        margin-bottom: 0;
    }
    
    .product-image,
    .app-icon {
        font-size: 2.5rem;
        margin-bottom: var(--spacing-xs);
    }
    
    .product-name,
    .app-name {
        font-size: 0.9375rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }
    
    .product-desc,
    .app-desc {
        font-size: 0.75rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* 统计数据 */
    .story-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xs);
    }
    
    .stat-item {
        padding: var(--spacing-sm);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* 联系表单 */
    .contact-content {
        gap: var(--spacing-md);
    }
    
    .form-group input,
    .form-group textarea {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 1rem; /* 防止 iOS 缩放 */
    }
    
    /* Footer 优化 */
    .footer {
        padding: var(--spacing-xl) 0 var(--spacing-md);
    }
    
    .footer-content {
        gap: var(--spacing-lg);
    }
    
    .footer-brand .logo-icon {
        font-size: 1.75rem;
    }
    
    .footer-brand .logo-text {
        font-size: 1.25rem;
    }
    
    .footer-links h4,
    .footer-social h4 {
        font-size: 1rem;
    }
    
    .footer-links a,
    .footer-bottom a {
        font-size: 0.875rem;
    }
    
    .social-link {
        padding: 0.4rem 0.875rem;
        font-size: 0.875rem;
    }
    
    /* 按钮优化 - 易于点击 */
    .btn {
        min-height: 44px; /* iOS 推荐点击区域 */
        touch-action: manipulation;
    }
    
    /* 链接优化 */
    a {
        -webkit-tap-highlight-color: rgba(255, 183, 197, 0.3);
    }
    
    /* 卡片悬停效果 - 移动端禁用 */
    .feature-card:hover,
    .product-card:hover,
    .app-card:hover {
        transform: none;
    }
    
    /* 动画优化 - 减少运动 */
    .animate-on-scroll {
        transition: opacity 0.3s ease;
    }
}

/* ===== 小屏手机 (≤375px) ===== */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9375rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .nav-container {
        height: 52px;
    }
    
    .logo {
        font-size: 1.125rem;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
}

/* ===== 平板竖屏 (768px-1024px) ===== */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
    .hero {
        padding: calc(68px + var(--spacing-xl)) var(--spacing-md) var(--spacing-xl);
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .features-grid,
    .products-grid,
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-brand {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* ===== 移动端特殊优化 ===== */

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大点击区域 */
    .nav-link {
        padding: var(--spacing-md);
        min-height: 44px;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
    }
    
    /* 移除悬停效果，改用点击反馈 */
    .feature-card:active,
    .product-card:active,
    .app-card:active {
        transform: scale(0.98);
    }
    
    /* 表单元素优化 */
    input, textarea, select {
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
}

/* 横屏优化 */
@media (max-width: 896px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: calc(56px + var(--spacing-lg)) var(--spacing-md) var(--spacing-lg);
    }
    
    .hero-avatar {
        display: none; /* 横屏时隐藏头像，节省空间 */
    }
    
    .footer {
        padding: var(--spacing-lg) 0 var(--spacing-md);
    }
}

/* ===== 安全区域适配 (iPhone X+) ===== */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .nav-container {
        padding-left: max(var(--spacing-md), env(safe-area-inset-left));
        padding-right: max(var(--spacing-md), env(safe-area-inset-right));
    }
    
    .footer {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ===== 性能优化 ===== */

/* 减少移动端的复杂动画 */
@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 {
        /* 可以在这里定义深色模式变量 */
        /* 目前保持浅色主题 */
    }
}

/* ===== 打印优化 ===== */
@media print {
    .header,
    .footer,
    .nav-toggle,
    .btn {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}
