.immich-gallery-wrap { width: 100%; }
.immich-gallery-title { margin: 0 0 1rem; }
.immich-gallery-description { margin: 0 0 1rem; }

/* Fælles galleri */
.immich-gallery-grid { width: 100%; }
.immich-gallery-item {
    position: relative;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #eee;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
}
.immich-gallery-item img {
    width: 100%;
    display: block;
    transition: transform .2s ease, filter .2s ease;
}
.immich-gallery-item:hover img { transform: scale(1.025); }

/* GRID: ens thumbnailfelter */
.immich-gallery-layout-grid .immich-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--immich-gallery-columns, 4), minmax(0, 1fr));
    gap: var(--immich-gallery-gap, 10px);
}
.immich-gallery-layout-grid .immich-gallery-item {
    aspect-ratio: var(--immich-gallery-ratio, 1 / 1);
}
.immich-gallery-layout-grid .immich-gallery-item img {
    height: 100%;
    object-fit: cover;
}

/* MASONRY: fysiske kolonner styret af JavaScript.
   Det giver præcis det antal kolonner, shortcoden beder om. */
.immich-gallery-layout-masonry .immich-gallery-grid {
    display: flex;
    align-items: flex-start;
    gap: var(--immich-gallery-gap, 10px);
    width: 100%;
}
.immich-gallery-layout-masonry .immich-gallery-masonry-column {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--immich-gallery-gap, 10px);
}
.immich-gallery-layout-masonry .immich-gallery-item {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
    height: auto;
    margin: 0;
}
.immich-gallery-layout-masonry .immich-gallery-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: var(--immich-lightbox-radius, 0);
}

/* Video-overlay */
.immich-gallery-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(0,0,0,.62);
    color: #fff;
    font-size: 23px;
    padding-left: 3px;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.immich-gallery-error {
    padding: .8rem 1rem;
    border-left: 4px solid #b32d2e;
    background: #fff3f3;
}

/* Lightbox */
.immich-gallery-lightbox {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--immich-lightbox-bg, rgba(0,0,0,.92));
    padding: 40px;
}
.immich-gallery-lightbox.is-open { display: flex; }
.immich-gallery-lightbox img,
.immich-gallery-lightbox video {
    display: block;
    max-width: min(var(--immich-lightbox-max-width, 94vw), 1600px);
    max-height: var(--immich-lightbox-max-height, 88vh);
    width: auto;
    height: auto;
    object-fit: contain;
}
.immich-gallery-lightbox video { width: min(var(--immich-lightbox-max-width, 94vw), 1400px); }
.immich-gallery-lightbox-close {
    position: absolute;
    right: 18px;
    top: 10px;
    border: 0;
    background: transparent;
    color: var(--immich-lightbox-text, #fff);
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
}
.immich-gallery-lightbox-title {
    position: absolute;
    left: 20px;
    bottom: 12px;
    right: 20px;
    color: var(--immich-lightbox-text, #fff);
    text-align: center;
    font-size: 14px;
}

@media (max-width: 767px) {
    .immich-gallery-layout-grid .immich-gallery-grid {
        grid-template-columns: repeat(var(--immich-gallery-columns-tablet, 3), minmax(0, 1fr));
    }
}
@media (max-width: 480px) {
    .immich-gallery-layout-grid .immich-gallery-grid {
        grid-template-columns: repeat(var(--immich-gallery-columns-mobile, 2), minmax(0, 1fr));
    }
    .immich-gallery-lightbox { padding: 20px; }
}

/* Lightbox navigation */
.immich-gallery-lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}
.immich-gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 54px;
    height: 72px;
    border: 0;
    border-radius: 8px;
    background: var(--immich-lightbox-control, rgba(0,0,0,.28));
    color: var(--immich-lightbox-text, #fff);
    font-size: 56px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s ease;
}
.immich-gallery-lightbox-nav:hover,
.immich-gallery-lightbox-nav:focus-visible {
    background: var(--immich-lightbox-control-hover, rgba(0,0,0,.58));
    outline: 2px solid rgba(255,255,255,.85);
    outline-offset: 2px;
}
.immich-gallery-lightbox-prev { left: 14px; }
.immich-gallery-lightbox-next { right: 14px; }
.immich-gallery-lightbox-counter {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--immich-lightbox-text, #fff);
    background: var(--immich-lightbox-control, rgba(0,0,0,.32));
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
    line-height: 1.3;
    pointer-events: none;
}

@media (max-width: 480px) {
    .immich-gallery-lightbox-nav {
        width: 44px;
        height: 60px;
        font-size: 46px;
        background: rgba(0,0,0,.2);
    }
    .immich-gallery-lightbox-prev { left: 4px; }
    .immich-gallery-lightbox-next { right: 4px; }
    .immich-gallery-lightbox-counter { top: 14px; }
}

/* Navngivne design-presets */
.immich-gallery-wrap .immich-gallery-title {
    text-align: var(--immich-title-align, inherit);
    font-size: var(--immich-title-size, inherit);
    color: var(--immich-title-color, inherit);
    font-family: var(--immich-title-font, inherit);
}
.immich-gallery-wrap .immich-gallery-description {
    text-align: var(--immich-description-align, inherit);
    font-size: var(--immich-description-size, inherit);
    color: var(--immich-description-color, inherit);
    font-family: var(--immich-description-font, inherit);
}
.immich-gallery-wrap .immich-gallery-item img {
    object-position: var(--immich-image-position, center center);
}
