.projects { display: grid; grid-auto-flow: dense; grid-gap: 10px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); padding: 1vw; figure > img { width: 100%; height: 100%; margin: 0; } figure { position: relative; width: 100%; height: 100%; margin: 0; &:hover > .project-caption { min-height: 100%; & > div { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } } } .project-caption { box-sizing: border-box; position: absolute; bottom: 0; left: 0; background-color: #000000aa; color: white; width: 100%; min-height: 1rem; font-size: 1.4rem; text-align: center; transition: min-height 0.25s ease; padding: 10px; div { .project-caption-date { font-size: 1.3rem; color: #e0e0e0; } } } @media (min-width: 650px) { a:first-child { grid-column: span 2; grid-row: span 2; } a:nth-child(4n) { grid-column: span 2; grid-row: span 2; } } } .project-featured-image { position: relative; height: 50vh; overflow: hidden; background-position-y: 50%; background-repeat: no-repeat; background-size: cover; .cover { width: 100%; height: 100%; background-color: #00000088 } .post-info { position: absolute; bottom: 0; left: 0; width: 100%; background-color: #00000088; color: white; padding: 15px; .post-title { margin-top: 0; } .author, .date, .reading-time { margin-right: 10px; } } } .project-links { text-align: center; margin-top: 30px; margin-bottom: 30px; a { padding: 10px 20px 6px 20px; text-decoration: none; border-radius: 5px; border: 2px solid; border-bottom: 5px solid; margin: 5px; color: white; background-size: 100% 200%; background-position: 100% 200%; transition: background-position 275ms ease; @each $name, $color in $accent-colors { &.#{$name} { border-color: $color; background-image: linear-gradient(to bottom, $color, $color 50%, transparent 50%); } } &:hover, &:focus { outline: none; background-position: 100% 100%; } } }