/* reset */
.gallery img,
.gallery figcaption,
.gallery .gallery__figcaption__content p,
.gallery figure{
    margin: 0;
    padding: 0;
    color: #FAFAFA;
    font-size: 14px;
    line-height: 18px;
    font-weight: 400;
    transition:none;
    -webkit-transition:none;
    -moz-transition:none;
    -ms-transition:none;
    -o-transition:none;
}

@media (max-width:991px) {
    .gallery .gallery__figcaption__content p {
        font-size:12px;
        line-height: 14px;
    }
}

/* general */
.gallery{
    max-width: 732px;
    font-family: "CNN Sans Display", sans-serif;
}

.post__header .gallery {
    max-width: 100%;
}

.post__content .gallery ul,
.gallery ul{
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gallery__item{
    width: 100%;
    position: absolute;
    opacity: 0;
    z-index: -9999;
}
.gallery__item.visible{
  z-index: 1;
  position: inherit;
  opacity: 1;
  transition: opacity 0.35s ease;
  -webkit-transition: opacity 0.35s ease;
  -moz-transition: opacity 0.35s ease;
  -ms-transition: opacity 0.35s ease;
  -o-transition: opacity 0.35s ease;
}
.gallery button{
    padding: 0;
    border: none;
    box-sizing: border-box;
}

/* zoom-wrap */
.gallery__zoom-wrap{
    position: relative;
    margin-bottom: 4px;
}
.gallery__zoom-wrap figure{
    margin: 0;
    min-height: 500px;
    flex-wrap: wrap;
    display: flex;
    flex-wrap: wrap;
    background-color: #F1F1F1;
}
.gallery__zoom-wrap a{
    color: #FAFAFA;
    text-decoration: underline;
}

.gallery__zoom-wrap img{
    width: 100%;
    max-height: 412px;
    object-fit: contain;
    justify-self: flex-start;
}

/* caption */
.gallery__figcaption__content{
    padding: 16px;
}
.gallery__zoom-wrap figcaption{
    justify-self: flex-end;
    min-height: 88px;
    bottom: 0;
    min-width: 100%;
    background-color: #262626;
    border-radius: 0 0 5px 5px;
    -webkit-border-radius: 0 0 5px 5px;
    -moz-border-radius: 0 0 5px 5px;
    -ms-border-radius: 0 0 5px 5px;
    -o-border-radius: 0 0 5px 5px;
    -webkit-border-radius: 0 0 5px 5px;
}

.gallery__zoom-wrap small{
    font-weight: 300;
    font-size: 12px;
    line-height: 16px;
    margin-top: 4px;
    display: block;
    transition:none;
    -webkit-transition:none;
    -moz-transition:none;
    -ms-transition:none;
    -o-transition:none;
}

/* count */
.gallery__count {
    width: 76px;
    height:24px;
    background-color: rgba(0, 0, 0, .5);
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    position: absolute;
    margin-top: -40px;
    left: calc(50% - 38px);
    border-radius: 2px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
}

.gallery__count, .gallery__count .current, .gallery__count .total {
    color: #FAFAFA;
}

/* thumbnails */
.gallery__thumbnails{
    position: relative;
    max-width: 100%;
    margin-left: 28px;
}
.gallery__thumbnails ul{
    margin: 0;
    max-width: 100%;
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.gallery__thumbnails ul::-webkit-scrollbar{
    height: 0 !important;
}
.gallery__thumbnails .center_thumbnails{
    justify-content: center;
}
.gallery__thumbnails li{
    width: 132px;
    height: 74px;
    margin-right: 4px;
    margin-bottom: 0;
}
.gallery__thumbnails button{
    width: 132px;
    height: 74px;
    position: relative;
    border-radius: 4px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    -ms-border-radius: 4px;
    -o-border-radius: 4px;
}
.gallery__thumbnails img{
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
}
.gallery__thumbnails .select{
    border: 4px solid rgba(255, 255, 255);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    opacity: 0;
    transition: 0.4s;
    -webkit-transition: 0.4s;
    -moz-transition: 0.4s;
    -ms-transition: 0.4s;
    -o-transition: 0.4s;
}
.gallery__thumbnails .selected,
button:hover .select{
    opacity: 0.4;
}

/* arrows control */
.gallery__controls{
    height: 74px;
    margin-top: -74px;
    width: 100%;
    z-index: 999;
}
.gallery__controls button{
    height: 74px;
    width: 24px;
    background-color: #A81D1D;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}
.gallery__controls .next{
    float: right;
}


/****************
    AMP VERSION 
****************/
.gallery--amp .gallery_zoom--amp {
    position: relative;
}
.gallery--amp .gallery_count--amp {
    margin: 0;
    position: absolute;
    bottom: 94px;
    z-index: 99999;
    left: 50%;
    transform: translateX(-50%);
    background: #000000b5;
    color: #fff;
    font-size: 12px;
    padding: 2px 10px;
    line-height: 18px;
    border-radius: 4px;
}
.gallery--amp amp-carousel {
    padding-bottom: 84px;
}
.gallery--amp amp-img {
    margin-bottom: 0;
    max-height:100%;
    height:100%;
}
.gallery--amp .primarySlide amp-img img {
    margin-top: -42px;
}
.gallery--amp amp-img img {
    object-fit: contain !important;
    background: #f1f1f1  !important;
    
}
.gallery--amp figcaption {
    background-color: #262626;
    padding:16px;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    min-height: 84px;
    max-width: 100%;
    position: absolute;
    bottom:0;
    color:#fff;
}
.gallery--amp figcaption p {
    margin:0;
    color:#fff;
    font-size:13px;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    -webkit-line-clamp: 2;
}
.gallery--amp figcaption small {
    color:#fff;
    font-size:11px;
    display: block;
}
.gallery--amp .amp-carousel-button {
    height: 74px;
    width: 16px;
    border-radius: 4px;
    margin:0;
    outline: 0;
    margin-top: -84px;
    clip-path:none !important;
}
.gallery--amp .amp-carousel-button-next {
    background: url(../img/gallery-next.svg) center center no-repeat #A81D1D;
}
.gallery--amp .amp-carousel-button-prev {
    background: url(../img/gallery-prev.svg) center center no-repeat #A81D1D;
}
.gallery--amp .amp-carousel-button-prev {
    left:0;    
}
.gallery--amp .amp-carousel-button-next {
    right:0;
}
.gallery--amp amp-selector {
    margin-top: 4px;
}
.gallery--amp amp-selector .amp-carousel-button {
    display: none !important;
}
.gallery--amp amp-selector amp-img[aria-selected="true"] img {
    outline: 5px #ffffff7d solid !important;
    outline-offset: -5px;
}
.gallery--amp amp-selector amp-img {
    margin-left: 4px !important;
    max-width: 77px;
    max-height:60px;
    outline: 0 !important;
}
.gallery--amp amp-selector amp-img img {
    min-height: 100%;
    min-width: 100%;
    object-fit: cover !important;
}


/* MOBILE */
@media screen and (max-width: 731px) {
    .gallery{
        position: relative;
        flex-wrap: wrap;
    }
    .gallery__item{
        width: inherit;
    }
    .gallery__zoom-wrap figure{
        min-height: auto;
        min-width: 320px;
        width: 100%;
    }
    .gallery__zoom-wrap img{
        max-height: 178px;
        min-height: 178px;
        min-width: 320px;
    }
    .gallery__zoom-wrap figcaption{
        min-height: 80px;
        font-size: 12px;
        line-height: 14px;
    }

    .gallery__zoom-wrap figcaption .gallery__figcaption__content p {
        font-size: 12px;
        line-height: 14px;
    }

    .gallery__zoom-wrap small{
        font-weight: 200;
        line-height: 15px;
        color: #FAFAFA;
    }
    .gallery__controls{
        height: 80px;
        width: 100%;
        position: absolute;
        top: calc(50% - 40px);
    }
    .gallery__controls button{
        width: 16px;
        height: 80px;
    }
    .gallery__thumbnails{
        margin: 0;
    }
    .gallery__thumbnails ul{
        margin: 0;
        max-width: 100%;
    }
    .gallery__thumbnails .center_thumbnails{
        justify-content: normal;
    }
    .gallery__thumbnails li,
    .gallery__thumbnails button,
    .gallery__thumbnails img,
    .gallery__thumbnails .select,
    .gallery__thumbnails .selected{
        width: 77px;
        height: 60px;
        box-sizing: border-box;
    }
}
