/* =============================================================
   sz-modal -- native <dialog> modals of the article page
   (e-book and call-back), driven by sz_modal_controller.js.

   Kept apart from article-page.css and from the "Modal-area" styles
   of main.css, which the landing, webinar and training modals still use.
   Every rule is scoped under .sz-modal, so the theme rules on
   input/label/h2 are overridden here only.
   ============================================================= */

.sz-modal {
    --sz-modal-shadow-hard: 8px 8px 0 0 var(--tg-common-color-blue);

    width: min(480px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 0;
    border: 2px solid var(--tg-common-color-blue);
    border-radius: var(--sz-radius-card);
    background: var(--tg-common-color-white);
    box-shadow: var(--sz-modal-shadow-hard);
    color: var(--tg-body-color);
    font-family: var(--tg-body-font-family);
    font-size: 16px;
    line-height: 1.6;
    overflow: visible;
}

.sz-modal::backdrop {
    background: rgba(6, 4, 46, 0.62);
}

/* Fills the dialog, which has no padding: a click on the dialog itself is therefore a click on the backdrop. */
.sz-modal__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-height: calc(100dvh - 52px);
    padding: 30px 32px 26px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: inherit;
}

.sz-modal p {
    margin: 0;
}

.sz-modal__handle {
    display: none;
}

.sz-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--tg-border-3);
    border-radius: 50%;
    background: var(--tg-common-color-white);
    color: var(--tg-heading-color);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sz-modal__close:hover {
    background: var(--tg-heading-color);
    border-color: var(--tg-heading-color);
    color: var(--tg-common-color-white);
}

.sz-modal__close:focus-visible {
    outline: 3px solid var(--tg-theme-primary);
    outline-offset: 3px;
}

/* -------- Header -------- */

.sz-modal__head {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-right: 40px;
}

.sz-modal__cover {
    flex: none;
    width: 72px;
    height: 104px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 4px 4px 0 0 var(--tg-common-color-blue);
}

.sz-modal__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sz-modal__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tg-common-color-gray-2);
    color: var(--tg-theme-primary);
    box-shadow: 4px 4px 0 0 var(--tg-common-color-blue);
}

.sz-modal .sz-modal__eyebrow {
    margin: 0 0 6px;
    font-size: 11.5px;
    font-weight: var(--tg-fw-semi-bold);
    line-height: 1.4;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tg-theme-primary);
}

.sz-modal .sz-modal__title {
    margin: 0;
    font-family: var(--tg-heading-font-family);
    font-size: 21px;
    font-weight: var(--tg-fw-semi-bold);
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--tg-heading-color);
    text-wrap: pretty;
}

.sz-modal .sz-modal__subtitle {
    margin: 8px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--tg-body-color);
    text-wrap: pretty;
}

.sz-modal .sz-modal__subtitle--standalone {
    margin-top: -8px;
}

/* -------- Form -------- */

.sz-modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
}

.sz-modal-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sz-modal .sz-modal-form__label {
    margin: 0;
    font-size: 13.5px;
    font-weight: var(--tg-fw-semi-bold);
    line-height: 1.3;
    color: var(--tg-heading-color);
}

.sz-modal .sz-modal-form__input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: var(--tg-common-color-white);
    border: 1px solid var(--tg-border-1);
    border-radius: var(--sz-radius-sm);
    font-family: var(--tg-body-font-family);
    font-size: 15px;
    line-height: 1.2;
    color: var(--tg-heading-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sz-modal .sz-modal-form__input:focus {
    outline: none;
    border-color: var(--tg-theme-primary);
    box-shadow: 0 0 0 3px rgba(87, 81, 225, 0.18);
}

.sz-modal .sz-modal-form__input[aria-invalid="true"] {
    border-color: var(--tg-common-color-red);
    background: #FFF8F8;
}

.sz-modal .sz-modal-form__error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    color: #C3141C;
}

.sz-modal-form__error svg {
    flex: none;
}

.sz-modal-form__alert {
    padding: 10px 12px;
    border-radius: var(--sz-radius-sm);
    background: #FDECEC;
    color: #A3121A;
    font-size: 13.5px;
    line-height: 1.4;
}

.sz-modal-form__consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--sz-radius-sm);
    background: var(--tg-common-color-gray);
}

.sz-modal-form__consent--invalid {
    background: #FFF3F3;
    box-shadow: inset 0 0 0 1px #F2B8BB;
}

.sz-modal .sz-modal-form__checkbox {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--tg-theme-primary);
    cursor: pointer;
}

.sz-modal .sz-modal-form__consent-text {
    margin: 0;
    font-size: 12px;
    font-weight: var(--tg-fw-regular);
    line-height: 1.55;
    color: var(--tg-body-color);
}

.sz-modal .sz-modal-form__consent-text a {
    color: var(--tg-theme-primary);
    font-weight: var(--tg-fw-semi-bold);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sz-modal .sz-modal-form .sz-btn[disabled] {
    opacity: 0.65;
    cursor: progress;
    box-shadow: none;
}

.sz-modal__dismiss {
    display: block;
    width: 100%;
    margin-top: -6px;
    padding: 4px 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: var(--tg-body-font-family);
    font-size: 14px;
    font-weight: var(--tg-fw-medium);
    line-height: 1.4;
    color: var(--tg-common-color-gray-3);
    text-align: center;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sz-modal__dismiss:hover,
.sz-modal__dismiss:focus-visible {
    color: var(--tg-heading-color);
}

/* Once the e-book is unlocked, declining it no longer makes sense (the mock-up drops it too). */
.sz-modal__panel:has(.sz-modal__success) .sz-modal__dismiss {
    display: none;
}

/* -------- Success -------- */

.sz-modal__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 8px;
    text-align: center;
}

.sz-modal__success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--tg-common-color-green);
    color: var(--tg-common-color-white);
    box-shadow: 4px 4px 0 0 var(--tg-common-color-blue);
}

.sz-modal .sz-modal__success-text {
    max-width: 320px;
    font-family: var(--tg-heading-font-family);
    font-size: 18px;
    font-weight: var(--tg-fw-semi-bold);
    line-height: 1.4;
    color: var(--tg-heading-color);
}

.sz-modal .sz-modal__success-text:focus {
    outline: none;
}

/* -------- Below 576px: bottom sheet -------- */

@media (max-width: 575.98px) {
    .sz-modal {
        width: 100%;
        max-height: 94dvh;
        margin: auto 0 0;
        border: 0;
        border-top: 2px solid var(--tg-common-color-blue);
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -6px 0 0 var(--tg-theme-primary);
    }

    .sz-modal__panel {
        gap: 18px;
        max-height: 94dvh;
        padding: 10px 20px 22px;
    }

    .sz-modal__handle {
        display: block;
        flex: none;
        width: 44px;
        height: 5px;
        margin: 0 auto 2px;
        border-radius: 3px;
        background: #D5D3E6;
    }

    .sz-modal__close {
        top: 16px;
        right: 16px;
    }

    .sz-modal__head {
        gap: 14px;
    }

    .sz-modal__cover {
        width: 56px;
        height: 80px;
    }

    .sz-modal__icon {
        width: 48px;
        height: 48px;
    }

    .sz-modal .sz-modal__title {
        font-size: 17px;
    }

    .sz-modal .sz-modal__subtitle {
        font-size: 13.5px;
    }

    .sz-modal-form {
        gap: 12px;
    }

    .sz-modal .sz-modal-form__input {
        height: 46px;
    }

    .sz-modal__success {
        padding: 24px 0 12px;
    }
}
