/* RELATED_ENTRIES: Общие стили */
.related-entries-wrapper {
  width: 100%;
  box-sizing: border-box;
}

.related-entries-block {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 0;
  padding: 0;
}

.related-entries-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f0;
  aspect-ratio: 2 / 3; /* Соотношение 2:3 */
  flex: 1 1 calc(25% - 15px);
  min-width: 200px;
}

.related-entries-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.related-entries-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.related-entries-content {
  position: relative;
  padding: 8px;
  z-index: 3;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

.related-entries-title {
  font-size: 14px;
  margin: 0 0 4px 0;
  font-weight: bold;
}

.related-entries-date {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 5px;
}

.related-entries-text {
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.related-entries-link {
  display: inline-block;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  border-radius: 3px;
  font-size: 12px;
}

/* Мобильные (<768px) */
@media (max-width: 767px) {
  .related-entries-wrapper {
    overflow-x: auto;
    padding-bottom: 10px;
  }
  .related-entries-block {
    flex-wrap: nowrap;
  }
  .related-entries-item {
    flex: 0 0 70%;
    min-height: 100px;
    margin-right: 10px;
  }
}

/* Планшеты (768–899px) */
@media (min-width: 768px) and (max-width: 899px) {
  .related-entries-wrapper {
    overflow-x: auto;
    padding: 0;
  }
  .related-entries-block {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 15px;
    margin: 0;
    width: auto;
  }
  .related-entries-item {
    flex: 0 0 45%;
    min-height: 80px;
    margin-right: 15px;
  }
}

/* Десктоп ≥900px */
@media (min-width: 900px) {
  .related-entries-wrapper {
    display: contents;
  }
  .related-entries-block {
    position: relative;
    max-width: 1217px;
    width: 100vw;
    margin-left: -50vw;
    box-sizing: border-box;
    transform: translateX(242px);
    flex-wrap: wrap;
    gap: 15px;
  }
  .related-entries-item {
    width: calc(25% - 15px);
    min-height: 80px;
  }
}

/* Точные разрешения */
@media (width: 640px) and (height: 480px) {
  .related-entries-wrapper { overflow-x: auto; padding-bottom: 10px; }
  .related-entries-block {
    display: inline-flex; flex-wrap: nowrap; gap: 10px; margin: 0; width: max-content; left: 0; margin-left: 0; transform: none;
  }
  .related-entries-item { flex: 0 0 70%; min-height: 100px; margin-right: 10px; }
}

@media (width: 800px) and (height: 600px) {
  .related-entries-wrapper { overflow-x: auto; padding-bottom: 10px; }
  .related-entries-block {
    display: inline-flex; flex-wrap: nowrap; gap: 15px; margin: 0; width: max-content; left: 0; margin-left: 0; transform: none;
  }
  .related-entries-item { flex: 0 0 45%; min-height: 80px; margin-right: 15px; }
}

/* Примеры десктопных размеров */
@media (width: 1024px) and (height: 768px),
       (width: 1152px) and (height: 864px),
       (width: 1280px) and (height: 800px),
       (width: 1280px) and (height: 1024px),
       (width: 1366px) and (height: 768px),
       (width: 1440px) and (height: 900px),
       (width: 1600px) and (height: 1200px),
       (width: 1920px) and (height: 1080px) {
  .related-entries-wrapper { display: block; }
  .related-entries-block { left: 0; margin-left: 0; transform: none; max-width: none; width: 100vw; }
  .related-entries-item { width: calc(25% - 15px); min-height: 80px; }
}
