/**
 * Shared CSS for PDF and Image Galleries
 */

/* PDF Gallery */
.fast-pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; margin: 20px 0; }
.pdf-box { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: #333; }
.pdf-thumb { width: 100%; max-width: 140px; aspect-ratio: 3/4; border: 1px solid #ddd; background: #fff; display: flex; align-items: center; justify-content: center; }
.pdf-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pdf-thumb-placeholder { font-size: 18px; font-weight: 600; letter-spacing: .05em; color: #999; }
.pdf-label { font-size: 13px; text-align: center; margin-top: 10px; font-weight: 500; }

/* Image Gallery */
.fast-image-grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, auto-fit), minmax(0, var(--gallery-min-width, 300px)));
    gap: 15px;
    width: 100%;
    justify-content: center;
}

/* Fixed number of columns (cols="N"): boxes fill their column */
.fast-image-grid.mode-dynamic-cols {
    grid-template-columns: repeat(var(--gallery-cols, 3), minmax(0, 1fr));
}
.fast-image-grid.mode-dynamic-cols .image-box {
    max-width: none;
}

.image-box {
    width: 100%;
    max-width: var(--gallery-min-width, 300px);
    display: flex;
    flex-direction: column;
    border: 1px solid #eee;
    background: #fff;
    margin: 0;
}

.image-box a {
    display: block;
    line-height: 0;
}

.image-box img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.image-label {
    padding: 10px 8px;
    text-align: center;
    font-size: 14px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    color: #333;
}

/* Size-Presets (scoped, so they do not hit WordPress' own .size-medium image classes) */
.fast-image-grid.size-thumb  { --gallery-min-width: 150px; }
.fast-image-grid.size-medium { --gallery-min-width: 300px; }
.fast-image-grid.size-big    { --gallery-min-width: 600px; }

/* Lightbox (built by fast-lightbox.js; all classes are prefixed to avoid theme conflicts) */
.fga-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    user-select: none;
}
.fga-lightbox.is-open { display: flex; }
.fga-lightbox [hidden] { display: none !important; }

body.fga-lb-open { overflow: hidden; }

.fga-lb-img {
    max-width: 85%;
    max-height: 80%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 2px solid #444;
}

.fga-lb-close,
.fga-lb-prev,
.fga-lb-next {
    position: absolute;
    background: none;
    border: 0;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    padding: 20px;
}
.fga-lb-close { top: 10px; right: 20px; font-size: 40px; }
.fga-lb-prev  { left: 10px;  font-size: 60px; }
.fga-lb-next  { right: 10px; font-size: 60px; }

.fga-lb-caption {
    color: #ccc;
    margin-top: 15px;
    font-family: sans-serif;
    font-size: 18px;
    text-align: center;
    width: 80%;
}
