/* An unillustrated story section uses the full row, with no line-length cap.
   A neighbouring figure keeps the original editorial layout and typography. */
#tab-description :is(.tjws-story-section, .tjws-heat-section) > :is(.tjws-story-copy, .tjws-heat-copy):only-child {
    box-sizing: border-box;
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-inline: 0;
}

#tab-description :is(.tjws-story-section, .tjws-heat-section) > :is(.tjws-story-copy, .tjws-heat-copy):only-child > :is(h2, h3, h4, p, ul, ol),
#tab-description > :is(h2, h3, h4, p, ul, ol),
#tab-description > .tjws-copy--detail > :is(h2, h3, h4, p, ul, ol),
#tab-tjws_documents .tjws-documents > :is(h2, h3, p, ul) {
    max-width: none;
}

/* Both classic WooCommerce descriptions and TRAJKOT's material lists use
   the tab's inner bounds, including its existing mobile gutters. */
#tab-description > :is(.tjws-copy--detail, .tjws-heat-story),
#tab-tjws_documents > .tjws-documents {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin-inline: 0;
}

#tab-tjws_documents .tjws-documents-list > li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

/* Product tabs need two visible columns on phones. Keep desktop navigation
   and WooCommerce's active, focus and keyboard behaviour. */
@media (max-width: 599px) {
    main.tj-shop-main.tj-shop-single div.product .woocommerce-tabs > ul.tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 12px;
        overflow: visible;
        white-space: normal;
    }

    main.tj-shop-main.tj-shop-single div.product .woocommerce-tabs > ul.tabs::after {
        display: none;
    }

    main.tj-shop-main.tj-shop-single div.product .woocommerce-tabs > ul.tabs > li:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    main.tj-shop-main.tj-shop-single div.product .woocommerce-tabs > ul.tabs > li > a {
        box-sizing: border-box;
        display: flex;
        align-items: center;
        min-height: 48px;
        height: 100%;
        padding: 8px 4px;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}
