/*
/****************************************************************************************************************
 * FRONT‑END CSS – assets/css/front.css (BEM + CSS variables)
 ****************************************************************************************************************/
 
:root {
    --cpx-gap: 1rem;
    --cpx-modal-bg: rgba(0, 0, 0, 0.5);
    --cpx-border-radius: 0.75rem;
}

.cpx-albums {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--cpx-gap);
}
.cpx-albums__item {
    position: relative;
    overflow: hidden;
    border-radius: var(--cpx-border-radius);
    border: 1px solid transparent;
    transition: border 0.12s ease-in-out;

    &:hover, &:focus {
        border: 1px solid var(--e-global-color-primary);
    }
}
.cpx-albums__item__image {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1/1;
    object-fit: cover;
    object-position: center;
}
.cpx-albums__item__title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 0.5rem;
    text-align: center;
    text-wrap: balance;
}

.cpx-album-grid {

}
.cpx-album-grid__item {
    line-height: 0;
    width: calc(25% - 15px);
    margin-bottom: 20px;
    border-radius: 15px !important;
    overflow: hidden;

    border: 1px solid transparent;
    transition: border 0.12s ease-in-out;

    &:hover, &:focus {
        border: 1px solid var(--e-global-color-primary);

        .cpx-album-grid__item__image {
            transform: scale(1.05);
        }
    }
}

.cpx-album-grid__item__image {
    width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: 14px !important;
    transition: transform .3s ease-in-out;
    transform-origin: center;
}

/* Heading */
.cpx-albums__heading, .cpx-album__heading {
    font-family: var(--e-global-typography-primary-font-family), Sans-serif;
    font-weight: var(--e-global-typography-primary-font-weight);
    color: var(--e-global-color-primary);
    line-height: 1;
    margin: 0;
    padding: 0;
    font-size: 2.5rem;
    margin-bottom: 1em;
}

@media (max-width: 767px) {
    .cpx-albums__heading, .cpx-album__heading {
        font-size: 25px;
        line-height: 1.2em;
    }
}

.cpx-album-grid__pagination {
    text-align: center;
    font-family: var(--e-global-typography-primary-font-family);
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 8px;
    
    a, .page-numbers.current {
        border-radius: 100px;
        width: 35px;
        height: 35px;
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        line-height: 1;
        background-color: #fff;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1) !important;
        color: var(--e-global-color-secondary) !important;
        transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    }

    a {
        &:hover, &:focus {
            background-color: var(--e-global-color-accent);
            color: #fff !important;
        }
    }

    .page-numbers.current {
        background-color: var(--e-global-color-secondary);
        color: #fff !important;
    }

    img {
        width: 17px;
        height: auto;
    }
}

/* Modal */
.cpx-modal {
    position: fixed;
    inset: 0;
    background: var(--cpx-modal-bg);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    font-family: var(--e-global-typography-primary-font-family);
}
.cpx-modal__overlay {
    position: absolute;
    inset: 0;
}
.cpx-modal__content {
    position: relative;
    background: #fff;
    width: auto;
    max-width: calc(100vw - 100px);
    max-height: calc(100dvh - 100px);
    overflow: hidden;
    border-radius: 25px;
    display: grid;
    grid-template-columns: 1fr 450px;
}
.cpx-modal__close,
.cpx-modal__previous,
.cpx-modal__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease-in-out;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, .1);
    backdrop-filter: blur(3px);

    img {
        height: 17px !important;
        width: auto;
    }
}

.cpx-modal__close {
    top: 10px;
    right: 10px;
    transform: none;
}

.cpx-modal__previous {
    left: 10px;
}

.cpx-modal__next {
    right: 10px;
}

.cpx-modal__close:hover,
.cpx-modal__previous:hover,
.cpx-modal__next:hover {
    background: rgba(255, 255, 255, 0.8);
}
.cpx-modal__image-wrapper {
    height: 100%;
    background: radial-gradient(rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.cpx-modal__image {
    width: 100%;
    max-height: calc(100dvh - 100px);
    height: auto;
    display: block;
    object-fit: contain;
    object-position: center;
}
.cpx-modal__comments {
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}
.cpx-comment {
    margin-bottom: 1rem;
    line-height: 1.2;

    .cpx-comment__author {
        display: block;
        font-size: 14px;
    }

    .cpx-comment__date {
        font-style: normal;
        font-size: 12px;
        color: var( --e-global-color-4f983ec );
        display: block;
        margin-bottom: 3px;
    }

    .cpx-comment__text {
        font-size: 14px;
    }
}
.cpx-modal__comments__list {
    overflow-y: auto;
    height: calc(100% - 140px);
    flex-grow: 0;
    background-color: #f6f6f6;
    border-radius: 10px;
    width: 100%;
    padding: 20px;

    .loading {
        text-align: center;
        padding: 30px;
    }
}
.cpx-no-comments {
    font-size: 14px;
}
.cpx-modal__form {
    margin-top: auto;
    height: 120px;
    width: 100%;
}
.cpx-modal__form__comment-submit-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
}
.cpx-modal__input {
    width: 100%;
    padding: 0.5rem 1rem !important;
    margin-bottom: 0.5rem;
    border: 1px solid #bebebe !important;
    border-radius: 10px !important;
    color: var(--e-global-color-text);
    resize: none;
}
.cpx-modal__input--comment {
    margin-bottom: 0 !important;
}
.cpx-modal__submit {
    border-radius: 10px !important;
    color: #fff !important;
    border: none !important;
    transition: opacity .12s ease-in !important;
    background: linear-gradient(to bottom right, var(--cpx-primary), var(--cpx-primary-gradient)) !important;
    cursor: pointer !important;
    line-height: 1 !important;
    height: 66px;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;

    img {
        height: 17px !important;
        width: auto;
    }

    &:hover, &:focus {
        opacity: 0.8 !important;
    }
}

.cpx-album__banner {
    width: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-top: 50px;
    padding-bottom: 50px;
    padding-left: 30px;
    padding-right: 30px;
    border-radius: 25px;
    margin-bottom: 20px;
    position: relative;
    min-height: 355px;

    .cpx-album__heading {
        margin-bottom: 0;
        color: #fff;
        z-index: 2;
        position: relative;
    }

    .cpx-album__back-link {
        z-index: 2;
        position: relative;
        color: #fff;
    }
    
    &:after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 25px;
    }
}

/* Loader */
.cpx-album__loader {
    width: 48px;
    height: 48px;
    border: 3px solid #111111;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: cpx_album_rotation 1s linear infinite;

    &::after {
        content: '';  
        box-sizing: border-box;
        position: absolute;
        left: 0;
        top: 0;
        background: #FA6E3A;
        width: 16px;
        height: 16px;
        transform: translate(-50%, 50%);
        border-radius: 50%;
    }
}

@keyframes cpx_album_rotation {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
} 

@media screen and (max-width: 1024px) {
    .cpx-album-grid__item {
        width: calc(33.33% - 13.33px);
    }

    .cpx-modal__image-wrapper {
        height: auto;
    }

    .cpx-modal__content {
        display: flex;
        flex-direction: column;
        max-width: 100vw;
        max-height: none;
        height: 100dvh;
        border-radius: 0;
        width: 100%;
    }

    .cpx-modal__image, .cpx-modal__image-wrapper {
        max-height: 300px;
    }

    .cpx-modal__comments {
        flex-grow: 1;
        padding: 20px;
    }

    .cpx-modal__comments__list {
        height: auto;
        flex-grow: 1;
        margin-bottom: 20px;
        font-size: 14px;
    }

    .cpx-modal__form {
        height: 105px;
    }

    .cpx-modal__input {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .cpx-modal__submit {
        height: 60px;
    }
    
    .cpx-modal__form__comment-submit-wrapper {
        gap: 5px;
    }

    .cpx-album__banner {
        min-height: 0;
        aspect-ratio: 5/3;
    }
}

@media screen and (max-width: 768px) {
    .cpx-album-grid__item {
        width: calc(50% - 5px);
        margin-bottom: 10px;
    }
}