/* =========================================================
   SCHOOL GALLERY - FRONTEND
   ========================================================= */

.sg-frontend {
    width: 100%;
    box-sizing: border-box;
}

.sg-frontend * {
    box-sizing: border-box;
}


/* =========================================================
   ALBUM / VIDEO BUTTONS
   ========================================================= */

.sg-content-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 30px;
}

.sg-switch-button {
    border: 1px solid #222;
    background: #fff;
    color: #222;
    padding: 10px 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
}

.sg-switch-button:hover,
.sg-switch-button.active {
    background: #222;
    color: #fff;
}

.sg-content-panel {
    display: none;
}

.sg-content-panel.active {
    display: block;
}


/* =========================================================
   ALBUM CARDS
   ========================================================= */

.sg-album-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.sg-album-card {
    border: 1px solid #ddd;
    background: #fff;
    overflow: hidden;
}

.sg-album-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.sg-album-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sg-no-image {
    color: #777;
}

.sg-album-content {
    padding: 18px;
}

.sg-album-content h3 {
    margin-top: 0;
}

.sg-album-description {
    line-height: 1.6;
}

.sg-view-album {
    display: inline-block;
    padding: 10px 16px;
    background: #222;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

.sg-view-album:hover {
    color: #fff;
    opacity: .9;
}


/* =========================================================
   SINGLE ALBUM PAGE
   ========================================================= */

.sg-single-album-header {
    margin-bottom: 30px;
}

.sg-back-to-gallery {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
}

.sg-single-album-header h1 {
    margin-bottom: 10px;
}

.sg-single-album-description {
    line-height: 1.7;
}


/* =========================================================
   PHOTO GRID
   ========================================================= */

.sg-photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.sg-gallery-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    background: #f3f3f3;
    cursor: pointer;
    overflow: hidden;
}

.sg-gallery-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}


/* =========================================================
   VIDEOS
   ========================================================= */

.sg-video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.sg-video-card {
    border: 1px solid #ddd;
    background: #fff;
    overflow: hidden;
}

.sg-video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.sg-video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.sg-video-content {
    padding: 18px;
}

.sg-video-content h3 {
    margin-top: 0;
}

.sg-video-description {
    line-height: 1.6;
}


/* =========================================================
   LIGHTBOX
   ========================================================= */

.sg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

.sg-lightbox[hidden] {
    display: none;
}

.sg-lightbox-content {
    width: min(90vw, 1200px);
    height: min(85vh, 850px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sg-lightbox-content img {
    max-width: 100%;
    max-height: calc(100% - 35px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.sg-lightbox-counter {
    color: #fff;
    margin-top: 12px;
    font-size: 14px;
}

.sg-lightbox-close,
.sg-lightbox-prev,
.sg-lightbox-next {
    position: absolute;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    z-index: 2;
}

.sg-lightbox-close {
    top: 15px;
    right: 25px;
    font-size: 42px;
    line-height: 1;
}

.sg-lightbox-prev,
.sg-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 60px;
    line-height: 1;
    padding: 10px 20px;
}

.sg-lightbox-prev {
    left: 15px;
}

.sg-lightbox-next {
    right: 15px;
}

.sg-lightbox-close:hover,
.sg-lightbox-prev:hover,
.sg-lightbox-next:hover {
    opacity: .7;
}

.sg-lightbox-open {
    overflow: hidden;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

    .sg-album-grid,
    .sg-photo-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sg-video-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 600px) {

    .sg-content-switcher {
        justify-content: center;
    }

    .sg-switch-button {
        flex: 1;
    }

    .sg-album-grid,
    .sg-photo-gallery,
    .sg-video-grid {
        grid-template-columns: 1fr;
    }

    .sg-lightbox {
        padding: 50px 15px;
    }

    .sg-lightbox-prev,
    .sg-lightbox-next {
        font-size: 42px;
        padding: 10px;
    }

    .sg-lightbox-prev {
        left: 0;
    }

    .sg-lightbox-next {
        right: 0;
    }

    .sg-lightbox-close {
        right: 12px;
    }

}
