/* 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 { } .posts-section h2 { margin-bottom: 30px; color: #333; font-size: 24px; padding-top: 20px; } /* ===== СЕТКИ С РАЗНЫМ КОЛИЧЕСТВОМ КОЛОНОК ===== */ /* Сетка на 4 колонки (по умолчанию) */ .posts-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--grid-gap); width: 100%; } /* Сетка на 3 колонки */ .posts-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--grid-gap); width: 100%; } /* Базовый класс для обратной совместимости */ .posts-grid { display: grid; 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%; } .post-card:hover .post-image { transform: scale(1.05); } /* Контейнер изображения */ .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-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; } .author-link { color: white; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.3); transition: border-color var(--transition-speed) ease; } .author-link:hover { border-bottom-color: white; } /* ===== АДАПТИВНОСТЬ ДЛЯ РАЗНЫХ ЭКРАНОВ ===== */ /* Десктоп (1200px и больше) */ @media (min-width: 1200px) { /* Для сетки 4 колонки - большие карточки на 2 колонки */ .posts-grid-4 .post-card-large { grid-column: span 2; aspect-ratio: 2 / 1; padding-bottom: 50%; } /* Для сетки 3 колонки - большие карточки на 2 колонки */ .posts-grid-3 .post-card-large { grid-column: span 2; aspect-ratio: 2 / 1; padding-bottom: 50%; } /* Улучшения для больших карточек */ .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; } } /* Ноутбуки (992px - 1199px) */ @media (min-width: 992px) and (max-width: 1199px) { /* Все сетки переходят на 3 колонки */ .posts-grid-4, .posts-grid-3 { grid-template-columns: repeat(3, 1fr); } /* Большие карточки становятся обычными */ .posts-grid-4 .post-card-large, .posts-grid-3 .post-card-large { grid-column: span 1; aspect-ratio: 1 / 1; padding-bottom: 100%; } } /* Планшеты (768px - 991px) */ @media (min-width: 768px) and (max-width: 991px) { /* Все сетки переходят на 2 колонки */ .posts-grid-4, .posts-grid-3 { grid-template-columns: repeat(2, 1fr); gap: var(--grid-gap-tablet); } /* Большие карточки становятся обычными */ .posts-grid-4 .post-card-large, .posts-grid-3 .post-card-large { grid-column: span 1; aspect-ratio: 1 / 1; padding-bottom: 100%; } .post-title-overlay { font-size: 15px; } } /* Мобильные (до 767px) */ @media (max-width: 767px) { /* Все сетки переходят на 1 колонку */ .posts-grid-4, .posts-grid-3 { grid-template-columns: 1fr; gap: var(--grid-gap-tablet); } .post-card, .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; } } /* Очень маленькие экраны (до 480px) */ @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; } } /* ===== ИНДИКАТОРЫ ЗАГРУЗКИ ===== */ #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; } .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; min-height: auto; } /* ===== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ===== */ .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; } .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; } }