/* ==================== GALERIE LAYOUT-VARIANTEN ==================== */

/* ========================================
   LAYOUT 1: MASONRY / PINTEREST STYLE
   ======================================== */

.gallery-masonry {
    column-count: 3;
    column-gap: 20px;
    margin-bottom: 24px;
}

.gallery-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

.gallery-masonry .gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.gallery-masonry .gallery-item:hover img {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

@media (max-width: 1024px) {
    .gallery-masonry {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .gallery-masonry {
        column-count: 1;
    }
}

/* ========================================
   LAYOUT 2: FULLSCREEN SLIDER / HERO
   ======================================== */

.gallery-slider {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 24px;
    background: #000;
}

.gallery-slider .slider-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.gallery-slider .slider-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.gallery-slider .slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-slider .slider-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.gallery-slider .slider-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
    pointer-events: none;
}

.gallery-slider .slider-slide:hover .slider-link img {
    transform: scale(1.05);
    filter: brightness(0.85);
}

.gallery-slider .slider-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    color: white;
    padding: 40px 32px 24px 32px;
    font-size: 1.2em;
    text-align: center;
    pointer-events: none;
}

.gallery-slider .slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.5em;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-slider .slider-nav:hover {
    background: rgba(0,0,0,0.9);
}

.gallery-slider .slider-nav-prev {
    left: 20px;
    border-radius: 50%;
}

.gallery-slider .slider-nav-next {
    right: 20px;
    border-radius: 50%;
}

.gallery-slider .slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.gallery-slider .slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-slider .slider-dot.active {
    background: var(--c64-orange);
    transform: scale(1.3);
}

@media (max-width: 768px) {
    .gallery-slider {
        height: 400px;
    }
    
    .gallery-slider .slider-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .gallery-slider .slider-nav-prev {
        left: 10px;
    }
    
    .gallery-slider .slider-nav-next {
        right: 10px;
    }
}

/* ========================================
   LAYOUT 3: THUMBNAILS + HAUPTBILD
   ======================================== */

.gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.gallery-thumbs .main-image-container {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.gallery-thumbs .main-image-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.gallery-thumbs .main-image-link img {
    transition: transform 0.3s ease, filter 0.3s ease;
    pointer-events: none;
}

.gallery-thumbs .main-image-container:has(.main-image-link):hover .main-image {
    transform: scale(1.05);
    filter: brightness(0.85);
}

.gallery-thumbs .main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.gallery-thumbs .main-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
    padding: 30px 20px 16px 20px;
    text-align: center;
    font-size: 1.1em;
    pointer-events: none;
}

.gallery-thumbs .thumbnails-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.gallery-thumbs .thumbnail {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.gallery-thumbs .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumbs .thumbnail:hover {
    border-color: var(--c64-accent);
    transform: translateY(-4px);
}

.gallery-thumbs .thumbnail:hover img {
    transform: scale(1.15);
}

.gallery-thumbs .thumbnail.active {
    border-color: var(--c64-orange);
    box-shadow: 0 0 20px rgba(255, 128, 0, 0.5);
}

.gallery-thumbs .thumbnail.active::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--c64-orange);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .gallery-thumbs .main-image-container {
        height: 300px;
    }
    
    .gallery-thumbs .thumbnails-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
}

/* ========================================
   LAYOUT 4: POLAROID STYLE
   ======================================== */

.gallery-polaroid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 32px;
    padding: 20px;
    margin-bottom: 24px;
}

.gallery-polaroid .polaroid-item {
    background: white;
    padding: 16px 16px 50px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.gallery-polaroid .polaroid-item:hover {
    transform: translateY(-8px) rotate(-1deg);
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.gallery-polaroid .polaroid-item:nth-child(even):hover {
    transform: translateY(-8px) rotate(1deg);
}

.gallery-polaroid .polaroid-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.gallery-polaroid .polaroid-caption {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    text-align: center;
    font-family: 'Permanent Marker', 'Comic Sans MS', cursive;
    color: #333;
    font-size: 0.95em;
}

/* Leichte Rotation für jeden Polaroid */
.gallery-polaroid .polaroid-item:nth-child(3n+1) {
    transform: rotate(-2deg);
}

.gallery-polaroid .polaroid-item:nth-child(3n+2) {
    transform: rotate(1deg);
}

.gallery-polaroid .polaroid-item:nth-child(3n+3) {
    transform: rotate(-1deg);
}

@media (max-width: 768px) {
    .gallery-polaroid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
    }
}

/* ========================================
   LAYOUT 5: HORIZONTAL SCROLL
   ======================================== */

.gallery-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 20px 0;
    margin-bottom: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--c64-accent) #f0f0f0;
}

.gallery-scroll::-webkit-scrollbar {
    height: 10px;
}

.gallery-scroll::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.gallery-scroll::-webkit-scrollbar-thumb {
    background: var(--c64-accent);
    border-radius: 10px;
}

.gallery-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--c64-accent-hover);
}

.gallery-scroll .scroll-item {
    flex: 0 0 400px;
    scroll-snap-align: start;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.gallery-scroll .scroll-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.gallery-scroll .scroll-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.gallery-scroll .scroll-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    color: white;
    padding: 30px 16px 12px 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .gallery-scroll .scroll-item {
        flex: 0 0 280px;
    }
    
    .gallery-scroll .scroll-item img {
        height: 220px;
    }
}

/* ========================================
   LAYOUT 6: JUSTIFIED GALLERY (wie Flickr)
   ======================================== */

.gallery-justified {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.gallery-justified .justified-item {
    flex-grow: 1;
    height: 250px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-justified .justified-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-justified .justified-item:hover {
    transform: scale(1.02);
    z-index: 10;
}

.gallery-justified .justified-item:hover img {
    transform: scale(1.1);
}

.gallery-justified .justified-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    color: white;
    padding: 40px 12px 12px 12px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    text-align: center;
}

.gallery-justified .justified-item:hover .justified-caption {
    transform: translateY(0);
}

/* Größenvariationen für mehr Dynamik */
.gallery-justified .justified-item:nth-child(3n) {
    flex-grow: 1.5;
}

.gallery-justified .justified-item:nth-child(5n) {
    flex-grow: 2;
}

@media (max-width: 768px) {
    .gallery-justified .justified-item {
        height: 180px;
        flex-grow: 1 !important;
    }
}

/* ========================================
   LAYOUT 7: GRID MIT OVERLAY-ICONS
   ======================================== */

.gallery-overlay {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.gallery-overlay .overlay-item {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    text-decoration: none;
    color: inherit;
}

.gallery-overlay .overlay-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    pointer-events: none;
}

.gallery-overlay .overlay-item:hover img {
    transform: scale(1.2);
}

.gallery-overlay .overlay-content {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    pointer-events: none;
}

.gallery-overlay .overlay-item:hover .overlay-content {
    opacity: 1;
}

.gallery-overlay .overlay-title {
    color: white;
    font-size: 1.3em;
    font-weight: 700;
    margin: 0 0 8px 0;
    transform: translateY(20px);
    transition: transform 0.3s ease 0.1s;
}

.gallery-overlay .overlay-item:hover .overlay-title {
    transform: translateY(0);
}

.gallery-overlay .overlay-caption {
    color: rgba(255,255,255,0.9);
    font-size: 0.95em;
    line-height: 1.5;
    margin: 0;
    transform: translateY(20px);
    transition: transform 0.3s ease 0.15s;
}

.gallery-overlay .overlay-item:hover .overlay-caption {
    transform: translateY(0);
}

.gallery-overlay .overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3em;
    color: white;
    background: rgba(0,0,0,0.6);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.gallery-overlay .overlay-item:hover .overlay-icon {
    transform: translate(-50%, -50%) scale(1);
}

/* ========================================
   LAYOUT 8: AUTOPLAY SLIDESHOW
   ======================================== */

.gallery-slideshow {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 24px;
}

.gallery-slideshow .slideshow-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-slideshow .slideshow-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.gallery-slideshow .slideshow-slide.active {
    opacity: 1;
}

.gallery-slideshow .slideshow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.gallery-slideshow .slideshow-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
}

.gallery-slideshow .slideshow-link img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
    pointer-events: none;
}

/* Hover-Effekt: Zoom + darüber Icon */
.gallery-slideshow .slideshow-slide:hover .slideshow-link img {
    transform: translate(-50%, -50%) scale(1.05);
    filter: brightness(0.85);
}

/* Klick-Icon über dem Bild bei Hover - größer machen */
.gallery-slideshow .slideshow-link::after {
    content: '🔗';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 4em;
    color: white;
    transition: transform 0.3s ease;
    z-index: 10;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
    pointer-events: none;
}

.gallery-slideshow .slideshow-slide:hover .slideshow-link::after {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-slideshow .slideshow-link:hover img {
    transform: translate(-50%, -50%) scale(1.02);
    transition: transform 0.3s ease;
}

.gallery-slideshow .slideshow-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
    pointer-events: none;
}

/* ========== CAPTION POSITION VARIANTEN ========== */

/* Variante 1: INSIDE-BOTTOM (Standard - auf dem Bild, unten) */
.gallery-slideshow-inside-bottom .slideshow-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
    pointer-events: none;
}

/* Variante 2: INSIDE-TOP (auf dem Bild, oben) */
.gallery-slideshow-inside-top .slideshow-caption {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: auto;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
    pointer-events: none;
}

/* Variante 3: OUTSIDE-BOTTOM (Unter der Slideshow, unter Progress-Bar) */
.gallery-slideshow-outside-bottom {
    margin-bottom: 20px;
}

/* Selector für die Caption außerhalb des Slides (Geschwister-Element) */
.gallery-slideshow-outside-bottom ~ .slideshow-caption {
    position: static !important;
    display: block !important;
    background: rgba(0,0,0,0.1) !important;
    border-left: 4px solid var(--c64-accent) !important;
    color: #333 !important;
    padding: 16px 20px !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-size: 1em !important;
    margin-top: 12px !important;
    margin-bottom: 0 !important;
}

/* Variante 4: HOVER-ONLY (nur beim Hover sichtbar) */
.gallery-slideshow-hover-only .slideshow-caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-slideshow-hover-only:hover .slideshow-caption {
    opacity: 1;
}

.gallery-slideshow .slideshow-controls {
    position: absolute !important;
    bottom: 16px !important;
    right: 16px !important;
    left: auto !important;
    transform: none !important;
    z-index: 100 !important;
}

.gallery-slideshow .slideshow-play {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 101;
}

.gallery-slideshow .slideshow-play:hover {
    background: rgba(255, 128, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 128, 0, 0.4);
}

.gallery-slideshow .slideshow-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--c64-orange);
    width: 0%;
    transition: width 0.1s linear;
}

/* ========================================
   GEMEINSAME UTILITY-KLASSEN
   ======================================== */

.gallery-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 1.2em;
    color: var(--c64-text-soft);
}

.gallery-mode-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 8px;
    border-left: 4px solid var(--c64-accent);
}

.gallery-mode-btn {
    padding: 10px 18px;
    background: white;
    border: 2px solid var(--c64-blue-mid);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    color: var(--c64-blue-dark);
}

.gallery-mode-btn:hover {
    background: var(--c64-blue-mid);
    color: white;
    transform: translateY(-2px);
}

.gallery-mode-btn.active {
    background: var(--c64-accent);
    color: white;
    border-color: var(--c64-accent);
}
