/**
 * Floating / inquiry modals — mobile bottom sheet, max one viewport height.
 */
body.service-modal-open {
    overflow: hidden;
}

#service-modal {
    box-sizing: border-box;
}

#service-modal.hidden {
    display: none !important;
}

#service-modal:not(.hidden) {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.service-modal-panel {
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 100%);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 640px) {
    #service-modal:not(.hidden) {
        align-items: center;
        padding: 1rem;
    }

    #service-modal .service-modal-panel {
        width: 100%;
        max-width: 28rem;
        border-radius: 0.5rem;
    }

    .service-modal-panel {
        max-height: min(88vh, 40rem);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    }
}

.service-modal-panel__handle {
    display: block;
    width: 2.5rem;
    height: 0.25rem;
    margin: 0 auto 0.625rem;
    border-radius: 9999px;
    background-color: #d1d5db;
}

.site-modal-panel {
    position: relative;
}

.service-modal-panel__header {
    position: relative;
    padding: 1rem 1.25rem 0.75rem;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .service-modal-panel__header {
        padding: 1.5rem 1.5rem 0;
    }
}

.service-modal-panel__body {
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 1.25rem 1rem;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .service-modal-panel__body {
        padding: 1rem 1.5rem 1.5rem;
    }
}

/* Title left, close (×) top-right — grid avoids relying on async Tailwind absolute/right-* */
.service-modal-panel__titlebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    grid-template-areas: "title close";
    align-items: start;
    column-gap: 0.25rem;
    margin-top: 0.125rem;
}

.service-modal-panel__title {
    grid-area: title;
    min-width: 0;
    margin: 0;
    padding-right: 0;
}

.service-modal-panel__close,
.site-modal-panel__close,
#close-service-modal,
#close-inquiry-modal {
    grid-area: close;
    justify-self: end;
    align-self: start;
    position: static;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.site-modal-panel__titlebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    grid-template-areas: "title close";
    align-items: start;
    column-gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.site-modal-panel__title {
    grid-area: title;
    min-width: 0;
    margin: 0;
    padding-right: 0;
}

.message-form--compact .message-form__fields {
    gap: 0.625rem;
}

.message-form--compact .message-form__label {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.message-form--compact .message-form__field {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message-form--compact .message-form__grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

.message-form--compact .message-form__textarea {
    min-height: 4.5rem;
    resize: vertical;
}

.message-form--compact .message-form__captcha-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.message-form--compact .message-form__captcha-row .message-form__field {
    width: 100%;
    flex: none;
    min-width: 0;
}

.message-form--compact .message-form__captcha-actions {
    flex-shrink: 0;
    width: auto;
    align-self: flex-start;
}

.message-form--compact .message-form__captcha-actions img {
    height: 2.25rem;
    width: 5.5rem;
}

.message-form--compact .message-form__submit-wrap {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, #ffffff 75%, rgba(255, 255, 255, 0));
}

.message-form--compact .message-form__submit {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-size: 0.9375rem;
}

@media (max-width: 639px) {
    #service-modal {
        padding: 0;
    }

    #inquiry-modal {
        align-items: flex-end;
        padding: 0;
    }

    #inquiry-modal > .bg-white,
    #inquiry-modal .site-modal-panel {
        width: 100%;
        max-width: 100%;
        max-height: min(92dvh, 100%);
        margin: 0;
        border-radius: 1rem 1rem 0 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}
