.area-items > .re-card {
    width: 31.5315315315%;
    margin-right: 2.70270270275%;
    margin-bottom: 18px;
    box-sizing: border-box;
}

.area-items > .re-card:nth-child(3n) {
    margin-right: 0;
}

/* Глобальный сброс сайта содержит правило "path{fill:inherit}" (main.css),
   которое перебивает атрибут fill на наших инлайн-svg иконках (path наследует
   fill="none" родительского <svg> и становится невидимым). Возвращаем нужный
   цвет явно, с более высокой специфичностью, для каждой иконки. */
.re-card .re-card__gallery-expand svg path {
    fill: #fff;
}

.re-card .re-card__btn-tg-icon svg path {
    fill: #fff;
}

.re-card .re-card__metro-dot svg path {
    fill: #fff;
}

.re-card .re-card__share svg path {
    fill: #689ae3;
}

.re-card {
    --re-card-text: #151515;
    --re-card-text-secondary: #8a8a8a;
    --re-card-text-address: #5c5c5c;
    --re-card-accent: #346af8;
    --re-card-accent-bg: rgba(52, 106, 248, 0.08);
    --re-card-light-blue: #689ae3;
    --re-card-radius: 8px;
    --re-card-shadow: 0 1px 1px rgba(0, 0, 0, 0.07);

    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
    border-radius: var(--re-card-radius);
    box-shadow: var(--re-card-shadow);
    padding: 16px;
    color: var(--re-card-text);
    box-sizing: border-box;
    font-family: inherit;
}

/* Внутри слайдера (.best-slides/.slick-slide) сайт навешивает глобальные
   правила ".slick-slide img { width:146px; height:90px }". Поднимаем
   специфичность через двойной класс, чтобы наши размеры не перебивались. */
.re-card.re-card--slider {
    height: auto;
}

/*
 * Выравнивание высоты карточек в слайдере.
 *
 * Slick навешивает класс "slick-slide" прямо на .re-card (без доп. обёртки),
 * поэтому используем "flex + align-items:stretch" на треке — это официальный
 * приём самого Slick (>=1.8) для карточек разной высоты.
 *
 * Специально ограничено селектором ".best-slides--re-card" (этот класс
 * добавляется в slider/template.php только когда USE_REALESTATE_CARD=Y),
 * чтобы не задеть остальные легаси-слайдеры на .best-slides/.slick-track,
 * не связанные с недвижимостью.
 */
.best-slides--re-card .slick-track {
    display: flex;
    align-items: stretch;
}

.best-slides--re-card .re-card.slick-slide {
    height: auto;
    float: none;
}

.re-card__body {
    flex: 1 1 auto;
}

.re-card__actions {
    margin-top: auto;
}

.re-card__gallery {
    position: relative;
    width: 100%;
    height: 232px;
    border-radius: 6px;
    background: #f3f3f3;
    overflow: hidden;
    touch-action: pan-y;
    flex: 0 0 232px;
}

/*
 * Слайды идут в ряд (как в макете: два изображения рядом, без скруглений,
 * скругляет и обрезает только внешний .re-card__gallery). Переключение —
 * это перемещение всего ряда через transform: translateX (см. script.js),
 * а не fade по opacity — так на мобильных виден "хвостик" следующего слайда.
 */
.re-card__gallery-track {
    display: flex;
    height: 100%;
    gap: 2px;
    transition: transform 0.3s ease;
    will-change: transform;
}

.re-card__gallery-track.is-dragging {
    transition: none;
}

.re-card__gallery-slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}

.re-card .re-card__gallery-slide img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    object-fit: cover;
    pointer-events: none;
}

.re-card__gallery-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ececec 0%, #f8f8f8 100%);
}

.re-card__gallery-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 10px;
    border: 0;
    border-radius: 60px;
    background: rgba(5, 20, 34, 0.6);
    color: #fff;
    cursor: pointer;
    box-sizing: border-box;
    /* Десктоп: кнопка открытия галереи появляется только при наведении на карточку. */
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.re-card__gallery:hover .re-card__gallery-expand,
.re-card__gallery-expand:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

/*
 * Стрелки переключения слайдов — как в макете, появляются только при
 * наведении на десктопе. На мобильных стрелок нет (см. медиа-запрос ниже) —
 * там листают свайпом, а подсказкой служит "хвостик" следующего слайда.
 */
.re-card__gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 100px;
    background: rgba(5, 20, 34, 0.6);
    color: #fff;
    cursor: pointer;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.re-card__gallery-arrow--prev {
    left: 8px;
}

.re-card__gallery-arrow--next {
    right: 8px;
}

.re-card__gallery:hover .re-card__gallery-arrow,
.re-card__gallery-arrow:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

.re-card__gallery-arrow svg {
    display: block;
    width: 8px;
    height: 12px;
}

.re-card__gallery-counter {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    padding: 7px 8px;
    border-radius: 100px;
    background: #fff;
    color: var(--re-card-text);
    font-size: 12px;
    line-height: 12px;
}

.re-card__gallery-fancybox {
    display: none;
}

.re-card__body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 20px;
}

.re-card__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.re-card__head {
    display: flex;
    flex-direction: column;
}

.re-card__id-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 16px;
}

.re-card__id {
    font-size: 12px;
    line-height: 12px;
    color: var(--re-card-text-secondary);
}

.re-card__share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--re-card-light-blue);
    cursor: pointer;
    flex: 0 0 16px;
}

.re-card__share svg {
    width: 16px;
    height: 14px;
}

.re-card__share-tip {
    position: absolute;
    top: -8px;
    right: 0;
    transform: translateY(-100%);
    padding: 6px 10px;
    border-radius: 6px;
    background: #151515;
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.re-card__share-tip.is-visible {
    opacity: 1;
}

.re-card__title-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.re-card__title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    line-height: 24px;
}

.re-card__title a {
    color: inherit;
    text-decoration: none;
}

.re-card__title a:hover {
    color: var(--re-card-accent);
}

.re-card__tower {
    display: flex;
    align-items: center;
    gap: 4px;
}

.re-card__tower-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 12px;
    width: 12px;
    height: 13px;
}

.re-card .re-card__tower-icon svg {
    display: block;
    width: 12px;
    height: 11px;
}

.re-card__tower-name {
    font-size: 13px;
    line-height: 12px;
    color: var(--re-card-text-secondary);
}

.re-card__location {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.re-card__address {
    font-size: 13px;
    line-height: 18px;
    color: var(--re-card-text-address);
}

.re-card__metro {
    display: flex;
    align-items: center;
    gap: 4px;
}

.re-card__metro-icons {
    display: inline-flex;
    align-items: center;
}

.re-card__metro-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 100px;
    box-sizing: border-box;
}

.re-card__metro-dot + .re-card__metro-dot {
    margin-left: -8px;
}

.re-card__metro-dot.re-card__metro-dot--outlined  {
  width: 22px;
  height: 22px;
}

.re-card__metro-dot--outlined {
    border: 2px solid #fff;
    padding: 5px;
}

.re-card .re-card__metro-dot svg {
    display: block;
    width: 7px;
    height: 5px;
}

.re-card__metro-label {
    font-size: 13px;
    line-height: 13px;
    color: var(--re-card-text-address);
}

.re-card__more {
    align-self: flex-start;
    font-size: 13px;
    line-height: 13px;
    color: var(--re-card-accent);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.re-card__more:hover {
    text-decoration: underline solid;
}

.re-card__tags {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
    /* По макету теги ограничены двумя строками независимо от их количества
       и ширины карточки. Высота тега фиксирована (padding 7px + line-height 13px = 27px),
       поэтому 2 строки + 1 gap между ними = 27*2 + 4 = 58px. Остальные теги просто
       обрезаются (переполнение скрывается). */
    max-height: 58px;
    overflow: hidden;
}

.re-card__tag {
    display: inline-flex;
    align-items: center;
    padding: 7px 8px;
    border-radius: 100px;
    background: var(--re-card-accent-bg);
    color: var(--re-card-accent);
    font-size: 13px;
    line-height: 13px;
    white-space: nowrap;
}

.re-card__price-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.re-card__price-old {
    display: none;
    font-size: 14px;
    line-height: 14px;
    color: var(--re-card-text-secondary);
    text-decoration: line-through;
}

.re-card__price-row--discount .re-card__price-old {
    display: block;
}

.re-card__price {
    font-size: 24px;
    font-weight: 500;
    line-height: 24px;
    color: var(--re-card-text);
}

.re-card__actions {
    display: flex;
    gap: 8px;
}

.re-card__btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 48px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 14px;
    text-decoration: none;
    box-sizing: border-box;
}

.re-card__btn-tg {
    background: var(--re-card-accent-bg);
    border: 1px solid var(--re-card-accent);
    color: var(--re-card-accent);
}

.re-card__btn-tg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 100px;
    background: #2babee;
    flex: 0 0 24px;
}

.re-card .re-card__btn-tg-icon svg {
    display: block;
    width: 14px;
    height: 12px;
}

.re-card__btn-call {
    background: var(--re-card-accent);
    color: #fff;
}

.re-card__btn:hover {
    opacity: 0.92;
}

@media (max-width: 991px) {
    .area-items > .re-card {
        width: 48%;
        margin-right: 4%;
    }

    .area-items > .re-card:nth-child(3n) {
        margin-right: 4%;
    }

    .area-items > .re-card:nth-child(2n) {
        margin-right: 0;
    }
}

@media (max-width: 767px) {
    .area-items > .re-card {
        width: 100%;
        margin-right: 0;
    }

    .re-card__title {
        font-size: 16px;
    }

    .re-card__price {
        font-size: 20px;
    }

    /*
     * Мобильная версия: стрелок нет (листаем свайпом), поэтому кнопка
     * "открыть галерею" показана постоянно, а активный слайд немного уже
     * ширины фрейма — виден "хвостик" (~16px) следующего слайда как
     * подсказка, что можно свайпнуть дальше (см. макет Node 390:2981).
     */
    .re-card__gallery-expand {
        opacity: 1;
        pointer-events: auto;
    }

    .re-card__gallery-arrow {
        display: none;
    }

    .re-card__gallery--multi .re-card__gallery-slide {
        flex: 0 0 calc(100% - 18px);
        width: calc(100% - 18px);
    }
}
