/*
 * Research7X responsive compatibility layer.
 * Loaded after Bootstrap, original CSS and page-specific CSS.
 * Original research assets remain unchanged.
 */

html {
    min-width: 0;
}

body.research7x-page {
    min-width: 0;
    margin: 0;
}

.research7x-page main,
.research7x-page .wrap,
.research7x-page .grid,
.research7x-page .dimension-grid,
.research7x-page .fields,
.research7x-page .explore-layout {
    min-width: 0;
}

.research7x-page main img {
    max-width: 100%;
    height: auto;
}

.research7x-page main :is(video, iframe, canvas) {
    max-width: 100%;
}

.research7x-page main :is(
    p, li, dd, a, h1, h2, h3, h4
) {
    overflow-wrap: anywhere;
}

.research7x-page main pre {
    max-width: 100%;
    overflow-x: auto;
}

.research7x-page .skip:focus {
    position: fixed;
    top: .5rem;
    left: .5rem;
    z-index: 1100;
    background: #fff;
    color: #102943;
    padding: .75rem;
    border: 2px solid #102943;
    border-radius: .35rem;
}

/* Avoid trapping Bootstrap offcanvas below its backdrop. */

.research7x-page .r7x-site-header {
    position: relative;
    z-index: auto;
}

.research7x-page .r7x-site-header .r7x-navbar {
    position: relative;
    z-index: auto;
}

.research7x-page .r7x-site-header .r7x-nav-container {
    min-width: 0;
}

.research7x-page .r7x-site-header .offcanvas {
    z-index: 1055;
}

.research7x-page .r7x-site-header .offcanvas-body {
    min-width: 0;
}

/* Restore original button design after Bootstrap Reboot. */

.research7x-page:not(.research7x-explorer) main .btn {
    display: inline-block;
    background: #f2ad18;
    color: #102943;
    padding: 12px 20px;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    white-space: normal;
    margin: 8px 8px 8px 0;
    max-width: 100%;
    cursor: pointer;
}

.research7x-page:not(.research7x-explorer) main .btn.secondary {
    background: #dbe3ed;
    color: #102943;
}

.research7x-page main .btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.research7x-page main :is(
    button, a.btn, .dimension-choice
) {
    min-height: 44px;
}

.research7x-page main :is(
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea
) {
    max-width: 100%;
    min-width: 0;
}

.research7x-page main textarea {
    resize: vertical;
}

.research7x-page main table {
    max-width: 100%;
}

.research7x-page main :is(
    .grid, .dimension-grid, .fields
) > * {
    min-width: 0;
}

.research7x-page footer .grid > * {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Preserve Explorer's independent design system. */

.research7x-explorer main .nav {
    list-style: none;
}

.research7x-explorer .r7x-site-header .r7x-brand-logo {
    width: 112px;
    max-width: 100%;
    height: auto;
}

.research7x-explorer .r7x-site-header .r7x-nav-links {
    list-style: none;
}

/* Complete dark mode for the original research components. */

html[data-bs-theme="dark"]
.research7x-page:not(.research7x-explorer) main :is(
    article, .tile, .dimension, .principle,
    .plan-item, .dimension-choice
) {
    background-color: var(--r7x-surface);
    color: var(--r7x-text);
    border-color: var(--r7x-border);
}

html[data-bs-theme="dark"]
.research7x-page:not(.research7x-explorer) main :is(
    .feature, .source-note
) {
    background-color: #172438;
    color: var(--r7x-text);
    border-left-color: #f2ad18;
}

html[data-bs-theme="dark"]
.research7x-page:not(.research7x-explorer) main :is(
    .dimension h3, .number, .article-lead,
    .dimension small, .muted
) {
    color: var(--r7x-muted);
}

html[data-bs-theme="dark"]
.research7x-page main .dimension-choice[aria-pressed="true"] {
    background-color: #102943;
    color: #fff;
    border-left-color: #f2ad18;
}

html[data-bs-theme="dark"]
.research7x-page main .hero {
    background-color: #102943;
    color: #fff;
}

html[data-bs-theme="dark"]
.research7x-page main .hero p {
    color: #d6e4e8;
}

html[data-bs-theme="dark"]
.research7x-page main .hero a:not(.btn) {
    color: #b7d8ff;
}

/* Explorer light theme: retain the original dynamic accent. */

html[data-bs-theme="light"]:has(body.research7x-explorer) {
    color-scheme: light;
    --bg: #f6f8fb;
    --bg2: #e9eff6;
    --card: #ffffff;
    --line: #b8c9dc;
    --ink: #102943;
    --mute: #415b70;
    --soft: #526672;
}

html[data-bs-theme="light"] body.research7x-explorer {
    background-color: var(--bg);
    color: var(--ink);
}

html[data-bs-theme="light"]
.research7x-explorer main :is(
    .dossier, .disc, .case, .pane
) {
    color: var(--ink);
}

html[data-bs-theme="light"]
.research7x-explorer .site-footer {
    background-color: #102943;
    color: #d6e4e8;
}

html[data-bs-theme="light"]
.research7x-explorer .site-footer a {
    color: #f4c45d;
}

/* Preserve Explorer's original dark palette. */

html[data-bs-theme="dark"]:has(body.research7x-explorer) {
    color-scheme: dark;
    --bg: #0a1730;
    --bg2: #0e2042;
    --card: #12284f;
    --line: #264372;
    --ink: #f4f1e8;
    --mute: #b8c3d8;
    --soft: #8fa0bf;
}

html[data-bs-theme="dark"] body.research7x-explorer {
    background-color: var(--bg);
    color: var(--ink);
}

/* Tablet and mobile compatibility. */

@media (max-width: 1199.98px) {

    .research7x-page .r7x-site-header .offcanvas-body {
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

@media (max-width: 767.98px) {

    .research7x-page .wrap {
        padding-inline: clamp(12px, 4vw, 24px);
    }

    .research7x-page main :is(
        .grid, .dimension-grid, .fields:not([hidden])
    ) {
        grid-template-columns: minmax(0, 1fr);
    }

    .research7x-page main .explore-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .research7x-page main :is(
        .tile, .dimension, .feature, .foundation-article
    ) {
        padding: clamp(14px, 4vw, 24px);
    }

    .research7x-page footer .grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .research7x-page main table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }

    .research7x-page main :is(input, select, textarea) {
        font-size: 16px;
    }

    .research7x-page main .hero h1 {
        font-size: clamp(30px, 8vw, 54px);
    }
}

@media (max-width: 479.98px) {

    .research7x-page main .hero-seal {
        float: none;
        width: min(140px, 60%);
        margin: 0 0 20px;
    }

    .research7x-page main .explore-nav {
        grid-template-columns: minmax(0, 1fr);
    }

    .research7x-page main .dimension-choice {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {

    .research7x-page {
        scroll-behavior: auto;
    }

    .research7x-page main *,
    .research7x-page main *::before,
    .research7x-page main *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* Keep printed research content readable in either theme. */

@media print {

    html[data-bs-theme] body.research7x-page,
    html[data-bs-theme] .research7x-page main,
    html[data-bs-theme] .research7x-page main :is(
        article, .tile, .dimension, .principle,
        .feature, .source-note, .plan-item,
        .hero, .dossier, .disc, .case, .pane
    ) {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border-color: #777 !important;
    }

    html[data-bs-theme] .research7x-page main :is(
        p, h1, h2, h3, h4, a, small
    ) {
        color: #000 !important;
    }

    .research7x-page main table {
        display: table;
        overflow: visible;
    }

    .research7x-page .r7x-site-header,
    .research7x-page footer,
    .research7x-page .skip,
    .research7x-page .offcanvas-backdrop,
    .research7x-page main .btn {
        display: none !important;
    }
}
