/*
 * Объявления, этап 4б: сторис на главной, «Горячие объявления», пометки продвижений в списке.
 * Отдельный файл, чтобы не пересекаться с правками dlc.css в других ветках.
 */

/* ---------- Пометки продвижения ---------- */

.ad-promo-mark {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid #d0d0d4;
    border-radius: 4px;
    background: rgba(255, 255, 255, .94);
    color: #5c5c62;
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ad-promo-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
}

.ad-promo-line__pin {
    color: #d8231b;
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ad-promo-line__pin:before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #d8231b;
    vertical-align: 1px;
}

.ad-urgent-badge {
    position: absolute;
    z-index: 3;
    left: 12px;
    bottom: 12px;
    padding: 4px 10px;
    border-radius: 18px;
    background: #d8231b;
    color: #fff;
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* «Выделить»: заметная рамка и тёплый фон, без изменения размеров сетки */
.offer-tile.offer-tile--highlight {
    background: #fff8e9 !important;
    box-shadow: 0 0 0 2px #f2b84b inset, 0 6px 18px rgba(242, 184, 75, .25) !important;
}

.offer-tile.offer-tile--pinned {
    box-shadow: 0 0 0 1px #f3c4c1 inset;
}

.offer-tile.offer-tile--pinned.offer-tile--highlight {
    box-shadow: 0 0 0 2px #f2b84b inset, 0 6px 18px rgba(242, 184, 75, .25) !important;
}

/* ---------- Сторис: лента кружков ---------- */

.ad-stories {
    margin: 16px 0 8px;
}

.ad-stories__row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.ad-stories__row::-webkit-scrollbar {
    display: none;
}

.ad-stories__inner {
    position: relative;
}

.ad-stories__row.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}

/* Стрелки ленты — только для мыши; на тач-экранах листают пальцем */
.ad-stories__arrow {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .ad-stories__row {
        cursor: grab;
    }

    .ad-stories__arrow {
        position: absolute;
        top: 24px;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 1px solid #e4e4e6;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 4px 12px rgba(20, 20, 22, .14);
        color: #141416;
        cursor: pointer;
        transition: box-shadow .15s ease, transform .15s ease;
    }

    .ad-stories__arrow[hidden] {
        display: none;
    }

    .ad-stories__arrow:hover {
        box-shadow: 0 6px 16px rgba(20, 20, 22, .22);
        transform: scale(1.06);
    }

    .ad-stories__arrow:before {
        content: '';
        width: 9px;
        height: 9px;
        border-top: 2px solid currentColor;
        border-right: 2px solid currentColor;
    }

    .ad-stories__arrow--prev {
        left: 4px;
    }

    .ad-stories__arrow--prev:before {
        margin-left: 4px;
        transform: rotate(-135deg);
    }

    .ad-stories__arrow--next {
        right: 4px;
    }

    .ad-stories__arrow--next:before {
        margin-right: 4px;
        transform: rotate(45deg);
    }
}

.ad-story {
    flex: 0 0 auto;
    width: 84px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    scroll-snap-align: start;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.ad-story__ring {
    display: block;
    width: 76px;
    height: 76px;
    margin: 0 auto;
    padding: 3px;
    border-radius: 50%;
    background: conic-gradient(from 210deg, #d8231b, #f2b84b, #d8231b);
    transition: transform .15s ease;
}

.ad-story:active .ad-story__ring {
    transform: scale(.95);
}

.ad-story.is-seen .ad-story__ring {
    background: #cfcfd4;
}

.ad-story__img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 3px solid #fff;
    border-radius: 50%;
    overflow: hidden;
    background: #2a2a2e;
}

.ad-story__img img {
    display: block;
    /* Размер не зависит от загрузки картинки: иначе каждая загрузка пересчитывает вёрстку страницы */
    flex: none;
    aspect-ratio: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-story__play {
    color: #fff;
    font-size: 22px;
}

.ad-story__label {
    display: -webkit-box;
    margin-top: 6px;
    overflow: hidden;
    color: #141416;
    font-size: 12px;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.ad-story__mark {
    display: block;
    margin-top: 3px;
    color: #9a9aa0;
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ad-story.is-seen .ad-story__label {
    color: #9a9aa0;
}

@media screen and (min-width: 768px) {
    .ad-stories {
        margin: 24px 0 12px;
    }

    .ad-stories__row {
        gap: 18px;
    }

    .ad-story {
        width: 96px;
    }

    .ad-story__ring {
        width: 88px;
        height: 88px;
    }

    .ad-stories__arrow {
        top: 30px;
    }
}

/* ---------- Сторис: полноэкранный просмотрщик ---------- */

html.ad-story-open,
html.ad-story-open body {
    overflow: hidden !important;
}

.ad-story-viewer {
    position: fixed;
    z-index: 100000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 12, .96);
}

.ad-story-viewer[hidden] {
    display: none;
}

.ad-story-viewer__frame {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity .15s ease;
}

@media screen and (min-width: 768px) {
    .ad-story-viewer__frame {
        width: auto;
        height: calc(100vh - 48px);
        aspect-ratio: 9 / 16;
        max-width: 100%;
        border-radius: 14px;
    }
}

.ad-story-viewer__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-story-viewer__media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
}

.ad-story-viewer__bars {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 0;
}

.ad-story-viewer__bar {
    flex: 1 1 0;
    height: 3px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, .35);
}

.ad-story-viewer__bar-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
}

.ad-story-viewer__top {
    position: absolute;
    z-index: 3;
    top: calc(20px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px 0 12px;
}

.ad-story-viewer__counter {
    margin-right: auto;
    color: rgba(255, 255, 255, .8);
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.ad-story-viewer__mark[hidden] {
    display: none;
}

.ad-story-viewer__close {
    width: 44px;
    height: 44px;
    border: 0;
    background: none;
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.ad-story-viewer__info {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    bottom: 0;
    /* снизу место под строку «Задать вопрос» с ❤ и «поделиться» */
    padding: 60px 16px calc(74px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, .55) 60%, rgba(0, 0, 0, 0));
    color: #fff;
}

/* Над строкой действий сообщение («Вопрос отправлен…») — подписи поднимаем над ним */
.ad-story-viewer.has-note .ad-story-viewer__info {
    padding-bottom: calc(136px + env(safe-area-inset-bottom, 0px));
}

/* Пишут вопрос: подписи убираем, чтобы поля имени и контакта их не перекрывали */
.ad-story-viewer.is-asking .ad-story-viewer__info {
    visibility: hidden;
}

.ad-story-viewer__backdrop {
    position: absolute;
    inset: -40px;
    width: calc(100% + 80px);
    height: calc(100% + 80px);
    object-fit: cover;
    filter: blur(28px) brightness(.55);
    pointer-events: none;
}

.ad-story-viewer__stage .ad-story-viewer__media {
    position: relative;
}

/* ---------- строка действий: вопрос, ❤, поделиться ---------- */

.ad-story-viewer__acts {
    position: absolute;
    z-index: 4;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

.ad-story-viewer.is-asking .ad-story-viewer__acts {
    padding-top: 40px;
    background: linear-gradient(to top, rgba(0, 0, 0, .9), rgba(0, 0, 0, .75) 70%, rgba(0, 0, 0, 0));
}

.ad-story-viewer__acts-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ad-story-viewer__ask {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.ad-story-viewer__ask-input,
.ad-story-viewer__input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 44px 0 16px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 22px;
    background: rgba(0, 0, 0, .25);
    box-shadow: none;
    color: #fff;
    font-size: 16px; /* 16px — иначе iOS увеличивает страницу при фокусе */
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ad-story-viewer__input {
    margin-bottom: 8px;
    padding-right: 16px;
}

.ad-story-viewer__ask-input::placeholder,
.ad-story-viewer__input::placeholder {
    color: rgba(255, 255, 255, .75);
}

.ad-story-viewer__ask-input:focus,
.ad-story-viewer__input:focus {
    border-color: #fff;
    background: rgba(0, 0, 0, .45);
}

.ad-story-viewer__send {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #d8231b;
    color: #fff;
    font-size: 18px;
    line-height: 34px;
    cursor: pointer;
}

.ad-story-viewer__send:disabled {
    opacity: .5;
}

.ad-story-viewer__ic {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
}

.ad-story-viewer__ic svg {
    display: block;
    margin: 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
}

.ad-story-viewer__like.is-on {
    color: #ff3b4e;
}

.ad-story-viewer__like.is-on svg {
    fill: currentColor;
}

.ad-story-viewer__like.is-on svg {
    animation: ad-story-like .3s ease;
}

@keyframes ad-story-like {
    50% {
        transform: scale(1.25);
    }
}

.ad-story-viewer__note {
    margin: 0 0 8px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    color: #141416;
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
}

.ad-story-viewer__note.is-error {
    background: #fde3e1;
    color: #8f1610;
}

.ad-story-viewer__trap {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.ad-story-viewer__note[hidden],
.ad-story-viewer__ask-extra[hidden],
.ad-story-viewer__input[hidden],
.ad-story-viewer__send[hidden],
.ad-story-viewer__peek[hidden] {
    display: none;
}

/* ---------- соседние сторис по бокам (широкий экран) ---------- */

.ad-story-viewer__peek {
    display: none;
}

@media screen and (min-width: 1100px) {
    .ad-story-viewer__peek {
        display: block;
        position: absolute;
        top: 50%;
        width: 180px;
        height: 320px;
        margin-top: -160px;
        padding: 0;
        overflow: hidden;
        border: 0;
        border-radius: 12px;
        background: #26262b;
        cursor: pointer;
        opacity: .55;
        transition: opacity .15s ease, transform .15s ease;
    }

    .ad-story-viewer__peek:hover {
        opacity: .9;
        transform: scale(1.03);
    }

    .ad-story-viewer__peek img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .ad-story-viewer__peek-in {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 40px 10px 10px;
        background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, 0));
        color: #fff;
        text-align: left;
    }

    .ad-story-viewer__peek-title {
        display: -webkit-box;
        overflow: hidden;
        font-size: 13px;
        font-weight: 600;
        line-height: 1.3;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    .ad-story-viewer__peek-price {
        display: block;
        margin-top: 4px;
        font-size: 12px;
        opacity: .85;
    }

    .ad-story-viewer__peek--prev {
        left: calc(50% - (100vh - 48px) * 9 / 32 - 220px);
    }

    .ad-story-viewer__peek--next {
        right: calc(50% - (100vh - 48px) * 9 / 32 - 220px);
    }

    /* вместо круглых стрелок — карточки соседей (селектор сильнее правила стрелок ниже по файлу) */
    .ad-story-viewer .ad-story-viewer__nav {
        display: none;
    }
}

.ad-story-viewer__price {
    font-family: "Space Grotesk", sans-serif;
    font-size: 22px;
    font-weight: 700;
}

.ad-story-viewer__title {
    display: -webkit-box;
    margin-top: 4px;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ad-story-viewer__city {
    margin-top: 4px;
    color: rgba(255, 255, 255, .75);
    font-size: 13px;
}

.ad-story-viewer__city[hidden] {
    display: none;
}

.ad-story-viewer__open {
    display: block;
    margin-top: 12px;
    padding: 13px 16px;
    border-radius: 10px;
    background: #d8231b;
    color: #fff !important;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
}

.ad-story-viewer__open:hover {
    background: #b81d16;
}

.ad-story-viewer__nav {
    display: none;
}

@media screen and (min-width: 768px) {
    .ad-story-viewer__nav {
        display: block;
        position: absolute;
        top: 50%;
        width: 48px;
        height: 48px;
        margin-top: -24px;
        border: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, .15);
        color: #fff;
        font-size: 32px;
        line-height: 44px;
        cursor: pointer;
    }

    .ad-story-viewer__nav:hover {
        background: rgba(255, 255, 255, .3);
    }

    .ad-story-viewer__nav:disabled {
        opacity: .3;
        cursor: default;
    }

    .ad-story-viewer__nav--prev {
        left: calc(50% - (100vh - 48px) * 9 / 32 - 72px);
    }

    .ad-story-viewer__nav--next {
        right: calc(50% - (100vh - 48px) * 9 / 32 - 72px);
    }
}

/* ---------- Горячие объявления на главной: карусель карточек home-ad-card ---------- */

.home-offers__head .__title:before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 10px;
    border-radius: 50%;
    background: #d8231b;
    box-shadow: 0 0 0 4px rgba(216, 35, 27, .15);
    vertical-align: 3px;
}

.home-ad-card__mark {
    position: absolute;
    z-index: 2;
    /* под бейджем рубрики */
    left: 12px;
    top: 44px;
}

/* Стрелки видны всегда, по центру фото (высота фото — 168px, у карточки справа отступ 8px) */
.home-offers .owl-carousel .owl-nav .owl-prev,
.home-offers .owl-carousel .owl-nav .owl-next {
    top: 84px;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border: 1px solid #e4e4e6;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(20, 20, 22, .18);
    box-sizing: border-box;
    opacity: 1;
    cursor: pointer;
}

.home-offers .owl-carousel .owl-nav .owl-prev {
    left: 8px;
}

.home-offers .owl-carousel .owl-nav .owl-next {
    right: 16px;
}

.home-offers .owl-carousel .owl-nav .owl-prev:hover,
.home-offers .owl-carousel .owl-nav .owl-next:hover {
    border-color: #141416;
    background: #fff;
}

.home-offers .owl-carousel .owl-nav .owl-prev:after,
.home-offers .owl-carousel .owl-nav .owl-next:after {
    width: 9px;
    height: 9px;
    border-top: 2px solid #141416;
    border-right: 2px solid #141416;
    background: none;
    transform: rotate(45deg);
    margin-left: -3px;
}

.home-offers .owl-carousel .owl-nav .owl-prev:after {
    transform: rotate(-135deg);
    margin-left: 3px;
}

/* Край ленты: стрелка в эту сторону не работает */
.home-offers .owl-carousel .owl-nav .owl-prev.disabled,
.home-offers .owl-carousel .owl-nav .owl-next.disabled {
    opacity: .35;
    cursor: default;
}

/* ---------- Горячие объявления ---------- */

.ad-hot {
    margin: 8px 0 28px;
}

.ad-hot--board {
    margin: 0 0 24px;
}

.ad-hot__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 14px;
}

.ad-hot__title {
    margin: 0;
    color: #141416;
    font-family: "Space Grotesk", sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.ad-hot__title:before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 10px;
    border-radius: 50%;
    background: #d8231b;
    box-shadow: 0 0 0 4px rgba(216, 35, 27, .15);
    vertical-align: 3px;
}

.ad-hot__row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(200px, 1fr);
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.ad-hot-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e4e4e6;
    border-radius: 12px;
    background: #fff;
    color: #141416 !important;
    text-decoration: none !important;
    scroll-snap-align: start;
    transition: box-shadow .15s ease;
}

.ad-hot-card:hover {
    box-shadow: 0 6px 18px rgba(20, 20, 22, .1);
}

.ad-hot-card.is-promoted {
    border-color: #f2b84b;
}

.ad-hot-card__photo {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f3f5;
}

.ad-hot-card__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-hot-card__mark {
    position: absolute;
    top: 10px;
    left: 10px;
}

.ad-hot-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
}

.ad-hot-card__price {
    font-family: "Space Grotesk", sans-serif;
    font-size: 17px;
    font-weight: 700;
}

.ad-hot-card__title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ad-hot-card__meta {
    color: #9a9aa0;
    font-size: 12px;
}

@media screen and (min-width: 1100px) {
    .ad-hot__row {
        grid-auto-flow: row;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        overflow: visible;
    }
}

@media screen and (max-width: 767px) {
    .ad-hot {
        margin-bottom: 24px;
    }

    .ad-hot__title {
        font-size: 18px;
    }

    .ad-hot__row {
        grid-auto-columns: 62%;
        gap: 10px;
    }
}

/* Сторис магазина (common/models/Story): кольцо своего цвета, знак вместо картинки,
   в просмотрщике — надпись сверху, заголовок, текст и своя кнопка. */
.ad-story.is-shop .ad-story__ring {
    background: var(--ring, #d8231b);
}

.ad-story.is-shop.is-seen .ad-story__ring {
    background: #cfcfd4;
}

.ad-story.is-shop .ad-story__img {
    background: #fff;
}

.ad-story__icon {
    color: #141416;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.ad-story-viewer__kicker {
    color: rgba(255, 255, 255, .8);
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ad-story-viewer__text {
    margin-top: 6px;
    color: rgba(255, 255, 255, .9);
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-line;
}

.ad-story-viewer__kicker[hidden],
.ad-story-viewer__text[hidden],
.ad-story-viewer__price[hidden],
.ad-story-viewer__title[hidden],
.ad-story-viewer__open[hidden],
.ad-story-viewer__info[hidden] {
    display: none;
}
