gallery/style/gallery.css

106 lines
1.7 KiB
CSS

@import url(base.css);
body {
max-width: 50em;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, var(--image-size));
grid-gap: 1.5em;
justify-content: center;
justify-items: center;
align-items: start;
--image-size: 200px;
--border-thickness: 2px;
padding: 0;
margin: 0;
}
.item {
list-style: none;
padding: 0;
margin: 0;
position: relative;
width: var(--image-size);
height: var(--image-size);
box-shadow: 0 0 10px var(--shadow);
border: 2px solid var(--text);
overflow: hidden;
}
figure {
margin: 0;
padding: 0;
}
.item figcaption {
width: calc(100% - 2 * var(--border-thickness));
margin: 0;
padding: var(--border-thickness);
position: absolute;
left: 0;
bottom: 0;
font-size: 80%;
text-align: center;
background: hsl(0, 0%, 100%, 75%);
text-shadow:
-1px -1px 1px white,
1px -1px 1px white,
-1px 1px 1px white,
1px 1px 1px white;
border-top: 2px solid var(--text);
}
@media (hover) {
.item:hover figcaption {
opacity: 20%;
}
@media (prefers-reduced-motion) {
.item:hover figcaption {
transform: translateY(80%);
}
}
@media (prefers-reduced-motion: no-preference) {
.item:hover img {
filter: contrast(120%);
}
.item:hover figcaption {
transform: translate(-20%, 80%) rotateZ(7deg);
}
.item * {
transition: all 0.2s ease-in-out;
}
}
}
@media (hover: none) {
.item a {
display: block;
margin: 0;
height: var(--image-size);
}
.item img {
margin-bottom: 0;
}
.item figcaption {
position: static;
background: hsl(0, 0%, 100%, 50%);
}
.item {
height: auto;
}
}