384 lines
6.9 KiB
CSS
384 lines
6.9 KiB
CSS
/* styles/components/ContentGrid.css */
|
||
|
||
/* CSS переменные */
|
||
:root {
|
||
--grid-gap: 20px;
|
||
--grid-gap-tablet: 15px;
|
||
--border-radius: 10px;
|
||
--transition-speed: 0.3s;
|
||
--overlay-padding: 20px 15px 15px;
|
||
--overlay-padding-large: 25px 20px 20px;
|
||
}
|
||
|
||
/* Секция постов */
|
||
.posts-section {
|
||
max-width: 1400px;
|
||
margin: 0 auto;
|
||
padding: 0 20px 20px;
|
||
}
|
||
|
||
.posts-section h2 {
|
||
margin-bottom: 30px;
|
||
color: #333;
|
||
font-size: 24px;
|
||
padding-top: 20px;
|
||
}
|
||
|
||
/* Сетка постов */
|
||
.posts-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(4, 1fr);
|
||
gap: var(--grid-gap);
|
||
width: 100%;
|
||
}
|
||
|
||
/* Карточка поста - базовые стили */
|
||
.post-card {
|
||
background: white;
|
||
border-radius: var(--border-radius);
|
||
overflow: hidden;
|
||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||
transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
|
||
aspect-ratio: 1 / 1;
|
||
position: relative;
|
||
display: flex;
|
||
flex-direction: column;
|
||
height: 0;
|
||
padding-bottom: 100%; /* Aspect ratio hack для надежности */
|
||
}
|
||
|
||
/* Большие карточки (десктоп) */
|
||
@media (min-width: 1200px) {
|
||
.post-card-large {
|
||
grid-column: span 2;
|
||
aspect-ratio: 2 / 1;
|
||
padding-bottom: 50%;
|
||
}
|
||
}
|
||
|
||
/* Hover эффекты */
|
||
.post-card:hover {
|
||
transform: translateY(-5px);
|
||
box-shadow: 0 8px 25px rgba(0,0,0,0.15);
|
||
}
|
||
|
||
.post-card:hover .post-image {
|
||
transform: scale(1.05);
|
||
}
|
||
|
||
/* Ссылка карточки */
|
||
.post-card-link {
|
||
position: absolute;
|
||
inset: 0;
|
||
display: block;
|
||
text-decoration: none;
|
||
color: inherit;
|
||
}
|
||
|
||
/* Контейнер изображения */
|
||
.post-image-container {
|
||
position: absolute;
|
||
inset: 0;
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* Изображение */
|
||
.post-image {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
display: block;
|
||
transition: transform var(--transition-speed) ease;
|
||
}
|
||
|
||
.post-image-placeholder {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||
}
|
||
|
||
/* Бейдж категории */
|
||
.post-category-badge {
|
||
position: absolute;
|
||
top: 15px;
|
||
right: 15px;
|
||
background: #2563eb;
|
||
color: white;
|
||
padding: 5px 10px;
|
||
border-radius: 4px;
|
||
font-size: 11px;
|
||
font-weight: 600;
|
||
text-transform: uppercase;
|
||
letter-spacing: 0.5px;
|
||
z-index: 2;
|
||
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
||
max-width: 80%;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
/* Оверлей с контентом */
|
||
.post-content-overlay {
|
||
position: absolute;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
padding: var(--overlay-padding);
|
||
background: linear-gradient(
|
||
to top,
|
||
rgba(0, 0, 0, 0.9) 0%,
|
||
rgba(0, 0, 0, 0.7) 50%,
|
||
rgba(0, 0, 0, 0) 100%
|
||
);
|
||
color: white;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
}
|
||
|
||
.post-meta-overlay {
|
||
margin-bottom: 3px;
|
||
}
|
||
|
||
.post-date-overlay {
|
||
font-size: 12px;
|
||
color: rgba(255, 255, 255, 0.9);
|
||
font-weight: 400;
|
||
}
|
||
|
||
.post-title-overlay {
|
||
font-size: 16px;
|
||
line-height: 1.3;
|
||
font-weight: 600;
|
||
margin: 0;
|
||
color: white;
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 3;
|
||
-webkit-box-orient: vertical;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.author-name {
|
||
font-size: 12px;
|
||
color: rgba(255, 255, 255, 0.85);
|
||
margin-top: 3px;
|
||
font-weight: 400;
|
||
}
|
||
|
||
/* Убедитесь что индикаторы не занимают лишнее место */
|
||
#infinity-scroll-sentinel {
|
||
height: 1px;
|
||
width: 100%;
|
||
visibility: hidden;
|
||
pointer-events: none;
|
||
}
|
||
|
||
.loading-indicator {
|
||
text-align: center;
|
||
padding: 40px 0;
|
||
color: #666;
|
||
min-height: auto; /* ← Важно! */
|
||
}
|
||
|
||
.no-more-posts {
|
||
text-align: center;
|
||
padding: 30px 0;
|
||
color: #666;
|
||
font-size: 16px;
|
||
border-top: 1px solid #eee;
|
||
margin-top: 20px;
|
||
min-height: auto; /* ← Важно! */
|
||
}
|
||
|
||
|
||
|
||
|
||
/* Улучшения для больших карточек */
|
||
@media (min-width: 1200px) {
|
||
.post-card-large .post-category-badge {
|
||
font-size: 12px;
|
||
padding: 6px 12px;
|
||
}
|
||
|
||
.post-card-large .post-content-overlay {
|
||
padding: var(--overlay-padding-large);
|
||
gap: 10px;
|
||
}
|
||
|
||
.post-card-large .post-date-overlay {
|
||
font-size: 13px;
|
||
}
|
||
|
||
.post-card-large .post-title-overlay {
|
||
font-size: 18px;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
.post-card-large .author-name {
|
||
font-size: 13px;
|
||
margin-top: 5px;
|
||
}
|
||
}
|
||
|
||
/* Ноутбуки: 3 колонки */
|
||
@media (min-width: 992px) and (max-width: 1199px) {
|
||
.posts-grid {
|
||
grid-template-columns: repeat(3, 1fr);
|
||
}
|
||
|
||
.post-card-large {
|
||
grid-column: span 1;
|
||
aspect-ratio: 1 / 1;
|
||
padding-bottom: 100%;
|
||
}
|
||
}
|
||
|
||
/* Планшеты: 2 колонки */
|
||
@media (min-width: 768px) and (max-width: 991px) {
|
||
.posts-grid {
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: var(--grid-gap-tablet);
|
||
}
|
||
|
||
.post-card-large {
|
||
grid-column: span 1;
|
||
aspect-ratio: 1 / 1;
|
||
padding-bottom: 100%;
|
||
}
|
||
|
||
.post-title-overlay {
|
||
font-size: 15px;
|
||
}
|
||
}
|
||
|
||
/* Мобильные: 1 колонка */
|
||
@media (max-width: 767px) {
|
||
.posts-grid {
|
||
grid-template-columns: 1fr;
|
||
gap: var(--grid-gap-tablet);
|
||
}
|
||
|
||
.post-card {
|
||
aspect-ratio: 2 / 1;
|
||
padding-bottom: 50%;
|
||
}
|
||
|
||
.post-card-large {
|
||
aspect-ratio: 2 / 1;
|
||
padding-bottom: 50%;
|
||
}
|
||
|
||
.posts-section {
|
||
padding: 0 15px 15px;
|
||
}
|
||
|
||
.posts-section h2 {
|
||
padding-top: 15px;
|
||
}
|
||
|
||
.post-content-overlay {
|
||
padding: 15px 12px 12px;
|
||
}
|
||
|
||
.post-title-overlay {
|
||
font-size: 15px;
|
||
}
|
||
|
||
.post-category-badge {
|
||
top: 12px;
|
||
right: 12px;
|
||
font-size: 10px;
|
||
padding: 4px 8px;
|
||
}
|
||
}
|
||
|
||
/* Очень маленькие экраны */
|
||
@media (max-width: 480px) {
|
||
.post-card,
|
||
.post-card-large {
|
||
aspect-ratio: 3 / 2;
|
||
padding-bottom: 66.67%;
|
||
}
|
||
|
||
.post-content-overlay {
|
||
padding: 12px 10px 10px;
|
||
gap: 5px;
|
||
}
|
||
|
||
.post-title-overlay {
|
||
font-size: 14px;
|
||
}
|
||
|
||
.post-category-badge {
|
||
top: 10px;
|
||
right: 10px;
|
||
padding: 3px 6px;
|
||
font-size: 9px;
|
||
}
|
||
}
|
||
|
||
/* Вспомогательные классы */
|
||
.sr-only {
|
||
position: absolute;
|
||
width: 1px;
|
||
height: 1px;
|
||
padding: 0;
|
||
margin: -1px;
|
||
overflow: hidden;
|
||
clip: rect(0, 0, 0, 0);
|
||
white-space: nowrap;
|
||
border: 0;
|
||
}
|
||
|
||
/* Состояния загрузки */
|
||
.loading-indicator {
|
||
text-align: center;
|
||
padding: 40px 0;
|
||
color: #666;
|
||
}
|
||
|
||
.loading-spinner {
|
||
display: inline-block;
|
||
width: 40px;
|
||
height: 40px;
|
||
border: 3px solid #f3f3f3;
|
||
border-top: 3px solid #2563eb;
|
||
border-radius: 50%;
|
||
animation: spin 1s linear infinite;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
@keyframes spin {
|
||
0% { transform: rotate(0deg); }
|
||
100% { transform: rotate(360deg); }
|
||
}
|
||
|
||
.no-more-posts {
|
||
text-align: center;
|
||
padding: 30px 0;
|
||
color: #666;
|
||
font-size: 16px;
|
||
border-top: 1px solid #eee;
|
||
margin-top: 20px;
|
||
}
|
||
|
||
.no-posts {
|
||
text-align: center;
|
||
padding: 40px;
|
||
color: #666;
|
||
font-size: 18px;
|
||
}
|
||
|
||
@media (max-width: 767px) {
|
||
.loading-spinner {
|
||
width: 30px;
|
||
height: 30px;
|
||
}
|
||
|
||
.no-more-posts {
|
||
padding: 20px 0;
|
||
}
|
||
}
|