/* Gallery module on the website: albums by year, picture grid, lightbox extras.
   Selectors are specific on purpose: site templates style img and a freely. */
.galerie { margin: 16px 0; text-align: left; }
.galerie img { display: block; border: 0; margin: 0; padding: 0; float: none; max-width: none; box-shadow: none; }

/* Year chips: one row, swipeable sideways on phones */
.galerie-years {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 10px;
    margin-bottom: 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.galerie-years::-webkit-scrollbar { display: none; }
.galerie .galerie-years a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f0f0f0;
    color: #333;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
}
.galerie .galerie-years a:hover { background: #e2e2e2; }

.galerie-year { scroll-margin-top: 12px; }
.galerie-year h3 { margin: 18px 0 10px; }

/* Album cards */
.galerie-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.galerie .galerie-card {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease;
}
.galerie .galerie-card:active { transform: scale(0.98); }
.galerie-cover { position: relative; display: block; aspect-ratio: 4 / 3; background: #ddd; overflow: hidden; }
.galerie .galerie-cover img { width: 100%; height: 100%; object-fit: cover; }
.galerie-card-text { display: block; padding: 8px 10px 10px; }
.galerie-card-text strong { display: block; line-height: 1.25; overflow-wrap: anywhere; }
.galerie-card-text small { display: block; margin-top: 3px; color: #666; }
.galerie-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #8e44ad;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    vertical-align: middle;
}
.galerie-cover .galerie-badge { position: absolute; top: 8px; left: 8px; }

/* One album */
.galerie-back { margin: 0 0 8px; }
.galerie .galerie-back a { text-decoration: none; font-weight: 600; }
.galerie-title { margin: 0 0 4px; }
.galerie-meta { margin: 0 0 10px; color: #666; }
.galerie-description { margin: 0 0 12px; }

/* Picture grid: square tiles like a phone's photo app */
.galerie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px;
}
.galerie .galerie-grid a {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: #ddd;
    -webkit-tap-highlight-color: transparent;
}
.galerie .galerie-grid img { width: 100%; height: 100%; object-fit: cover; }

.galerie-empty { color: #666; font-style: italic; }

/* Access code */
.galerie-access { margin-top: 24px; font-size: 0.92em; color: #555; }
.galerie-access summary { cursor: pointer; }
.galerie-access form { margin-top: 8px; }
.galerie-access input[type=text] { padding: 6px 8px; font-size: 16px; }
.galerie-access button { padding: 6px 12px; }
.galerie .galerie-link { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.galerie-error { color: #c0392b; margin: 6px 0 0; }

@media (max-width: 600px) {
    .galerie-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .galerie-card-text { padding: 6px 8px 8px; font-size: 0.92em; }
    .galerie-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
    /* Edge to edge, as photo apps do */
    .galerie-grid { margin-left: -8px; margin-right: -8px; }
}

/* Lightbox additions (PhotoSwipe itself: photoswipe.css) */
.pswp__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.25s;
}
.pswp--ui-visible .pswp__caption { opacity: 1; }
.pswp:not(.pswp--ui-visible) .pswp__caption { opacity: 0; }
.pswp__top-bar { padding-top: env(safe-area-inset-top, 0px); }
.pswp__button--share .pswp__icn { fill: none; }
