/* Shared visual composition for the public notice and its editor preview. */
/* Keep the native scrollbar track while Bootstrap locks the Home behind this modal. */
html:has(body.modal-open #avisoModal) {
    overflow-y: scroll;
}

body.modal-open:has(#avisoModal) {
    position: fixed;
    top: calc(-1 * var(--home-modal-scroll-y, 0px));
    width: 100%;
    overflow: visible !important;
    padding-right: 0 !important;
}

body.modal-open:has(#avisoModal) .site-header {
    padding-right: 0 !important;
}

#avisoModal {
    z-index: 10000;
    padding-right: 0 !important;
}

body:has(#avisoModal.show) > .modal-backdrop {
    z-index: 9500;
    background: rgba(17, 17, 17, 0.68);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#avisoModal .home-welcome-modal__dialog {
    --bs-modal-margin: 16px;
    width: min(800px, calc(100vw - 32px));
    max-width: none;
    margin: var(--bs-modal-margin) auto;
}

.home-welcome-modal {
    --media-height: 390px;
    position: relative;
    display: flex;
    max-height: calc(100dvh - 32px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(30, 30, 30, 0.1);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(17, 17, 17, 0.22);
    color: #171717;
}

.home-welcome-modal::before {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    height: 4px;
    background: #c62828;
    content: '';
}

.home-welcome-modal[data-image-shape='portrait'] {
    --media-height: 420px;
}

.home-welcome-modal__header {
    display: flex;
    min-width: 0;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    padding: 23px 76px 17px 32px;
    border-bottom: 1px solid #ededed;
}

.home-welcome-modal__header-mark {
    width: 4px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 4px;
    background: #c62828;
}

.home-welcome-modal__eyebrow,
.home-welcome-modal__institution {
    margin: 0;
}

.home-welcome-modal__eyebrow {
    color: #ae2424;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.home-welcome-modal__institution {
    margin-top: 3px;
    color: #454545;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
}

.home-welcome-modal__close {
    position: absolute;
    top: 21px;
    right: 24px;
    z-index: 4;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid #e4e4e4;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(17, 17, 17, 0.07);
    color: #454545;
    font-size: 25px;
    font-weight: 300;
    line-height: 1;
    opacity: 1;
}

.home-welcome-modal__close:hover,
.home-welcome-modal__close:focus-visible {
    background: #f6f6f6;
    color: #171717;
}

.home-welcome-modal__close:focus-visible,
.home-welcome-modal__action:focus-visible {
    outline: 3px solid rgba(198, 40, 40, 0.32);
    outline-offset: 2px;
}

.home-welcome-modal__body {
    display: grid;
    width: 100%;
    max-width: 760px;
    min-width: 0;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 20px;
    margin: 0 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px 30px 28px;
    text-align: left;
}

.home-welcome-modal__content {
    min-width: 0;
}

.home-welcome-modal__title {
    margin: 0 0 10px;
    color: #171717;
    font-size: clamp(1.9rem, 2.6vw, 2.25rem);
    font-weight: 800;
    line-height: 1.13;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.home-welcome-modal__description {
    margin: 0;
    color: #555;
    font-size: 0.98rem;
    line-height: 1.58;
    overflow-wrap: anywhere;
}

.home-welcome-modal__action {
    display: inline-flex;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 14px;
    border: 1px solid #c62828;
    border-radius: 9px;
    background: #c62828;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.home-welcome-modal__action span {
    min-width: 0;
    overflow-wrap: break-word;
    text-wrap: balance;
}

.home-welcome-modal__action:hover,
.home-welcome-modal__action:focus-visible {
    border-color: #a82222;
    background: #a82222;
    color: #fff;
    text-decoration: none;
}

.home-welcome-modal__action i,
.home-welcome-modal__action svg {
    flex: 0 0 auto;
}

.home-welcome-modal__identity {
    display: flex;
    min-width: 0;
    width: fit-content;
    max-width: 100%;
    justify-self: center;
    align-items: center;
    justify-content: center;
}

.home-welcome-modal__image-frame {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid #e9e9e9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(198, 40, 40, 0.12);
}

.home-welcome-modal__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(calc(var(--media-height) - 26px), 48dvh);
    object-fit: contain;
}

.home-modal-preview {
    container-type: inline-size;
}

.home-modal-preview .home-welcome-modal__dialog {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.home-modal-preview .home-welcome-modal,
.home-modal-preview .home-welcome-modal__body {
    max-height: none;
}

.home-modal-preview .home-welcome-modal__header {
    gap: 9px;
    padding: 17px 52px 13px 20px;
}

.home-modal-preview .home-welcome-modal__header-mark {
    height: 26px;
}

.home-modal-preview .home-welcome-modal__eyebrow {
    font-size: 0.6rem;
}

.home-modal-preview .home-welcome-modal__institution {
    font-size: 0.76rem;
}

.home-modal-preview .home-welcome-modal__close {
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    font-size: 22px;
}

.home-modal-preview .home-welcome-modal__body {
    gap: 18px;
    padding: 20px;
}

.home-modal-preview .home-welcome-modal__title {
    font-size: clamp(1.45rem, 3cqw, 1.9rem);
}

.home-modal-preview .home-welcome-modal__description {
    font-size: 0.85rem;
}

.home-modal-preview .home-welcome-modal__action {
    min-height: 40px;
    padding: 8px 11px;
    font-size: 0.78rem;
}

.home-modal-preview .home-welcome-modal__identity {
    --media-height: 250px;
}

.home-modal-preview .home-welcome-modal[data-image-shape='portrait'] .home-welcome-modal__identity {
    --media-height: 280px;
}

@media (max-width: 720px) {
    #avisoModal .home-welcome-modal__dialog {
        --bs-modal-margin: 12px;
        width: calc(100vw - 24px);
    }

    .home-welcome-modal {
        max-height: calc(100dvh - 24px);
    }

    .home-welcome-modal__header {
        padding: 19px 62px 15px 22px;
    }

    .home-welcome-modal__close {
        top: 17px;
        right: 18px;
    }

    .home-welcome-modal__body {
        gap: 16px;
        padding: 21px 22px 24px;
    }

    .home-welcome-modal__identity,
    .home-welcome-modal[data-image-shape='portrait'] .home-welcome-modal__identity {
        --media-height: 280px;
    }

    .home-welcome-modal[data-image-shape='landscape'] .home-welcome-modal__identity {
        --media-height: 260px;
    }

    .home-welcome-modal__title {
        font-size: clamp(1.7rem, 5vw, 2rem);
    }
}

@media (max-width: 420px) {
    #avisoModal .home-welcome-modal__dialog {
        --bs-modal-margin: 8px;
        width: calc(100vw - 16px);
    }

    .home-welcome-modal {
        max-height: calc(100dvh - 16px);
        border-radius: 15px;
    }

    .home-welcome-modal__header {
        gap: 9px;
        padding: 17px 52px 13px 17px;
    }

    .home-welcome-modal__institution {
        font-size: 0.78rem;
    }

    .home-welcome-modal__close {
        top: 14px;
        right: 13px;
        width: 33px;
        height: 33px;
    }

    .home-welcome-modal__body {
        gap: 15px;
        padding: 18px 17px 20px;
    }

    .home-welcome-modal__identity,
    .home-welcome-modal[data-image-shape='portrait'] .home-welcome-modal__identity {
        --media-height: 245px;
    }

    .home-welcome-modal[data-image-shape='landscape'] .home-welcome-modal__identity {
        --media-height: 225px;
    }

    .home-welcome-modal__title {
        font-size: clamp(1.5rem, 7vw, 1.65rem);
    }

    .home-welcome-modal__description {
        font-size: clamp(0.875rem, 3.9vw, 0.9rem);
    }

    .home-welcome-modal__action {
        gap: 6px;
        padding-inline: 10px;
        font-size: clamp(0.8rem, 3.7vw, 0.84rem);
    }
}

@container (max-width: 520px) {
    .home-modal-preview .home-welcome-modal__body {
        gap: 14px;
    }

    .home-modal-preview .home-welcome-modal__action {
        gap: 6px;
        padding-inline: 10px;
    }

    .home-modal-preview .home-welcome-modal__identity,
    .home-modal-preview .home-welcome-modal[data-image-shape='portrait'] .home-welcome-modal__identity {
        --media-height: 220px;
    }
}
