/* ========================================
   CSS ПЕРЕМЕННЫЕ
======================================== */
:root {
    --primary: #ff6633;
    --primary-dark: #cc5229;
    --bg: #1a1a1a;
    --text: #f0f0f0;
    --card: #2d2d2d;
    --border: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

/* ========================================
   БАЗОВЫЕ СТИЛИ И ЗАЩИТА ОТ СКРОЛЛА
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

body.no-scroll {
    position: fixed;      /* Полная блокировка, работает на iOS */
    width: 100%;
    height: 100%;
    overflow: hidden !important;
}

/* Внутренние области продолжают скроллиться */
body.no-scroll nav ul,
body.no-scroll .modal-content {
    -webkit-overflow-scrolling: touch;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   HEADER
======================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    background-color: rgba(26, 26, 26, 0.9);
    max-width: 100vw;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    z-index: 1001;
}

.logo-img {
    height: 42px;
    width: auto;
    display: block;
    transition: var(--transition);
}

.logo:hover .logo-img {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(255, 102, 51, 0.5));
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    font-weight: 600;
    color: inherit;
    position: relative;
    padding: 0.5rem 0;
    transition: var(--transition);
}

nav a:hover {
    color: var(--primary);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
}

nav a:hover::after {
    width: 100%;
}

/* ========================================
   МОБИЛЬНОЕ МЕНЮ
======================================== */
.mobile-menu-toggle {
    display: none;
    background: rgba(30, 30, 30, 0.85);
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    z-index: 1002;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 5%;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: rgba(40, 40, 40, 0.9);
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--text);
    margin: 5px 0;
    border-radius: 2px;
    transition: var(--transition);
}

/* ========================================
   HERO SECTION
======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 5%;
    position: relative;
    overflow: hidden;
    max-width: 100vw;
}

.hero-content {
    max-width: 600px;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 102, 51, 0.3);
    margin-top: 1rem;
    transition: var(--transition);
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 102, 51, 0.5);
    background-color: var(--primary-dark);
}

.hero-image {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 45%;
    max-width: 600px;
    z-index: 0;
    opacity: 0.1;
    max-width: 45vw;
}

/* ========================================
   ЧАСТИЦЫ
======================================== */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    max-width: 100vw;
}

.particle {
    position: absolute;
    background-color: var(--primary);
    border-radius: 50%;
    pointer-events: none;
}

/* ========================================
   ОБЩИЕ СТИЛИ СЕКЦИЙ
======================================== */
.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    display: block;
    width: 100%;
    max-width: 100vw;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary);
    border-radius: 2px;
}

.about, .portfolio {
    padding: 5rem 5%;
    text-align: center;
    max-width: 100vw;
    overflow: hidden;
}

.about-content {
    max-width: 800px;
    margin: 0 auto 3rem;
}

/* ========================================
   УСЛУГИ (ФОН КАК В КОНТАКТАХ)
======================================== */
.services {
    padding: 5rem 5%;
    background-color: var(--card);
    text-align: center;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    max-width: 100%;
}

.service-card {
    background: var(--bg);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    max-width: 100%;
}

.service-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 102, 51, 0.2);
    border-color: var(--primary);
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 102, 51, 0.1), transparent);
    transition: var(--transition);
}

.service-card:hover::before {
    left: 100%;
}

.service-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.service-card h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--primary);
}

.service-card p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.service-price {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 1rem 0;
    color: var(--primary-dark);
}

.service-features {
    list-style: none;
    text-align: left;
    margin: 1.5rem 0;
    padding: 0;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.service-features li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
}

.service-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ========================================
   ПОРТФОЛИО
======================================== */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    max-width: 100%;
}

.portfolio-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    height: 300px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    max-width: 100%;
}

.portfolio-item:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 102, 51, 0.4);
}

.portfolio-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.9));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay h3 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.portfolio-overlay p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ========================================
   КОНТАКТЫ (ПРОЗРАЧНЫЕ БЛОКИ)
======================================== */
.contact {
    padding: 5rem 5%;
    background-color: var(--card);
    text-align: center;
    max-width: 100vw;
    overflow: hidden;
}

.contact-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    text-align: left;
}

.contact-methods, .contact-form-section {
    border-radius: 20px;
    padding: 2.5rem;
    
}

.contact-methods h3, .contact-form-section h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.contact-methods h3::after, .contact-form-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.contact-methods p, .contact-form-section p {
    text-align: center;
    margin-bottom: 1.5rem;
    opacity: 0.85;
    line-height: 1.6;
}

/* ========================================
   КНОПКИ МЕТОДОВ СВЯЗИ (SVG + ЕДИНЫЙ ЦВЕТ)
======================================== */
.contact-methods-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-method-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
}

.contact-method-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    color: var(--primary);
}

/* SVG иконки в кнопках методов связи */
.contact-method-svg {
    width: 28px;
    height: 28px;
    min-width: 28px;
    fill: var(--text);
    transition: all 0.3s ease;
}

/* Логотип MAX — корректировка размера */
.max-logo.contact-method-svg {
    width: 26px;
    height: 26px;
    min-width: 26px;
}

/* Единый цвет иконки при наведении — основной оранжевый */
.contact-method-btn:hover .contact-method-svg {
    fill: var(--primary);
}

/* Убираем старые эмодзи-иконки */
.contact-method-icon {
    display: none !important;
}

/* ========================================
   ФОРМА ОБРАТНОЙ СВЯЗИ
======================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group .required {
    color: var(--primary);
    margin-left: 0.25rem;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: inherit;
    color: inherit;
    transition: var(--transition);
    max-width: 100%;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 102, 51, 0.1);
}

.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: inherit;
    color: inherit;
    transition: var(--transition);
    min-height: 120px;
    resize: vertical;
    max-width: 100%;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 102, 51, 0.1);
}

.submit-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(255, 102, 51, 0.3);
    transition: var(--transition);
    width: 100%;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 102, 51, 0.5);
    background-color: var(--primary-dark);
}

/* ========================================
   FOOTER
======================================== */
footer {
    background-color: var(--bg);
    color: var(--text);
    padding: 2rem 5%;
    text-align: center;
    max-width: 100vw;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.social-links a {
    color: inherit;
    font-size: 1.5rem;
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

.copyright {
    margin-top: 1rem;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* ========================================
   ЗАГРУЗОЧНЫЙ ЭКРАН
======================================== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
    max-width: 100vw;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 102, 51, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   МОДАЛЬНОЕ ОКНО СВЯЗИ
======================================== */
.contact-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.contact-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--card);
    border-radius: 20px;
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.contact-modal.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-modal {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text);
    font-size: 1.8rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.close-modal:hover {
    background: rgba(255, 102, 51, 0.2);
    transform: rotate(90deg);
    color: var(--primary);
}

.modal-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.modal-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.modal-description {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0.85;
    font-size: 1.05rem;
    line-height: 1.5;
}

.contact-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.contact-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.4rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    gap: 0.7rem;
}

.contact-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    color: var(--primary);
}

.contact-btn:active {
    transform: translateY(-2px);
}

/* SVG иконки в модальном окне */
.contact-btn-svg {
    width: 36px;
    height: 36px;
    min-width: 36px;
    fill: var(--text);
    transition: all 0.3s ease;
}

/* Логотип MAX в модальном окне */
.max-logo.contact-btn-svg {
    width: 34px;
    height: 34px;
    min-width: 34px;
}

/* Единый цвет иконки при наведении — основной оранжевый */
.contact-btn:hover .contact-btn-svg {
    fill: var(--primary);
}

/* Убираем старые эмодзи-иконки в модалке */
.contact-btn-icon {
    display: none !important;
}

/* ========================================
   ФИКСИРОВАННАЯ КРУГЛАЯ КНОПКА
======================================== */
.contact-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;               /* Фиксированная ширина */
    height: 60px;              /* Фиксированная высота */
    border-radius: 50%;        /* Делаем круглой */
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 102, 51, 0.4);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;                /* Убираем внутренние отступы */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-float-btn:hover {
    transform: scale(1.1);     /* Увеличение при наведении */
    box-shadow: 0 6px 20px rgba(255, 102, 51, 0.6);
}

/* Стили для иконок внутри кнопки */
.float-icon {
    width: 28px;
    height: 28px;
    fill: white;
    position: absolute;        /* Накладываем друг на друга */
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Начальное состояние: Диалог виден, Телефон скрыт */
.icon-chat {
    opacity: 1;
    transform: scale(1);
}

.icon-phone {
    opacity: 0;
    transform: scale(0.5);
}

/* Класс для переключения (добавляется через JS) */
.contact-float-btn.show-phone .icon-chat {
    opacity: 0;
    transform: scale(0.5);
}

.contact-float-btn.show-phone .icon-phone {
    opacity: 1;
    transform: scale(1);
}

/* Анимация пульсации (более частая) */
.contact-float-btn.pulse {
    animation: pulseAnimation 0.8s ease-in-out; /* Быстрая пульсация */
}

@keyframes pulseAnimation {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 102, 51, 0.7); }
    50% { transform: scale(1.15); box-shadow: 0 0 0 15px rgba(255, 102, 51, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 102, 51, 0); }
}

.header-contact-btn {
    display: none !important;
}

/* ========================================
   АДАПТИВНОСТЬ
======================================== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100vw;
    }

    .logo-img {
        height: 32px;
        }

    nav ul {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        height: 100vh;
        flex-direction: column;
        gap: 2rem;
        background: var(--bg);
        padding: 5rem 2rem 2rem;
        transition: transform 0.3s ease;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        z-index: 999;
        margin: 0;
        max-width: 85vw;
    }

    nav ul.active {
        left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-image {
        display: none;
    }

    .services-grid,
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .service-price {
        font-size: 1.5rem;
    }

    .service-features {
        text-align: center;
        padding-left: 0;
    }

    .service-features li {
        text-align: left;
        padding-left: 1.5rem;
        margin: 0 auto;
    }

    .about, .services, .portfolio, .contact, footer {
        padding: 3rem 4%;
        box-sizing: border-box;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-methods, .contact-form-section {
        padding: 2rem;
    }

    .contact-options {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .modal-content {
        width: 92%;
        max-width: 420px;
        max-height: 85vh;          /* Окно не выше экрана */
        overflow-y: auto;          /* Скролл внутри, если не влезает */
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }

    .modal-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .modal-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .contact-btn {
        flex-direction: row;       /* Было: column */
        justify-content: center;
        gap: 0.9rem;
        padding: 0.9rem 1.2rem;    /* Было: 1.4rem 1rem */
        font-size: 1rem;
        border-radius: 12px;
    }

    .contact-btn-svg {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }

    .close-modal {
        top: 0.8rem;
        right: 0.8rem;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }
}

@media (max-height: 600px) {
    .modal-content {
        max-height: 90vh;
        padding: 1.5rem 1.25rem;
    }

    .modal-description {
        margin-bottom: 1rem;
    }
}