/* Shared sidebar colors. Each module still determines its own active item. */
#studio-sidebar,
#v2-ocean-workspace,
#v2-seaice-workspace {
    --sidebar-icon-active: #07569e;
    --sidebar-icon-hover: #e7f1fb;
    --sidebar-icon-hover-text: #034a86;
}

/* Clear the legacy first-preset highlight before applying the actual state. */
#v2-seaice-workspace #v2-seaice-page-rail #v2-seaice-page-config {
    background: #fff;
    color: #31516d;
}

#studio-sidebar .mpas-sidebar-tabs li:not(.active):hover,
#studio-sidebar .mpas-sidebar-tabs li:not(.active):hover > a,
#v2-ocean-workspace #v2-ocean-mode-rail button:is([data-ocean-mode], #v2-ocean-mode-about):where(:hover:not(:disabled)),
#v2-seaice-workspace #v2-seaice-page-rail button:is([data-seaice-preset], #v2-seaice-page-config, #v2-seaice-page-about, #v2-seaice-page-reference):where(:hover:not(:disabled)) {
    background: var(--sidebar-icon-hover);
    color: var(--sidebar-icon-hover-text);
}

#v2-module-home #v2-ocean-workspace:not(.ocean-about-active) #v2-ocean-mode-rail button[data-ocean-mode][aria-selected="true"],
#v2-ocean-workspace #v2-ocean-mode-rail #v2-ocean-mode-about[aria-pressed="true"],
#v2-seaice-workspace:not(.seaice-about-active, .seaice-reference-active) #v2-seaice-page-rail button:is([data-seaice-preset], #v2-seaice-page-config)[aria-pressed="true"],
#v2-seaice-workspace #v2-seaice-page-rail :is(#v2-seaice-page-about, #v2-seaice-page-reference)[aria-pressed="true"] {
    background: var(--sidebar-icon-active);
    color: #fff;
}

/* The active Atmosphere tab shares a row with the blue section header.
 * Give the tab its own fill and an inset edge that follows the active tab. */
#app #studio-sidebar .mpas-sidebar-tabs li[data-studio-tab].active,
#app #studio-sidebar .mpas-sidebar-tabs li[data-studio-tab].active > a {
    background: #123a63 !important;
    color: #fff !important;
}

#app #studio-sidebar .mpas-sidebar-tabs li[data-studio-tab].active > a {
    box-shadow: inset 4px 0 #b9e1ff;
}

/* Keep keyboard focus visibly distinct from the selected state. */
#studio-sidebar .mpas-sidebar-tabs a:focus-visible,
#v2-ocean-workspace #v2-ocean-mode-rail button:focus-visible,
#v2-seaice-workspace #v2-seaice-page-rail button:focus-visible {
    outline: 2px solid #987000;
    outline-offset: -3px;
}

/* A module banner above both the Atmosphere rail and the section heading. */
#studio-sidebar > .sidebar-inner {
    display: grid;
    grid-template-rows: 40px minmax(0, 1fr);
}

#studio-sidebar > .sidebar-inner > .sidebar-workspace {
    position: relative;
    min-height: 0;
}

#studio-sidebar .mpas-atmosphere-banner {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #0074d9;
    color: #fff;
    font-size: 1.2rem;
}
