/* Responsive Design */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .hero-title {
        font-size: 4rem;
    }

    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium screens (768px to 1199px) */
@media (max-width: 1199px) {
    .hero-title {
        font-size: 3rem;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-grid {
        gap: 3rem;
    }
}



/* Small screens (768px and down) */
@media (max-width: 768px) {
    .container {
        padding: 0 5px;
    }

    /* Improved Mobile Navigation */
    .nav-links {
        position: fixed;
        top: 70px;
        left: 50%;
        width: 90%;
        max-width: 400px;
        max-height: 0;
        background-color: rgba(30, 41, 59, 0.98);
        backdrop-filter: blur(5px);
        flex-direction: column;
        align-items: center;
        padding: 0;
        gap: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        z-index: 999;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        border-radius: 0 0 12px 12px;
        transform: translateX(-50%);
    }

    .nav-links.active {
        max-height: 80vh;
        padding: 1rem 0;
    }

    /* Mobile Menu Button - Fixed Cross Icon */
    .mobile-menu-btn {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        position: relative;
        z-index: 1001;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .mobile-menu-btn span {
        display: block;
        width: 28px;
        height: 3px;
        background: white;
        border-radius: 3px;
        transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
        position: absolute;
        left: 8px;
        /* Центрирование в кнопке */
    }

    /* Исходное положение полосок */
    .mobile-menu-btn span:nth-child(1) {
        top: 15px;
        transform: none;
    }

    .mobile-menu-btn span:nth-child(2) {
        top: 21px;
        transform: none;
    }

    .mobile-menu-btn span:nth-child(3) {
        top: 27px;
        transform: none;
    }

    /* Анимация превращения в крестик */
    .mobile-menu-btn.active span:nth-child(1) {
        top: 21px;
        transform: rotate(45deg);
        width: 28px;
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
        transform: scale(0);
    }

    .mobile-menu-btn.active span:nth-child(3) {
        top: 21px;
        transform: rotate(-45deg);
        width: 28px;
    }

    .nav-link {
        width: 80%;
        text-align: center;
        padding: 12px 0;
        margin: 4px 0;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }

    .nav-link:hover,
    .nav-link.active {
        background-color: #f97316;
    }

    .phone-btn {
        margin: 12px auto 0;
        width: 80%;
        justify-content: center;
    }

    /* Body lock when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Hero Section */
    .hero-content {
        padding: 120px 0 60px;
    }

    .hero-title {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    /* Features */
    .features {
        padding: 60px 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .feature-item {
        padding: 1.5rem;
    }

    /* Services */
    .services {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 3rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .section-header p {
        font-size: 1.125rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .service-card {
        padding: 1.5rem;
    }

    /* Contact */
    .contact-form {
        gap: 1rem;
    }

    .contact-form-section {
        padding: 60px 0;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-info h2 {
        font-size: 2rem;
    }

    .contact-info p {
        font-size: 1.125rem;
    }

    .contact-form-container {
        padding: 0.75rem;
        /* уменьшаем внутренний паддинг */
        box-sizing: border-box;
        width: 100%;
        max-width: 100vw;
        /* запрещаем вылазить за экран */
        overflow: hidden;
    }

    .btn-full {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Footer */
    .footer {
        padding: 40px 0 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Extra small screens (480px and down) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .section-header p {
        font-size: 1rem;
    }

    .contact-info h2 {
        font-size: 1.75rem;
    }

    .contact-info p {
        font-size: 1rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .feature-item,
    .service-card,
    .contact-form-container {
        padding: 1.25rem;
    }

    /* Mobile Menu adjustments */
    .nav-links {
        width: 95%;
        max-width: 350px;
    }

    .nav-link {
        width: 85%;
        padding: 10px 0;
    }
}


/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-content {
        padding: 90px 0 30px;
    }

    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
    }

    .hero-buttons .btn {
        width: auto;
        max-width: none;
    }

    /* Mobile Menu adjustments */
    .nav-links {
        max-height: 70vh;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .hero-bg::before {
        background-size: 50px 50px;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    /* Mobile Menu adjustments */
    .nav-links {
        transition: none;
    }

    .mobile-menu-btn span {
        transition: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .image-placeholder {
        background-color: #374151;
        color: #9ca3af;
    }
}

/* Print optimizations */
@media print {
    .hero-title {
        font-size: 2rem !important;
    }

    .section-header h2 {
        font-size: 1.5rem !important;
    }

    .services-grid,
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .service-card,
    .feature-item {
        break-inside: avoid;
        margin-bottom: 1rem;
    }

    /* Hide mobile menu button when printing */
    .mobile-menu-btn {
        display: none !important;
    }
}