/* see CLAUDE_notes.md */

.tabcol { display: contents; }
.tabcol-btn { display: none; }


@media (max-width: 820px) {

    .tabcol {
        display: block;
        position: relative;      /* the panel hangs off this */
        margin-bottom: 1rem;
    }

    .tabcol-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        max-width: 100%;
        padding: 0.5rem 0.75rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-main);
        font-family: inherit;
        font-size: var(--fs-md);
        font-weight: 600;
        line-height: 1.2;
        cursor: pointer;
        --toolIcon-size: 0.9em;
    }
    .tabcol-btn:hover { border-color: var(--primary-color, #3b82f6); }

    /* Nothing registered yet — see syncLabel() in the JS. */
    .tabcol.tabcol-empty > .tabcol-btn { display: none; }

    .tabcol-btn-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .tabcol-caret {
        flex: none;
        opacity: 0.6;
        transition: transform 0.15s ease;
    }
    .tabcol-open .tabcol-caret { transform: rotate(180deg); }

    /* The strip, relaid as the panel.
       Doubled class on purpose (`.tabcol-strip.tabcol-strip`): `.met-tabs` on
       the Metabolites index also carries `.pageNav`, whose own rules are
       written `.pageNav.pageNav { position: fixed; … }` for the same reason.
       A single-class selector here would tie with those and lose on order. */
    .tabcol > .tabcol-strip.tabcol-strip {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        /* right/bottom/height are not just tidiness. A `.pageNav` strip is
           `position: fixed` with `right: var(--rail-right)` and a hard
           `height: var(--pageNav-h)` (46px) — inherited here, that stretched
           the panel to the wrapper's width and clamped it to one row high, so
           three stacked options rendered as a 46px sliver. */
        right: auto;
        bottom: auto;
        height: auto;
        min-height: 0;
        z-index: 300;

        flex-direction: column;
        align-items: stretch;
        gap: 0;

        /* Exactly the wrapper's width — which is the content column, since
           .tabcol is a block. Not `max-content`: min-width always beats
           max-width in CSS, so a `min-width: 100%` panel can never be capped,
           and one long tab label would have pushed the page into a horizontal
           scroll. Labels wrap instead (`white-space: normal` on the rows). */
        width: auto;
        min-width: 100%;
        max-width: 100%;
        max-height: 70vh;
        overflow-y: auto;
        overflow-x: hidden;

        margin: 0;
        padding: 6px;

        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);   /* not the strip's 2px rule */
        border-radius: 8px;
        box-shadow: 0 8px 26px rgba(0, 0, 0, .16);
    }
    .tabcol.tabcol-open > .tabcol-strip.tabcol-strip { display: flex; }

    /* Rows, not tabs: the underline that marked the active tab in a row is
       meaningless stacked, so the active row is marked by fill instead. */
    .tabcol > .tabcol-strip.tabcol-strip > * {
        justify-content: flex-start;
        width: 100%;
        margin: 0;
        padding: 0.6rem 0.7rem;
        border: none;
        border-bottom: none;
        border-radius: 6px;
        text-align: left;
        white-space: normal;
    }
    .tabcol > .tabcol-strip.tabcol-strip > *:hover { background: var(--hover-bg); }
    .tabcol > .tabcol-strip.tabcol-strip > .active,
    .tabcol > .tabcol-strip.tabcol-strip > .is-active,
    .tabcol > .tabcol-strip.tabcol-strip > [aria-selected="true"] {
        background: var(--hover-bg);
    }

    /* tab_slider.js draws the travelling underline into the strip's ::after.
       There is no row for it to travel along here. */
    .tabcol > .tabcol-strip.tabcol-strip::after { display: none; }
}
