.gallery picture {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
}

.gallery picture img { width: 100%; }

.gallery picture img.fade {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity .5s ease;
}

.gallery picture img.fade.anim { opacity: 1; }

.gallery .items {
    display: flex;
    padding: 2px;
    margin: 0 -5px;
}

.gallery .items a {
    display: inline-block;
    padding: 3px;
    box-sizing: border-box;
}

/*.gallery .items a:not(:last-child) {
    display: inline-block;
    padding: 5px 5px 0 0;
}*/

/*.gallery .items a:last-child { padding: 5px 0 0 0; }*/

@media all and (max-width: 480px) {
    .gallery .items a { width: 25%; }
}

@media all and (min-width: 481px) and (max-width: 600px) {
    .gallery .items a { width: 20%; }
}

@media all and (min-width: 601px) and (max-width: 800px) {
    .gallery .items a { width: 10%; }
}


@media all and (max-width: 800px) {
    .gallery .items { flex-wrap: wrap; }
}


.buttonset {
    display: inline-block;
    margin: 0 auto;
    border-radius: 25px;
    box-shadow: 0 2px 6px 2px rgba(0,0,0,.15);
}

.buttonset a {
    display: inline-block;
    padding: 10px 20px;
}

.buttonset a.current {
    background-color: #369f4c;
    color: #FFF;
}

.buttonset a:not(.current):hover {
    background-color: #F6D734;
    color: #FFF;
}

.buttonset a:first-child {
    border-top-left-radius: 25px;
    border-bottom-left-radius: 25px;
    border-left: 1px solid #AAA;
    border-top: 1px solid #AAA;
    border-bottom: 1px solid #AAA;
}

.buttonset a:last-child {
    border-top-right-radius: 25px;
    border-bottom-right-radius: 25px;
    border-right: 1px solid #AAA;
    border-top: 1px solid #AAA;
    border-bottom: 1px solid #AAA;
}

.gallery {
    /*padding: 50px 0;*/
    /*text-align: center;*/
    /*background-color: #fff;*/
}

.gallery div.images { padding: 40px 0; }

.gallery div.images img {
    padding: 10px;
    box-sizing: border-box;
    display: inline-block;
}

@media all and (min-width: 481px) and (max-width: 640px) {
    .gallery div.images img { width: 50%; }
}

@media all and (min-width: 641px) and (max-width: 940px) {
    .gallery div.images img { width: 33.333333333%; }
}

@media all and (min-width: 941px) {
    .gallery div.images img { width: 25%; }
}

/* popup */
.mgGallery {
    height: 100%;
}

.mgGallery .slider {
    height: 100%;
}

.mgGallery .slider .slide {
    /*text-align: center;*/
    position: relative;
    box-sizing: border-box;
    float: left;
    width: 100%;
    height: 100%;
}

.mgPopupBody .mgGallery .slider .slide { text-align: center; }

.mgGallery .slider .slide img {
    /*height: 100%;*/
    max-width: 100%;
    max-height: 100%;
    vertical-align: middle;
}

.mgGallery .slider .slide span {
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

.mgGallery .slider .slide.fade {
    position: absolute;
    top: 0;
    left: 0;
    /* z-index: -1; */
}

/*.mgGallery .slider .slide h3 {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    background-color: rgba(255,255,255,0.5);
    line-height: 60px;
    font-family: sans-serif;
}*/

/* *** */

/* !!! ako ima frame w .mgGallery ne e neobhodimo da ima position: relative; overflow: hidden; */
.mgGallery .frame {
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* controls */

@media all and (max-width: 960px)
{
    .mgGallery .arrow {
        position: absolute;
        top: 50%;
        padding: 10px;
        font-size: 18px;
        line-height: 40px;
        width: 40px;
        text-align: center;
        text-decoration: none;
        margin-top: -30px;
        cursor: pointer;

        background-color: rgba(255,255,255,0.7);

        /* disable text selection highlighting */
        -webkit-touch-callout: none; /* iOS Safari */
        -webkit-user-select: none;   /* Chrome/Safari/Opera */
        -khtml-user-select: none;    /* Konqueror */
        -moz-user-select: none;      /* Firefox */
        -ms-user-select: none;       /* Internet Explorer/Edge */
        user-select: none;           /* Non-prefixed version, currently
                                      not supported by any browser */
    }

    .mgGallery .arrow:hover {
        /*background-color: rgba(255,255,255,0.7);*/
        color: #FFF;
    }

    .mgGallery .arrow.left {
        left: 0;
        border-bottom-right-radius: 10px;
        border-top-right-radius: 10px;
    }

    .mgGallery .arrow.right {
        right: 0;
        border-bottom-left-radius: 10px;
        border-top-left-radius: 10px;
    }
}

@media all and (min-width: 961px) {
    .mgGallery .arrow { display: none; }
}

/* *** */
.mgGallery .items {
    display: none;
}

/*@media all and (min-width: 601px) {
    .mgGallery .slider .slide { padding: 40px; }
}
*/

/* popup */
.mgGallery {
    height: 100%;
}


.mgGallery .slider .slide {
    position: relative;
    box-sizing: border-box;
    float: left;
    width: 100%;
    height: 100%;
}

.mgGallery .slider .slide img {
    /*height: 100%;*/
    max-width: 100%;
    max-height: 100%;
    vertical-align: middle;
}

.mgGallery .slider .slide span {
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

.mgGallery .slider .slide.fade {
    position: absolute;
    top: 0;
    left: 0;
    /* z-index: -1; */
}

.mgGallery .frame {
    height: 100%;
    position: relative;
    overflow: hidden;
}


.mgGallery .arrow {
    color: #8e8e8e;
    position: absolute;
    top: 50%;
    padding: 10px;
    font-size: 24px;
    line-height: 40px;
    width: 40px;
    text-align: center;
    text-decoration: none;
    margin-top: -30px;
    cursor: pointer;


    opacity: 1;
    transition: all 0.5s;

    user-select: none;    
}

.mgGallery .arrow:hover {
    background-color: rgba(0,0,0,0.1);
    color: #181818;
}

.mgGallery .arrow.left {
    left: 0px;
}

.mgGallery .arrow.right {
    right: 0px;
}

/* *** */
.mgGallery .items {
    display: none;
}

/*@media all and (min-width: 601px) {
    .mgGallery .slider .slide { padding: 40px; }
}*/