/*
 * Блок отзывов Google.
 *
 * Классы .grp-* приходят из разметки плагина google-review-parser,
 * остальные — из template-parts/google-reviews.php.
 *
 * Оформление повторяет секции главной (css/main-page-new.css):
 * плоские карточки #F4F4F4 без скруглений и теней, Roboto для
 * заголовков и подписей, Roboto Mono для текста отзыва, почти чёрный
 * #101012. Ширина — во всю страницу с отступами 64px, как у соседей.
 */

.google-reviews-container {
    box-sizing: border-box;
    width: 100%;
    padding: 20px 64px;
    /* Прокрутка к якорю (/#reviews): блок встаёт под липкую шапку, а не за неё. */
    scroll-margin-top: calc(var(--w22-header-height, 81px) + var(--w22-notice-offset, 0px));
}

/*
 * На «Про нас» блок лежит внутри #primary.content-area, а у неё
 * max-width 1200px (style.css) — карточки сжимались, имена и даты
 * переносились по слогам. Выходим на полную ширину тем же приёмом,
 * что и секции той страницы (.uber-uns-hero в css/uber-uns.css).
 * На главной обёртки нет, там правило не нужно.
 */
.content-area .google-reviews-container {
    width: var(--w22-page-width, 100vw);
    max-width: var(--w22-page-width, 100vw);
    margin-left: calc(50% - calc(var(--w22-page-width, 100vw) / 2));
}

.google-reviews-wrapper {
    width: 100%;
    position: relative;
}

.google-reviews-title {
    margin: 0 0 40px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: clamp(24px, calc(100vw * 32 / var(--w22-fluid-baseline, 1440)), 40px);
    line-height: clamp(30px, calc(100vw * 38 / var(--w22-fluid-baseline, 1440)), 48px);
    color: #101012;
    text-align: center;
    text-transform: uppercase;
}

.google-reviews {
    display: flex;
    align-items: stretch;
    gap: 24px;
}

/* ── Средняя оценка ──────────────────────────────────────────────── */

.google-reviews-average-rating {
    box-sizing: border-box;
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background: #f4f4f4;
}

.google-reviews-average-rating .rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.google-reviews-average-rating-value {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: clamp(40px, calc(100vw * 56 / var(--w22-fluid-baseline, 1440)), 56px);
    line-height: 1;
    color: #101012;
}

.google-reviews-stars {
    display: block;
    width: 120px;
    height: 24px;
    color: #ffc107;
}

.google-reviews-average-rating .google {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 18px;
    line-height: 1.2;
    color: #101012;
    text-align: center;
}

.google-reviews-average-rating-text {
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.3;
    color: #77777c;
}

.google-reviews-average-rating .google img {
    display: block;
    width: 62px;
    height: auto;
    margin-top: 4px;
}

/* ── Слайдер ─────────────────────────────────────────────────────── */

.google-reviews-shortcode {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
}

.google-reviews-shortcode .grp-swiper {
    width: 100%;
    overflow: hidden;
}

.google-reviews-shortcode .grp-reviews {
    position: relative;
    width: 100%;
    align-items: stretch;
}

.google-reviews-shortcode .grp-review {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: auto;
    min-height: 220px;
    /* Запасная ширина: если Swiper почему-то не отработает, слайды
       не схлопнутся по содержимому. При активном Swiper его инлайновая
       ширина это правило перекрывает. */
    width: 300px;
    flex: 0 0 auto;
    padding: 24px;
    background: #f4f4f4;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-family: 'Roboto Mono', monospace;
    text-align: left;
}

/* ── Шапка карточки ──────────────────────────────────────────────── */

.google-reviews-shortcode .grp-review__header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-bottom: 12px;
    /* Место под значок Google, он позиционируется в этот отступ. */
    padding-right: 36px;
}

/* Длинные имена не должны переноситься по слогам. */
.google-reviews-shortcode .grp-review__author-row {
    min-width: 0;
}

.google-reviews-shortcode .grp-review__avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.google-reviews-shortcode .grp-review__avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.google-reviews-shortcode .grp-review__header-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.google-reviews-shortcode .grp-review__author {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.2;
    color: #101012;
}

.google-reviews-shortcode .grp-review__date {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    line-height: 1.25;
    color: #77777c;
}

.google-reviews-shortcode .grp-review__source {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
}

/* Звёзды плагина — инлайновые span со svg внутри.
   Раскладка задаётся явно, иначе они встают столбиком. */
.google-reviews-shortcode .grp-review__rating {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
}

.google-reviews-shortcode .grp-review__star {
    display: inline-flex;
    flex: 0 0 auto;
    line-height: 0;
}

.google-reviews-shortcode .grp-review__star svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* ── Текст отзыва ────────────────────────────────────────────────── */

/* Внутреннего скролла нет: длинный отзыв обрезается многоточием,
   карточки за счёт этого одной высоты. */
.google-reviews-shortcode .grp-review__text,
.google-reviews-shortcode .grp-review__body,
.google-reviews-shortcode .grp-review__content {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    max-height: none;
    padding-right: 0;
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
    /* У формулы темы min(16px, 100vw*16/1440) нижней границы нет: на 390px
       она даёт 4.3px. Тема лечит это отдельным медиазапросом с базисом 430,
       но между 768 и 1440 всё равно остаётся провал. clamp с полом в 14px
       читается на любой ширине и медиазапроса не требует. */
    font-size: clamp(14px, calc(100vw * 16 / 1440), 16px);
    line-height: clamp(19px, calc(100vw * 21 / 1440), 21px);
    color: #323235;
}

.google-reviews-shortcode .grp-review__footer {
    display: none;
}

/* ── Стрелки ─────────────────────────────────────────────────────── */

/* Оформление как у стрелок блока simplicity на главной
   (.simplicity-section__slider-arrow): круг 36px, фон #e1e0dd,
   тёмный шеврон 16x16. Плагин отдаёт пустые div без svg внутри,
   поэтому шеврон рисуется фоном — контур тот же, что в разметке
   simplicity. */
.google-reviews-shortcode .grp-slider-controls .swiper-button-next,
.google-reviews-shortcode .grp-slider-controls .swiper-button-prev {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background-color: #e1e0dd;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    z-index: 10;
    position: absolute;
    top: 50%;
    margin-top: 0;
    transform: translateY(-50%);
    cursor: pointer;
    transition: opacity 0.2s;
}

.google-reviews-shortcode .grp-slider-controls .swiper-button-next:hover,
.google-reviews-shortcode .grp-slider-controls .swiper-button-prev:hover {
    opacity: 0.8;
}

.google-reviews-shortcode .grp-slider-controls .swiper-button-next::after,
.google-reviews-shortcode .grp-slider-controls .swiper-button-prev::after {
    display: none;
}

.google-reviews-shortcode .grp-slider-controls .swiper-navigation-icon {
    display: none !important;
}

.google-reviews-shortcode .grp-slider-controls .swiper-button-prev {
    left: -18px;
    right: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23101012' stroke-width='2'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
}

.google-reviews-shortcode .grp-slider-controls .swiper-button-next {
    right: -18px;
    left: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23101012' stroke-width='2'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
}

.google-reviews-shortcode .grp-slider-controls .swiper-button-disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ── Адаптив ─────────────────────────────────────────────────────── */

@media screen and (max-width: 1024px) {
    .google-reviews-container {
        padding: 20px 32px;
    }

    .google-reviews {
        flex-direction: column;
        gap: 20px;
    }

    .google-reviews-average-rating {
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: center;
        gap: 24px;
        max-width: 320px;
        margin: 0 auto;
    }
}

@media screen and (max-width: 768px) {
    .google-reviews-container {
        padding: 20px;
    }

    .google-reviews-title {
        margin-bottom: 24px;
    }

    .google-reviews-shortcode .grp-review {
        min-height: 200px;
    }

    .google-reviews-shortcode .grp-slider-controls .swiper-button-next,
    .google-reviews-shortcode .grp-slider-controls .swiper-button-prev {
        display: none;
    }
}

/*
 * Пока не загрузился Swiper: те же карточки и отступы, что задаёт
 * js/google-reviews.js, чтобы блок сразу выглядел готовым и не прыгал при запуске.
 */
.google-reviews-shortcode .grp-swiper:not(.swiper-initialized) .swiper-slide {
    width: 100%;
    margin-right: 10px;
}

@media (min-width: 768px) {
    .google-reviews-shortcode .grp-swiper:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 20px) / 2);
        margin-right: 20px;
    }
}

@media (min-width: 1024px) {
    .google-reviews-shortcode .grp-swiper:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 48px) / 3);
        margin-right: 24px;
    }
}

@media (min-width: 1600px) {
    .google-reviews-shortcode .grp-swiper:not(.swiper-initialized) .swiper-slide {
        width: calc((100% - 72px) / 4);
    }
}
