/* Responsive corrections that retain the original page templates. */
/* Intrinsic dimensions reserve space; preserve that ratio when width is capped. */
img {
    height: auto;
}

.ls-nav-left .ls-nav-container .ls-nav-link .ls-icon-chevron-right {
    width: auto;
}

#mainContent .declaration-statement-details__content-left,
#mainContent .declaration-statement-details__content-right,
#mainContent .local-table-scroll,
.leadership-main-content .ls-main-content-right,
.ls-overview-section .overview-text-container {
    min-width: 0;
}

#mainContent .local-table-scroll {
    overscroll-behavior-x: contain;
    scrollbar-color: #b7c3cc transparent;
    scrollbar-width: thin;
}

/* Fixed legacy dimensions must not push portrait cards outside the viewport. */
.ls-man-grid-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ls-main-content-right .ls-overview-section .overview-text-container {
    flex: 1;
}

.ls-main-content-right .ls-overview-section .overview-text-container .ls-text-container {
    max-width: 100%;
}

.ls-main-content-right .ls-image-container {
    flex-shrink: 1;
    max-width: 100%;
    min-width: 0;
}

.ls-main-content-right .ls-image-container img {
    max-width: 100%;
}

.ls-man-grid-container .ls-man-person-card,
.ls-man-grid-container .ls-man-person-name-icon-wrapper {
    min-width: 0;
}

/* Keep the existing dialog size where it fits; scroll its body on short screens. */
.ls-person-modal .ls-modal-container {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overscroll-behavior: contain;
}

.ls-person-modal .ls-modal-header {
    flex-shrink: 0;
}

.ls-person-modal .ls-modal-person-details {
    min-height: 0;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}

.ls-person-modal .ls-modal-header .ls-modal-close-button {
    align-items: center;
    display: inline-flex;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.ls-person-modal .ls-modal-header .ls-modal-close-button img {
    height: 24px;
    width: 24px;
}

.ls-person-modal .ls-modal-header .ls-modal-close-button:focus-visible {
    outline: 2px solid #0060a0;
    outline-offset: 2px;
}

/* The header remains 64px tall on phones, including browser-toolbar changes. */
@media (max-width: 1023px) {
    .site-header__nav-list {
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
        overflow-y: auto;
        overscroll-behavior-y: contain;
        padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    }

    .eyd-megamenu__view {
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
        min-height: 0;
        overscroll-behavior-y: contain;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .eyd-megamenu__mobile .eyd-megamenu__item-arrow {
        min-height: 44px;
        min-width: 44px;
    }

    .eyd-megamenu__mobile [data-toggle] {
        height: 44px;
        right: 0;
        top: 3px;
        width: 44px;
    }

    .eyd-megamenu__mobile .eyd-megamenu__item,
    .eyd-megamenu__mobile .eyd-megamenu__back {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .eyd-megamenu__view.is-submenu .level-4 li a {
        align-items: center;
        display: flex;
        min-height: 44px;
    }
}

@media (max-width: 1024px) {
    .ls-man-grid-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .ls-main-content-right .ls-section {
        width: min(330px, calc(100% - 48px));
    }

    .ls-main-content-right .ls-overview-section {
        max-width: calc(100% - 48px);
    }

    .ls-main-content-right .ls-overview-section .overview-text-container .ls-text-container {
        width: 100%;
    }

    .ls-main-content-right .ls-image-container {
        height: auto;
        aspect-ratio: 1;
    }

    .ls-man-grid-container .ls-man-person-card .ls-man-person-image-frame {
        width: 100%;
    }

    .ls-person-modal .ls-modal-person-details .ls-modal-top-section .ls-modal-person-image {
        aspect-ratio: 1;
        flex-shrink: 0;
        height: auto;
        max-width: 100%;
    }
}

@media (min-width: 1025px) and (max-width: 1199px) {
    .ls-main-content-right .ls-image-container {
        flex-basis: 340px;
        height: auto;
        max-width: 40%;
    }

    .ls-main-content-right .ls-image-container img {
        height: auto;
    }
}

@media (pointer: coarse) {
    .leadership-main-content .ls-nav-mobile-background .ls-nav-mobile .ls-nav-header {
        align-items: center;
        min-height: 32px;
    }

    .leadership-main-content .ls-nav-mobile-background .ls-nav-mobile .ls-nav-panel .ls-nav-item {
        align-items: center;
        display: flex;
        min-height: 44px;
    }
}
