/* ============================================================================
   Страница «Отзывы» нового дизайна: левая колонка с рейтингом, сетка карточек
   и попап полного отзыва.

   Размеры из макета (Figma «Чистовик»): контент 1336, левая колонка 316,
   зазор между колонками 52, карточки 472 с зазором 24, плитка фото 80×80
   (в попапе 106×106) с зазором 6, радиусы 4/6/12.
   ========================================================================= */
/* Переменные объявлены на :root, а не на блоке страницы: карточка отзыва
   и попап переиспользуются на главной, где обёртки .nd-reviews нет. */
:root {
    --nd-red: #c60000;
    --nd-ink: #101014;
    --nd-ink-soft: #181417;
    --nd-muted: #8f8f9a;
    --nd-line: rgba(82, 82, 100, .15);
    --nd-line-soft: rgba(82, 82, 100, .12);
}
.nd-reviews {
    display: grid;
    grid-template-columns: 316px minmax(0, 1fr);
    gap: 52px;
    width: 100%;
    max-width: 1336px;
    margin: 0 auto;
    font-family: 'Nunito Sans', 'Nunito Fallback', Arial, sans-serif;
    color: var(--nd-ink);
}

/* ---------- левая колонка ---------- */
/* В колонке две карточки: сводка и блок «Уточните наличие и условия
   доставки» — отбиваем их друг от друга. */
.nd-reviews__summary {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-self: start;
}
.nd-reviews__summary-box {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    border-radius: 4px;
    background: rgba(82, 82, 100, .05);
}
.nd-reviews__avg {
    font-size: 22px;
    line-height: 26px;
    font-weight: 700;
}
.nd-reviews__total {
    margin-top: -16px; /* внутри текстового блока макета зазор 8, а не 24 */
    font-size: 18px;
    line-height: 25px;
    font-weight: 400;
}
.nd-reviews__add {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 8px 16px;
    border-radius: 4px;
    background: var(--nd-red);
    color: #fff;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background .15s ease;
}
.nd-reviews__add,
.nd-reviews__add:hover,
.nd-reviews__add:focus {
    color: #fff;
    text-decoration: none;
}
.nd-reviews__add:hover {
    background: #a80000;
}

/* ---------- сетка карточек ---------- */
.nd-reviews__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}
.nd-reviews__card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    border: 1px solid var(--nd-line);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.nd-reviews__head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nd-reviews__name {
    margin: 0;
    padding: 0;
    font-size: 22px;
    line-height: 26px;
    font-weight: 700;
    color: var(--nd-ink-soft);
}
.nd-reviews__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.nd-reviews__mark {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    line-height: 25px;
}
.nd-reviews__star {
    display: block;
    flex: 0 0 auto;
}
.nd-reviews__date {
    font-size: 14px;
    line-height: 20px;
    color: var(--nd-muted);
}
/* метка города — в стиле светлых блоков дизайна: заливка 5 %, радиус 4 */
.nd-reviews__city {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(82, 82, 100, .05);
    color: #525264;
    font-size: 14px;
    line-height: 20px;
    white-space: nowrap;
}
.nd-reviews__city svg {
    flex: 0 0 auto;
}

/* ---------- лента фото в карточке ---------- */
.nd-reviews__photos {
    position: relative;
}
.nd-reviews__track {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* полосу прокрутки прячем: листаем стрелкой и свайпом */
}
.nd-reviews__track::-webkit-scrollbar {
    display: none;
}
.nd-reviews__photo {
    display: block;
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    border: 1px solid var(--nd-line-soft);
    border-radius: 6px;
    overflow: hidden;
}
.nd-reviews__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* затемнение со стрелкой у правого края — показывает, что лента листается.
   Скрипт вешает .is-scrollable, пока прокрутка вправо ещё возможна. */
.nd-reviews__scroll {
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 80px;
    padding: 0;
    border: 0;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(to right, rgba(16, 16, 20, 0) 0%, var(--nd-ink) 100%);
    cursor: pointer;
}
.nd-reviews__photos.is-scrollable .nd-reviews__scroll {
    display: flex;
}

/* ---------- текст и ссылка ---------- */
.nd-reviews__text {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 16px;
    line-height: 24px;
    color: var(--nd-ink-soft);
}
.nd-reviews__more {
    align-self: flex-start;
    margin-top: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--nd-red);
    font-family: inherit;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    cursor: pointer;
}
.nd-reviews__more:hover {
    text-decoration: underline;
}
.nd-reviews__empty {
    margin: 0;
    font-size: 18px;
    line-height: 25px;
    color: var(--nd-muted);
}
.nd-reviews__nav {
    margin-top: 40px;
}

/* ============================ попап отзыва ============================== */
.nd-modal[hidden] {
    display: none;
}
.nd-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Nunito Sans', 'Nunito Fallback', Arial, sans-serif;
}
.nd-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 13, 14, .5);
}
.nd-modal__win {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 600px;
    max-width: 100%;
    max-height: calc(100vh - 48px);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 88px rgba(0, 0, 0, .2);
    overflow: hidden;
}
.nd-modal__head {
    position: relative;
    flex: 0 0 auto;
    padding: 20px 68px 20px 24px;
}
.nd-modal__title {
    font-size: 28px;
    line-height: 34px;
    font-weight: 700;
    color: #0c0d0e;
}
.nd-modal__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.nd-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.nd-modal__body {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0 24px 24px;
    overflow-y: auto;
}
.nd-modal__photos {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}
.nd-modal__photo {
    display: block;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(82, 82, 100, .12);
    border-radius: 6px;
    overflow: hidden;
}
.nd-modal__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.nd-modal__text {
    font-size: 18px;
    line-height: 25px;
    color: #181417;
}
.nd-modal__action {
    flex: 0 0 auto;
    padding: 4px 24px 24px;
}
/* по макету кнопка светлая: заливка красным на 10 % и красная подпись */
.nd-modal__btn {
    width: 100%;
    min-height: 56px;
    border: 0;
    border-radius: 4px;
    background: rgba(198, 0, 0, .1);
    color: #c60000;
    font-family: inherit;
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease;
}
.nd-modal__btn:hover {
    background: rgba(198, 0, 0, .18);
}
/* пока открыт попап — страница под ним не скроллится */
body.nd-modal-open {
    overflow: hidden;
}

/* ============================== планшет ================================= */
@media (max-width: 1199px) {
    .nd-reviews {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 32px;
    }
    .nd-reviews__list {
        gap: 16px;
    }
}

/* ============================== мобильный =============================== */
@media (max-width: 767px) {
    .nd-reviews {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }
    /* В одну колонку блок «Уточните наличие» должен уйти под список
       отзывов (Ирина, 2026-08-05). Колонка раскрывается через
       display:contents — тогда её карточки становятся ячейками сетки
       и их можно переставить порядком. */
    .nd-reviews__summary {
        display: contents;
    }
    .nd-reviews__summary-box {
        order: 1;
    }
    .nd-reviews__main {
        order: 2;
    }
    .nd-reviews__summary .nd-infochat-wrap {
        order: 3;
    }
    .nd-reviews__list {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
    .nd-reviews__card {
        gap: 12px;
        padding: 16px;
    }
    .nd-reviews__name {
        font-size: 20px;
        line-height: 24px;
    }
    .nd-reviews__mark {
        font-size: 16px;
        line-height: 22px;
    }
    .nd-reviews__text {
        -webkit-line-clamp: 4;
    }
    .nd-reviews__nav {
        margin-top: 24px;
    }

    .nd-modal {
        padding: 16px;
    }
    .nd-modal__win {
        width: 100%;
        max-height: calc(100vh - 32px);
    }
    .nd-modal__head {
        padding: 16px 60px 16px 16px;
    }
    .nd-modal__title {
        font-size: 24px;
        line-height: 30px;
    }
    .nd-modal__close {
        top: 12px;
        right: 12px;
    }
    .nd-modal__body {
        gap: 16px;
        padding: 0 16px 16px;
    }
    .nd-modal__photos {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .nd-modal__text {
        font-size: 16px;
        line-height: 24px;
    }
    .nd-modal__action {
        padding: 4px 16px 16px;
    }
}

/* H1 страницы отзывов с разделителем под ним.
   Макет: десктоп 21289:57101 — 52/57.2 800, отступ 40, линия 2px
   rgba(82,82,100,.15) во всю ширину контейнера (21289:57112), снова 40;
   мобильный 21289:60504 — 30/33, отступы 24 и 36 (линия 21289:60509). */
.nd-reviews__h1 {
    margin: 0 0 40px;
    padding-bottom: 40px;
    border-bottom: 2px solid rgba(82, 82, 100, .15);
    font-size: 52px;
    line-height: 57.2px;
    font-weight: 800;
    color: #101014;
}
@media (max-width: 991px) {
    /* Тема задаёт мобильному h1 свой размер через !important
       (media.css), поэтому перебиваем тем же. */
    body .nd-reviews__h1 {
        margin-bottom: 36px;
        /* Отступы h1 тема тоже задаёт через !important. */
        padding-bottom: 24px !important;
        font-size: 30px !important;
        line-height: 33px !important;
    }
}
