/* Блок «Услуги» — слайдер категорий-сторис (block-all-services).
   Карточка вертикальная (9:16), фон — сторис-изображение категории + чёрная заливка 0.6.
   Название и счётчик сверху, до 7 услуг, внизу — выделенная ссылка «Все услуги».
   Анимация покоя: мягкое сияние и мерцающие звёздочки. */

.services-block {
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.services-slider-wrapper {
    position: relative;
    padding: 20px 0;
    margin: 0 -20px;
}

.services-swiper {
    padding: 20px 20px 30px;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    position: relative;
    z-index: 2;
}

.services-swiper::-webkit-scrollbar {
    display: none;
}

.swiper-wrapper {
    align-items: stretch;
    box-sizing: border-box;
    position: relative;
}

.swiper-slide {
    height: auto;
    box-sizing: border-box;
}

/* Карточка категории — вертикальный формат сторис (9:16) */
.service-category-card {
    width: 320px;
    min-width: 320px;
    aspect-ratio: 9 / 16;
    background: #22303e;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    text-align: right;
    color: #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.service-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
}

/* Чёрная полупрозрачная заливка 0.6 поверх сторис-изображения */
.service-category-card--has-bg::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 0;
    pointer-events: none;
}

/* Контент карточки — над фонами */
.category-header,
.services-list,
.service-category-card__all {
    position: relative;
    z-index: 2;
}

/* ─── Анимация покоя: сияние ─── */
.service-category-card__glow {
    position: absolute;
    inset: -30%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 72% 18%, rgba(126, 200, 255, .55), transparent 52%),
        radial-gradient(circle at 18% 78%, rgba(255, 214, 128, .45), transparent 55%);
    filter: blur(10px);
    opacity: .45;
    animation: cardGlow 8s ease-in-out infinite;
}

/* ─── Анимация покоя: мерцающие звёздочки ─── */
.service-category-card__stars {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.service-category-card__stars i {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, .85);
    animation: cardTwinkle 3.4s ease-in-out infinite, cardFloat 6s ease-in-out infinite;
}

/* Искра-звёздочка — крест из двух линий */
.service-category-card__stars i::before,
.service-category-card__stars i::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 1px;
    margin: -0.5px 0 0 -5px;
    background: rgba(255, 255, 255, .85);
    border-radius: 1px;
}

.service-category-card__stars i::after {
    transform: rotate(90deg);
}

.service-category-card__stars i:nth-child(1) { top: 10%; right: 16%; animation-delay: 0s, 0s; }
.service-category-card__stars i:nth-child(2) { top: 26%; right: 44%; animation-delay: .9s, 1.2s; }
.service-category-card__stars i:nth-child(3) { top: 48%; right: 10%; animation-delay: 1.7s, .6s; }
.service-category-card__stars i:nth-child(4) { top: 62%; right: 58%; animation-delay: 2.4s, 1.8s; }

@keyframes cardGlow {
    0%, 100% { opacity: .35; transform: scale(1) rotate(0deg); }
    50% { opacity: .70; transform: scale(1.12) rotate(10deg); }
}

@keyframes cardTwinkle {
    0%, 100% { opacity: 0; transform: scale(.5); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes cardFloat {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -6px; }
}

/* Заголовок и счётчик — сверху */
.category-header {
    margin-bottom: 12px;
}

.category-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: block;
    margin-bottom: 5px;
    line-height: 1.2;
    transition: color 0.3s ease;
    word-break: break-word;
    overflow-wrap: break-word;
}

.category-title:hover {
    color: var(--pb-accent, #1BA3D5);
}

.services-count {
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}

/* Список услуг — прижат к низу карточки, сразу над ссылкой «Все услуги» */
.services-list {
    margin-top: auto;
    margin-bottom: 0;
}

.service-item {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.service-item:last-child {
    border-bottom: none;
}

.service-link {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.4;
    font-size: 14px;
    display: block;
    transition: color 0.3s ease;
    word-break: break-word;
    overflow-wrap: break-word;
}

.service-link:hover {
    color: var(--pb-accent, #1BA3D5);
}

.service-link .fa-bolt {
    margin-right: 5px;
    font-size: 12px;
}

/* Нижний выделенный пункт «Все услуги» — ссылка на страницу категории */
.service-category-card__all {
    display: inline-flex;
    align-items: center;
    align-self: flex-end;
    margin-top: 12px;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.service-category-card__all::after {
    content: '→';
    margin-left: 6px;
    transition: transform 0.3s ease;
}

.service-category-card__all:hover {
    color: var(--pb-accent, #1BA3D5);
}

.service-category-card__all:hover::after {
    transform: translateX(3px);
}

/* Частичный показ следующего слайда */
.services-swiper .swiper-slide {
    width: 320px !important;
    min-width: 320px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

.services-swiper .swiper-slide-active {
    opacity: 1;
}

.services-swiper .swiper-slide-next {
    opacity: 0.9;
}

/* Адаптивность */
@media (max-width: 768px) {
    .services-slider-wrapper {
        margin: 0 -15px;
    }

    .services-swiper {
        padding: 15px 15px 25px;
    }

    .service-category-card {
        width: 280px;
        min-width: 280px;
        padding: 20px;
    }

    .services-swiper .swiper-slide {
        width: 280px !important;
        min-width: 280px;
    }

    .service-link {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .services-slider-wrapper {
        margin: 0 -10px;
    }

    .services-swiper {
        padding: 10px 10px 20px;
    }

    .service-category-card {
        width: 260px;
        min-width: 260px;
        padding: 18px;
    }

    .services-swiper .swiper-slide {
        width: 260px !important;
        min-width: 260px;
    }

    .category-title {
        font-size: 18px;
    }
}

/* Исправления для мобильных устройств */
@media (hover: none) and (pointer: coarse) {
    .service-category-card:hover {
        transform: none;
    }

    .services-swiper {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* Исправление для Samsung Internet Browser */
@media (-webkit-touch-callout: none) {
    .services-swiper {
        -webkit-overflow-scrolling: auto !important;
    }
}

/* Бережём пользователей, отключивших анимацию */
@media (prefers-reduced-motion: reduce) {
    .service-category-card__glow,
    .service-category-card__stars i {
        animation: none;
    }
}
