/* Data Hub homepage: mobile-only presentation. Desktop styles remain untouched. */
@media (max-width: 767px) {
    html,
    body {
        width: 100%;
        overflow-x: hidden;
        background: #f4f8fb;
    }

    /* Keep both fixed navigation bars usable without changing their desktop layout. */
    .navbar-fixed-top {
        right: 0;
        left: 0;
    }

    .navbar-fixed-top .bigd-navbar {
        min-height: 30px;
    }

    .navbar-fixed-top .bigd-navbar-header {
        position: relative;
        height: 30px;
    }

    .navbar-fixed-top .bigd-navbar-brand {
        display: flex;
        width: auto;
        max-width: 168px;
        height: 30px;
        align-items: center;
        padding: 4px 8px;
    }

    .navbar-fixed-top .bigd-navbar-brand img {
        width: auto;
        max-width: 100%;
        max-height: 22px;
    }

    .navbar-fixed-top .bigd-navbar-toggle {
        position: absolute;
        top: 3px;
        right: 8px;
        display: block !important;
        margin: 0;
        z-index: 3;
    }

    .navbar-fixed-top .bigd-navbar-collapse {
        position: absolute;
        top: 30px;
        right: 0;
        left: 0;
        z-index: 30;
        padding: 8px 12px 12px;
        background: #1979bb;
        box-shadow: 0 12px 22px rgba(14, 58, 91, .2);
    }

    .navbar-fixed-top .bigd-navbar-collapse:not(.bigd-in) {
        display: none !important;
    }

    .navbar-fixed-top .bigd-navbar-collapse.bigd-in {
        display: block !important;
    }

    .navbar-fixed-top .bigd-navbar-nav {
        margin: 0;
    }

    .navbar-fixed-top .bigd-navbar-nav > li > a {
        padding: 8px 10px;
        color: #fff;
    }

    .navbar-fixed-top .navbar.navbar-default {
        min-height: 68px;
    }

    #nav_container {
        position: relative;
        display: block !important;
        width: 100% !important;
        min-height: 68px;
        margin: 0 !important;
        padding: 0 58px 0 12px !important;
    }

    #nav_container .navbar-header {
        display: flex !important;
        width: 100%;
        height: 68px;
        align-items: center;
        gap: 12px;
        margin: 0;
        padding: 0 !important;
    }

    #nav_container .navbar-toggle {
        position: absolute;
        top: 16px;
        right: 12px;
        z-index: 4;
        display: block !important;
        margin: 0;
    }

    #nav_container .navbar-brand {
        min-width: 0;
        height: auto;
        margin: 0 !important;
        padding: 0 !important;
    }

    #nav_container .navbar-brand:first-of-type img {
        width: auto;
        height: 35px !important;
    }

    #nav_container .navbar-brand:nth-of-type(2) {
        flex: 1 1 auto;
    }

    #nav_container .navbar-brand:nth-of-type(2) img {
        width: auto;
        max-width: 138px !important;
        height: 31px !important;
    }

    #bs-example-navbar-collapse-1 {
        position: absolute;
        top: 68px;
        right: 0;
        left: 0;
        z-index: 25;
        margin: 0;
        padding: 8px 12px 14px;
        border-top: 1px solid #e5edf3;
        background: #fff;
        box-shadow: 0 12px 20px rgba(27, 66, 94, .14);
    }

    #bs-example-navbar-collapse-1 .navbar-nav {
        display: block !important;
        width: 100%;
        margin: 0;
    }

    #bs-example-navbar-collapse-1 .navbar-nav > li {
        width: 100%;
        min-width: 0;
        padding: 0 !important;
        text-align: left;
    }

    #bs-example-navbar-collapse-1 .navbar-nav > li > a {
        padding: 8px 12px;
        border-radius: 8px;
        line-height: 28px !important;
    }

    /* Compact hero: logo and copy share one row, search stays full width. */
    .datahub-hero-wrap {
        margin-top: 98px !important;
        padding: 0;
    }

    #search {
        min-height: 0 !important;
        padding: 25px 14px 22px !important;
        background-size: 480px auto;
    }

    #search > .container {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    #search > .container > div {
        padding-left: 0 !important;
    }

    #search > .container > div > div:first-child {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    #search .logo {
        width: 68px !important;
        height: 68px !important;
        flex: 0 0 68px;
        object-fit: contain;
    }

    #search .col-md-8 {
        min-width: 0;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0;
    }

    #search h1 {
        margin: 0 !important;
        font-size: clamp(30px, 9vw, 39px) !important;
        line-height: 1.05;
        letter-spacing: -.025em;
    }

    #search h1 small,
    #search h1 small small {
        display: block;
        margin-top: 7px;
        color: rgba(255, 255, 255, .92) !important;
        font-size: 13px !important;
        line-height: 1.25;
    }

    #search h3 {
        margin: 10px 0 0 !important;
        font-size: 16px;
        line-height: 1.35;
    }

    #search .select2-container {
        width: calc(100% - 20px) !important;
        margin: 20px 10px 0;
    }

    #search .select2-selection--single {
        height: 50px;
        padding: 10px 42px 10px 16px;
        border: 0;
        border-radius: 13px;
        box-shadow: 0 10px 24px rgba(7, 65, 106, .2);
    }

    #search .select2-selection__rendered {
        padding: 0;
        color: #60758a;
        font-size: 14px;
        line-height: 30px;
    }

    #search .select2-selection__arrow {
        top: 12px;
        right: 12px;
    }

    #search h5 {
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 13px 10px 0;
        padding-bottom: 2px;
        font-size: 0;
        line-height: 1.4;
        overflow-x: auto;
        scrollbar-width: none;
        white-space: nowrap;
    }

    #search h5::-webkit-scrollbar {
        display: none;
    }

    #search h5::before {
        display: inline-block;
        flex: 0 0 auto;
        margin: 0 2px 0 0;
        color: rgba(255, 255, 255, .82);
        content: "Try an example";
        font-size: 10px;
        font-weight: 500;
    }

    #search h5 > a {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        margin: 0;
        padding: 4px 6px;
        border: 1px solid rgba(255, 255, 255, .32);
        border-radius: 999px;
        background: rgba(255, 255, 255, .1);
        font-size: 10px;
        line-height: 1.3;
        white-space: nowrap;
    }

    /* Main feature cards. */
    .datahub-home-content {
        padding-bottom: 32px !important;
        background: #f4f8fb !important;
    }

    .datahub-home-content > .container-fluid {
        padding: 18px 14px 0;
    }

    .datahub-home-content > .container-fluid > .col-md-9,
    .datahub-home-content > .container-fluid > .col-md-3 {
        padding: 0 !important;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel {
        margin-bottom: 14px;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .datahub-home-content .panel-body {
        padding: 0;
    }

    .datahub-home-content .col-md-10,
    .datahub-home-content .col-md-12,
    .datahub-home-content .col-md-6,
    .datahub-home-content .col-md-4,
    .datahub-home-content .col-md-2 {
        min-width: 0;
    }

    .datahub-home-content .col-md-10 {
        padding: 0;
    }

    .datahub-home-content .alert {
        margin: 0 0 14px;
        padding: 18px 15px 16px;
        border: 1px solid rgba(41, 102, 144, .11);
        border-radius: 16px;
        box-shadow: 0 8px 24px rgba(29, 77, 111, .07);
    }

    .datahub-home-content .alert h3 {
        margin: 0 0 15px !important;
        color: #17324d;
        font-size: 20px;
        font-weight: 700;
        line-height: 1.25;
    }

    .datahub-home-content .alert > .col-md-12 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        padding: 0;
    }

    .datahub-home-content .alert-success > .col-md-12,
    .datahub-home-content .alert-warning > .col-md-12 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .datahub-home-content .alert-info {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .datahub-home-content .alert-info > h3 {
        grid-column: 1 / -1;
        margin-bottom: 6px !important;
    }

    .datahub-home-content .alert-info > .col-md-12 {
        display: contents;
    }

    .datahub-home-content .alert .col-md-4 {
        width: auto;
        height: auto !important;
        min-height: 0 !important;
        padding: 0;
    }

    .datahub-home-content .alert .col-md-4 > a {
        display: flex;
        min-height: 92px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 7px;
        border: 1px solid rgba(58, 126, 172, .14);
        border-radius: 13px;
        color: #216c9f;
        background: rgba(255, 255, 255, .76);
        text-align: center;
    }

    .datahub-home-content .alert-success .col-md-4 > a,
    .datahub-home-content .alert-warning .col-md-4 > a {
        min-height: 82px;
        gap: 6px;
        padding: 10px 4px;
    }

    .datahub-home-content .alert-success .col-md-4 img,
    .datahub-home-content .alert-warning .col-md-4 img {
        width: 34px;
        height: 34px !important;
    }

    .datahub-home-content .alert-success .col-md-4 span,
    .datahub-home-content .alert-warning .col-md-4 span {
        font-size: 11px;
    }

    .datahub-home-content .alert .col-md-4 > a:focus,
    .datahub-home-content .alert .col-md-4 > a:hover {
        text-decoration: none;
        background: #fff;
        box-shadow: 0 6px 15px rgba(30, 96, 141, .1);
    }

    .datahub-home-content .alert .col-md-4 img {
        width: 39px;
        height: 39px !important;
        object-fit: contain;
    }

    .datahub-home-content .alert .col-md-4 span {
        width: 100%;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.25;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* External links and the former desktop sidebar become stacked cards. */
    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body {
        margin-bottom: 16px;
        padding: 18px 16px 16px;
        border: 1px solid rgba(41, 102, 144, .1);
        border-radius: 15px;
        background: linear-gradient(145deg, #fff, #f7fbfe);
        box-shadow: 0 8px 24px rgba(29, 77, 111, .06);
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body > .col-md-10 > p > span {
        display: flex;
        align-items: center;
        gap: 7px;
        color: #17324d;
        font-size: 16px;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body .col-md-10 {
        padding: 0;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body ul {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin: 14px 0 0;
        padding: 0 !important;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body ul::before,
    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body ul::after {
        display: none !important;
        content: none !important;
    }

    /* The original markup contains an empty wrapper link; keep it out of the grid. */
    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body ul > a {
        display: none;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body ul > div > a:first-child {
        display: none;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body a[href="https://twitter.com/AtlasEwas"] {
        display: none !important;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body ul > div {
        width: auto;
        height: auto !important;
        padding: 0;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body li {
        list-style: none;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body li a {
        display: flex;
        min-height: 46px;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
        border: 1px solid #cfe2ee;
        border-radius: 11px;
        color: #176fa8;
        background: #fff;
        box-shadow: 0 3px 10px rgba(34, 93, 132, .06);
        font-size: 13px;
        font-weight: 600;
        text-align: left;
        text-decoration: none;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body li a::after {
        flex: 0 0 auto;
        color: #5d9fc7;
        content: "\2197";
        font-size: 15px;
        font-weight: 700;
    }

    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body li a:focus,
    .datahub-home-content > .container-fluid > .col-md-9 > .panel-body li a:hover {
        border-color: #7fb5d5;
        color: #0c5c8e;
        background: #f3f9fd;
        box-shadow: 0 5px 14px rgba(34, 93, 132, .12);
    }

    .datahub-home-content > .container-fluid > .col-md-3 {
        padding-top: 0 !important;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel {
        margin-bottom: 14px;
        overflow: hidden;
        border: 1px solid rgba(41, 102, 144, .1);
        border-radius: 15px;
        background: #fff;
        box-shadow: 0 8px 24px rgba(29, 77, 111, .07);
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel > .panel-heading {
        padding: 15px 16px;
        border: 0;
        background: #f5f9fc;
        text-align: left !important;
    }

    .datahub-home-content .panel-title {
        color: #17324d;
        font-size: 18px;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel > .panel-body {
        padding: 15px 16px;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child > .panel-body {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 16px;
        padding-top: 0;
        padding-bottom: 10px;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child > .panel-body::before,
    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child > .panel-body::after {
        display: none;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child .col-md-6 {
        width: auto;
        height: auto !important;
        padding: 0;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child p {
        display: flex;
        min-height: 70px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 4px;
        margin: 0;
        padding: 10px 3px;
        border-bottom: 1px solid #e4edf3;
        background: transparent;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child p > span {
        color: #1979bb;
        font-size: 20px;
        font-weight: 700;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:first-child p > a {
        order: -1;
        margin: 0;
        color: #60758a;
        font-size: 12px;
        font-weight: 500;
        line-height: 1.2;
        text-align: left;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:nth-child(2) > .panel-body,
    .datahub-home-content > .container-fluid > .col-md-3 > .panel:nth-child(3) > .panel-body {
        height: 250px !important;
        padding: 4px 16px 14px;
        overflow-y: auto !important;
        scrollbar-width: thin;
        scrollbar-color: #aec9db transparent;
    }

    .datahub-home-content > .container-fluid > .col-md-3 > .panel:nth-child(2) p {
        margin: 0;
        padding: 11px 0;
        border-top: 1px solid #e6eef4;
        color: #425c72;
        font-size: 13px;
        line-height: 1.45;
    }

    #cite-list {
        margin: 0;
        padding-left: 20px !important;
        line-height: 1.45 !important;
    }

    #cite-list li {
        margin: 0 0 12px;
        color: #425c72;
        font-size: 12px;
    }

    .bigd-footer {
        position: static;
    }
}

@media (max-width: 360px) {
    #nav_container {
        padding-left: 8px !important;
    }

    #nav_container .navbar-header {
        gap: 7px;
    }

    #nav_container .navbar-brand:first-of-type img {
        height: 31px !important;
    }

    #nav_container .navbar-brand:nth-of-type(2) img {
        max-width: 112px !important;
        height: 27px !important;
    }

    #search .logo {
        width: 58px !important;
        height: 58px !important;
        flex-basis: 58px;
    }

    #search h1 {
        font-size: 29px !important;
    }
}
