/*
 * Product category sliders on phones and tablets. The desktop layout (a
 * full-bleed slide with the feature list laid over it) only stacked below
 * 1280px, which left a washed-out gradient card, unlabeled feature icons, a
 * catalogue button covering the product and detached up/down arrows.
 * Each product becomes a self-contained card here: title and labelled
 * features, a feature list, a square product image cropped to the
 * right, slide controls and the catalogue link at the bottom. Loaded after
 * product-accordion-fix-v1.css; desktop is untouched.
 */

[data-product-pdf] {
    white-space: nowrap;
    max-width: 100%;
}

[data-product-pdf] > svg {
    flex-shrink: 0;
}

@media (max-width: 1279.98px) {
    html:has([data-product-tabs]) {
        overflow-x: hidden;
        overflow-x: clip;
        overscroll-behavior-x: none;
    }

    [data-product-tabs-glow] {
        width: 100%;
        max-width: 100%;
    }

    [data-product-tabs-label] {
        display: none;
    }

    [data-product-tabs-nav] {
        z-index: 3;
        width: 100%;
        min-width: 0;
        align-items: stretch;
        gap: 20px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    [data-product-tabs-nav]::-webkit-scrollbar {
        display: none;
    }

    [data-product-tab] {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        padding-block: 0;
        white-space: nowrap;
        font-size: 13px;
    }

    [data-product-tabs-nav] > :not([data-product-tab]) {
        flex-shrink: 0;
        align-self: center;
    }

    [data-product-container] [data-inner-tab] {
        margin-inline: 0;
    }

    [data-product-container] [data-product-group-title] {
        padding-inline: 0;
    }

    [data-product-group-title] {
        padding-inline: 16px;
        font-size: 40px;
        line-height: 1;
    }

    [data-inner-tab] {
        --product-card-bg: #161618;
        --product-card-line: rgba(255, 255, 255, 0.08);
        --product-card-chip: rgba(255, 255, 255, 0.06);
        --product-card-media: #050505;

        width: auto !important;
        height: auto !important;
        margin: 0 16px 16px;
        padding: 28px 24px 24px !important;
        gap: 24px !important;
        border-radius: 24px;
        background: var(--product-card-bg) !important;
        box-shadow: inset 0 0 0 1px var(--product-card-line);
    }

    [data-inner-tab]:last-child {
        margin-bottom: 0;
    }

    [data-inner-tab][data-product-text-theme="light"] {
        --product-theme-control-bg: rgba(255, 255, 255, 0.1);
    }

    [data-inner-tab][data-product-text-theme="dark"] {
        --product-card-bg: #f5f5f7;
        --product-card-line: rgba(24, 24, 25, 0.08);
        --product-card-chip: #fff;
        --product-card-media: #fff;
        --product-theme-control-bg: rgba(24, 24, 25, 0.06);
    }

    /* Title and features */
    [data-inner-tab] > :first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        margin: 0;
        padding: 0;
    }

    [data-inner-tab] [data-product-theme-heading] {
        font-size: 24px;
        line-height: 1.25;
        letter-spacing: -0.02em;
    }

    [data-product-features] {
        flex-wrap: wrap;
        gap: 6px;
    }

    [data-product-feature] {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 12px 4px 4px;
        border-radius: 999px;
        background: var(--product-card-chip);
        box-shadow: inset 0 0 0 1px var(--product-card-line);
    }

    [data-product-feature] > :first-child {
        width: 28px;
        height: 28px;
        cursor: default;
    }

    [data-product-feature] > :first-child img {
        width: 20px;
        height: 20px;
    }

    /* The hover tooltip becomes the chip's visible label. */
    [data-product-feature-label] {
        position: static;
        visibility: visible;
        margin: 0;
        opacity: 1;
        transform: none;
        translate: none;
    }

    [data-product-feature-label] > div {
        display: block;
        min-height: 0;
        padding: 0;
    }

    [data-product-feature-label] svg {
        display: none;
    }

    [data-product-feature-label] span {
        font-size: 13px;
        line-height: 1.2;
        letter-spacing: -0.01em;
        color: var(--product-theme-text);
    }

    /* Slide */
    [data-inner-tab] [data-product-background-container] {
        order: 3;
        width: calc(100% + 48px) !important;
        height: auto !important;
        aspect-ratio: 1;
        margin-inline: -24px;
        overflow: hidden;
        border-radius: 0;
        background-color: var(--product-card-media);
        touch-action: pan-y;
    }

    [data-inner-tab] [data-product-background-container] :is(img, video) {
        object-fit: cover;
        /* The banner artwork sits near 70% of its width, slightly left of a right crop. */
        object-position: 94% center;
    }

    /* Controls and feature list */
    [data-inner-tab] > :has(> [data-product-controls]) {
        display: contents;
    }

    [data-inner-tab] [data-product-controls] {
        order: 4;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }

    [data-inner-tab] [data-product-controls] .rotate-90 {
        rotate: none;
        width: 40px;
        height: 40px;
    }

    [data-product-progress] {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
        margin-right: auto;
    }

    [data-product-progress-bar] {
        display: flex;
        gap: 4px;
    }

    [data-product-progress-bar] i {
        width: 12px;
        height: 3px;
        border-radius: 3px;
        background: var(--product-theme-border);
        transition: width 0.3s ease, background-color 0.3s ease;
    }

    [data-product-progress-bar] i.is-active {
        width: 24px;
        background: #f58220;
    }

    [data-inner-tab] [data-product-accordion-container] {
        order: 2;
        gap: 0;
        width: 100%;
        max-height: none;
        overflow: visible;
    }

    [data-inner-tab] [data-accordion-item] > div {
        padding: 18px 0;
        border-radius: 0;
        background: none !important;
        backdrop-filter: none;
        border-top: 1px solid var(--product-card-line);
    }

    [data-product-accordion-container] [data-accordion-button] {
        flex-direction: row-reverse;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        min-height: 32px;
    }

    [data-product-accordion-container] [data-accordion-button] > div:first-child {
        margin-top: 0;
        transition: border-color 0.3s ease;
    }

    [data-inner-tab] [data-accordion-item].active [data-accordion-button] > div:first-child {
        border-color: #f58220 !important;
    }

    [data-product-accordion-container] [data-accordion-button] > div:last-child {
        display: flex;
        align-items: baseline;
        font-size: 14pt;
        line-height: 1.35;
        letter-spacing: -0.01em;
    }

    [data-product-accordion-label]::before {
        content: none;
    }

    [data-inner-tab] [data-accordion-content] > div > div {
        padding: 16px 0 4px;
    }

    [data-inner-tab] [data-accordion-content] ul {
        gap: 12px;
    }

    [data-inner-tab] [data-accordion-content] li > [data-product-accordion-copy] {
        font-size: 14px;
        line-height: 1.6;
        font-weight: 400;
    }

    /* Catalogue link closes the card instead of covering the slide. */
    [data-inner-tab] [data-product-pdf] {
        position: static;
        order: 5;
        justify-content: center;
        gap: 10px;
        width: 100%;
        height: 48px;
        border-color: rgba(245, 130, 32, 0.35);
        background: rgba(245, 130, 32, 0.08);
    }

    [data-inner-tab] [data-product-pdf] > div {
        min-width: 0;
        font-size: 14px;
        font-weight: 600;
    }

    [data-product-pdf-desktop-label] { display: none; }
    [data-product-pdf-mobile-label] { display: inline; }
}

@media (min-width: 1280px) {
    [data-product-pdf-mobile-label] { display: none; }
    [data-product-progress] {
        display: none;
    }
}

/* Touch screens keep :hover after a tap, which left the arrow orange. */
@media (max-width: 1279.98px) and (hover: none) {
    [data-inner-tab] [data-product-accordion-prev]:hover > div,
    [data-inner-tab] [data-product-accordion-next]:hover > div {
        background-color: var(--product-theme-control-bg) !important;
    }

    [data-inner-tab] [data-product-accordion-prev]:hover path,
    [data-inner-tab] [data-product-accordion-next]:hover path {
        fill: var(--product-theme-text) !important;
    }
}
