/* Gallery CSS — responsive grid with aspect-ratio thumbnails */ /* Основной контейнер — CSS Grid */ .gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; max-width: 1400px; margin: 0 auto; } /* Контейнер изображения */ .gallery .box { aspect-ratio: 1; border-radius: 8px; overflow: hidden; transition: transform 0.2s ease; border: none; width: 100%; height: auto; } /* Эффект наведения */ .gallery .box:hover { transform: scale(1.03); z-index: 1; position: relative; } /* Figure элемент */ .gallery figure { width: 100%; height: 100%; margin: 0; position: relative; overflow: hidden; } /* Изображение */ .gallery .img { width: 100%; height: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; border-radius: 8px; transition: transform 0.3s ease; } .gallery .box:hover .img { transform: scale(1.08); } /* Скрываем обычные img теги */ .gallery img { display: none; } /* Ссылка на полное изображение */ .gallery figure a { display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; } /* Подписи скрыты */ .gallery figcaption { display: none; } /* Планшет — 3 колонки */ @media (max-width: 900px) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 5px; } } /* Мобиль — 2 колонки */ @media (max-width: 600px) { .gallery { grid-template-columns: repeat(2, 1fr); gap: 3px; } .gallery .box { border-radius: 4px; } .gallery .img { border-radius: 4px; } /* Убираем hover-scale на тач-устройствах */ .gallery .box:hover { transform: none; } .gallery .box:hover .img { transform: none; } } /* Отдельные figure элементы (не в галерее) */ .box:not(.gallery .box) { display: inline-block; margin: 10px; max-width: 300px; } .box:not(.gallery .box) figure { position: relative; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); } .box:not(.gallery .box) .img { position: relative; width: 100%; height: 200px; background-size: cover; background-position: center; }