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

/* ===== 基础优化 (所有移动设备) ===== */
@media (max-width: 767px) {
    /* 字体大小优化 - 确保可读性 */
    html {
        font-size: 15px;
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        line-height: 1.65;
    }
    
    /* 优化触摸体验 */
    * {
        -webkit-tap-highlight-color: rgba(255, 183, 197, 0.3);
    }
    
    a, button {
        min-height: 44px; /* iOS 推荐点击区域 */
        touch-action: manipulation;
    }
    
    /* 导航栏优化 */
    .nav-container {
        height: 58px;
        padding: 0 var(--spacing-sm);
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .logo-icon {
        font-size: 1.75rem;
    }
    
    .nav-toggle {
        width: 36px;
        height: 36px;
    }
    
    .nav-menu {
        top: 58px;
        padding: var(--spacing-sm);
        background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,245,247,0.98));
        box-shadow: 0 20px 44px rgba(255, 105, 135, 0.16);
    }

    .nav-link {
        width: 100%;
        border-radius: 18px;
    }
    
    /* Hero 区域优化 */
    .hero {
        padding: calc(58px + 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;
        border-radius: 999px;
    }
    
    .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: 1rem;
        margin-bottom: 0;
        border-radius: 18px;
    }
    
    .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: 1rem;
        margin-bottom: 0;
        border-radius: 18px;
    }
    
    .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);
        border-radius: 16px;
    }
    
    .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 缩放 */
        border-radius: 16px;
        min-height: 48px;
    }
    
    /* 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);
    }
}

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

/* GPU 加速优化 - 减少重绘和回流 */
.feature-card,
.product-card,
.app-card,
.review-card,
.stat-item,
.hero-avatar,
.avatar-ring,
.avatar-ring-2,
.sakura-petal,
.golden-particle {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 按钮触摸反馈优化 */
.btn:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

/* 触摸水波纹效果 */
.btn-primary,
.btn-secondary,
.nav-link,
.feature-card,
.product-card,
.app-card {
    position: relative;
    overflow: hidden;
}

.btn-primary::after,
.btn-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;
    opacity: 0;
    pointer-events: none;
}

.btn-primary:active::after,
.btn-secondary:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
    transition: 0s;
}

/* 卡片触摸反馈 */
.feature-card:active,
.product-card:active,
.app-card:active {
    transform: scale(0.97);
    transition: transform 0.15s ease;
}

/* 导航链接触摸反馈 */
.nav-link:active {
    background: rgba(255, 183, 197, 0.25);
    transform: scale(0.98);
    transition: all 0.1s ease;
}

/* 减少移动端的复杂动画 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        will-change: auto !important;
    }
}

/* 移动端动画性能优化 */
@media (max-width: 768px) {
    /* 简化复杂阴影 */
    .feature-card,
    .product-card,
    .app-card {
        box-shadow: 0 2px 12px rgba(255, 105, 135, 0.1);
    }
    
    /* 减少动画时长，提升响应速度 */
    .btn,
    .nav-link,
    .feature-card,
    .product-card,
    .app-card {
        transition-duration: 200ms;
    }
    
    /* 优化滚动性能 */
    .nav-menu,
    .hero,
    .features,
    .blog,
    .apps,
    .footer {
        -webkit-overflow-scrolling: touch;
    }
}

/* 深色模式适配（可选） */
@media (prefers-color-scheme: dark) {
    :root {
        /* 可以在这里定义深色模式变量 */
        /* 目前保持浅色主题 */
    }
}

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

/* ===== 桃桃 Claw 导航链接移动端优化 ===== */
@media (max-width: 768px) {
    .peach-chat-nav {
        padding: 8px !important;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    
    .peach-chat-nav .nav-text {
        display: none;
    }
    
    .peach-chat-nav .nav-icon {
        font-size: 22px;
        margin: 0;
    }
    
    .peach-chat-nav .nav-badge {
        top: 2px;
        right: 2px;
        font-size: 8px;
        padding: 1px 4px;
    }
}

/* 小屏幕进一步优化 */
@media (max-width: 375px) {
    .peach-chat-nav {
        padding: 6px !important;
    }
    
    .peach-chat-nav .nav-icon {
        font-size: 20px;
    }
}
