/*
 * Mobile/content stability layer.
 * Loaded after main theme CSS to neutralize inconsistent inline post styles
 * and prevent overflow/icon blow-ups on narrow screens.
 */

.single-reference__meta-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.single-reference__meta-date {
    color: #667085;
    font-size: 0.75rem;
    line-height: 1.25;
}

.single-reference__content,
.page-content {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.single-reference__content > *,
.page-content > * {
    max-width: 100%;
}

.single-reference__content img,
.single-reference__content video,
.single-reference__content iframe,
.single-reference__content embed,
.single-reference__content object,
.single-reference__content table,
.page-content img,
.page-content video,
.page-content iframe,
.page-content embed,
.page-content object,
.page-content table {
    max-width: 100% !important;
}

.single-reference__content iframe,
.single-reference__content table,
.page-content iframe,
.page-content table {
    width: 100%;
}

.single-reference__content table,
.page-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
}

.single-reference__content pre,
.page-content pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.single-reference__content .wp-block-image,
.single-reference__content figure,
.page-content .wp-block-image,
.page-content figure {
    width: 100% !important;
    margin-left: 0;
    margin-right: 0;
}

.single-reference__content .wp-block-image img,
.single-reference__content figure img,
.page-content .wp-block-image img,
.page-content figure img {
    width: 100% !important;
    height: auto !important;
}

.single-reference__content svg,
.page-content svg {
    max-width: 100%;
    height: auto;
}

@media (max-width: 767px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .single-reference__content,
    .page-content {
        overflow-x: hidden;
    }

    .single-reference__article-shell,
    .single-reference__heading-wrap,
    .single-reference__headline,
    .single-reference__meta-row,
    .single-reference__meta-group,
    .single-reference__share,
    .single-reference__author-row,
    .single-reference__author-copy {
        min-width: 0;
        max-width: 100%;
    }

    .single-reference__article-shell {
        overflow-x: clip;
    }

    .single-reference__share {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .single-reference__share .story-share__link {
        flex: 0 0 auto;
    }

    .single-reference__author-row {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: .75rem .85rem;
    }

    .single-reference__author-avatar {
        grid-row: 1 / span 2;
    }

    .single-reference__author-name,
    .single-reference__headline {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .single-reference__author-date {
        grid-column: 1 / -1;
        width: auto;
    }

    .single-reference__content img[sizes^="auto"],
    .single-reference__content img[sizes*="auto,"],
    .page-content img[sizes^="auto"],
    .page-content img[sizes*="auto,"] {
        contain-intrinsic-size: auto 0 !important;
    }

    .single-reference__article-shell,
    .single-reference__content,
    .single-reference__content > *,
    .single-reference__content p,
    .single-reference__content li,
    .single-reference__content a,
    .single-reference__content span,
    .single-reference__content strong,
    .single-reference__content em,
    .page-content,
    .page-content > *,
    .page-content p,
    .page-content li,
    .page-content a,
    .page-content span,
    .page-content strong,
    .page-content em {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
        white-space: normal;
    }

    .single-reference__content [style*="color"],
    .single-reference__content [style*="background"],
    .single-reference__content font,
    .page-content [style*="color"],
    .page-content [style*="background"],
    .page-content font {
        color: inherit !important;
        background: transparent !important;
    }

    .single-reference__content [style*="font-size"],
    .page-content [style*="font-size"] {
        font-size: inherit !important;
        line-height: inherit !important;
    }

    .single-reference__content *,
    .page-content * {
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
    }

    .single-reference__content p,
    .single-reference__content li,
    .single-reference__content a,
    .single-reference__content span,
    .single-reference__content strong,
    .single-reference__content em,
    .single-reference__content h1,
    .single-reference__content h2,
    .single-reference__content h3,
    .single-reference__content h4,
    .page-content p,
    .page-content li,
    .page-content a,
    .page-content span,
    .page-content strong,
    .page-content em,
    .page-content h1,
    .page-content h2,
    .page-content h3,
    .page-content h4 {
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
        white-space: normal !important;
    }

    .single-reference__content img,
    .single-reference__content video,
    .single-reference__content iframe,
    .single-reference__content embed,
    .single-reference__content object,
    .single-reference__content canvas,
    .page-content img,
    .page-content video,
    .page-content iframe,
    .page-content embed,
    .page-content object,
    .page-content canvas {
        width: auto;
        height: auto;
        max-width: 100% !important;
    }

    .single-reference__content div[style*="width"],
    .single-reference__content p[style*="width"],
    .single-reference__content figure[style*="width"],
    .single-reference__content table[style*="width"],
    .single-reference__content iframe[style*="width"],
    .single-reference__content img[style*="width"],
    .page-content div[style*="width"],
    .page-content p[style*="width"],
    .page-content figure[style*="width"],
    .page-content table[style*="width"],
    .page-content iframe[style*="width"],
    .page-content img[style*="width"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    .single-reference__content table,
    .page-content table,
    .single-reference__content pre,
    .page-content pre,
    .single-reference__content code,
    .page-content code {
        max-width: 100% !important;
    }

    .single-reference__content .wp-block-columns,
    .page-content .wp-block-columns,
    .single-reference__content .wp-block-media-text,
    .page-content .wp-block-media-text {
        display: block !important;
    }

    .single-reference__content .wp-block-column,
    .page-content .wp-block-column,
    .single-reference__content .wp-block-media-text__content,
    .page-content .wp-block-media-text__content,
    .single-reference__content .wp-block-media-text__media,
    .page-content .wp-block-media-text__media {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex-basis: 100% !important;
    }

    .single-reference__content .wp-block-gallery,
    .page-content .wp-block-gallery,
    .single-reference__content .blocks-gallery-grid,
    .page-content .blocks-gallery-grid {
        grid-template-columns: 1fr !important;
    }

    .single-reference__content .wp-block-gallery .blocks-gallery-item,
    .page-content .wp-block-gallery .blocks-gallery-item,
    .single-reference__content .blocks-gallery-grid .blocks-gallery-item,
    .page-content .blocks-gallery-grid .blocks-gallery-item {
        width: 100% !important;
        margin: 0 0 .75rem !important;
    }

    .single-reference__content .wp-block-cover,
    .page-content .wp-block-cover {
        min-height: 0 !important;
        padding: 1rem !important;
    }

    .single-reference__content .wp-block-cover__image-background,
    .page-content .wp-block-cover__image-background,
    .single-reference__content .wp-block-cover img,
    .page-content .wp-block-cover img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        object-fit: cover;
    }

    .single-reference__content .wp-block-embed,
    .page-content .wp-block-embed,
    .single-reference__content .wp-block-embed__wrapper,
    .page-content .wp-block-embed__wrapper {
        max-width: 100% !important;
        overflow: hidden;
    }

    .single-reference__content .wp-block-embed__wrapper iframe,
    .single-reference__content .wp-block-embed__wrapper embed,
    .single-reference__content .wp-block-embed__wrapper object,
    .page-content .wp-block-embed__wrapper iframe,
    .page-content .wp-block-embed__wrapper embed,
    .page-content .wp-block-embed__wrapper object {
        width: 100% !important;
        height: auto !important;
        min-height: 200px;
    }

    .single-reference__content > p:empty,
    .single-reference__content > div:empty,
    .single-reference__content > section:empty,
    .single-reference__content > article:empty,
    .page-content > p:empty,
    .page-content > div:empty,
    .page-content > section:empty,
    .page-content > article:empty {
        display: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .single-reference__hero img[src=""],
    .single-reference__hero img:not([src]) {
        display: none;
    }

    .single-reference__hero {
        min-height: 0;
        height: auto !important;
        aspect-ratio: 16 / 9;
        max-height: 56vh;
        overflow: hidden;
    }

    .single-reference__hero img,
    .single-reference__content img:first-of-type {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 56vh !important;
        object-fit: cover;
    }

    .single-reference__content .wp-block-image,
    .page-content .wp-block-image,
    .single-reference__content figure,
    .page-content figure,
    .single-reference__content .wp-block-embed__wrapper,
    .page-content .wp-block-embed__wrapper,
    .single-reference__content .wp-block-cover,
    .page-content .wp-block-cover {
        aspect-ratio: 16 / 9;
        overflow: hidden;
    }

    .single-reference__content .wp-block-image img,
    .page-content .wp-block-image img,
    .single-reference__content figure img,
    .page-content figure img,
    .single-reference__content .wp-block-cover img,
    .page-content .wp-block-cover img,
    .single-reference__content .wp-block-cover__image-background,
    .page-content .wp-block-cover__image-background,
    .single-reference__content .wp-block-embed__wrapper iframe,
    .single-reference__content .wp-block-embed__wrapper embed,
    .single-reference__content .wp-block-embed__wrapper object,
    .page-content .wp-block-embed__wrapper iframe,
    .page-content .wp-block-embed__wrapper embed,
    .page-content .wp-block-embed__wrapper object {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
    }

    .single-reference__content .alignleft,
    .single-reference__content .alignright,
    .page-content .alignleft,
    .page-content .alignright {
        float: none;
        display: block;
        margin-left: 0;
        margin-right: 0;
    }

    .single-reference__content i[class*="icon"],
    .single-reference__content i[class*="fa"],
    .page-content i[class*="icon"],
    .page-content i[class*="fa"] {
        font-size: 1em !important;
        line-height: 1;
        vertical-align: middle;
    }

    .single-reference__content svg,
    .single-reference__content i[class*="icon"],
    .single-reference__content i[class*="fa"],
    .page-content svg,
    .page-content i[class*="icon"],
    .page-content i[class*="fa"] {
        max-width: 1.25em;
        max-height: 1.25em;
    }

    .menu-link__icon,
    .menu-link__icon svg,
    .menu-link__icon img,
    .news-home__mobile-nav-icon,
    .news-home__mobile-nav-icon svg,
    .news-home__mobile-nav-icon img {
        width: 1.35rem !important;
        height: 1.35rem !important;
        max-width: 1.35rem !important;
        max-height: 1.35rem !important;
    }

    .news-home__mobile-nav {
        padding: 0.4rem 0.6rem calc(0.4rem + env(safe-area-inset-bottom)) !important;
    }

    .news-home__mobile-nav-link {
        min-height: 3rem !important;
        gap: 0.15rem !important;
        padding: 0.05rem 0.3rem !important;
    }

    .news-home__mobile-nav-icon,
    .news-home__mobile-nav-icon svg,
    .news-home__mobile-nav-icon img {
        width: 1.15rem !important;
        height: 1.15rem !important;
        max-width: 1.15rem !important;
        max-height: 1.15rem !important;
    }

    .news-home__mobile-nav-label {
        font-size: 0.65rem !important;
        line-height: 1.05;
    }

    .news-home--reference .story-card,
    .news-home--reference .story-card__content,
    .news-home--reference .story-card-title,
    .news-home--reference .story-card-title a {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .news-home__grid,
    .news-home__feed-column,
    .news-feed,
    .news-feed .story-card,
    .news-feed .story-card__body,
    .news-home--reference .news-feed .story-card,
    .news-home--reference .story-card__content,
    .news-home--reference .story-card__media,
    .search-result-card,
    .search-result-card__link,
    .search-result-card__body,
    .epaper-grid,
    .epaper-card,
    .epaper-card__link {
        min-width: 0;
        max-width: 100%;
    }

    .news-feed .story-card-title,
    .news-feed .story-card-title a,
    .news-home--reference .story-card-title,
    .news-home--reference .story-card-title a,
    .search-result-card__title,
    .search-result-card__title a,
    .epaper-card__title,
    .epaper-card__title a,
    .epaper-card__date {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Keep long news and article text in the normal page flow on mobile. */
    .news-home--reference .news-feed,
    .news-home--reference .news-feed .story-card,
    .news-home--reference .story-card__content,
    .single-reference__article-shell,
    .single-reference__content {
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    .single-reference__content p,
    .single-reference__content li,
    .single-reference__content h2,
    .single-reference__content h3,
    .single-reference__content h4 {
        display: block;
        max-height: none !important;
        overflow: visible !important;
        -webkit-line-clamp: unset !important;
        line-clamp: unset !important;
        text-overflow: clip !important;
        white-space: normal !important;
    }

    /* Keep homepage headline truncation consistent with desktop. */
    .news-home--reference .latest-spotlight__title {
        display: -webkit-box !important;
        overflow: hidden !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .news-home--reference .story-card-title {
        display: -webkit-box !important;
        overflow: hidden !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    .news-home--reference .news-feed .story-card {
        align-items: start;
        row-gap: 0.4rem;
        min-height: 0 !important;
        padding-bottom: 0.35rem;
    }

    .news-home--reference .news-feed .story-card:last-child {
        padding-bottom: 0.15rem;
    }

    .news-home--reference .story-card__content {
        align-content: start;
        grid-template-rows: auto !important;
    }

    .news-home--reference .story-card__footer {
        align-self: start;
        margin-top: 0;
    }

    .news-feed .story-card-image,
    .news-feed .story-card-image img,
    .news-home--reference .story-card__thumb,
    .news-home--reference .story-card__thumb img,
    .search-result-card__media,
    .search-result-card__media img,
    .epaper-card__media-wrap,
    .epaper-card__media {
        max-width: 100% !important;
    }
}
