/* =============================================
   BELLAMY ALBUM GALLERY - Elementor Widget CSS
   ============================================= */

.bellamywidget-album-gallery {
    --bellamy-gallery-zigzag-offset: 60px;
    width: 100%;
    box-sizing: border-box;
}

.bellamywidget-album-gallery *,
.bellamywidget-album-gallery *:before,
.bellamywidget-album-gallery *:after {
    box-sizing: border-box;
}

/* ==================== FILTER TABS ==================== */
.bellamywidget-album-gallery-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.bellamywidget-album-gallery-filter {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    font: inherit;
    line-height: 1.4;
    position: relative;
    transition: color 0.3s ease;
}

.bellamywidget-album-gallery-filter:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.bellamywidget-album-gallery-filter.is-active:after,
.bellamywidget-album-gallery-filter:hover:after {
    width: 100%;
}

/* ==================== ITEMS CONTAINER ==================== */
.bellamywidget-album-gallery-items {
    width: 100%;
}

/* Masonry: CSS multi-column flow. Each item keeps its cover's
   natural (original) aspect ratio, so columns settle at different
   heights automatically -- no JavaScript layout math required. */
.bellamywidget-album-gallery-layout-masonry .bellamywidget-album-gallery-items {
    column-count: 3;
    column-gap: 20px;
}

.bellamywidget-album-gallery-layout-masonry .bellamywidget-album-gallery-item {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    vertical-align: top;
}

/* Grid & Zigzag: real CSS Grid, equal-height covers via aspect-ratio. */
.bellamywidget-album-gallery-layout-grid .bellamywidget-album-gallery-items,
.bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
}

/* Zigzag stagger: the offset is applied via an inline nth-child rule
   generated from the "Columns" control (see the widget PHP), so it
   automatically follows however many columns are selected. */
.bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-item {
    transition: transform 0.4s ease, opacity 0.3s ease;
}

/* Deliberately mixed tile sizes (Grid & Zigzag only). */
.bellamywidget-album-gallery-layout-grid .bellamywidget-album-gallery-size-wide,
.bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-size-wide {
    grid-column: span 2;
}

.bellamywidget-album-gallery-layout-grid .bellamywidget-album-gallery-size-wide .bellamywidget-album-gallery-cover,
.bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-size-wide .bellamywidget-album-gallery-cover {
    aspect-ratio: 21 / 9 !important;
}

.bellamywidget-album-gallery-layout-grid .bellamywidget-album-gallery-size-tall .bellamywidget-album-gallery-cover,
.bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-size-tall .bellamywidget-album-gallery-cover {
    aspect-ratio: 3 / 5 !important;
}

/* ==================== ITEM / COVER ==================== */
.bellamywidget-album-gallery-item {
    margin-bottom: 20px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bellamywidget-album-gallery-item-hidden {
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
}

.bellamywidget-album-gallery-cover {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.bellamywidget-album-gallery-cover-link {
    display: block;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.bellamywidget-album-gallery-cover-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease, clip-path 0.4s ease;
}

/* Lightbox helper links: not part of the visible layout, they only
   exist so Elementor's native lightbox can group every extra album
   image into the same slideshow as the cover. */
.bellamywidget-album-gallery-hidden-slide {
    display: none;
}

/* ==================== IMAGE ZOOM (independent of overlay effect) ==================== */
.bellamywidget-album-gallery.has-hover-zoom .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover-link img {
    transform: scale(1.08);
}

/* ==================== COUNT BADGE ==================== */
.bellamywidget-album-gallery-count {
    position: absolute;
    z-index: 3;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    line-height: 1.6;
    font-size: 13px;
}

.bellamywidget-album-gallery-count-top-left {
    top: 14px;
    left: 14px;
}

.bellamywidget-album-gallery-count-top-right {
    top: 14px;
    right: 14px;
}

.bellamywidget-album-gallery-count-bottom-left {
    bottom: 14px;
    left: 14px;
}

.bellamywidget-album-gallery-count-bottom-right {
    bottom: 14px;
    right: 14px;
}

/* ==================== CONTENT: OVERLAY ==================== */
.bellamywidget-album-gallery-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    pointer-events: none;
}

.bellamywidget-album-gallery-overlay-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    padding: 0px;
}

/* Content reveal: hidden until hover ... */
.bellamywidget-album-gallery-reveal-hover .bellamywidget-album-gallery-overlay {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.bellamywidget-album-gallery-reveal-hover .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-overlay {
    opacity: 1;
}

/* ... or always visible. */
.bellamywidget-album-gallery-reveal-always .bellamywidget-album-gallery-overlay {
    opacity: 1;
}

/* ==================== CONTENT: BELOW IMAGE ==================== */
.bellamywidget-album-gallery-below {
    padding-top: 16px;
}

/* ==================== TEXT ELEMENTS ==================== */
.bellamywidget-album-gallery-category {
    display: inline-block;
    width: fit-content;
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bellamywidget-album-gallery-title {
    margin: 0;
    line-height: 1.3;
}

.bellamywidget-album-gallery-description {
    margin-top: 8px;
    line-height: 1.6;
}

/* =====================================================
   HOVER EFFECTS
   Every effect (except Focus to Blur, which works directly on
   the image) drives a dedicated tint layer ("::before" on the
   cover) rather than relying only on subtle filter/transform
   changes on the <img> itself. This keeps every effect clearly
   visible regardless of caption content, and keeps it fully
   independent from the "Zoom Image on Hover" toggle -- which
   also animates the image's transform -- so the two never
   compete over the same CSS property.
   ===================================================== */

.bellamywidget-album-gallery-cover:before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
}

/* ---- Fade Overlay: a dark veil fades over the cover ---- */
.bellamywidget-album-gallery-hover-fade .bellamywidget-album-gallery-cover:before {
    background: rgba(0, 0, 0, 0.5);
}

.bellamywidget-album-gallery-hover-fade .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover:before {
    opacity: 1;
}

.bellamywidget-album-gallery-hover-fade .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover-link img {
    filter: brightness(0.85);
}

/* ---- Slide Up: a bottom-anchored veil rises in as the caption follows ---- */
.bellamywidget-album-gallery-hover-slide-up .bellamywidget-album-gallery-cover:before {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 65%);
    transform: translateY(100%);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.bellamywidget-album-gallery-hover-slide-up .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover:before {
    opacity: 1;
    transform: translateY(0);
}

.bellamywidget-album-gallery-hover-slide-up .bellamywidget-album-gallery-overlay-content {
    transform: translateY(40px);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.bellamywidget-album-gallery-hover-slide-up .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-overlay-content {
    transform: translateY(0);
}

/* ---- Color Shift: a punchy duotone wash sweeps over the cover ---- */
.bellamywidget-album-gallery-hover-color-shift .bellamywidget-album-gallery-cover:before {
    background: linear-gradient(135deg, #ff2d95 0%, #00c2ff 100%);
    mix-blend-mode: color;
}

.bellamywidget-album-gallery-hover-color-shift .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover:before {
    opacity: 0.75;
}

.bellamywidget-album-gallery-hover-color-shift .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover-link img {
    filter: saturate(1.7) contrast(1.1);
}

/* ---- Focus to Blur: sharp by default, softens into a blur on hover ---- */
.bellamywidget-album-gallery-hover-focus-blur .bellamywidget-album-gallery-cover-link img {
    filter: blur(0) grayscale(0%);
    transform: scale(1);
}

.bellamywidget-album-gallery-hover-focus-blur .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover-link img {
    filter: blur(6px) grayscale(35%);
    transform: scale(1.06);
}

/* ---- Liquid: a gentle rippling wobble across the cover ---- */
@keyframes bellamyGalleryLiquid {
    0%, 100% {
        clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
    }
    25% {
        clip-path: polygon(0% 5%, 100% 0%, 96% 96%, 3% 100%);
    }
    50% {
        clip-path: polygon(0% 0%, 100% 6%, 100% 97%, 0% 100%);
    }
    75% {
        clip-path: polygon(3% 3%, 97% 0%, 100% 100%, 0% 94%);
    }
}

.bellamywidget-album-gallery-hover-liquid .bellamywidget-album-gallery-cover:before {
    background: linear-gradient(135deg, rgba(0, 115, 170, 0.35), rgba(255, 255, 255, 0.1));
}

.bellamywidget-album-gallery-hover-liquid .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover:before {
    opacity: 1;
}

/* Chained selector (repeats the wrapper class) so this rule's
   specificity always matches or beats the "has-hover-zoom" scale
   rule above, guaranteeing the wobble animation is never silently
   dropped when both effects are enabled together. */
.bellamywidget-album-gallery.bellamywidget-album-gallery-hover-liquid .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover-link img {
    animation: bellamyGalleryLiquid 1.8s ease-in-out infinite;
}

/* ---- Glitch: a jittery, RGB-split digital malfunction ---- */
@keyframes bellamyGalleryGlitch {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
        filter: hue-rotate(0deg);
    }
    10% {
        clip-path: inset(8% 0 62% 0);
        transform: translate(-5px, 0);
        filter: hue-rotate(80deg);
    }
    20% {
        clip-path: inset(52% 0 18% 0);
        transform: translate(5px, 0);
        filter: hue-rotate(-60deg);
    }
    30% {
        clip-path: inset(22% 0 54% 0);
        transform: translate(-4px, 0);
        filter: hue-rotate(40deg);
    }
    40% {
        clip-path: inset(70% 0 4% 0);
        transform: translate(4px, 0);
        filter: hue-rotate(-30deg);
    }
    50% {
        clip-path: inset(4% 0 80% 0);
        transform: translate(-3px, 0);
        filter: hue-rotate(0deg);
    }
    60%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
        filter: hue-rotate(0deg);
    }
}

.bellamywidget-album-gallery.bellamywidget-album-gallery-hover-glitch .bellamywidget-album-gallery-item:hover .bellamywidget-album-gallery-cover-link img {
    animation: bellamyGalleryGlitch 0.6s steps(1) 2;
}

/* ==================== RESPONSIVE FALLBACKS ==================== */
@media (max-width: 767px) {
    .bellamywidget-album-gallery-layout-masonry .bellamywidget-album-gallery-items {
        column-count: 1;
    }

    .bellamywidget-album-gallery-layout-grid .bellamywidget-album-gallery-items,
    .bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-items {
        grid-template-columns: 1fr;
    }

    .bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-item {
        transform: none !important;
    }

    .bellamywidget-album-gallery-layout-grid .bellamywidget-album-gallery-size-wide,
    .bellamywidget-album-gallery-layout-zigzag .bellamywidget-album-gallery-size-wide {
        grid-column: span 1;
    }
}
