.immich-gallery-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.immich-gallery-card {
    border: 1px solid rgba(20, 25, 35, 0.14);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.immich-gallery-card-link {
    color: inherit;
    display: block;
    text-decoration: none;
}

.immich-gallery-card img,
.immich-gallery-card-placeholder {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #20252f, #516170);
    display: block;
    object-fit: cover;
    width: 100%;
}

.immich-gallery-card-body {
    display: block;
    padding: 12px 14px;
}

.immich-gallery-card-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.immich-gallery-card-meta {
    color: #68707d;
    display: block;
    font-size: 13px;
    margin-top: 4px;
}

.immich-gallery-copy,
.immich-upload-submit,
.immich-lightbox-copy,
.immich-lightbox-download {
    align-items: center;
    background: #146c94;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    gap: 6px;
    justify-content: center;
    line-height: 1.2;
    padding: 9px 12px;
    text-decoration: none;
}

.immich-gallery-card .immich-gallery-copy {
    margin: 0 14px 14px;
}

.immich-gallery-header {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin: 0 0 20px;
}

.immich-gallery-title {
    margin: 0 0 8px;
}

.immich-gallery-description {
    color: #3c4653;
    max-width: 72ch;
}

.immich-gallery-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(var(--ig-cols-desktop, 4), minmax(0, 1fr));
}

.immich-gallery-item {
    margin: 0;
    min-width: 0;
}

.immich-gallery-thumb {
    aspect-ratio: 1 / 1;
    background: #111821;
    border: 0;
    border-radius: 6px;
    cursor: zoom-in;
    display: block;
    overflow: hidden;
    padding: 0;
    width: 100%;
}

.immich-gallery-thumb img {
    height: 100%;
    object-fit: cover;
    transition: transform 160ms ease;
    width: 100%;
}

.immich-gallery-thumb:hover img,
.immich-gallery-thumb:focus-visible img {
    transform: scale(1.04);
}

.immich-gallery-item figcaption {
    color: #4e5967;
    display: grid;
    font-size: 13px;
    gap: 2px;
    line-height: 1.35;
    margin-top: 6px;
}

.immich-gallery-empty {
    background: #f5f7f9;
    border-radius: 8px;
    color: #4f5b67;
    padding: 16px;
}

body.single-immich_gallery #secondary,
body.single-immich_gallery .secondary,
body.single-immich_gallery .sidebar,
body.single-immich_gallery .sidebar-main,
body.single-immich_gallery .widget-area,
body.single-immich_gallery .site-sidebar,
body.single-immich_gallery .right-sidebar,
body.single-immich_gallery .is-right-sidebar,
body.single-immich_gallery aside[role="complementary"] {
    display: none !important;
}

body.single-immich_gallery #primary,
body.single-immich_gallery .primary,
body.single-immich_gallery .content-area,
body.single-immich_gallery .site-main,
body.single-immich_gallery main,
body.single-immich_gallery .entry-content,
body.single-immich_gallery .post-content,
body.single-immich_gallery .site-content .content-area {
    box-sizing: border-box;
    max-width: none !important;
    width: 100% !important;
}

body.single-immich_gallery.ast-right-sidebar #primary,
body.single-immich_gallery.ast-left-sidebar #primary,
body.single-immich_gallery .ast-container,
body.single-immich_gallery .site-content,
body.single-immich_gallery .content-sidebar-wrap,
body.single-immich_gallery .page-content,
body.single-immich_gallery .immich-gallery-single {
    max-width: none !important;
}

body.single-immich_gallery .site-content,
body.single-immich_gallery .content-sidebar-wrap {
    display: block !important;
}

body.single-immich_gallery .immich-gallery-single {
    margin-left: auto;
    margin-right: auto;
    width: min(100%, 1280px);
}

body.single-immich_gallery .immich-gallery-template-main,
body.immich-gallery-fullwidth-template .immich-gallery-template-main {
    box-sizing: border-box;
    margin: 0;
    max-width: none !important;
    padding: clamp(24px, 4vw, 56px) clamp(18px, 4vw, 64px);
    width: 100%;
}

body.single-immich_gallery .immich-gallery-template-wrap,
body.immich-gallery-fullwidth-template .immich-gallery-template-wrap {
    margin-left: auto;
    margin-right: auto;
    max-width: 1280px;
    width: 100%;
}

body.single-immich_gallery .immich-gallery-template-article,
body.immich-gallery-fullwidth-template .immich-gallery-template-article {
    margin: 0;
}

body.single-immich_gallery .immich-gallery-template-content,
body.immich-gallery-fullwidth-template .immich-gallery-template-content {
    max-width: none !important;
    width: 100%;
}

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

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

.immich-lightbox {
    inset: 0;
    overflow: hidden;
    position: fixed;
    z-index: 999999;
}

.immich-lightbox-backdrop {
    background: rgba(7, 10, 14, 0.9);
    inset: 0;
    position: absolute;
}

.immich-lightbox-dialog {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    inset: 0;
    justify-content: center;
    min-height: 0;
    padding: 64px 76px 28px;
    position: absolute;
}

.immich-lightbox-image {
    display: block;
    flex: 0 1 auto;
    max-height: calc(100vh - 210px);
    max-height: calc(100dvh - 210px);
    max-width: 100%;
    min-height: 0;
    object-fit: contain;
}

.immich-lightbox-close,
.immich-lightbox-nav {
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-size: 34px;
    height: 44px;
    line-height: 1;
    width: 44px;
}

.immich-lightbox-close {
    position: absolute;
    right: 22px;
    top: 18px;
}

.immich-lightbox-prev {
    left: 16px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.immich-lightbox-next {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.immich-lightbox-caption {
    color: #fff;
    flex: 0 0 auto;
    line-height: 1.35;
    max-width: min(900px, 100%);
    min-height: 22px;
    text-align: center;
}

.immich-lightbox-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 0;
    max-width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
}

.immich-lightbox-download {
    background: #2f7d57;
}

.immich-upload-form {
    display: grid;
    gap: 14px;
    max-width: 680px;
}

.immich-upload-form label {
    display: grid;
    gap: 6px;
}

.immich-upload-form input,
.immich-upload-form select,
.immich-upload-form textarea {
    border: 1px solid #cfd6df;
    border-radius: 6px;
    font: inherit;
    padding: 10px 11px;
}

.immich-upload-message {
    border-radius: 6px;
    padding: 12px 14px;
}

.immich-upload-success {
    background: #e9f7ef;
    color: #1f6b3f;
}

.immich-upload-error {
    background: #fdeeee;
    color: #9d1f1f;
}

@media (max-width: 900px) {
    .immich-gallery-grid {
        grid-template-columns: repeat(var(--ig-cols-tablet, 3), minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .immich-gallery-header {
        display: grid;
    }

    .immich-gallery-grid {
        grid-template-columns: repeat(var(--ig-cols-mobile, 2), minmax(0, 1fr));
    }

    .immich-lightbox-dialog {
        padding: 58px 54px 22px;
    }

    .immich-lightbox-image {
        max-height: calc(100vh - 190px);
        max-height: calc(100dvh - 190px);
    }

    .immich-lightbox-prev {
        left: 8px;
    }

    .immich-lightbox-next {
        right: 8px;
    }

    .immich-lightbox-close,
    .immich-lightbox-nav {
        font-size: 30px;
        height: 40px;
        width: 40px;
    }

    .immich-lightbox-actions {
        width: 100%;
    }

    .immich-lightbox-copy,
    .immich-lightbox-download {
        flex: 1 1 160px;
    }
}

@media (max-height: 700px) {
    .immich-lightbox-dialog {
        gap: 8px;
        padding-bottom: 18px;
        padding-top: 52px;
    }

    .immich-lightbox-image {
        max-height: calc(100vh - 170px);
        max-height: calc(100dvh - 170px);
    }

    .immich-lightbox-caption {
        font-size: 14px;
        min-height: 18px;
    }

    .immich-lightbox-copy,
    .immich-lightbox-download {
        padding-bottom: 8px;
        padding-top: 8px;
    }
}
