/* =========================================
   GENERAL STYLES & ACCESSIBILITY
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Критически важно для адаптивности */
}

body {
    font-family: 'Montserrat', sans-serif; /* КРИТЕРИЙ 13 */
    line-height: 1.6;
    color: #333;
    font-size: 16px; /* КРИТЕРИЙ 12 */
    padding-top: 80px; /* Отступ, чтобы контент не заезжал под шапку */
}

/* КРИТЕРИИ 13, 14, 27: Шрифты и заголовки */
h1 { font-size: 2.5rem; text-decoration: none; }
h2 { font-size: 2rem; text-decoration: none; }
h3 { font-size: 1.75rem; text-decoration: none; }
h4 { font-size: 1.5rem; text-decoration: none; }

/* КРИТЕРИИ 16, 17, 18: Ссылки */
a { color: #ce1a1a; text-decoration: underline; transition: color 0.3s; }
a:visited { color: #8b1313; }
a:hover, a:active { color: #000; }

p { margin-bottom: 1.5rem; text-align: left; } /* КРИТЕРИЙ 29 */
ul { margin-bottom: 1.5rem; list-style: none; text-align: left; } /* КРИТЕРИЙ 26 */

/* =========================================
   ДОСТУПНОСТЬ И КНОПКИ (КРИТЕРИЙ 38)
   ========================================= */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #ce1a1a;
    color: white;
    padding: 8px;
    z-index: 1001;
    text-decoration: none;
}
.skip-link:focus { top: 0; }

.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #ce1a1a;
    color: #fff;
    font-weight: bold;
    border-radius: 5px;
    text-decoration: none;
    transition: opacity 0.3s;
}
.btn:hover { opacity: 0.9; }

/* =========================================
   УМНЫЙ ТОПБАР (HEADER)
   ========================================= */
.main-header {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(8px);
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw; 
    max-width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    padding: 15px 5%;
}

.main-header.header-hidden {
    transform: translateY(-100%); 
}

/* Идеальное центрирование Топбара (CSS Grid) */
.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* 3 колонки: свободное место, по размеру, свободное место */
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo { justify-self: start; }
.nav-bar { justify-self: center; }
.header-actions { justify-self: end; }

/* Стили элементов шапки */
.logo a {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.logo span { color: #ce1a1a; }

.nav-bar ul { display: flex; align-items: center; gap: 40px; margin-bottom: 0; }
.nav-bar a {
    color: #fff;
    font-weight: 600;
    text-decoration: none !important;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-bar a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: #ce1a1a;
    transition: width 0.3s ease;
}

.nav-bar a:hover { color: #ce1a1a; }
.nav-bar a:hover::after { width: 100%; }
.nav-bar a.current { color: #ce1a1a; } /* КРИТЕРИЙ 33 */
.nav-bar a.current::after { width: 100%; }

.contrast-btn {
    background: transparent;
    border: 2px solid #ce1a1a;
    color: #fff;
    padding: 8px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.3s ease;
}
.contrast-btn:hover {
    background: #ce1a1a;
    color: #fff;
    box-shadow: 0 0 10px rgba(206, 26, 26, 0.5);
}

/* =========================================
   БЛОКИ И СЕКЦИИ (HERO, ABOUT, SERVICES)
   ========================================= */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('bg.png') no-repeat center center;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 0 5%;
    margin-top: -80px; /* Компенсация отступа шапки для главного блока */
}

.hero-content { text-align: center; }

.red-badge {
    background: #ce1a1a;
    padding: 10px 20px;
    display: inline-block;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 900;
    font-style: italic;
    transform: skewX(-15deg);
}

/* Обновленный компактный футер */
.main-footer {
    padding: 15px 5% !important; /* Уменьшили вертикальный отступ с 30px до 15px */
    background: #333;
    color: #fff;
    text-align: center;
}

.main-footer p {
    font-size: 0.8rem !important; /* Уменьшили размер шрифта текста копирайта */
    margin-bottom: 5px !important; /* Сократили отступ под текстом */
    color: #fff !important;
}

.external-links {
    margin-top: 5px !important; /* Уменьшили отступ над ссылками */
}

.external-links a {
    font-size: 0.8rem !important; /* Сделали ссылки помельче */
    margin: 0 8px !important;
    color: #fff !important;
    text-decoration: none;
}

.external-links a:hover {
    text-decoration: underline;
}

/* Возвращаем основной текст карточек к темному цвету */
/* 1. Основные заголовки карточек оставляем темными */
/* 1. Названия услуг (делаем их темными и жирными, чтобы их было четко видно) */
.service-card h3 {
    text-align: center;
    color: #1a1a1a; /* Глубокий темный цвет */
    font-size: 1.3rem;
    font-weight: 900; /* Максимальная жирность */
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* 2. Те самые строки, которые должны быть красными (Даже на месте и т.д.) */
.service-card .red-sm {
    color: #ce1a1a !important; /* Яркий красный */
    text-align: center;
    display: block;
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 1rem;
}

/* 3. Основной большой текст (делаем его светлее, как вы просили ранее) */
.service-card .desc {
    color: #777; /* Светло-серый */
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 4. Ключевые слова внутри светлого текста (чуть темнее для читаемости) */
.service-card .desc strong {
    font-weight: 700;
    color: #444; 
}

/* 5. Настройки для режима высокого контраста (чтобы всё стало белым на черном) */
body.high-contrast .service-card h3,
body.high-contrast .service-card .desc,
body.high-contrast .service-card .desc strong {
    color: #ffffff !important;
}


/* Обновленные стили для галереи с отступами */
.photo-line-section {
    padding: 60px 5% 40px 5%; /* Сверху 60px, по бокам 5%, снизу 40px */
    overflow: hidden; 
    background: #f9f9f9;
}

/* Дополнительный отступ снизу только для заголовка */
.photo-line-section .section-title {
    margin-bottom: 40px; /* Отступ между текстом "Галерея" и фотографиями */
    text-align: center;
}

.photo-line-container {
    display: flex;
    width: 100%;
}

.photo-line-track {
    display: flex;
    gap: 15px;
    animation: scrollLine 25s linear infinite;
}

.photo-line-track img {
    width: 280px; 
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
/* Логика бесконечного движения */
@keyframes scrollLine {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-280px * 5 - 15px * 5)); /* Ширина 5 фото + отступы */
    }
}

/* Настройки для темной темы */
body.high-contrast .photo-line-section {
    background: #000 !important;
}


.hero-subtext { font-size: 1.5rem; font-weight: bold; margin-bottom: 20px; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }

.about-section, .services-section { padding: 50px 5%; background: #f9f9f9; }

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }

/* Единый размер фото */
.about-image img { width: 100%; height: 400px; object-fit: cover; border-radius: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.service-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); text-align: center; }
.service-card img { width: 100%; height: 220px; object-fit: cover; border-radius: 5px; margin-bottom: 15px; display: block; }

/* =========================================
   ФОРМЫ (КРИТЕРИЙ 5, 20, 21)
   ========================================= */
input[type="text"], textarea, select {
    width: 100%;
    border: 2px solid #ddd;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-family: inherit;
}

/* =========================================
   HIGH CONTRAST MODE (ТЕМНАЯ ТЕМА)
   ========================================= */
body.high-contrast { background: #000000 !important; color: #ffffff !important; }
body.high-contrast .about-section, body.high-contrast .services-section, body.high-contrast .faq-section { background: #000000 !important; }
body.high-contrast .main-header, body.high-contrast .main-footer { background: #111111 !important; }

body.high-contrast .service-card, body.high-contrast article, body.high-contrast aside, body.high-contrast form, body.high-contrast .about-text {
    background: #2a2a2a !important; border: none !important; border-radius: 12px !important; padding: 25px !important; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8) !important; color: #fff !important;
}

body.high-contrast a { color: #ffcc00 !important; text-decoration: underline !important; }
body.high-contrast a:visited { color: #e6b800 !important; }
body.high-contrast a:hover { color: #ffffff !important; }
body.high-contrast .red-badge, body.high-contrast .btn-red { background: #ffffff !important; color: #000000 !important; border: none !important; }
body.high-contrast .contrast-btn { border: 2px solid #ffcc00 !important; color: #ffcc00 !important; background: transparent !important; }
body.high-contrast .contrast-btn:hover { background: #ffcc00 !important; color: #000000 !important; }
/* Исправление для таблицы и спойлеров (details) в темной теме */
body.high-contrast details {
    background: #2a2a2a !important; /* Делаем фон серым, как у остальных окошек */
    color: #ffffff !important;      /* Белый текст */
    border: 1px solid #444 !important; /* Добавляем легкую рамку */
}

body.high-contrast table {
    color: #ffffff !important;
}

body.high-contrast th {
    background: #ce1a1a !important; /* Оставляем красную шапку таблицы */
    color: #ffffff !important;
}

body.high-contrast td {
    border-bottom: 1px solid #555 !important; /* Делаем линии в таблице серыми, а не белыми */
    color: #ffffff !important;
}

body.high-contrast details summary {
    color: #ffcc00 !important; /* Делаем заголовок спойлера желтым для понятности */
}
body.high-contrast input[type="text"], 
body.high-contrast textarea, 
body.high-contrast select {
    background: #111111 !important;
    color: #ffffff !important;
    border: 2px solid #666666 !important;
}

/* Делаем текст-подсказку (placeholder) светло-серым, чтобы он читался */
body.high-contrast input::placeholder, 
body.high-contrast textarea::placeholder {
    color: #aaaaaa !important;
}

/* 2. Перебиваем светлый фон у блока с радио-кнопками (заданный в HTML) */
body.high-contrast form div {
    background: transparent !important;
    border-color: #555555 !important;
}

/* 3. Делаем главную кнопку отправки яркой (желтая с черным текстом) */
body.high-contrast .btn {
    background: #ffcc00 !important;
    color: #000000 !important;
}

body.high-contrast .btn:hover {
    background: #ffffff !important;
    color: #000000 !important;
}
/* =========================================
   АДАПТИВНОСТЬ (КРИТЕРИЙ 9)
   ========================================= */

/* 2. МАКЕТ ДЛЯ ПЛАНШЕТОВ (Tablet - до 1024px) */
@media (max-width: 1024px) {
    .header-container { display: flex; flex-wrap: wrap; justify-content: space-between; }
    .nav-bar { order: 3; width: 100%; margin-top: 20px; display: flex; justify-content: center; }
    .nav-bar ul { gap: 20px; }
    .services-grid { grid-template-columns: 1fr 1fr; }
    .about-grid { gap: 20px; }
}

/* 3. МАКЕТ ДЛЯ СМАРТФОНОВ (Smartphone - до 600px) */
/* =========================================
   ПОЛНОЕ ИСПРАВЛЕНИЕ МОБИЛЬНОЙ ВЕРСИИ
   ========================================= */
@media (max-width: 600px) {
    /* 1. Глобальные настройки: запрещаем горизонтальный скролл */
    html, body {
        overflow-x: hidden; /* Критически важно, чтобы шрифты не уменьшались */
        width: 100%;
    }

    body {
        padding-top: 120px; /* Больше места под высокую мобильную шапку */
        font-size: 16px; /* Увеличиваем базовый шрифт */
    }

    /* 2. Шапка сайта (Header) */
    .header-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .nav-bar ul {
        flex-direction: row !important; /* Пункты меню в ряд */
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px !important;
    }

    .nav-bar a {
        font-size: 0.9rem !important;
        padding: 5px 10px !important;
    }

    /* 3. Главный блок (Hero) */
    .hero-section {
        min-height: 70vh !important;
        padding: 40px 5% !important;
        margin-top: -120px; /* Компенсация шапки */
    }

    .red-badge h1 {
        font-size: 1.5rem !important; /* Крупный читаемый заголовок */
    }

    .hero-subtext {
        font-size: 1.1rem !important;
        line-height: 1.3;
    }

    .hero-list li {
        font-size: 0.9rem !important;
        text-align: center;
    }

    /* 4. Сетки (About и Services) — ПРИНУДИТЕЛЬНО 1 КОЛОНКА */
    .about-grid, .services-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px !important;
    }

    .about-section, .services-section, main {
        padding: 40px 20px !important;
    }

    /* Заголовки в секциях */
    h2 { font-size: 1.6rem !important; }
    h3 { font-size: 1.4rem !important; }

    /* 5. Карточки и картинки */
    .service-card, .about-text {
        width: 100% !important;
        padding: 20px !important;
    }

    .service-card img, .about-image img {
        height: 220px !important; /* Фиксированная высота для красоты */
        width: 100% !important;
        object-fit: cover !important;
    }

    /* 6. Исправление Галереи (чтобы не ломала ширину) */
    .photo-line-section {
        padding: 30px 0 !important;
    }

    .photo-line-track img {
        width: 220px !important; /* Чуть меньше фото для мобильных */
        height: 150px !important;
    }

    /* Кнопки на всю ширину для удобства нажатия пальцем */
    .btn, .phone-btn {
        display: block !important;
        width: 100% !important;
        margin: 10px 0 !important;
        font-size: 1rem !important;
        padding: 15px !important;
        text-align: center;
    }

    /* Убираем лишние декоративные элементы, если они мешают */
    .red-badge {
        transform: none !important; /* Убираем наклон на мобильных */
        width: 100%;
    }
}