/* Home announcement pop-up modal across all frontend themes (CSP-safe, dark-mode aware, mobile bottom-sheet). */
.home-popup-modal {
    z-index: 1065;
}

.home-popup-modal .modal-dialog.home-popup-dialog {
    max-width: 560px;
    margin: 1rem auto;
}

.home-popup-modal .home-popup-content {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 1.15rem;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .26);
    overflow: hidden;
}

.home-popup-modal .home-popup-sheet-handle {
    display: none;
}

.home-popup-modal .home-popup-scroll-area {
    min-height: 0;
}

.home-popup-modal .home-popup-close-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 4;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    background: rgba(15, 23, 42, .68);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: transform .15s ease, background-color .15s ease;
}

.home-popup-modal .home-popup-close-btn:hover {
    background: rgba(15, 23, 42, .88);
    transform: scale(1.05);
}

.home-popup-modal .home-popup-close-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.home-popup-modal .home-popup-close-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    pointer-events: none;
}

.home-popup-modal .home-popup-media {
    width: 100%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.home-popup-modal .home-popup-media img {
    width: 100%;
    height: auto;
    max-height: 58vh;
    object-fit: contain;
    display: block;
}

.home-popup-modal .home-popup-body {
    padding: 1.15rem 1.35rem .5rem;
}

.home-popup-modal .home-popup-body--text-only {
    padding-top: 2.65rem;
}

.home-popup-modal .home-popup-desc {
    margin: 0;
    color: #334155;
    font-size: .95rem;
    line-height: 1.65;
    word-break: break-word;
}

.home-popup-modal .home-popup-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .55rem;
    padding: 1rem 1.35rem 1.2rem;
}

.home-popup-modal .home-popup-actions--solo {
    padding-top: 2.65rem;
}

.home-popup-modal .home-popup-btn-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: .55rem 1.05rem;
    border: 1px solid #cbd5e1;
    border-radius: .65rem;
    background: #f8fafc;
    color: #475569;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.home-popup-modal .home-popup-btn-dismiss:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.home-popup-modal .home-popup-btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 2.5rem;
    padding: .55rem 1.2rem;
    border-radius: .65rem;
    background: var(--brand, #2563eb);
    color: #ffffff;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(37, 99, 235, .24);
    transition: transform .15s ease, filter .15s ease;
}

.home-popup-modal .home-popup-btn-cta:hover {
    filter: brightness(.94);
    color: #ffffff;
    text-decoration: none;
}

.home-popup-modal .home-popup-btn-cta svg {
    width: .95rem;
    height: .95rem;
    flex: 0 0 auto;
}

/* Fallback display when Bootstrap JS modal is unavailable */
body.home-popup-scroll-lock {
    overflow: hidden;
}

.home-popup-modal.is-fallback-open {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: .75rem;
    background: rgba(15, 23, 42, .65);
    opacity: 1;
}

@keyframes homePopupSlideUp {
    from {
        transform: translate3d(0, 100%, 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

/* Mobile Bottom Sheet UX (< 768px) */
@media (max-width: 767.98px) {
    .home-popup-modal {
        padding-right: 0 !important;
    }

    .home-popup-modal .modal-dialog.home-popup-dialog {
        margin: 0;
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        display: flex;
        align-items: flex-end;
        --bs-modal-margin: 0px;
    }

    .home-popup-modal.fade .modal-dialog.home-popup-dialog {
        transform: translate3d(0, 100%, 0);
        transition: transform .38s cubic-bezier(.22, 1, .36, 1);
        will-change: transform;
    }

    .home-popup-modal.show .modal-dialog.home-popup-dialog {
        transform: translate3d(0, 0, 0);
    }

    .home-popup-modal.is-fallback-open {
        align-items: flex-end;
        padding: 0;
    }

    .home-popup-modal.is-fallback-open .modal-dialog.home-popup-dialog {
        animation: homePopupSlideUp .38s cubic-bezier(.22, 1, .36, 1) forwards;
    }

    .home-popup-modal .home-popup-content {
        width: 100%;
        max-height: 88vh;
        max-height: 88dvh;
        border: 0;
        border-radius: 1.35rem 1.35rem 0 0;
        box-shadow: 0 -14px 40px rgba(15, 23, 42, .28);
    }

    .home-popup-modal .home-popup-sheet-handle {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        flex: 0 0 auto;
        min-height: 2.85rem;
        padding: .65rem 3.25rem .45rem;
        touch-action: pan-y;
    }

    .home-popup-modal .home-popup-sheet-handle span {
        display: block;
        width: 2.75rem;
        height: .28rem;
        border-radius: 999px;
        background: #cbd5e1;
    }

    .home-popup-modal .home-popup-close-btn {
        top: .5rem;
        right: .85rem;
        width: 2.1rem;
        height: 2.1rem;
        background: #f1f5f9;
        border-color: #e2e8f0;
        color: #475569;
        backdrop-filter: none;
    }

    .home-popup-modal .home-popup-close-btn:hover {
        background: #e2e8f0;
        color: #0f172a;
    }

    .home-popup-modal .home-popup-scroll-area {
        flex: 1 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .home-popup-modal .home-popup-media {
        margin: 0 .95rem;
        width: auto;
        border-radius: .9rem;
    }

    .home-popup-modal .home-popup-media img {
        max-height: 48vh;
        max-height: 48dvh;
    }

    .home-popup-modal .home-popup-body {
        padding: .95rem 1.05rem .45rem;
    }

    .home-popup-modal .home-popup-body--text-only {
        padding-top: .25rem;
    }

    .home-popup-modal .home-popup-desc {
        font-size: .94rem;
        line-height: 1.6;
    }

    .home-popup-modal .home-popup-actions {
        flex: 0 0 auto;
        flex-direction: column-reverse;
        align-items: stretch;
        gap: .5rem;
        padding: .85rem 1.05rem calc(1rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #f1f5f9;
        background: #ffffff;
    }

    .home-popup-modal .home-popup-actions--solo {
        border-top: 0;
        padding-top: 1.15rem;
    }

    .home-popup-modal .home-popup-btn-dismiss,
    .home-popup-modal .home-popup-btn-cta {
        width: 100%;
        min-height: 2.95rem;
        border-radius: .85rem;
        font-size: .94rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-popup-modal.fade .modal-dialog.home-popup-dialog {
        transition: none;
    }

    .home-popup-modal.is-fallback-open .modal-dialog.home-popup-dialog {
        animation: none;
    }
}

html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-content {
    background: #111827;
    color: #f1f5f9;
    border-color: #1f2937;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-media {
    background: #0b1120;
}

html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-desc {
    color: #cbd5e1;
}

html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-btn-dismiss {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-btn-dismiss:hover {
    background: #334155;
    color: #ffffff;
}

@media (max-width: 767.98px) {
    html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-sheet-handle span {
        background: #475569;
    }

    html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-close-btn {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    html[data-color-mode="dark"] body:not(.wcag-high-contrast) .home-popup-modal .home-popup-actions {
        border-top-color: #1f2937;
        background: #111827;
    }
}
