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

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f9; /* Світлий нейтральний фон сторінки */
    color: #333;
    line-height: 1.6;
}

.specialties-section {
    /* padding: 80px 20px; */
    /* max-width: 1200px; */
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    color: #1a1a1a;
    margin-bottom: 15px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
}

/* Контейнер для списку спеціальностей */
.specialties-list {
    display: flex;
    flex-direction: column;
    gap: 40px; /* Відстань між рядками */
}

/* Стилі окремого рядка (картки) */
.specialty-row {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border-radius: 20px;
    min-height: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    overflow: hidden; /* Щоб закруглені кути працювали для дочірніх елементів */
}

/* Зображення з ефектом затухання */
.specialty-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 60%; /* Фото займає 60% ширини */
    height: 100%;
    object-fit: cover;
    object-position: bottom;
    /* Магія затухання: від 100% видимості до 0% видимості */
    -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to right, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
    z-index: 1;
    transition: transform 0.7s ease;
}

/* Легкий зум фото при наведенні на весь рядок */
.specialty-row:hover .specialty-image {
    transform: scale(1.03);
}

/* Контентний блок */
.specialty-content {
    position: relative;
    z-index: 2; /* Текст завжди поверх зображення/фону */
    width: 50%;
    margin-left: 50%; /* Зсуваємо текст вправо */
    padding: 50px;
}

.card-title {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

.card-text {
    font-size: 1.05rem;
    color: #555;
    margin-bottom: 30px;
}

.card-link {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    background-color: #27ae60;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.card-link:hover {
    background-color: #1e8449;
    transform: translateY(-2px);
}

/* Чергування рядків: для парних елементів міняємо сторони */
.specialty-row:nth-child(even) .specialty-image {
    left: auto;
    right: 0;
    /* Градієнт в іншу сторону */
    -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to left, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
}

.specialty-row:nth-child(even) .specialty-content {
    margin-left: 0;
    margin-right: 50%; /* Зсуваємо текст вліво */
}

/* Адаптивність для мобільних пристроїв */
@media (max-width: 900px) {
    .specialty-row, 
    .specialty-row:nth-child(even) {
        flex-direction: column;
        min-height: auto;
    }

    .specialty-image, 
    .specialty-row:nth-child(even) .specialty-image {
        position: relative;
        width: 100%;
        height: 300px;
        /* На мобілці фото затухає зверху вниз */
        -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
        mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 50%, rgba(0,0,0,0) 100%);
    }

    .specialty-content, 
    .specialty-row:nth-child(even) .specialty-content {
        width: 100%;
        margin: -60px 0 0 0; /* "Натягуємо" текст на затухаючу частину фото */
        padding: 30px;
    }

    .section-title {
        font-size: 2rem;
    }
}