.form-modal,
.form-modal *,
.form-modal *::before,
.form-modal *::after {
    box-sizing: border-box;
}

.form-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.form-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.form-modal[hidden] {
    display: none;
}

.form-modal:not([hidden]) {
    display: flex;
}

.form-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(43, 43, 43, 0.75);
    backdrop-filter: blur(4px);
}

.form-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 960px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.form-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.form-modal__close:hover {
    opacity: 0.85;
    background: #fff;
}

.form-modal__grid {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
}

.form-modal__media {
    position: relative;
    flex: 0 0 42%;
    align-self: stretch;
    min-width: 0;
    min-height: 520px;
    overflow: hidden;
    background: #333;
}

.form-modal__image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.form-modal__content {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    padding: 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.form-modal__header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 32px;
}

.form-modal__service {
    margin: 0;
    color: #fe924e;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    line-height: 18.2px;
    letter-spacing: 0.65px;
    text-transform: uppercase;
}

.form-modal__service[hidden] {
    display: none;
}

.form-modal__title {
    margin: 0;
    color: #000;
    font-family: var(--second-family);
    font-size: 28px;
    font-weight: 600;
    line-height: 33.6px;
}

.form-modal__description {
    margin: 0;
    color: rgba(0, 0, 0, 0.5);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    line-height: 22.4px;
}

.form-modal__form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-modal__flash:empty {
    display: none;
}

.form-modal__flash .alert {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
}

.form-modal__flash .alert p,
.form-modal__flash .alert h4 {
    margin: 0;
}

.form-modal__flash .alert ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.form-modal__flash .alert-success {
    background: rgba(46, 125, 50, 0.1);
    color: #1b5e20;
}

.form-modal__flash .alert-danger {
    background: rgba(198, 40, 40, 0.1);
    color: #b71c1c;
}

.form-modal__flash .close {
    display: none;
}

.form-modal__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-modal__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-modal__field--full {
    grid-column: 1 / -1;
}

.form-modal__label {
    color: #000;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    line-height: 18.2px;
}

.form-modal__input,
.form-modal__textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: #f2f2f2;
    color: #000;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-modal__input::placeholder,
.form-modal__textarea::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

.form-modal__input:focus,
.form-modal__textarea:focus {
    outline: none;
    border-color: #fe924e;
    background: #fff;
}

.form-modal__textarea {
    min-height: 112px;
    resize: vertical;
}

.form-modal__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-width: 180px;
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: 99px;
    background: #fe924e;
    color: #fff;
    font-family: var(--second-family);
    font-size: 16px;
    font-weight: 600;
    line-height: 19.2px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.form-modal__submit:hover {
    opacity: 0.85;
}

body.form-modal-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .form-modal {
        align-items: flex-start;
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .form-modal__dialog {
        display: block;
        max-height: none;
        margin: auto 0;
        overflow: hidden;
        border-radius: 16px;
    }

    .form-modal__grid {
        display: block;
        width: 100%;
    }

    .form-modal__media {
        display: block;
        width: 100%;
        height: 200px;
        min-height: 200px;
        max-height: none;
        flex: none;
        aspect-ratio: auto;
    }

    .form-modal__image {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
    }

    .form-modal__content {
        display: flex;
        width: 100%;
        padding: 28px 20px 24px;
        overflow: visible;
    }

    .form-modal__header {
        padding-right: 36px;
    }

    .form-modal__title {
        font-size: 22px;
        line-height: 28px;
    }

    .form-modal__description {
        font-size: 13px;
        line-height: 20px;
    }

    .form-modal__close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.95);
    }
}

@media (max-width: 600px) {
    .form-modal {
        padding: 12px;
    }

    .form-modal__dialog {
        border-radius: 16px;
    }

    .form-modal__media {
        height: 160px;
        min-height: 160px;
    }

    .form-modal__content {
        gap: 20px;
        padding: 24px 16px 20px;
    }

    .form-modal__header {
        gap: 8px;
        padding-right: 28px;
    }

    .form-modal__title {
        font-size: 20px;
        line-height: 26px;
    }

    .form-modal__fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-modal__input,
    .form-modal__textarea {
        padding: 12px 14px;
        font-size: 16px;
        line-height: 22px;
    }

    .form-modal__textarea {
        min-height: 96px;
    }

    .form-modal__submit {
        width: 100%;
        height: 48px;
    }
}
