/**
 * CE Video Banner Gallery - Styles
 * Masonry Layout mit variablen Breiten
 * 
 * Desktop: 12 Masonry-Einheiten, 11 Gutters à 20px = 220px
 * - Sizer: 1/12
 * - Skyscraper: 2/12 = 1/6 → 6 pro Reihe
 * - Normale: 3/12 = 1/4 → 4 pro Reihe  
 * - Leaderboards: 6/12 = 1/2 → 2 pro Reihe
 */

.cevbg-gallery {
    /* Masonry container */
}

/* Sizer für Masonry - 1/12 Basis-Einheit */
.cevbg-gallery__sizer {
    width: calc((100% - 220px) / 12);
}

/* Gallery Item - Standard: 3/12 = 1/4 (4 pro Reihe) */
.cevbg-gallery__item {
    width: calc((100% - 220px) / 12 * 3 + 40px);
    margin-bottom: var(--cevbg-gap-row, 1.25em);
    
    /* Fade-In Animation */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Sichtbarer Zustand nach Intersection Observer */
.cevbg-gallery__item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Skyscraper (Hochformate): 2/12 = 1/6 (6 pro Reihe) */
.cevbg-gallery__item[data-format="160x600"],
.cevbg-gallery__item[data-format="300x600"],
.cevbg-gallery__item[data-format="120x600"] {
    width: calc((100% - 220px) / 12 * 2 + 20px);
}

/* Querformate: 6/12 = 1/2 (2 pro Reihe) */
.cevbg-gallery__item[data-format="728x90"],
.cevbg-gallery__item[data-format="970x250"],
.cevbg-gallery__item[data-format="1920x1080"] {
    width: calc((100% - 220px) / 12 * 6 + 100px);
}

/* Video Wrapper - clip-path hier */
.cevbg-gallery__video-wrap {
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
    line-height: 0;
    clip-path: inset(0.4% 0.4% 0.4% 0.4% round 0.3em);
}

.cevbg-gallery__video {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

/* Play Button */
.cevbg-gallery__play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: background 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.cevbg-gallery__play-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.cevbg-gallery__play-btn svg {
    width: 36px;
    height: 36px;
    display: block;
}

/* Play-Button ausblenden wenn Video spielt */
.cevbg-gallery__video-wrap.is-playing .cevbg-gallery__play-btn {
    opacity: 0;
    pointer-events: none;
}

/* Caption/Projektname */
.cevbg-gallery__caption {
    margin: 8px 0 0;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5em;
    color: #666;
    text-align: center;
    min-height: 3em;
}

/* Responsive */
@media (max-width: 768px) {
    /* Mobile: 6 Masonry-Einheiten, 5 Gutters à 20px = 100px */
    .cevbg-gallery__sizer {
        width: calc((100% - 100px) / 6);
    }
    
    /* Normale: 3/6 = 1/2 (2 pro Reihe) */
    .cevbg-gallery__item {
        width: calc((100% - 100px) / 6 * 3 + 40px);
    }
    
    /* Skyscraper: 2/6 = 1/3 (3 pro Reihe) */
    .cevbg-gallery__item[data-format="160x600"],
    .cevbg-gallery__item[data-format="300x600"],
    .cevbg-gallery__item[data-format="120x600"] {
        width: calc((100% - 100px) / 6 * 2 + 20px);
    }
    
    /* Leaderboards: volle Breite auf Mobile */
    .cevbg-gallery__item[data-format="728x90"],
    .cevbg-gallery__item[data-format="970x250"],
    .cevbg-gallery__item[data-format="1920x1080"] {
        width: 100%;
    }
    
    .cevbg-gallery__play-btn {
        width: 50px;
        height: 50px;
    }
    
    .cevbg-gallery__play-btn svg {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    /* Sehr kleine Screens: alles auf volle Breite */
    .cevbg-gallery__sizer {
        width: 100%;
    }
    
    .cevbg-gallery__item,
    .cevbg-gallery__item[data-format="160x600"],
    .cevbg-gallery__item[data-format="300x600"],
    .cevbg-gallery__item[data-format="120x600"],
    .cevbg-gallery__item[data-format="728x90"],
    .cevbg-gallery__item[data-format="970x250"],
    .cevbg-gallery__item[data-format="1920x1080"] {
        width: 100%;
    }
    
    .cevbg-gallery__play-btn {
        width: 45px;
        height: 45px;
    }
    
    .cevbg-gallery__play-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Editor Preview */
.cevbg-gallery--editor {
    padding: 20px;
    background: #f9f9f9;
    border: 1px dashed #ccc;
}

.cevbg-gallery__item--preview {
    background: #fff;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cevbg-gallery__item--preview img {
    display: block;
    clip-path: inset(0.4% 0.4% 0.4% 0.4% round 0.3em);
}
