/* сбрасываем старый grid на контейнерах из styles.css */
#news-container,
#pinned-container {
  display: block;
}

/* ── Сетка карточек ────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 24px 0;
}

.posts-loading,
.posts-empty {
  text-align: center;
  color: #888;
  padding: 32px;
}

/* ── Карточка ──────────────────────────────────────────── */
.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 360px;
  position: relative;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* ── Обложка ───────────────────────────────────────────── */
.pc-cover {
  width: 100%;
  height: 240px;
  flex-shrink: 0;
  overflow: hidden;
}

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

/* подложка когда нет обложки: цвет + большая буква */
.pc-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-bg span {
  font-size: 5rem;
  font-weight: 700;
  font-family: Georgia, serif;
  line-height: 1;
  user-select: none;
}

/* ── Тело карточки ─────────────────────────────────────── */
.pc-body {
  padding: 12px 16px 14px;
  height: 120px; /* 360 - 240 */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pc-date {
  font-size: 0.6875rem;
  color: #999;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.pc-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.pc-dept {
  font-size: 0.6875rem;
  color: #2d5016;
  flex-shrink: 0;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 16px;
}

/* ── Булавка закреплённой новости ──────────────────────── */
.pc-pin-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #c0392b;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  z-index: 1;
  flex-shrink: 0;
}

/* ── Кнопки под сеткой ─────────────────────────────────── */
.posts-expand-btn {
  display: block;
  margin: 4px auto 20px;
  padding: 10px 28px;
  background: transparent;
  border: 2px solid #2d5016;
  border-radius: 20px;
  color: #2d5016;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.posts-expand-btn:hover:not(:disabled) {
  background: #2d5016;
  color: #e3ceaf;
}

.posts-expand-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.posts-more-link {
  display: block;
  margin: 4px auto 20px;
  padding: 10px 28px;
  border: 2px solid #c9a227;
  border-radius: 20px;
  color: #7a5c1e;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  width: fit-content;
  transition: background 0.18s ease, color 0.18s ease;
}

.posts-more-link:hover {
  background: #c9a227;
  color: #0e350e;
}

/* ══ Компонент документов (docs.js) ═══════════════════════ */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 24px 0;
}

.doc-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.doc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}

.dc-cover {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  flex-shrink: 0;
}

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

.dc-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dc-bg span {
  font-size: 4rem;
  font-weight: 700;
  font-family: Georgia, serif;
  line-height: 1;
  user-select: none;
}

.dc-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
}

.dc-year {
  font-size: 0.6875rem;
  color: #999;
  margin-bottom: 3px;
}

.dc-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Адаптив: планшет ───────────────────────────────────── */
@media (max-width: 1279px) {
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* ── Адаптив: мобильный ─────────────────────────────────── */
@media (max-width: 767px) {
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 0;
  }
  .post-card {
    height: auto;
    flex-direction: row;
    align-items: stretch;
  }
  .pc-cover {
    width: 110px;
    height: auto;
    min-height: 110px;
    flex-shrink: 0;
  }
  .pc-body {
    height: auto;
    flex: 1;
  }
}
