﻿/* Tafel-Galerie: alle Regeln sind auf .tg-gallery begrenzt. */

.tg-gallery {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 18px 36px;
    color: #303030;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.tg-gallery * {
    box-sizing: border-box;
}

.tg-heading {
    margin: 0 0 22px;
}

.tg-heading h2 {
    margin: 0 0 6px;
    color: #333;
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.2;
}

.tg-heading p {
    margin: 0;
    color: #666;
}

/* Album-Raster */
.tg-album-grid,
.tg-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

/* Album-Übersicht: alle Karten gleich hoch */
.tg-album-grid {
    align-items: stretch !important;
}

.tg-album-grid .tg-album-card {
    display: flex !important;
    flex-direction: column !important;
    height: 240px !important;
    min-height: 240px !important;
    max-height: 240px !important;
    overflow: hidden !important;
    color: inherit;
    text-decoration: none;
    border: 1px solid #e1e1e1;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(0,0,0,.07);
    transition: transform .15s ease, box-shadow .15s ease;
}

.tg-album-grid .tg-album-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0,0,0,.13);
}

/* Vorschaubilder: alle exakt gleich groß */
.tg-album-grid .tg-album-card img {
    display: block !important;
    width: 100% !important;
    height: 175px !important;
    min-height: 175px !important;
    max-height: 175px !important;
    flex: 0 0 175px !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    object-position: center center !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Namensfelder: alle gleich hoch */
.tg-album-grid .tg-album-info {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 65px !important;
    min-height: 65px !important;
    max-height: 65px !important;
    padding: 5px 12px !important;
    gap: 3px;
    overflow: hidden !important;
}

.tg-album-grid .tg-album-info strong {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    overflow-wrap: anywhere;
    font-size: 1rem;
    line-height: 1.3 !important;
}

.tg-album-grid .tg-album-info small {
    color: #777;
}

/* Einzelbilder – unverändert */
.tg-photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.tg-photo-card {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    background: #eee;
    aspect-ratio: 4 / 3;
}

.tg-photo-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}

.tg-photo-card:hover img {
    transform: scale(1.035);
}

/* Zurück-Link */
.tg-back {
    display: inline-block;
    margin: 0 0 16px;
    color: #315f83;
    text-decoration: none;
}

.tg-back:hover {
    text-decoration: underline;
}

/* Leere Galerie */
.tg-empty {
    padding: 18px;
    background: #f5f5f5;
    border-radius: 4px;
}

/* Lightbox */
.tg-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 55px 65px;
    background: rgba(0,0,0,.93);
}

.tg-lightbox.tg-open {
    display: flex;
}

.tg-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tg-lightbox button {
    position: absolute;
    border: 0;
    color: #fff;
    background: rgba(255,255,255,.14);
    cursor: pointer;
    border-radius: 4px;
}

.tg-close {
    top: 12px;
    right: 18px;
    width: 44px;
    height: 44px;
    font-size: 32px;
}

.tg-prev,
.tg-next {
    top: 50%;
    width: 44px;
    height: 58px;
    margin-top: -29px;
    font-size: 38px;
}

.tg-prev {
    left: 12px;
}

.tg-next {
    right: 12px;
}

.tg-count {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    color: #fff;
    text-align: center;
}

/* Smartphone */
@media (max-width: 560px) {

    .tg-gallery {
        padding: 16px 12px 28px;
    }

    .tg-album-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .tg-album-grid .tg-album-card {
        height: 185px !important;
        min-height: 185px !important;
        max-height: 185px !important;
    }

    .tg-album-grid .tg-album-card img {
        height: 125px !important;
        min-height: 125px !important;
        max-height: 125px !important;
        flex: 0 0 125px !important;
    }

    .tg-album-grid .tg-album-info {
        height: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
        padding: 4px 8px !important;
    }

    .tg-album-grid .tg-album-info strong {
        font-size: .9rem;
    }

    .tg-photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .tg-lightbox {
        padding: 50px 48px;
    }
}