body.sego-gallery-dark-album #page-body {
    box-sizing: border-box;
    padding: 12px;
    background: #373737;
    color: #eeeeee;
}

body.sego-gallery-dark-album #page-body h2,
body.sego-gallery-dark-album #page-body h3,
body.sego-gallery-dark-album #page-body label,
body.sego-gallery-dark-album #page-body .pagination,
body.sego-gallery-dark-album #page-body .display-options,
body.sego-gallery-dark-album #page-body .jumpbox-return {
    color: #eeeeee;
}

body.sego-gallery-dark-album #page-body a:not(.button) {
    color: #f2f2f2;
}

body.sego-gallery-dark-album #page-body a:not(.button):hover,
body.sego-gallery-dark-album #page-body a:not(.button):focus {
    color: #ffffff;
}

body.sego-gallery-dark-album #page-body .action-bar .button {
    border-color: #8a8a8a;
    background: #4a4a4a;
    color: #ffffff;
    box-shadow: none;
}

body.sego-gallery-dark-album #page-body .action-bar .button:hover,
body.sego-gallery-dark-album #page-body .action-bar .button:focus {
    border-color: #bcbcbc;
    background: #5a5a5a;
}

/* Nested-album cards on an open album page: keep their contents, remove decor. */
body.sego-gallery-dark-album #page-body > .polaroid,
body.sego-gallery-dark-album #page-body h2 + .polaroid {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.sego-gallery-dark-album #page-body > .polaroid > hr,
body.sego-gallery-dark-album #page-body h2 + .polaroid > hr {
    display: none !important;
}

/* Child albums mirror the clean cards of the main Albums page. Their covers
   are intentionally hidden; the useful title and metadata remain. */
.sego-gallery-subalbum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 400px));
    align-items: stretch;
    gap: 24px 28px;
    clear: both;
    width: 100%;
    margin: 14px 0 26px;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card {
    display: block !important;
    float: none !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 92px !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    overflow: hidden;
    border: 1px solid #dedede !important;
    border-radius: 9px !important;
    background: #fafafa !important;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.28) !important;
    color: #1d2630 !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    text-align: center;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card > p:first-child {
    margin: 0 0 5px !important;
    font-size: 18px !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a,
.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a:not(.button) {
    color: #111111 !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a:hover,
.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a:focus {
    color: #105289 !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card > .polaroid_img_container {
    display: block !important;
    margin: 6px 0 !important;
}
.sego-gallery-subalbum-grid .sego-gallery-subalbum-card > .polaroid_img_container img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card > hr {
    display: block !important;
    height: 0 !important;
    margin: 5px 0 !important;
    border: 0 !important;
    border-top: 1px solid #cccccc !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card > hr + hr {
    display: none !important;
}

.sego-gallery-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    clear: both;
    gap: 4px;
    width: 100%;
    margin: 8px 0 12px;
}

.sego-gallery-photo-grid .sego-gallery-photo-card {
    display: block !important;
    float: none !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: transparent;
    font-size: 0 !important;
    line-height: 0 !important;
}

.sego-gallery-photo-grid .sego-gallery-photo-card > p,
.sego-gallery-photo-grid .sego-gallery-photo-card > hr,
.sego-gallery-photo-grid .sego-gallery-photo-card > br {
    display: none !important;
}

.sego-gallery-photo-grid .sego-gallery-photo-card #thumbnail,
.sego-gallery-photo-grid .sego-gallery-photo-card .polaroid_img_container {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    line-height: 0 !important;
}

.sego-gallery-photo-grid .sego-gallery-photo-card #thumbnail img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    object-fit: cover;
}

body.sego-gallery-dark-album #page-body > span.clear {
    display: none !important;
}

@media (max-width: 900px) {
    .sego-gallery-subalbum-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 14px;
    }

    .sego-gallery-photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 600px) {
    body.sego-gallery-dark-album #page-body {
        padding: 6px;
    }

    .sego-gallery-photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .sego-gallery-subalbum-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

}

@media (max-width: 360px) {
    .sego-gallery-photo-grid {
        grid-template-columns: 1fr;
    }
}


/* Albums catalogue: dark background without changing the album cards. */
body.sego-gallery-albums-index #page-body {
    box-sizing: border-box;
    padding: 12px;
    background: #373737;
    color: #eeeeee;
}

body.sego-gallery-albums-index #page-body > h2,
body.sego-gallery-albums-index #page-body > h2 > a {
    color: #eeeeee;
}

/* Unified dark album cards */

/* My Albums / nested albums */
.sego-gallery-subalbum-grid .sego-gallery-subalbum-card {
    background: transparent !important;
    border: 1px solid #dedede !important;
    color: #eeeeee !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a,
.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a:not(.button) {
    color: #f2f2f2 !important;
}

.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a:hover,
.sego-gallery-subalbum-grid .sego-gallery-subalbum-card a:focus {
    color: #ffffff !important;
}

/* Albums catalogue */
body.sego-gallery-albums-index #page-body .polaroid,
body.sego-gallery-albums-index #page-body .polaroid a,
body.sego-gallery-albums-index #page-body .polaroid a:not(.button) {
    color: #f2f2f2 !important;
}

body.sego-gallery-albums-index #page-body .polaroid a:hover,
body.sego-gallery-albums-index #page-body .polaroid a:focus {
    color: #ffffff !important;
}
