/* Shared header and homepage geometry, including before a graph is mounted. */
#top-bar { box-sizing: border-box; }
#site-navigation { position: relative; flex: 0 0 auto; order: 4; }
#site-navigation > summary { display: none; cursor: pointer; }
#site-navigation > nav { display: flex; align-items: center; gap: 10px; }
#site-navigation a { color: inherit; font-size: 13px; }
#site-navigation button { cursor: pointer; }
#top-bar :focus-visible { outline: 3px solid #86efac; outline-offset: 2px; }
body:has(#hero-image):not(.graph-workspace):not(.homepage-research-active) #record-tabs { display: none; }
body:not(.graph-workspace) #hero-image { height: 220px; flex-direction: column; gap: 18px; }
#hero-image .home-introduction { color: #435b4d; font-size: 17px; line-height: 1.5; margin: 0 20px; text-align: center; }
body.dark-mode #hero-image .home-introduction { color: #d1d5db; }
body:not(.graph-workspace) #top-searches-panel {
    left: 50%; transform: translateX(-50%); width: min(1040px, calc(100vw - 48px));
    top: calc(var(--top-bar-height, 68px) + 230px); max-width: none;
    padding: 24px; border: 1px solid #d6dfd9; box-shadow: 0 6px 20px #1235200a;
}
#top-searches-panel #top-searches-content { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
#top-searches-panel #top-searches-content[style*="display: none"] { display: none !important; }
#top-searches-panel .top-search-group strong { color: #435b4d; font-size: 13px; }
#top-searches-panel .top-search-group a { display: block; padding: 10px 0; border-bottom: 1px solid #e4e9e6; }
.node-context-menu { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; box-sizing: border-box; }
.node-context-menu-title { white-space: normal; overflow-wrap: anywhere; }
body.graph-workspace #evidence-panel.collapsed { visibility: hidden; }
body.graph-workspace #evidence-panel:not(.collapsed) { visibility: visible; }
#map-save-confirmation:not([hidden]) {
    position: fixed; right: 12px; bottom: 16px; z-index: 10002; box-sizing: border-box;
    max-width: calc(100vw - 24px); padding: 14px 18px; border: 1px solid #19834d; border-radius: 6px;
    background: #ecfdf3; color: #12452d; box-shadow: 0 4px 18px #12352022; font: 14px/1.5 Arial, sans-serif;
}
body.graph-workspace #bio-strip .bio-name { display: block; max-width: 100%; }
.investigation-scorecard [role="region"]::before {
    content: 'Scroll horizontally to read every column'; display: block;
    font-size: 12px; line-height: 1.5; padding: 6px 0;
}
.investigation-scorecard table { min-width: 48rem; }
.investigation-scorecard th, .investigation-scorecard td { min-width: 8rem; vertical-align: top; }
.investigation-scorecard th:last-child, .investigation-scorecard td:last-child { min-width: 14rem; }
@media (max-width: 1450px) {
    body.graph-workspace #top-bar { flex-wrap: wrap; overflow: visible; }
    body.graph-workspace #top-bar form { flex: 1 1 300px; }
    body.graph-workspace #top-bar form input[name="q"] { min-width: 0; width: 0; flex: 1; }
    body.graph-workspace #record-tabs { flex: 1 1 auto; }
    #site-navigation > summary { display: block; padding: 9px 12px; border: 1px solid #718679; border-radius: 5px; }
    #site-navigation > nav { display: none; }
    #site-navigation[open] > nav {
        display: flex; position: absolute; right: 0; top: calc(100% + 8px); z-index: 10001;
        flex-direction: column; align-items: stretch; min-width: 185px; padding: 12px;
        background: #0a1628; color: #fff; border: 1px solid #718679; border-radius: 6px;
    }
    #site-navigation nav > * { padding: 10px; min-height: 24px; }
}
@media (max-width: 679px) {
    #top-bar, body.graph-workspace #top-bar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 8px; overflow: visible; }
    #top-bar > a { grid-column: 1; grid-row: 1; min-width: 0; }
    #top-bar > a img, body.graph-workspace #top-bar > a img { width: 220px !important; max-width: 100%; height: 40px !important; margin: 0; }
    #site-navigation { grid-column: 2; grid-row: 1; }
    #top-bar form, body.graph-workspace #top-bar form { grid-column: 1 / -1; grid-row: 2; display: flex; width: 100%; min-width: 0; margin: 0; gap: 6px; }
    #top-bar form input[name="q"], body.graph-workspace #top-bar form input[name="q"] { flex: 1; width: 0; min-width: 0; box-sizing: border-box; height: 44px; font-size: 16px; }
    #top-bar form button[type="submit"], body.graph-workspace #top-bar form button[type="submit"] { min-height: 44px; }
    #record-tabs, body.graph-workspace #record-tabs { grid-column: 1 / -1; grid-row: 3; margin: 0; gap: 4px; }
    body.graph-workspace #record-tabs button { min-height: 40px; padding: 6px 7px; }
    body:not(.graph-workspace) #hero-image { height: 200px; padding: 0 16px; width: auto; }
    #hero-image h1 { font-size: 27px; }
    #hero-image .home-introduction { font-size: 15px; margin: 0; }
    body:not(.graph-workspace) #top-searches-panel { top: calc(var(--top-bar-height, 112px) + 200px); width: calc(100vw - 32px); padding: 16px; max-height: calc(100dvh - var(--top-bar-height,112px) - 216px); }
    #top-searches-panel #top-searches-content { grid-template-columns: 1fr; gap: 20px; }
    body.graph-workspace #bio-strip { display: grid !important; grid-template-columns: 56px minmax(0,1fr); gap: 8px; padding: 10px 12px; min-height: 0; }
    body.graph-workspace #bio-strip .bio-image { width: 54px; height: 64px; grid-row: 1 / 3; }
    body.graph-workspace #bio-strip .bio-main { grid-column: 2; min-width: 0; width: auto; }
    body.graph-workspace #bio-strip .bio-meta { -webkit-line-clamp: 2; font-size: 13px; }
    body.graph-workspace #bio-strip .bio-stats { position: static !important; grid-column: 2; width: auto !important; max-width: 100%; font-size: 11px; }
    body.graph-workspace #bio-image-credit { font-size: 11px; max-height: 32px; overflow-y: auto; }
    body.graph-workspace #graph-map-controls { gap: 4px; }
    body.graph-workspace .map-main-tools { flex-wrap: nowrap; width: 100%; min-width: 0; overflow-x: auto; padding-bottom: 3px; }
    body.graph-workspace .map-main-tools > * { flex-shrink: 0; }
    body.graph-workspace .map-main-tools [data-expansion-count] { display: none; }
    body.graph-workspace .map-selection-tools { flex-wrap: nowrap; width: 100%; min-width: 0; }
    body.graph-workspace .map-selection-tools [data-selection-count] { flex: 1; min-width: 0; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
    body.graph-workspace .map-selection-tools > [data-map-action]:not([data-map-action="research"]) { display: none; }
    body.graph-workspace #node-more-actions { white-space: nowrap; }
    body.graph-workspace #evidence-panel:not(.collapsed) { height: min(52dvh, calc(100dvh - var(--top-bar-height) - var(--graph-toolbar-height))) !important; max-height: none !important; }
    body.graph-workspace .record-panel-header { padding: 6px 8px !important; }
    .node-context-menu-item { min-height: 44px; }
}
