:root {
    --selector-width: 840px;
    --selector-font: var(--luvstudy-language-font, "LuvStudyRounded", Arial, sans-serif);
    /* Цвет формы LNGButton.png до и после выбора языка (формат RGBA). */
    --language-button-color-before: rgba(146 216 255);
    --language-button-color-after: rgba(0 255 232 / 96%);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    color: #fff;
    overflow: hidden;
    background: #fff;
    font-family: var(--selector-font);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.language-page {
    display: flex;
    width: min(100%, var(--selector-width));
    height: 100vh;
    height: 100svh;
    margin: 0 auto;
    flex-direction: column;
    overflow: hidden;
    background: #08bdf4 url('../learning/images/Background.webp') center top / 120% auto repeat-y;
}

.language-page__hero {
    display: grid;
    width: min(100%);
    height: 100px;
    min-height: 0;
    max-height: 100px;
    flex: 0 0 100px;
    place-items: center;
    margin-inline: auto;
    padding: 10px 16px;
    background: #0002ff47;
}

.language-page__hero h1 {
    width: 100%;
    max-width: 600px;
    margin: 0;
    color: #ffe900;
    font-size: clamp(25px, 7vw, 40px);
    font-weight: 900;
    line-height: 1.08;
    text-align: center;
    text-shadow: 0 2px 2px #14364d, 0 0 2px #14364d;
    font-family: var(--luvstudy-language-font, "LuvStudyRounded", Arial, sans-serif);
}

.language-page__divider {
    width: 100%;
    height: 20px;
    flex: 0 0 auto;
    background: url('../../images/Lines.webp') center / 100% 100% no-repeat;
    pointer-events: none;
    margin: -7px 0px -7px 0px;
}

.language-selector {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

.language-list {
    display: grid;
    width: min(100%, 500px);
    min-height: 0;
    margin: 0 auto;
    padding: 5px 8px 5px;
    overflow-x: hidden;
    overflow-y: auto;
    align-content: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 5px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.language-list--single {
    width: calc(50% - 7px);
    margin-inline: auto;
}

.language-choice {
    position: relative;
    isolation: isolate;
    display: grid;
    aspect-ratio: 4 / 1;
    grid-template-columns: 28% minmax(0, 1fr);
    align-items: center;
    padding: 6% 7%;
    color: #fff;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.language-choice::before,
.language-choice::after {
    position: absolute;
    z-index: -2;
    inset: 0;
    content: "";
}

.language-choice::before {
    background: url('../language/images/LNGButton.png') center / 100% 100% no-repeat;
}

.language-choice::after {
    z-index: -1;
    background: var(--language-button-color-before);
    mix-blend-mode: multiply;
    -webkit-mask: url('../language/images/LNGButton.png') center / 100% 100% no-repeat;
    mask: url('../language/images/LNGButton.png') center / 100% 100% no-repeat;
    transition: background-color 120ms ease;
}

.language-choice.is-selected::after {
    background: var(--language-button-color-after);
}

.language-choice.is-selected {
    filter: drop-shadow(0 0 4px rgba(0, 54, 149, .9));
}

.language-choice:hover {
    transform: translateY(-1px);
}

.language-choice:active {
    transform: translateY(2px);
}

.language-choice:focus-visible,
.language-continue:focus-visible {
    outline: 4px solid #ffe900;
    outline-offset: 3px;
    border-radius: 18px;
}

.language-choice__flag {
    display: block;
    width: 110%;
    height: auto;
    aspect-ratio: 3.5 / 2.5;
    border-radius: 5px;
    object-fit: cover;
    filter: none;
    margin: 0px 0px 0px -5px;
}

.language-choice__name {
    min-width: 0;
    font-size: clamp(22px, 5vw, 22px);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-shadow: 0 2px 2px #344b59, 0 0 3px #344b59;
    overflow-wrap: anywhere;
    font-family: var(--luvstudy-language-font, "LuvStudyRounded", Arial, sans-serif);
}

.language-page__action {
    flex: 0 0 auto;
    background: #0002ff47;
}

.language-continue {
    position: relative;
    display: grid;
    width: min(calc(100% - 50px), 350px);
    max-width: 400px;
    max-height: 100px;
    aspect-ratio: 4 / 1;
    place-items: center;
    margin: 25px auto 25px;
    padding: 0% 0% 1.5%;
    color: #fff;
    background: transparent url('../language/images/ChooseLNGButton.png') center / 100% 100% no-repeat;
    font-size: clamp(25px, 5vw, 30px);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    letter-spacing: 1px;
    text-decoration: none;
    text-shadow: 0 2px 2px #514414, 0 0 2px #514414;
    font-family: var(--luvstudy-language-font, "LuvStudyRounded", Arial, sans-serif);
}

.language-continue:hover {
    filter: brightness(1.04);
}

.language-continue[aria-disabled="true"] {
    cursor: not-allowed;
    filter: grayscale(.55);
    opacity: .65;
    pointer-events: none;
}

.language-continue:active {
    transform: translateY(2px);
}

@media (max-width: 560px) {
    .language-page__divider {
        height: 22px;
        margin: -9px 0px -9px 0px;
    }

    .language-selector {
        min-height: 0;
    }

    .language-choice {
        padding-inline: 7%;
    }

    .language-choice__name {
        font-size: clamp(15px, 4.5vw, 22px);
    }

    .language-continue {
        margin: 25px auto 25px;
        font-size: clamp(15px, 5vw, 25px);
    }
}

@media (max-width: 340px) {
    .language-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .language-list--single {
        width: 100%;
    }

    .language-choice__name {
        font-size: clamp(22px, 8vw, 30px);
    }
}

@media (max-height: 620px) {
    .language-page__hero {
        height: 92px;
        max-height: 92px;
        flex-basis: 92px;
        padding-block: 10px;
    }

    .language-page__hero h1 {
        font-size: clamp(30px, 6vw, 44px);
    }

    .language-page__divider {
        height: 18px;
    }

    .language-continue {
        margin: 14px auto 10px;
        font-size: clamp(25px, 5vw, 35px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .language-choice::after {
        transition: none;
    }
}
