/* =========================================
   LICENSES
   ========================================= */

.licenses {
    width: 100%;
    background: #f8f8fa;
    box-sizing: border-box;

    /*
     * Header находится выше и сюда не входит.
     * Footer находится ниже и сюда не входит.
     */
    padding: 34px 20px 135px;
}

.licenses *,
.licenses *::before,
.licenses *::after {
    box-sizing: border-box;
}


/* =========================================
   CONTAINER
   ========================================= */

.licenses__container {
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
}


/* =========================================
   TITLE
   ========================================= */

.licenses__title {
    margin: 0 0 34px;

    font-family: Arial, sans-serif;
    font-size: 62px;
    line-height: 1.08;
    font-weight: 700;

    color: #287a76;
}


/* =========================================
   GRID
   ========================================= */

.licenses__grid {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    column-gap: 26px;
    row-gap: 28px;

    width: 100%;
}


/* =========================================
   LICENSE CARD
   ========================================= */

.license-card {
    display: block;

    width: 100%;

    overflow: hidden;

    background: #ffffff;

    text-decoration: none;

    cursor: pointer;
}

.license-card__image {
    display: block;

    width: 100%;
    height: auto;

    aspect-ratio: 0.72 / 1;

    object-fit: cover;

    transition: transform 0.25s ease;
}


/*
 * Небольшой zoom при наведении.
 * Можно убрать, если увеличение не нужно.
 */

.license-card:hover .license-card__image {
    transform: scale(1.015);
}


/* =========================================
   PAGINATION
   ========================================= */

.licenses__pagination {
    display: flex;
    align-items: center;
    justify-content: center;

    width: max-content;
    min-width: 365px;
    height: 52px;

    margin: 34px auto 0;

    padding: 0 12px;

    border-radius: 12px;

    background: #ffffff;
}

.licenses__pagination-arrow,
.licenses__pagination-number {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 36px;

    padding: 0;

    border: 0;
    background: transparent;

    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1;

    color: #c8c8cc;

    cursor: pointer;
}

.licenses__pagination-arrow {
    font-size: 18px;
}

.licenses__pagination-arrow:disabled {
    color: #d9d9dc;
    cursor: default;
}

.licenses__pagination-number--active {
    width: 28px;
    height: 28px;

    margin: 0 7px;

    border-radius: 50%;

    background: #287a76;

    color: #ffffff;
}


/* =========================================
   MORE BUTTON
   ========================================= */

.licenses__more {
    display: none;
}


/* =========================================
   TABLET
   ========================================= */

@media (max-width: 1200px) {

    .licenses {
        padding-left: 24px;
        padding-right: 24px;
    }

    .licenses__title {
        font-size: 52px;
    }

    .licenses__grid {
        column-gap: 20px;
        row-gap: 22px;
    }

}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 767px) {

    .licenses {
        padding: 27px 20px 60px;
    }


    /* -------------------------------------
       Container
       ------------------------------------- */

    .licenses__container {
        max-width: none;
    }


    /* -------------------------------------
       Title
       ------------------------------------- */

    .licenses__title {
        margin: 0 0 25px;

        font-size: 36px;
        line-height: 1.08;
    }


    /* -------------------------------------
       Grid
       ------------------------------------- */

    .licenses__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        column-gap: 10px;
        row-gap: 14px;
    }


    /*
     * На мобильном по макету показываем
     * первые 4 лицензии.
     */

    .license-card:nth-child(n + 5) {
        display: none;
    }


    .license-card {
        border-radius: 5px;
    }

    .license-card__image {
        aspect-ratio: 0.72 / 1;
    }


    /* -------------------------------------
       More button
       ------------------------------------- */

    .licenses__more {
        display: block;

        width: calc(100% - 70px);
        height: 48px;

        margin: 28px auto 0;

        padding: 0 20px;

        border: 1px solid #287a76;
        border-radius: 13px;

        background: transparent;

        font-family: Arial, sans-serif;
        font-size: 18px;
        line-height: 1;

        color: #287a76;

        cursor: pointer;
    }


    .licenses__more:active {
        background: #287a76;
        color: #ffffff;
    }


    /* -------------------------------------
       Hide desktop pagination
       ------------------------------------- */

    .licenses__pagination {
        display: none;
    }

}


/* =========================================
   SMALL MOBILE
   ========================================= */

@media (max-width: 390px) {

    .licenses {
        padding-left: 20px;
        padding-right: 20px;
    }

    .licenses__title {
        font-size: 34px;
    }

    .licenses__grid {
        column-gap: 9px;
        row-gap: 13px;
    }

    .licenses__more {
        width: calc(100% - 70px);
    }

}

/* =========================================
   LICENSE MODAL
   ========================================= */

.license-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    visibility: hidden;
    opacity: 0;

    pointer-events: none;

    transition:
            opacity 0.25s ease,
            visibility 0.25s ease;
}


/* Открытое состояние */

.license-modal.is-open {
    visibility: visible;
    opacity: 1;

    pointer-events: auto;
}


/* =========================================
   Затемнение
   ========================================= */

.license-modal__overlay {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.75);

    cursor: pointer;
}


/* =========================================
   Контент
   ========================================= */

.license-modal__content {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    max-width: calc(100vw - 100px);
    max-height: calc(100vh - 60px);

    transform: scale(0.95);

    transition: transform 0.25s ease;
}

.license-modal.is-open .license-modal__content {
    transform: scale(1);
}


/* =========================================
   Изображение
   ========================================= */

.license-modal__image {
    display: block;

    width: auto;
    height: auto;

    max-width: calc(100vw - 100px);
    max-height: calc(100vh - 60px);

    object-fit: contain;

    border-radius: 4px;

    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35);

    background: #ffffff;
}


/* =========================================
   Крестик
   ========================================= */

.license-modal__close {
    position: absolute;
    z-index: 2;

    top: -22px;
    right: -22px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #ffffff;

    cursor: pointer;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);

    transition:
            transform 0.2s ease,
            background-color 0.2s ease;
}

.license-modal__close:hover {
    transform: scale(1.08);
}

.license-modal__close span {
    position: absolute;

    width: 20px;
    height: 2px;

    background: #247a76;

    border-radius: 2px;
}

.license-modal__close span:first-child {
    transform: rotate(45deg);
}

.license-modal__close span:last-child {
    transform: rotate(-45deg);
}


/* =========================================
   Заблокировать скролл страницы
   ========================================= */

body.license-modal-open {
    overflow: hidden;
}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 767px) {

    .license-modal {
        padding: 20px;
    }

    .license-modal__content {
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }

    .license-modal__image {
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }

    .license-modal__close {
        top: -18px;
        right: -10px;

        width: 38px;
        height: 38px;
    }

    .license-modal__close span {
        width: 18px;
    }
}