/* "Свързани услуги" slider on service pages — see inc/related-services.php */
.mrd-related {
    --mrd-rel-accent: #19C674;
    --mrd-rel-accent-hover: #12a861;
    --mrd-rel-bg: #eaf9f2;
    --mrd-rel-dot: #b9d9c9;
    --mrd-rel-gap: 24px;
    --mrd-rel-per-view: 4;
    position: relative;
    padding: 70px 0 60px;
    background: var(--mrd-rel-bg);
    color: #212529;
}
/* Category accents, as in style.css (body.term-*). */
.term-pochistvashti-uslugi .mrd-related {
    --mrd-rel-accent: #34C8FF;
    --mrd-rel-accent-hover: #2aa8d7;
    --mrd-rel-bg: #eaf8fe;
    --mrd-rel-dot: #b5e3f5;
}
.term-snegopochistvane .mrd-related {
    --mrd-rel-accent: #1F79E3;
    --mrd-rel-accent-hover: #1968c5;
    --mrd-rel-bg: #ebf3fd;
    --mrd-rel-dot: #b7d1f2;
}
.mrd-related .col-header-centered h2 {
    margin-bottom: 30px;
}

/* Strip: native horizontal scroll with snapping (works without JS). */
.mrd-related__track {
    display: flex;
    gap: var(--mrd-rel-gap);
    margin: 0 -14px;
    padding: 10px 14px 26px; /* room for the cards' shadow and hover lift */
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 14px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.mrd-related__slider.is-enhanced .mrd-related__track {
    scrollbar-width: none;
}
.mrd-related__slider.is-enhanced .mrd-related__track::-webkit-scrollbar {
    display: none;
}
.mrd-related__slider.is-static .mrd-related__track {
    justify-content: center;
}

.mrd-related__item {
    flex: 0 0 calc((100% - (var(--mrd-rel-per-view) - 1) * var(--mrd-rel-gap)) / var(--mrd-rel-per-view));
    min-width: 0;
    scroll-snap-align: start;
}

/* Card: photo + title, the whole card is the link. */
.mrd-related__card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    /* Negative spread keeps the shadow inside the track's padding: the scroll
       container clips anything beyond it into a hard vertical edge. */
    box-shadow: 0 6px 14px -6px rgba(31, 45, 38, .22);
    color: #212529;
    text-decoration: none;
    transition: transform .3s ease, box-shadow .3s ease;
}
.mrd-related__card:hover,
.mrd-related__card:focus-visible {
    color: #212529;
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 14px 22px -10px rgba(31, 45, 38, .32);
}
.mrd-related__card:focus-visible {
    outline: 3px solid var(--mrd-rel-accent);
    outline-offset: 3px;
}

.mrd-related__img {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f5f4;
}
.mrd-related__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s ease;
}
.mrd-related__card:hover .mrd-related__img img {
    transform: scale(1.06);
}
/* Green line growing under the photo on hover, like the active item of the header menu. */
.mrd-related__img::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 4px;
    background: var(--mrd-rel-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s ease;
}
.mrd-related__card:hover .mrd-related__img::after,
.mrd-related__card:focus-visible .mrd-related__img::after {
    transform: scaleX(1);
}

.mrd-related__name {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 18px 20px 20px;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
    text-transform: uppercase;
}
.mrd-related__arrow {
    display: inline-flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--mrd-rel-accent);
    border-radius: 50%;
    color: var(--mrd-rel-accent);
    transition: background-color .3s ease, color .3s ease;
}
.mrd-related__card:hover .mrd-related__arrow,
.mrd-related__card:focus-visible .mrd-related__arrow {
    background: var(--mrd-rel-accent);
    color: #fff;
}

/* Arrows + dots under the strip (added by js/related-services.js). */
.mrd-related__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 4px;
}
.mrd-related__nav[hidden] {
    display: none;
}
.mrd-related__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid var(--mrd-rel-accent);
    border-radius: 50%;
    background: #fff;
    color: var(--mrd-rel-accent);
    cursor: pointer;
    transition: background-color .3s ease, color .3s ease, opacity .3s ease;
}
.mrd-related__btn:hover:not(:disabled),
.mrd-related__btn:focus-visible {
    background: var(--mrd-rel-accent);
    color: #fff;
}
.mrd-related__btn:focus-visible {
    outline: 3px solid var(--mrd-rel-accent-hover);
    outline-offset: 2px;
}
.mrd-related__btn:disabled {
    opacity: .35;
    cursor: default;
}
.mrd-related__dots {
    display: flex;
    align-items: center;
    gap: 4px;
}
.mrd-related__dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.mrd-related__dot::before {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background: var(--mrd-rel-dot);
    transition: width .3s ease, background-color .3s ease;
}
.mrd-related__dot[aria-current="true"]::before {
    width: 22px;
    background: var(--mrd-rel-accent);
}
.mrd-related__dot:focus-visible {
    outline: 2px solid var(--mrd-rel-accent-hover);
    outline-offset: 1px;
    border-radius: 4px;
}

@media (max-width: 1199px) {
    .mrd-related__name { font-size: 14px; padding: 16px 16px 18px; }
}
@media (max-width: 991px) {
    .mrd-related { --mrd-rel-per-view: 3; --mrd-rel-gap: 20px; }
}
@media (max-width: 767px) {
    .mrd-related { --mrd-rel-per-view: 2; padding: 50px 0 40px; }
}
@media (max-width: 575px) {
    .mrd-related { --mrd-rel-gap: 16px; }
    /* One card and a peek of the next one: shows that the strip scrolls. */
    .mrd-related__item { flex-basis: 78%; }
    .mrd-related__arrow { flex-basis: 30px; width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    .mrd-related__card,
    .mrd-related__img img,
    .mrd-related__img::after,
    .mrd-related__dot::before { transition: none; }
    .mrd-related__card:hover,
    .mrd-related__card:focus-visible { transform: none; }
    .mrd-related__card:hover .mrd-related__img img { transform: none; }
}
