.gallery { .gallery-item { position: relative; width: 50%; padding: 0; &::after { content: ""; display: block; padding-bottom: 100%; } &:hover { .overlay { visibility: visible; opacity: 1; } } } .overlay { visibility: hidden; position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; transition: .2s ease-out; opacity: 0; background-color: $black; cursor: pointer; a { color: $white; &:hover { color: $accent; } } h2 { margin: $vertical-rhythm; color: $white; } } .gallery-img-container { display: flex; position: absolute; align-items: center; justify-content: center; width: 100%; height: 100%; overflow: hidden; } img { padding: $vertical-rhythm * 3; /*TODO: This is an ugly hack. Either fix or ensure images to have a good dimension*/ width: 640px; height: auto; } .gallery-modal-link { display: flex; position: absolute; align-items: center; justify-content: center; width: 100%; height: 100%; } }