/* ========================================
   Beijing Digital Square - Responsive Styles
   Mobile-First Responsive Design
   ======================================== */

/* ========================================
   LARGE DESKTOP (1400px and up)
   ======================================== */

@media screen and (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero h1 {
        font-size: 6rem;
    }
    
    .section {
        padding: 100px 0;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

/* ========================================
   DESKTOP (1200px - 1399px)
   ======================================== */

@media screen and (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }
    
    .hero h1 {
        font-size: 5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   SMALL DESKTOP / TABLET LANDSCAPE (992px - 1199px)
   ======================================== */

@media screen and (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    .hero h1 {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-menu {
        gap: 2rem;
    }
    
    .about-grid {
        gap: 3rem;
    }
    
    .app-showcase {
        gap: 3rem;
    }
}

/* ========================================
   TABLET (768px - 991px)
   ======================================== */

@media screen and (min-width: 768px) and (max-width: 991px) {
    :root {
        --spacing-lg: 3rem;
        --spacing-xl: 5rem;
    }
    
    .container {
        max-width: 720px;
        padding: 0 1.5rem;
    }
    
    /* Typography */
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    /* Hero */
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-content {
        padding: 6rem 1.5rem;
    }
    
    /* Navigation */
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        transform: translateX(-100%);
        transition: transform 0.4s ease;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    .nav-link {
        font-size: 1.1rem;
        padding: 0.5rem 0;
    }
    
    /* Grids */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Layouts */
    .about-grid,
    .contact-grid,
    .app-showcase {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .app-showcase {
        text-align: center;
    }
    
    .app-features {
        text-align: left;
    }
    
    /* Buttons */
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    /* Section */
    .section {
        padding: 4rem 0;
    }
    
    .section-header p {
        font-size: 1rem;
    }
    
    /* Cards */
    .service-card {
        padding: 1.5rem;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
    }
    
    /* Statistics */
    .stat-number {
        font-size: 3rem;
    }
    
    .stat-label {
        font-size: 1rem;
    }
    
    /* Footer */
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .footer-legal {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Legal pages */
    .legal-page {
        padding: 100px 0 4rem;
    }
    
    .legal-content {
        padding: 2rem;
    }
    
    .legal-content h1 {
        font-size: 2.5rem;
    }
    
    .legal-content h2 {
        font-size: 1.75rem;
    }
    
    .legal-content h3 {
        font-size: 1.3rem;
    }
}

/* ========================================
   MOBILE LANDSCAPE / LARGE PHONE (576px - 767px)
   ======================================== */

@media screen and (min-width: 576px) and (max-width: 767px) {
    :root {
        --spacing-lg: 2.5rem;
        --spacing-xl: 4rem;
        --spacing-md: 1.5rem;
    }
    
    .container {
        max-width: 540px;
        padding: 0 1rem;
    }
    
    /* Typography */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    p {
        font-size: 1rem;
    }
    
    /* Hero */
    .hero {
        min-height: 100vh;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-content {
        padding: 5rem 1rem;
    }
    
    /* Navigation */
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
        transform: translateX(-100%);
        transition: transform 0.4s ease;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    .nav-link {
        font-size: 1rem;
        padding: 0.5rem 0;
    }
    
    .nav-logo {
        font-size: 1.2rem;
    }
    
    .nav-logo svg {
        width: 40px;
        height: 40px;
    }
    
    /* Grids */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Layouts */
    .about-grid,
    .contact-grid,
    .app-showcase {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Buttons */
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .btn {
        padding: 0.875rem 2rem;
        font-size: 0.95rem;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    /* Section */
    .section {
        padding: 3rem 0;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-header p {
        font-size: 0.95rem;
    }
    
    /* Cards */
    .service-card {
        padding: 1.25rem;
    }
    
    .service-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .service-card h3 {
        font-size: 1.2rem;
    }
    
    /* Statistics */
    .stats-section {
        padding: 3rem 0;
    }
    
    .stat-item {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    /* Contact */
    .contact-info,
    .contact-form {
        padding: 1.5rem;
    }
    
    .contact-item {
        margin-bottom: 1rem;
    }
    
    .contact-item svg {
        width: 32px;
        height: 32px;
    }
    
    /* Footer */
    .footer {
        padding: 3rem 0 1.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding-top: 1.5rem;
    }
    
    .footer-legal {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-legal a {
        font-size: 0.9rem;
    }
    
    /* Legal pages */
    .legal-page {
        padding: 90px 0 3rem;
    }
    
    .legal-content {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .legal-content h1 {
        font-size: 2rem;
    }
    
    .legal-content h2 {
        font-size: 1.5rem;
        margin-top: 2rem;
    }
    
    .legal-content h3 {
        font-size: 1.2rem;
        margin-top: 1.5rem;
    }
    
    .legal-content p {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    .legal-content ul {
        padding-left: 1.5rem;
    }
    
    .legal-content li {
        font-size: 0.95rem;
    }
    
    /* App features */
    .app-content h3 {
        font-size: 1.75rem;
    }
    
    .app-features li {
        font-size: 1rem;
    }
}

/* ========================================
   MOBILE PORTRAIT (up to 575px)
   ======================================== */

@media screen and (max-width: 575px) {
    :root {
        --spacing-lg: 2rem;
        --spacing-xl: 3rem;
        --spacing-md: 1rem;
        --spacing-sm: 0.75rem;
    }
    
    .container {
        max-width: 100%;
        padding: 0 0.875rem;
    }
    
    /* Typography */
    h1 {
        font-size: 1.75rem;
        letter-spacing: -0.01em;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    h4 {
        font-size: 1.1rem;
    }
    
    p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    /* Hero */
    .hero {
        min-height: 100vh;
    }
    
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-content {
        padding: 4rem 0.875rem;
    }
    
    /* Navigation */
    .navbar {
        padding: 0.5rem 0.875rem;
    }
    
    .nav-container {
        padding: 0.5rem 0;
    }
    
    .nav-toggle {
        display: flex;
        padding: 8px;
    }
    
    .nav-toggle span {
        width: 24px;
        height: 2px;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 1rem 0.875rem;
        gap: 0.75rem;
        transform: translateX(-100%);
        transition: transform 0.4s ease;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
    
    .nav-link {
        font-size: 0.95rem;
        padding: 0.5rem 0;
    }
    
    .nav-logo {
        font-size: 1rem;
    }
    
    .nav-logo svg {
        width: 35px;
        height: 35px;
    }
    
    /* Grids */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Layouts */
    .about-grid,
    .contact-grid,
    .app-showcase {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Buttons */
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        max-width: 260px;
        justify-content: center;
    }
    
    /* Section */
    .section {
        padding: 2.5rem 0;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .section-header h2::after {
        width: 60px;
        height: 3px;
        bottom: -8px;
    }
    
    .section-header p {
        font-size: 0.9rem;
    }
    
    /* Cards */
    .service-card {
        padding: 1rem;
    }
    
    .service-icon {
        width: 45px;
        height: 45px;
        margin-bottom: 0.75rem;
    }
    
    .service-card h3 {
        font-size: 1.1rem;
    }
    
    .service-card p {
        font-size: 0.9rem;
    }
    
    /* Statistics */
    .stats-section {
        padding: 2.5rem 0;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
        letter-spacing: 0.05em;
    }
    
    /* News */
    .news-image {
        height: 160px;
    }
    
    .news-content {
        padding: 1rem;
    }
    
    .news-category {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    .news-content h3 {
        font-size: 1.1rem;
    }
    
    /* Contact */
    .contact-info,
    .contact-form {
        padding: 1rem;
    }
    
    .contact-item {
        margin-bottom: 0.75rem;
        padding: 0.5rem;
    }
    
    .contact-item svg {
        width: 28px;
        height: 28px;
    }
    
    .contact-item h4 {
        font-size: 1rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .form-group textarea {
        min-height: 120px;
    }
    
    /* Footer */
    .footer {
        padding: 2.5rem 0 1rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .footer-section p {
        font-size: 0.9rem;
    }
    
    .footer-links li {
        margin-bottom: 0.5rem;
    }
    
    .footer-links a {
        font-size: 0.9rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding-top: 1rem;
    }
    
    .footer-legal {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-legal a {
        font-size: 0.85rem;
    }
    
    /* Legal pages */
    .legal-page {
        padding: 80px 0 2.5rem;
    }
    
    .legal-content {
        padding: 1rem;
        margin: 0 0.5rem;
        border-radius: 6px;
    }
    
    .legal-content h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .legal-content h2 {
        font-size: 1.3rem;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .legal-content h3 {
        font-size: 1.1rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .legal-content p {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 0.75rem;
    }
    
    .legal-content ul {
        padding-left: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .legal-content li {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .ad-network-item {
        padding: 1rem;
    }
    
    .ad-network-item h4 {
        font-size: 1rem;
    }
    
    /* App features */
    .app-content h3 {
        font-size: 1.5rem;
    }
    
    .app-features li {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    /* Animations */
    .scroll-animate,
    .scroll-animate-left,
    .scroll-animate-right,
    .scroll-animate-scale {
        opacity: 1;
        transform: none;
        transition: none;
    }
    
    .stagger-item {
        opacity: 1;
        transform: none;
    }
}

/* ========================================
   SPECIAL MOBILE OPTIMIZATIONS
   ======================================== */

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .service-card:hover {
        transform: none;
    }
    
    .news-card:hover {
        transform: none;
    }
    
    .btn-hover-lift:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .service-card:active,
    .news-card:active {
        transform: scale(0.98);
    }
    
    /* Improve touch targets */
    .nav-link,
    .btn,
    .footer-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp text */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode adjustments (respects system preference) */
@media (prefers-color-scheme: dark) {
    /* Already dark theme, but ensure consistency */
    :root {
        color-scheme: dark;
    }
}

/* Print styles */
@media print {
    .navbar,
    .hero,
    .hero-buttons,
    .contact-form,
    .footer,
    .nav-toggle {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .section {
        padding: 20px 0;
    }
    
    .legal-content {
        border: 1px solid #ccc;
        box-shadow: none;
        padding: 20px;
        max-width: 100%;
    }
    
    .legal-content h1,
    .legal-content h2,
    .legal-content h3 {
        color: black;
    }
    
    .legal-content p,
    .legal-content li {
        color: black;
    }
}

/* Reduced motion - respect user preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .scroll-animate,
    .scroll-animate-left,
    .scroll-animate-right,
    .scroll-animate-scale {
        opacity: 1;
        transform: none;
    }
    
    .parallax-bg {
        animation: none;
    }
    
    .hero-bg {
        animation: none;
    }
}
