/*
 * Gallery for Immich: gallery and lightbox styles.
 *
 * Every part of a gallery has a class, and the rules use one or two classes, so a theme can
 * override any of them without !important. Sizes set in the shortcode or block arrive as custom
 * properties on .immich-gallery (only when they differ from the default); a theme can set them
 * too, e.g. `.immich-gallery { --immich-size: 240px; }`.
 *
 *   --immich-size              thumbnail size in album grids
 *   --immich-width             maximum width of a single photo
 *   --immich-title-size        album name
 *   --immich-description-size  album and photo descriptions
 *   --immich-date-size         photo dates
 */

/* --- Grids --- */

.immich-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--immich-size, 200px), var(--immich-size, 200px)));
    gap: 20px;
}

.immich-grid.immich-album-grid {
    gap: 15px;
}

.immich-album,
.immich-album-grid .immich-photo {
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.immich-album-grid .immich-photo {
    border-radius: 6px;
}

.immich-album:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.immich-album-grid .immich-photo:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.immich-grid a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.immich-thumb {
    width: 100%;
    height: var(--immich-size, 200px);
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.immich-album-grid .immich-thumb {
    border-radius: 6px;
}

.immich-album:hover .immich-thumb {
    transform: scale(1.05);
}

.immich-album-grid .immich-photo:hover .immich-thumb {
    transform: scale(1.03);
}

/* --- Texts --- */

.immich-album-title {
    font-size: var(--immich-title-size, 16px);
}

.immich-album-page > .immich-album-title:first-child {
    margin-top: 0;
}

/* Inside the gallery the theme's spacing between blocks no longer reaches the album name and
   description, so give them the block gap of a block theme, or 1em in a classic theme. */
.immich-album-page > .immich-album-title,
.immich-album-page > .immich-album-description {
    margin-bottom: var(--wp--style--block-gap, 1em);
}

.immich-album-description {
    font-size: var(--immich-description-size, 14px);
}

.immich-album-text {
    padding: 10px;
    text-align: center;
}

.immich-album-text .immich-album-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.immich-album-text .immich-album-description {
    color: #666;
}

.immich-album-grid .immich-date,
.immich-album-grid .immich-description {
    padding: 10px;
    text-align: center;
    line-height: 1;
}

.immich-album-grid .immich-date {
    margin-top: 4px;
    margin-bottom: -2px;
    font-size: var(--immich-date-size, 13px);
}

.immich-album-grid .immich-description {
    margin: 0;
    font-size: var(--immich-description-size, 14px);
    color: #666;
}

/* --- Single photo --- */

.immich-single-photo .immich-photo {
    max-width: var(--immich-width, 200px);
    margin-bottom: 1em;
}

.immich-single-photo .immich-align-left {
    float: left;
    margin: 0 1.5em 1em 0;
}

.immich-single-photo .immich-align-right {
    float: right;
    margin: 0 0 1em 1.5em;
}

.immich-single-photo .immich-align-center {
    margin: 0 auto 1em auto;
    text-align: center;
}

.immich-image {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin-bottom: 0.5em;
}

/* --- Error for administrators --- */

.immich-admin-error {
    border-left: 4px solid #d63638;
    background: #fcf0f1;
    padding: 8px 12px;
    font-size: 14px;
}

/* --- Lightbox --- */

/* Full scale, centered, keeping the aspect ratio */
.glightbox-container .gslide img {
    max-width: 95vw !important;
    max-height: 95vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

.glightbox-container .gslide-inline video {
    max-width: 100%;
    max-height: 100%;
    display: block;
    margin: auto auto;
}

.glightbox-container .gslide-inline,
.glightbox-container .ginlined-content {
    background: transparent !important;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
}

/* The video's max-height needs a container with a height, or a portrait video is shown at full
   size and runs off the screen. Flex (over GLightbox's `display: block !important`) keeps a
   landscape video vertically centred in that height. */
.glightbox-container .gslide-inline .ginlined-content {
    display: flex !important;
    height: 100%;
    width: 100%;
}

/* No underline or focus ring on a mouse click; keyboard users still see where they are. */
.immich-lightbox {
    text-decoration: none;
}

.immich-lightbox:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Live Photo play button */
.immich-live-btn::before {
    content: "\25BA";
    margin-right: 4px;
}
.immich-live-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    z-index: 100;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    pointer-events: auto;
}
.immich-live-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
}
.immich-live-btn:disabled {
    cursor: default;
    opacity: 0.7;
}
