/*
  Uzel Popular Posts — frontend styles
  ПК: sticky-блок под хедером, при необходимости — внутренняя прокрутка.
  Мобилка: горизонтальный свайп-слайдер с одинаковой высотой карточек.
*/

.uzel-popular-posts,
.uzel-popular-posts * {
  box-sizing: border-box;
}

.uzel-popular-posts {
  width: 100%;
  max-width: 100%;
  background: var(--upp-bg, #fff);
  border-radius: var(--upp-radius, 28px);
  box-shadow: var(--upp-shadow, 0 8px 26px rgba(20, 32, 54, 0.10));
  padding: 22px 16px 18px;
  font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
  color: var(--upp-text, #343434);
  overflow: hidden;
}

@media (min-width: 769px) {
  .uzel-popular-posts-sticky-shell {
    width: 100%;
    max-width: 100%;
  }

  .uzel-popular-posts--sticky-desktop {
    align-self: flex-start;
    z-index: var(--upp-desktop-sticky-zindex, 20);
  }

  .uzel-popular-posts--js-sticky-active {
    will-change: top, left, width;
  }

  /* В sticky-режиме список не перехватывает прокрутку страницы. */
  .uzel-popular-posts--sticky-desktop .uzel-popular-posts__viewport {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

.uzel-popular-posts__heading {
  margin: 0 0 18px;
  color: var(--upp-text, #343434);
  font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
  font-size: var(--upp-desktop-title-size, 24px);
  font-weight: 700;
  line-height: 1.15;
}

.uzel-popular-posts__viewport {
  max-height: var(--upp-desktop-max-height, 590px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--upp-accent, #0095FF) rgba(0, 0, 0, 0.06);
}

.uzel-popular-posts__viewport::-webkit-scrollbar {
  width: 6px;
}

.uzel-popular-posts__viewport::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
}

.uzel-popular-posts__viewport::-webkit-scrollbar-thumb {
  background: var(--upp-accent, #0095FF);
  border-radius: 999px;
}

.uzel-popular-posts__track {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.uzel-popular-posts__card {
  display: grid;
  grid-template-columns: var(--upp-desktop-image-width, 98px) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.uzel-popular-posts__image {
  display: block;
  width: var(--upp-desktop-image-width, 98px);
  height: var(--upp-desktop-image-height, 70px);
  overflow: hidden;
  border-radius: 9px;
  background: #eef2f7;
}

.uzel-popular-posts__image img,
.uzel-popular-posts__image-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uzel-popular-posts__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: var(--upp-desktop-image-height, 70px);
}

.uzel-popular-posts__title {
  margin: 0;
  font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
  font-size: var(--upp-desktop-item-title-size, 15px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--upp-text, #343434);
}

.uzel-popular-posts__title a {
  color: inherit;
  text-decoration: none;
}

.uzel-popular-posts__title a:hover {
  color: var(--upp-accent, #0095FF);
}

.uzel-popular-posts__excerpt {
  display: none;
  color: var(--upp-muted, #8B8B8B);
  font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
  font-weight: 500;
}

.uzel-popular-posts--desktop-excerpt .uzel-popular-posts__excerpt {
  display: -webkit-box;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.uzel-popular-posts__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

.uzel-popular-posts__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--upp-pill-bg, #F2F2F2);
  color: var(--upp-muted, #8B8B8B);
  font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
  font-size: var(--upp-desktop-meta-size, 12px);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.uzel-popular-posts__pill svg {
  display: block;
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.uzel-popular-posts__button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  margin-top: 24px;
  border: 1px solid var(--upp-accent, #0095FF);
  border-radius: 999px;
  color: var(--upp-accent, #0095FF);
  background: transparent;
  font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}

.uzel-popular-posts__button:visited {
  color: var(--upp-accent, #0095FF);
}

.uzel-popular-posts__button:hover,
.uzel-popular-posts__button:focus,
.uzel-popular-posts__button:active {
  background: var(--upp-accent, #0095FF);
  color: #fff !important;
}

.uzel-popular-posts__button:hover,
.uzel-popular-posts__button:focus,
.uzel-popular-posts__button:active,
.uzel-popular-posts__button:hover *,
.uzel-popular-posts__button:focus *,
.uzel-popular-posts__button:active * {
  color: #fff !important;
}

.uzel-popular-posts__empty {
  font-size: 15px;
  color: var(--upp-muted, #8B8B8B);
}

@media (max-width: 768px) {
  .uzel-popular-posts {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    overflow: visible;
  }

  .uzel-popular-posts__heading {
    margin: 0 0 18px;
    font-size: var(--upp-mobile-title-size, 42px);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.04em;
  }

  .uzel-popular-posts__viewport {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 16px 8px 0;
    margin-right: -16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .uzel-popular-posts__viewport::-webkit-scrollbar {
    display: none;
  }

  .uzel-popular-posts__track {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
  }

  .uzel-popular-posts__card {
    display: flex;
    flex-direction: column;
    flex: 0 0 min(var(--upp-mobile-card-width, 345px), calc(100vw - 28px));
    width: min(var(--upp-mobile-card-width, 345px), calc(100vw - 28px));
    min-height: var(--upp-mobile-card-min-height, 500px);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--upp-shadow, 0 8px 26px rgba(20, 32, 54, 0.10));
    overflow: hidden;
    scroll-snap-align: start;
  }

  .uzel-popular-posts__image {
    width: 100%;
    height: var(--upp-mobile-image-height, 230px);
    border-radius: 10px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .uzel-popular-posts__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px 18px 16px;
  }

  .uzel-popular-posts__title {
    font-size: var(--upp-mobile-card-title-size, 25px);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.04em;
  }

  .uzel-popular-posts__excerpt,
  .uzel-popular-posts--desktop-excerpt .uzel-popular-posts__excerpt {
    display: -webkit-box !important;
    margin-top: 18px;
    color: var(--upp-muted, #8B8B8B);
    font-family: var(--upp-font-family, Montserrat), Arial, sans-serif;
    font-size: var(--upp-mobile-excerpt-size, 18px);
    font-weight: 500;
    line-height: 1.18;
    overflow: hidden;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
  }

  .uzel-popular-posts__meta {
    margin-top: auto;
    padding-top: 16px;
    gap: 8px;
  }

  .uzel-popular-posts__pill {
    min-height: 26px;
    padding: 5px 10px;
    font-size: var(--upp-mobile-meta-size, 15px);
  }

  .uzel-popular-posts__pill svg {
    width: 15px;
    height: 15px;
  }

  .uzel-popular-posts__button {
    display: none;
  }
}
