:root {
    /* Color Palette */
    --primary: #003049;
    --secondary: #669BBC;
    --accent: #D62828;
    --bg-light: #FDF0D5;
    --text-main: #111111;
    --text-light: #FDF0D5;
    --white: #FFFFFF;
    --gray: #e5e5e5;

    /* Variables */
    --header-height: 70px;
    --container-width: 1200px;
    --transition: all 0.3s ease;

    /* Fonts */
    --font-main: 'Exo 2', sans-serif;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-main);
    background-color: var(--bg-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

.section--light {
    background: var(--white);
}

.section--dark {
    background: var(--primary);
    color: var(--white);
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
    cursor: pointer;
    font-family: var(--font-main);
}

.btn--primary {
    background-color: var(--accent);
    color: var(--white);
}

.btn--primary:hover {
    background-color: #a81d1d;
    transform: translateY(-2px);
}

.btn--outline {
    border-color: var(--white);
    color: var(--white);
    background: transparent;
}

.btn--outline:hover {
    background: var(--white);
    color: var(--primary);
}

.btn--small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn--full {
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

/* Header */
.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}

.nav__list {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav__link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    transition: var(--transition);
}

.nav__link:hover {
    color: var(--accent);
}

/* Оновлені стилі для Бургера */
.burger {
    display: none;
    /* За замовчуванням прихована на десктопі */
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    /* ВАЖЛИВО: Z-index має бути більшим, ніж у мобільного меню (999), 
       щоб кнопка залишалася доступною для натискання */
    z-index: 1001;
    position: relative;
    padding: 10px;
    /* Збільшимо область кліку */
}

.burger span {
    width: 30px;
    height: 3px;
    background: var(--primary);
    transition: all 0.3s ease-in-out;
    border-radius: 2px;
    transform-origin: center;
}

/* Адаптивність: показуємо бургер на менших екранах */
@media (max-width: 1024px) {
    .burger {
        display: flex;
    }
}

/* --- Анімація перетворення на Хрестик (Закрити) --- */

/* Верхня паличка повертається і опускається */
.burger.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
    background: var(--accent);
    /* Можна змінити колір на червоний при відкритті */
}

/* Середня паличка зникає */
.burger.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

/* Нижня паличка повертається і піднімається */
.burger.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
    background: var(--accent);
}

/* Hero */
.hero {
    height: 100vh;
    min-height: 600px;
    /* Використано зображення з Pexels для фону */
    background: url('images/hero-bg.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    position: relative;
    margin-top: var(--header-height);
}

.hero__overlay {
    position: absolute;
    inset: 0;
    /* Темний градієнтний оверлей для кращої читабельності тексту */
    background: linear-gradient(135deg, rgba(0, 48, 73, 0.95), rgba(0, 48, 73, 0.7));
}

.hero__content {
    position: relative;
    z-index: 2;
    color: var(--white);
    max-width: 800px;
}

.badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero__title {
    font-size: 3rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero__subtitle {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero__actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Features Section - Rubber Adaptation */
.features-grid {
    display: grid;
    /* Магічна формула гумової адаптації:
       - auto-fit: створює стільки колонок, скільки поміститься
       - minmax(260px, 1fr): колонка не менше 260px, але може розтягуватися (1fr)
    */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
    align-items: stretch;
    /* Розтягує картки по висоті, щоб були однаковими */
}

.feature-card {
    background: var(--white);
    padding: 40px 30px;
    border-radius: 16px;
    /* Більш м'яке скруглення */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    /* Легка тінь */
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;

    /* Flexbox для вертикального вирівнювання вмісту */
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    /* Гарантує, що картка займає всю висоту комірки */
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 48, 73, 0.1);
}

.feature-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 25px;
    /* Додамо красиву підкладку під іконку (опціонально, як на скріншоті) */
    background: rgba(214, 40, 40, 0.08);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon {
    background: var(--accent);
    color: var(--white);
    transform: rotateY(180deg);
    /* Невелика анімація при наведенні */
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--primary);
    font-weight: 700;
}

.feature-card p {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
}

/* Services */
/* Services Section Redesign */
.services-grid {
    display: grid;
    /* Примусово 4 рівні колонки в один ряд */
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    /* Трохи зменшив відступ, щоб вони краще поміщалися */
}

.service-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Декоративна лінія зверху (з'являється при наведенні) */
.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 48, 73, 0.1);
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-icon {
    width: 60px;
    height: 60px;
    background: rgba(214, 40, 40, 0.1);
    /* Прозорий червоний */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    transition: var(--transition);
}

.service-icon i {
    font-size: 1.8rem;
    color: var(--accent);
}

.service-card:hover .service-icon {
    background: var(--accent);
}

.service-card:hover .service-icon i {
    color: var(--white);
}

.service-content h3 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 15px;
    font-weight: 700;
}

.service-content p {
    color: #555;
    font-size: 1rem;
    margin-bottom: 25px;
    flex-grow: 1;
    /* Притискає кнопку до низу */
}

.service-link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.service-link i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.service-link:hover {
    color: var(--accent);
}

.service-link:hover i {
    transform: translateX(5px);
}

@media (max-width: 1200px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Адаптивність: на мобільних - по 1 в ряд */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
}

/* Reviews Section - Rubber Grid */
.reviews-slider {
    display: grid;
    /* Гумова адаптація:
       Картка не менше 300px, але розтягується, якщо є місце.
       Автоматично переноситься на наступний рядок.
    */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.review-card {
    background: var(--white);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    /* Flexbox допомагає розтягнути контент, якщо тексти різної довжини */
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    /* Лінія-розділювач */
}

.review-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    /* Забороняє стискати фото */
    border: 2px solid var(--gray);
}

.review-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 700;
}

.stars {
    display: block;
    margin-top: 5px;
    font-size: 0.9rem;
}

.review-card p {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    font-style: italic;
    /* Курсив для цитати */
}

/* Contact */
.contact-wrapper {
    display: flex;
    gap: 50px;
    flex-wrap: wrap;
}

.contact-info {
    flex: 1;
    min-width: 300px;
}

.contact-list {
    list-style: none;
    margin-top: 30px;
}

.contact-list li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
}

.contact-form-container {
    flex: 1;
    min-width: 300px;
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    color: var(--text-main);
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
}

.error-msg {
    color: var(--accent);
    font-size: 0.8rem;
    display: none;
    margin-top: 5px;
}

.form-group.error input {
    border-color: var(--accent);
}

.form-group.error .error-msg {
    display: block;
}

.form-loader,
.form-success {
    text-align: center;
    margin-top: 15px;
    font-weight: 600;
}

.form-success {
    color: green;
}

/* Footer */
.footer {
    background: #0d1b2a;
    color: var(--gray);
    padding: 60px 0 20px;
}

.footer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer__logo {
    color: var(--white);
    margin-bottom: 15px;
}

.footer h4 {
    color: var(--white);
    margin-bottom: 20px;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 10px;
}

.footer a {
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--accent);
}

.footer__bottom {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    font-size: 0.9rem;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: var(--white);
    padding: 20px;
    transform: translateY(-150%);
    transition: var(--transition);
    z-index: 999;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
    transform: translateY(0);
}

.mobile-menu__list {
    list-style: none;
    text-align: center;
}

.mobile-menu__list li {
    margin: 15px 0;
}

.mobile-menu__list a {
    text-decoration: none;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 600;
}

/* Cookie Popup */
.cookie-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    padding: 20px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    border-top: 4px solid var(--accent);
}

.cookie-content {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--white);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    z-index: 3001;
    border-radius: 10px;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    overflow-y: auto;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--primary);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary);
}

.modal-content p,
.modal-content ul {
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.modal-content ul {
    padding-left: 20px;
}

/* Responsive */
@media (max-width: 1024px) {
    .nav {
        display: none;
    }

    .burger {
        display: flex;
    }

    .hero__title {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .hero__actions {
        justify-content: center;
    }

    .hero__content {
        text-align: center;
    }

    .contact-wrapper {
        flex-direction: column;
    }
}