/* Common style */
.grid {
    margin: 0 auto 10px;
    max-width: 1000px;
    width: 90%;
}

    .grid a {
        float: left;
        /*width: 33.3%;*/
        width: 24.3%;
        color: #333;
    }

        .grid a:nth-child(odd) {
            margin: 0 0 -30px 0;
        }

    .grid figure {
        position: relative;
        overflow: hidden;
        margin: 5px;
        background: #333;
    }

        .grid figure img {
            position: relative;
            display: block;
            width: 100%;
            opacity: 0.7;
            -webkit-transition: opacity 0.3s;
            transition: opacity 0.3s;
        }

    .grid figcaption {
        position: absolute;
        top: 0;
        z-index: 11;
        padding: 10px 10px 10px 10px;
        width: 100%;
        height: 100%;
        text-align: center;
    }

        .grid figcaption h2 {
            margin: 0 0 20px 0;
            color: #3498db;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: bold;
            font-size: 1.3em;
            -webkit-transition: -webkit-transform 0.3s;
            transition: transform 0.3s;
        }

        .grid figcaption p {
            padding: 0 20px;
            color: #aaa;
            font-size: 1.2em;
            font-weight: 300;
            -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
            transition: opacity 0.3s, transform 0.3s;
        }

        .grid figcaption h2,
        .grid figcaption p {
            -webkit-transform: translateY(50px);
            transform: translateY(50px);
        }

    .grid figure button {
        position: absolute;
        padding: 4px 20px;
        border: none;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: bold;
        -webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
        transition: opacity 0.3s, transform 0.3s;
    }

    .grid figcaption,
    .grid figcaption h2,
    .grid figcaption p,
    .grid figure button {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    /* Style for SVG */
    .grid svg {
        position: absolute;
        top: -1px; /* fixes rendering issue in FF */
        z-index: 10;
        width: 100%;
        height: 100%;
    }

        .grid svg path {
            fill: #fff;
        }

    /* Hover effects */
    .grid a:hover figure img {
        opacity: 1;
    }

    .grid a:hover figcaption h2,
    .grid a:hover figcaption p {
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }

    .grid a:hover figcaption p {
        opacity: 0;
    }

/* Individual styles */
.demo-1 body {
    background: #3498db;
}

.demo-1 .grid figure button,
.demo-3 .grid figure button {
    top: 50%;
    left: 50%;
    border: 3px solid #fff;
    background: transparent;
    color: #fff;
    opacity: 0;
    -webkit-transform: translateY(-50%) translateX(-50%) scale(0.25);
    transform: translateY(-50%) translateX(-50%) scale(0.25);
}

.demo-1 .grid a:hover figure button,
.demo-3 .grid a:hover figure button {
    opacity: 1;
    -webkit-transform: translateY(-50%) translateX(-50%) scale(1);
    transform: translateY(-50%) translateX(-50%) scale(1);
}

.demo-2 body {
    background: #e74c3c;
}

.demo-2 .grid figcaption h2 {
    color: #e74c3c;
}

.demo-2 .grid figcaption p {
    -webkit-transition-delay: 0.05s;
    transition-delay: 0.05s;
}

.demo-2 .grid figure button {
    bottom: 0 !important;
    left: 0 !important;
    padding: 15px !important;
    width: 100% !important;
    background: #fff !important;
    color: #333 !important;
    font-weight: 300 !important;
    -webkit-transform: translateY(100%) !important;
    transform: translateY(100%) !important;
}

.demo-2 .grid a:hover figure button {
    -webkit-transition-timing-function: ease-out !important;
    transition-timing-function: ease-out !important;
    -webkit-transform: translateY(0) !important;
    transform: translateY(0) !important;
}

.demo-2 .grid figcaption h2,
.demo-2 .grid figcaption p,
.demo-3 .grid figcaption h2,
.demo-3 .grid figcaption p {
    -webkit-transition-timing-function: cubic-bezier(0.250, 0.250, 0.115, 1); /* older webkit */
    -webkit-transition-timing-function: cubic-bezier(0.250, 0.250, 0.115, 1.445);
    timing-function: cubic-bezier(0.250, 0.250, 0.115, 1.445);
}

.demo-2 .grid a:hover figcaption p,
.demo-3 .grid a:hover figcaption p {
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
    -webkit-transition-duration: 0.1s;
    transition-duration: 0.1s;
}

.demo-3 body {
    background: #52be7f;
}

.demo-3 .grid figcaption h2 {
    color: #52be7f;
}

.demo-3 .grid a:hover figcaption h2 {
    -webkit-transform: translateY(5px);
    transform: translateY(5px);
}

.active-tb {
    color: #444 !important;
}

/* Media Queries */
/* Let's redefine the width of each anchor and the margins */
@media screen and (max-width: 1100px) {

    .grid figcaption h2 {
        text-align: center !important;
        font-size: 16px;
        margin-bottom: 4px !important;
    }

    .grid figcaption p {
        font-size: 1em !important;
    }
}


@media screen and (max-width: 768px) {
    .grid a {
        width: 33.3% !important;
        max-width: 33.3%;
    }

    .grid svg {
        position: absolute;
        top: -1px; /* fixes rendering issue in FF */
        z-index: 10;
        width: 100%;
        height: 50%;
    }

    .grid figcaption h2 {
        text-align: center !important;
        font-size: 16px;
        margin-bottom: 4px !important;
    }


    .grid figcaption p {
        font-size: 1em !important;
        display: none;
    }

    .grid a:nth-child(odd) {
        margin: 0;
    }

    .grid a:nth-child(3n-1) {
        margin: 0 0 0 0;
    }
}

@media screen and (max-width: 550px) {
    .grid a {
        width: 100% !important;
        max-width: 100%;
    }
}


@media screen and (max-width: 45em) {




    .grid a:nth-child(3n-1) {
        margin: 0;
    }

    .grid a:nth-child(even) {
        margin: 0 0 0 0;
    }


    .grid figcaption h2 {
        margin-bottom: 0px;
        -webkit-transform: translateY(30px);
        transform: translateY(30px);
    }

    .grid figcaption p {
        margin: 0;
        padding: 0 10px;
    }
}

@media screen and (max-width: 27em) {




    .grid a:nth-child(even) {
        margin: 0;
    }
}
