/*
 * Gated ebook lightbox (public/js/ebook-gate.v1.js).
 * Desktop: two-panel dialog (navy story | offer + form). Mobile: bottom sheet
 * with a sticky action bar. Versioned filename: /css/ is cached immutable for 1 year.
 */
html.ebgate-open { overflow: hidden; }

.ebgate {
    box-sizing: border-box;
    width: min(1120px, calc(100% - 48px));
    max-width: none;
    max-height: calc(100% - 48px);
    margin: auto; /* the theme's "* { margin: 0 }" would pin the modal to the top-left corner */
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: #404a50;
    font-family: var(--font, 'Nunito', sans-serif);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
    overflow: hidden;
}
.ebgate[open] { display: flex; flex-direction: column; animation: ebgate-in .22s ease-out; }
.ebgate::backdrop { background: rgba(11, 28, 45, .78); }
.ebgate *, .ebgate *::before, .ebgate *::after { box-sizing: border-box; }
@keyframes ebgate-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.ebgate__close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
.ebgate__close:hover { background: #e9ecef; }
.ebgate__close:focus-visible, .ebgate__more:focus-visible { outline: 3px solid #f26419; outline-offset: 3px; }

/* ---------- desktop layout ---------- */
.ebgate__scroll { display: grid; grid-template-columns: 460px minmax(0, 1fr); min-height: 0; flex: 1 1 auto; overflow: hidden; }
.ebgate__story { display: flex; flex-direction: column; gap: 20px; padding: 52px 48px; background: #11283f; color: #fff; overflow-y: auto; }
.ebgate__story-top, .ebgate__story-body { display: flex; flex-direction: column; gap: 20px; }
.ebgate__eyebrow { display: flex; align-items: center; gap: 10px; color: #f26419; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.ebgate__eyebrow::before { content: ''; width: 24px; height: 2px; background: #f26419; }
.ebgate .ebgate__title { margin: 0; color: #fff; font-family: inherit; font-size: 34px; line-height: 1.18; font-weight: 800; }
.ebgate__story p { margin: 0; color: rgba(255, 255, 255, .86); font-size: 16px; line-height: 1.6; }
.ebgate__stat { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); }
.ebgate__stat-num { flex-shrink: 0; color: #f26419; font-size: 52px; line-height: 1; font-weight: 800; white-space: nowrap; }
.ebgate__stat-num_sm { font-size: 44px; }
.ebgate__stat-txt { color: rgba(255, 255, 255, .86); font-size: 14px; line-height: 1.45; }
.ebgate__stat-src { display: block; color: rgba(255, 255, 255, .6); }
.ebgate__cover { display: block; width: 96px; height: 124px; object-fit: cover; border-radius: 4px; box-shadow: 0 10px 24px rgba(17, 40, 63, .28); transform: rotate(-3deg); flex-shrink: 0; }
.ebgate__cover_m, .ebgate__more, .ebgate__bar, .ebgate__mini, .ebgate__form-title { display: none; }

.ebgate__offer { position: relative; display: flex; flex-direction: column; gap: 22px; padding: 48px 56px 36px; overflow-y: auto; }
.ebgate__head { display: flex; align-items: center; gap: 22px; padding-right: 48px; }
.ebgate__kicker { color: #f26419; font-size: 15px; font-weight: 700; }
.ebgate__book { color: #2f4858; font-size: 22px; line-height: 1.3; font-weight: 700; font-style: italic; }
.ebgate__learn { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ebgate__learn-title { color: #2f4858; font-size: 15px; font-weight: 700; }
.ebgate__learn li { position: relative; margin: 0; padding-left: 30px; color: #404a50; font-size: 15px; line-height: 1.45; }
.ebgate__learn li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fde7da url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.3l2.6 2.6L14 7.5' stroke='%23f26419' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 20px;
}

/* ---------- the CF7 form ---------- */
.ebgate .wpcf7 { margin: 0; }
.ebgate .wpcf7-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.ebgate__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ebgate__field { display: flex; flex-direction: column; gap: 6px; margin: 0; color: #2f4858; font-size: 14px; font-weight: 700; }
.ebgate__opt { color: #5f6b73; font-weight: 600; }
.ebgate .wpcf7-form-control-wrap { display: block; }
.ebgate .ebgate__field input {
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 1.5px solid #c9d1d8;
    border-radius: 10px;
    background: #fff;
    color: #2f4858;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.ebgate .ebgate__field input::placeholder { color: #7a858c; opacity: 1; }
.ebgate .ebgate__field input:focus { outline: none; border-color: #f26419; box-shadow: 0 0 0 4px rgba(242, 100, 25, .16); }
.ebgate .ebgate__field input[aria-invalid="true"] { border-color: #c62828; box-shadow: 0 0 0 4px rgba(198, 40, 40, .12); }
.ebgate .wpcf7-not-valid-tip { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: #c62828; font-size: 14px; font-weight: 600; }
.ebgate .wpcf7-not-valid-tip::before {
    content: '';
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' stroke='%23c62828' stroke-width='1.6' fill='none'/%3E%3Cpath d='M8 4.5v4.2' stroke='%23c62828' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.3' r='1' fill='%23c62828'/%3E%3C/svg%3E") no-repeat center / 16px;
}
.ebgate .form-consent { margin: 0; color: #5f6b73; font-size: 13px; line-height: 1.45; }
.ebgate .form-consent a, .ebgate__done a.ebgate__link { color: #c94f0f; }
.ebgate .cf-turnstile:empty { display: none; }
.ebgate__submit-wrap { margin: 0; }
.ebgate .wpcf7-submit, .ebgate__bar-btn {
    width: 100%;
    height: 54px;
    padding: 0 20px;
    border: 0;
    border-radius: 27px;
    background: #f26419;
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(242, 100, 25, .32);
    transition: background-color .2s, box-shadow .2s;
}
.ebgate .wpcf7-submit:hover, .ebgate__bar-btn:hover { background: #ff691a; box-shadow: 0 8px 24px rgba(242, 100, 25, .42); }
.ebgate .wpcf7-submit:disabled, .ebgate__bar-btn:disabled { opacity: .7; cursor: progress; }
.ebgate .wpcf7-spinner { display: none; }
.ebgate .wpcf7 form .wpcf7-response-output { margin: 0; padding: 10px 14px; border: 0; border-radius: 10px; background: #fdecea; color: #8e1c1c; font-size: 14px; }
.ebgate .wpcf7 form.init .wpcf7-response-output,
.ebgate .wpcf7 form.sent .wpcf7-response-output,
.ebgate .wpcf7 form.invalid .wpcf7-response-output { display: none; }

/* ---------- after submit ---------- */
.ebgate__done { display: none; }
.ebgate.is-done { width: min(600px, calc(100% - 48px)); }
.ebgate.is-done .ebgate__scroll, .ebgate.is-done .ebgate__bar, .ebgate.is-done .ebgate__mini { display: none; }
.ebgate.is-done .ebgate__done { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 48px 56px 44px; text-align: center; overflow-y: auto; }
.ebgate__done-art { position: relative; width: 120px; height: 150px; margin-bottom: 6px; }
.ebgate__done-art .ebgate__cover { width: 112px; height: 145px; }
.ebgate__done-check { position: absolute; right: -10px; bottom: -6px; width: 44px; height: 44px; border-radius: 50%; background: #1e8e5a; border: 4px solid #fff; display: flex; align-items: center; justify-content: center; }
.ebgate .ebgate__done-title { margin: 0; color: #2f4858; font-family: inherit; font-size: 30px; line-height: 1.2; font-weight: 800; }
.ebgate__done p { max-width: 440px; margin: 0; color: #404a50; font-size: 16px; line-height: 1.6; }
.ebgate__done-desk em, .ebgate__done-mob em { font-weight: 700; }
.ebgate__done-mob { display: none; }
.ebgate__open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 54px;
    margin-top: 6px;
    border-radius: 27px;
    background: #f26419;
    color: #fff !important;
    font-size: 17px;
    font-weight: 800;
    text-decoration: none !important;
    box-shadow: 0 8px 20px rgba(242, 100, 25, .32);
}
.ebgate__open:hover { background: #ff691a; }
.ebgate__open-size { font-weight: 600; opacity: .9; }
.ebgate__rule { width: 100%; height: 1px; margin: 10px 0 4px; background: #e6eaee; }
.ebgate__demo-lead { color: #2f4858; font-size: 16px; line-height: 1.5; font-weight: 700; }
.ebgate__demo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 214px;
    height: 50px;
    border: 2px solid #f26419;
    border-radius: 25px;
    color: #c94f0f !important;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none !important;
}
.ebgate__demo:hover { background: #fff4ed; }

/* ---------- mobile: bottom sheet ---------- */
@media screen and (max-width: 767px) {
    .ebgate {
        width: 100%;
        height: calc(100% - 36px);
        max-height: calc(100% - 36px);
        margin: auto 0 0;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, .3);
    }
    .ebgate[open] { animation: ebgate-up .28s cubic-bezier(.2, .8, .2, 1); }
    @keyframes ebgate-up { from { transform: translateY(100%); } to { transform: none; } }
    .ebgate::backdrop { background: rgba(11, 28, 45, .7); }

    .ebgate__close { top: 12px; right: 12px; background: rgba(255, 255, 255, .12); }
    .ebgate__close svg path { stroke: #fff; }
    .ebgate.is-scrolled .ebgate__close, .ebgate.is-done .ebgate__close { background: #f5f5f7; }
    .ebgate.is-scrolled .ebgate__close svg path, .ebgate.is-done .ebgate__close svg path { stroke: #2f4858; }

    .ebgate__scroll { display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .ebgate__story { display: block; padding: 0; background: transparent; overflow: visible; }
    .ebgate__story-top { position: relative; flex-direction: row; align-items: flex-end; gap: 16px; padding: 34px 20px 22px; background: #11283f; }
    .ebgate__story-top::before { content: ''; position: absolute; top: 14px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
    .ebgate__story-heading { flex: 1 1 0; display: flex; flex-direction: column; gap: 8px; padding-top: 18px; }
    .ebgate__eyebrow { font-size: 12px; }
    .ebgate__eyebrow::before { display: none; }
    .ebgate .ebgate__title { font-size: 25px; line-height: 1.2; }
    .ebgate__cover_m { display: block; width: 76px; height: 98px; box-shadow: 0 8px 18px rgba(0, 0, 0, .35); }
    .ebgate__story-body { gap: 16px; padding: 20px 20px 0; }
    .ebgate__story p { color: #404a50; font-size: 16px; line-height: 1.55; }
    .ebgate__stat { gap: 14px; padding: 14px 16px; background: #fff4ed; border: 0; }
    .ebgate__stat-num { color: #d4520f; font-size: 38px; }
    .ebgate__stat-num_sm { font-size: 32px; }
    .ebgate__stat-txt { color: #2f4858; }
    .ebgate__stat-src { color: #5f6b73; }
    .ebgate__more-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .ebgate__story.is-expanded .ebgate__more-text { display: block; }
    .ebgate__more { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 44px; margin-top: -10px; padding: 0; border: 0; background: transparent; color: #d4520f; font-family: inherit; font-size: 15px; font-weight: 800; cursor: pointer; }
    .ebgate__story.is-expanded .ebgate__more svg { transform: rotate(180deg); }

    .ebgate__offer { gap: 18px; padding: 20px 20px 28px; overflow: visible; }
    .ebgate__head { display: none; }
    .ebgate__learn-title { font-size: 16px; font-weight: 800; }
    .ebgate__form-title { display: block; margin: 10px 0 0; color: #2f4858; font-size: 22px; line-height: 1.25; font-weight: 800; }
    .ebgate__fields { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .ebgate__field { font-size: 15px; }
    .ebgate .ebgate__field input { height: 52px; border-radius: 12px; }
    .ebgate__submit-wrap { display: none; }

    .ebgate__mini {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 64px 12px 20px;
        border-bottom: 1px solid #e6eaee;
        background: #fff;
        transform: translateY(-100%);
        transition: transform .2s ease-out;
    }
    .ebgate.is-scrolled .ebgate__mini { transform: none; }
    .ebgate__mini img { width: 38px; height: 49px; object-fit: cover; border-radius: 2px; box-shadow: 0 3px 8px rgba(17, 40, 63, .25); }
    .ebgate__mini-kicker { color: #d4520f; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    .ebgate__mini-book { color: #2f4858; font-size: 14px; line-height: 1.3; font-weight: 700; font-style: italic; }

    .ebgate__bar { display: flex; flex-direction: column; gap: 8px; flex: none; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid #e6eaee; background: #fff; }
    .ebgate__bar-btn { display: flex; align-items: center; justify-content: center; gap: 10px; }
    .ebgate__bar-note { color: #5f6b73; font-size: 13px; text-align: center; }
    .ebgate.is-form .ebgate__bar-note { display: none; }

    .ebgate.is-done { width: 100%; height: fit-content; }
    .ebgate.is-done .ebgate__done { gap: 16px; padding: 40px 24px calc(28px + env(safe-area-inset-bottom)); }
    .ebgate.is-done .ebgate__done-title { font-size: 26px; }
    .ebgate__done-desk { display: none; }
    .ebgate__done-mob { display: block; }
    .ebgate__demo { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .ebgate[open], .ebgate__mini { animation: none; transition: none; }
}
