.modal {
    position: fixed;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    background: rgba(7,52,95,0.58);
    backdrop-filter: blur(0);

    z-index: 3000;

    overflow: hidden;
    overscroll-behavior: none;
}

.modal.show {
    display: flex;
    animation: contactBackdropIn 0.3s forwards;
}

.modal.hide {
    display: flex;
    animation: contactBackdropOut 0.3s forwards;
}

@keyframes contactBackdropIn {
    from {
        background: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0);
    }

    to {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(6px);
    }
}

@keyframes contactBackdropOut {
    from {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(6px);
    }

    to {
        background: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0);
    }
}

.modal-content {
    position: relative;

    background: var(--color-white);
    border-radius: 20px;

    width: min(100% - 40px, 600px);

    max-height: calc(100dvh - 40px);

    height: auto;

    padding: 32px 40px;

    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    transform: translateY(24px) scale(0.96);
    opacity: 0;
}

.modal.show .modal-content {
    animation: contactModalIn 0.35s ease forwards;
}

.modal.hide .modal-content {
    animation: contactModalOut 0.25s ease forwards;
}

@keyframes contactModalIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes contactModalOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
}

.modal-close {
    position: absolute;

    top: 14px;
    right: 18px;

    font-size: 32px;
    line-height: 1;

    color: var(--color-dark);

    cursor: pointer;

    user-select: none;

    transition: opacity 0.2s ease;
}

.modal-close:hover {
    opacity: 0.6;
}

.modal-content h2 {
    flex-shrink: 0;

    margin: 0 0 20px;

    padding-right: 30px;
}

.form-group {
    flex-shrink: 0;

    margin-bottom: 14px;
}

.form-group label {
    display: block;

    margin-bottom: 6px;

    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    box-sizing: border-box;

    border: 1px solid var(--color-silver);
    border-radius: 10px;

    padding: 11px 13px;

    font-family: inherit;
    font-size: 16px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-group input,
.form-group select {
    height: 44px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-accent);

    box-shadow: 0 0 0 3px rgba(169,232,50,0.16);
}

.form-group textarea {
    height: 90px;

    min-height: 90px;
    max-height: 90px;

    resize: none;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 6px;
}

.message-header label {
    margin-bottom: 0;
}

.message-counter {
    flex-shrink: 0;

    font-size: 13px;

    color: var(--color-steel);
}

.honeypot-field {
    position: absolute;

    left: -9999px;

    width: 1px;
    height: 1px;

    overflow: hidden;
}

.consent-fixed {
    flex-shrink: 0;

    margin-top: 2px;
    margin-bottom: 16px;
}

.consent-fixed > input {
    position: absolute;

    opacity: 0;
    pointer-events: none;
}

.consent-fixed label {
    display: flex;

    align-items: flex-start;

    gap: 10px;

    cursor: pointer;

    font-size: 13px;
    line-height: 1.4;

    color: var(--color-text);
}

.consent-fixed .box {
    position: relative;

    flex-shrink: 0;

    width: 20px;
    height: 20px;

    margin-top: 1px;

    border: 2px solid var(--color-steel-light);
    border-radius: 5px;

    box-sizing: border-box;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.consent-fixed > input:checked + label .box {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.consent-fixed > input:checked + label .box::after {
    content: "";

    position: absolute;

    left: 5px;
    top: 2px;

    width: 5px;
    height: 9px;

    border: solid var(--color-dark);
    border-width: 0 2px 2px 0;

    transform: rotate(45deg);
}

.consent-fixed .text {
    flex: 1;
}

.consent-fixed a {
    color: #333;
    text-decoration: underline;
}

.modal-content > .btn {
    flex-shrink: 0;

    width: 100%;

    min-height: 46px;

    margin-top: 0;

    border: none;
    border-radius: 10px;

    cursor: pointer;

    font-size: 16px;
    font-weight: 600;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.modal-content > .btn:hover {
    transform: translateY(-1px);
}

.modal-content > .btn:active {
    transform: translateY(0);
}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 768px) {

    .modal {
        align-items: flex-end;

        padding: 0;
    }

    .modal-content {
        width: 100%;

        height: 100dvh;
        max-height: 100dvh;

        border-radius: 20px 20px 0 0;

        padding: 24px 18px;

        transform: translateY(100%);
        opacity: 1;
    }

    .modal.show .modal-content {
        animation: contactSlideUp 0.4s ease forwards;
    }

    .modal.hide .modal-content {
        animation: contactSlideDown 0.35s ease forwards;
    }

    @keyframes contactSlideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    @keyframes contactSlideDown {
        from {
            transform: translateY(0);
        }

        to {
            transform: translateY(100%);
        }
    }

    .modal-content h2 {
        margin-bottom: 18px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group textarea {
        height: 90px;
        min-height: 90px;
        max-height: 90px;
    }
}


/* =========================================
   VERY SMALL SCREENS
   ========================================= */

@media (max-width: 768px) and (max-height: 700px) {

    .modal-content {
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .modal-content h2 {
        margin-bottom: 12px;
    }

    .form-group {
        margin-bottom: 9px;
    }

    .form-group input,
    .form-group select {
        height: 40px;

        padding-top: 8px;
        padding-bottom: 8px;
    }

    .form-group textarea {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }

    .consent-fixed {
        margin-bottom: 10px;
    }

    .modal-content > .btn {
        min-height: 42px;
    }
}

@media (max-width: 768px) {
    #contact-form-modal {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        animation: none;
    }

    #contact-form-modal.show {
        animation: contactWhiteBackground 0s 0.4s forwards;
    }

    @keyframes contactWhiteBackground {
        to {
            background: #fff;
        }
    }
}