/* 移动端优化 - 黑色微信绿风格 */

/* 基础移动端重置 */
@media (max-width: 768px) {
    /* 确保触摸友好的点击区域 */
    .btn,
    .nav-link,
    .article-link,
    .back-to-top,
    .qrcode {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 导航栏移动端优化 */
    .navbar {
        height: 60px;
    }
    
    .nav-menu {
        background: rgba(26, 26, 26, 0.98);
        backdrop-filter: blur(20px);
    }
    
    .nav-link {
        padding: 1rem 0;
        font-size: 1.1rem;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.8);
        font-weight: 500;
        transition: color 0.3s ease;
    }
    
    .nav-link:hover,
    .nav-link.active {
        color: var(--accent-color);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    /* 首页签名优化 */
    .hero {
        min-height: 100vh;
        padding: 60px 0 2rem;
    }
    
    .hero-content {
        padding: 2rem 1rem;
    }
    
    .signature-text {
        font-size: 1.75rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    .signature-subtitle {
        font-size: 1rem;
        color: var(--text-secondary);
    }
    
    .signature-divider {
        width: 50px;
        margin: 1.5rem auto;
    }
    
    /* 相册移动端优化 */
    .gallery {
        padding: 2rem 0;
    }
    
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gallery-item {
        border-radius: 6px;
    }
    
    .gallery-item:active {
        transform: scale(0.98);
    }
    
    .gallery-info h4 {
        font-size: 1rem;
    }
    
    .gallery-info p {
        font-size: 0.875rem;
    }
    
    /* 文章移动端优化 */
    .articles {
        padding: 2rem 0;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .article-card {
        border-radius: 8px;
        overflow: hidden;
    }
    
    .article-card:hover {
        transform: none;
    }
    
    .article-card:active {
        transform: scale(0.98);
    }
    
    .article-content {
        padding: 1.25rem;
    }
    
    .article-meta {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }
    
    .article-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .article-excerpt {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    /* 工具移动端优化 */
    .tools {
        padding: 2rem 0;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tool-card {
        padding: 1.5rem;
    }
    
    .tool-card:hover {
        transform: none;
    }
    
    .tool-card:active {
        transform: scale(0.98);
    }
    
    .tool-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .tool-emoji {
        font-size: 1.5rem;
    }
    
    .tool-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .tool-desc {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .tool-features {
        gap: 0.5rem;
    }
    
    .feature-tag {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
    
    .ad-slot {
        margin: 1.5rem auto;
        padding: 1rem;
    }
    
    .ad-placeholder {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    /* 关于我移动端优化 */
    .about {
        padding: 2rem 0;
    }
    
    .about-content {
        text-align: center;
    }
    
    .about-info {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
        margin-bottom: 2rem;
    }
    
    .about-highlights {
        align-items: center;
    }
    
    .highlight-item {
        flex-direction: column;
        text-align: center;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .highlight-icon {
        margin-bottom: 0.5rem;
    }
    
    .highlight-text h4 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
    
    .highlight-text p {
        font-size: 0.9rem;
    }
    
    .about-contact {
        text-align: center;
    }
    
    .contact-title {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .contact-social {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .social-item {
        width: 100%;
        max-width: 250px;
    }
    
    .qrcode {
        width: 130px;
        height: 130px;
    }
    
    .qrcode-placeholder {
        font-size: 0.8rem;
    }
    
    .qrcode-icon {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }
    
    /* 弹窗移动端优化 */
    .modal-content {
        margin: 20px;
        max-width: calc(100vw - 40px);
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 1.25rem;
    }
    
    .modal-body {
        padding: 1.25rem;
        max-height: 300px;
    }
    
    .modal-footer {
        padding: 1rem 1.25rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.875rem 1rem;
    }
    
    /* 联系方式移动端优化 */
    .contact {
        padding: 2rem 0;
    }
    
    .contact-social {
        flex-direction: column;
        gap: 2rem;
        margin-bottom: 2rem;
    }
    
    .social-item {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .qrcode {
        width: 140px;
        height: 140px;
        border-width: 1px;
    }
    
    .qrcode-placeholder {
        font-size: 0.875rem;
    }
    
    .qrcode-icon {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }
    
    .social-item p {
        font-size: 1rem;
    }
    
    .contact-info {
        text-align: center;
    }
    
    .contact-info p {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .contact-divider {
        width: 40px;
        margin: 1.5rem auto;
    }
    
    .contact-note {
        font-size: 0.9rem;
    }
    
    /* 页脚优化 */
    .footer {
        padding: 1.5rem 0;
    }
    
    .footer-content p {
        font-size: 0.8rem;
    }
}

/* 小屏幕设备优化 */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .hero-content {
        padding: 1.5rem 1rem;
    }
    
    .signature-text {
        font-size: 1.625rem;
    }
    
    .signature-subtitle {
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.625rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    .article-content {
        padding: 1rem;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
    
    .qrcode {
        width: 120px;
        height: 120px;
    }
    
    .qrcode-icon {
        font-size: 1.5rem;
    }
    
    .qrcode-placeholder span {
        font-size: 0.75rem;
    }
}

/* 超小屏幕设备优化 */
@media (max-width: 360px) {
    .signature-text {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .qrcode {
        width: 100px;
        height: 100px;
    }
    
    .qrcode-icon {
        font-size: 1.25rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移除悬停效果，专注于触摸反馈 */
    .gallery-item:hover,
    .article-card:hover,
    .qrcode:hover {
        transform: none;
    }
    
    /* 添加触摸反馈 */
    .gallery-item:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .article-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .qrcode:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* 确保足够的触摸间距 */
    .nav-menu {
        padding: 2rem 1rem;
    }
    
    .nav-link {
        margin: 0.5rem 0;
        padding: 1.25rem 0;
        font-size: 1.2rem;
        color: rgba(255, 255, 255, 0.8) !important;
    }
    
    /* 图片点击区域优化 */
    .gallery-image,
    .article-image {
        cursor: pointer;
        position: relative;
    }
    
    .gallery-image::after,
    .article-image::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: transparent;
        transition: background 0.2s ease;
    }
    
    .gallery-image:active::after,
    .article-image:active::after {
        background: rgba(0, 0, 0, 0.1);
    }
}

/* iOS Safari 特定优化 */
@supports (-webkit-touch-callout: none) {
    /* 防止iOS缩放 */
    input,
    textarea,
    select {
        font-size: 16px;
    }
    
    /* iOS安全区域适配 */
    @media (max-width: 768px) {
        .navbar {
            padding-top: env(safe-area-inset-top);
            height: calc(60px + env(safe-area-inset-top));
        }
        
        .hero {
            padding-top: calc(60px + env(safe-area-inset-top));
        }
        
        .back-to-top {
            bottom: calc(1rem + env(safe-area-inset-bottom));
        }
    }
    
    /* iOS滚动优化 */
    .gallery-grid,
    .articles-grid {
        -webkit-overflow-scrolling: touch;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 60px 0 1rem;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .signature-text {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .signature-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .signature-divider {
        margin: 1rem auto;
    }
    
    .contact-social {
        flex-direction: row;
        gap: 1rem;
    }
    
    .social-item {
        max-width: 200px;
    }
    
    .qrcode {
        width: 100px;
        height: 100px;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* 图标和文字清晰度优化 */
    .qrcode-icon {
        transform: scale(1.1);
    }
    
    .signature-text,
    .section-title {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 减少动画以提升性能 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .signature-text {
        animation: none !important;
    }
    
    .gallery-item,
    .article-card,
    .social-item {
        animation: none !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #e5e5e5;
        --secondary-color: #b3b3b3;
        --accent-color: #4da6ff;
        --background: #1a1a1a;
        --background-light: #2d2d2d;
        --border-color: #404040;
        --text-primary: #e5e5e5;
        --text-secondary: #b3b3b3;
        --text-light: #808080;
    }
    
    .navbar {
        background: rgba(26, 26, 26, 0.98);
        border-bottom-color: var(--border-color);
    }
    
    .nav-menu {
        background: rgba(26, 26, 26, 0.98);
        color: rgba(255, 255, 255, 0.8);
    }
    
    .gallery-item,
    .article-card {
        background: var(--background-light);
        border-color: var(--border-color);
    }
    
    .qrcode {
        background: var(--background-light);
        border-color: var(--border-color);
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .nav-toggle,
    .back-to-top {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .hero-content {
        padding: 1rem;
        text-align: center;
    }
    
    .signature-divider {
        margin: 1rem auto;
    }
    
    section {
        page-break-inside: avoid;
        padding: 2rem 0;
    }
    
    .gallery-grid,
    .articles-grid {
        display: block;
    }
    
    .gallery-item,
    .article-card {
        break-inside: avoid;
        margin-bottom: 2rem;
    }
    
    .contact-social {
        display: none;
    }
}