/* PartsDone ProductPage 1.4.0 */

/* Review summary on the left, brand visual on the right below the title. */
.product-info-main .my-2.flex:has(> [data-pd-product-brand]) {
    width: 100%;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.pd-product-brand {
    display: inline-flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex: 0 0 auto;
    max-width: 135px;
    min-height: 29px;
    margin-left: auto;
    line-height: 1;
}

.pd-product-brand__image {
    display: block;
    width: auto;
    max-width: 135px;
    height: auto;
    max-height: 54px;
    object-fit: contain;
    object-position: right bottom;
}

.pd-product-brand__fallback {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

/* FitmentPro is already inside a Hyva section card. */
section[id="partsdone.product.fitment.section"] .pd-compatibility {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

section[id="partsdone.product.fitment.section"] .pd-compatibility__details {
    display: block;
}

section[id="partsdone.product.fitment.section"] .pd-compatibility__details > summary {
    display: none;
}

section[id="partsdone.product.fitment.section"] .pd-fitment-table__controls {
    margin-top: 0;
}

/* Main product image navigation. */
.pd-gallery-arrows-host {
    position: relative;
}

.pd-gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(17, 24, 39, 0.14);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-fg, #111827);
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.14);
    cursor: pointer;
    transform: translateY(-50%);
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease,
        opacity 150ms ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.pd-gallery-arrow--previous {
    left: 12px;
}

.pd-gallery-arrow--next {
    right: 12px;
}

.pd-gallery-arrow:hover {
    background: #fff;
    border-color: rgba(17, 24, 39, 0.24);
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.18);
}

.pd-gallery-arrow:active {
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.16);
}

.pd-gallery-arrow:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.pd-gallery-arrow__chevron {
    display: block;
    width: 10px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
}

.pd-gallery-arrow--previous .pd-gallery-arrow__chevron {
    margin-left: 4px;
    transform: rotate(-135deg);
}

.pd-gallery-arrow--next .pd-gallery-arrow__chevron {
    margin-right: 4px;
    transform: rotate(45deg);
}

/* Pointer devices: controls appear only on hover or true keyboard focus. */
@media (hover: hover) and (pointer: fine) {
    .pd-gallery-arrow {
        opacity: 0;
        pointer-events: none;
    }

    .pd-gallery-arrows-host:hover .pd-gallery-arrow,
    .pd-gallery-arrows-host:has(.pd-gallery-arrow:focus-visible) .pd-gallery-arrow {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 767px) {
    .product-info-main .my-2.flex:has(> [data-pd-product-brand]) {
        gap: 10px;
    }

    .pd-product-brand {
        max-width: 99px;
        min-height: 24px;
    }

    .pd-product-brand__image {
        max-width: 99px;
        max-height: 40px;
    }

    .pd-gallery-arrow {
        width: 38px;
        height: 38px;
    }

    .pd-gallery-arrow--previous {
        left: 8px;
    }

    .pd-gallery-arrow--next {
        right: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pd-gallery-arrow {
        transition: none;
    }
}

/* Hyva 1.4.6 fullscreen overlay: keep the page visible behind the gallery. */
#gallery > :is([role="dialog"], [aria-modal="true"]) {
    background-color: rgba(255, 255, 255, 0.78) !important;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

#gallery > :is([role="dialog"], [aria-modal="true"]) #gallery-main {
    background-color: transparent !important;
}

/* PartsDone Hyva fullscreen gallery presentation. */
#gallery {
    --pd-gallery-bottom-nav-offset: 0px;
}


/* Fullscreen image stage. */
#gallery > :is([role="dialog"], [aria-modal="true"])
> div.relative.self-center.w-full {
    position: absolute !important;

    top: 16px !important;
    right: 56px !important;

    bottom: calc(
        152px + var(--pd-gallery-bottom-nav-offset)
    ) !important;

    left: 56px !important;

    width: auto !important;
    height: auto !important;
    margin: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    background: rgba(255, 255, 255, 0.72) !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#gallery-main {
    position: relative !important;

    width: 100% !important;
    height: 100% !important;

    margin: 0 !important;

    background: transparent !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#gallery-main > img {
    max-width: 100% !important;

    max-height: calc(100vh - 184px) !important;
    max-height: calc(100dvh - 184px) !important;

    object-fit: contain !important;
    object-position: center !important;
}


/* Fullscreen thumbnail tray. */
#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs {
    box-sizing: border-box !important;

    position: fixed !important;

    left: 0 !important;
    right: 0 !important;

    bottom:
        var(--pd-gallery-bottom-nav-offset)
        !important;

    width: auto !important;

    height: 104px !important;
    min-height: 104px !important;

    margin: 0 !important;
    padding: 8px 60px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    gap: 0 !important;

    overflow: hidden !important;

    background: rgba(255, 255, 255, 0.92) !important;

    z-index: 40 !important;
}


/* Hide Hyva thumbnail-strip arrow buttons in fullscreen. */
#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs > button {
    display: none !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .thumbs-wrapper {
    position: relative !important;

    width: auto !important;
    max-width: 100% !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    gap: 8px !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;

    scrollbar-width: auto !important;
    scroll-snap-type: none !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .js_thumbs_slide {
    flex: 0 0 auto !important;
    margin: 0 !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .js_thumbs_slide > button {
    box-sizing: border-box !important;

    padding: 2px !important;

    background: #fff !important;

    border: 1px solid #adadad !important;
    border-radius: 0 !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .js_thumbs_slide > button:hover,

#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .js_thumbs_slide > button:focus,

#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .js_thumbs_slide > button.border-primary {
    border-color:
        var(--color-primary, #1f48c5)
        !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
#thumbs .js_thumbs_slide img {
    display: block !important;

    width: 80px !important;
    height: 80px !important;

    max-width: none !important;

    object-fit: contain !important;
}


/* Fullscreen 1 / N counter. */
.pd-gallery-counter {
    display: none;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
.pd-gallery-counter {
    position: fixed !important;

    left: 50% !important;

    bottom: calc(
        104px + var(--pd-gallery-bottom-nav-offset)
    ) !important;

    transform: translateX(-50%) !important;

    z-index: 10001 !important;

    display: block;

    padding: 4px 10px !important;

    background: rgba(255, 255, 255, 0.92) !important;

    border: 1px solid #d6d6d6 !important;
    border-radius: 9999px !important;

    color: #6b6b6b !important;

    font-size: 12px !important;
    line-height: 18px !important;

    pointer-events: none !important;
}


/*
 * Fullscreen arrows retain the existing PartsDone arrow geometry
 * and use its verified normal-gallery hover appearance.
 */
#gallery > :is([role="dialog"], [aria-modal="true"])
.pd-gallery-arrow {
    position: fixed !important;

    z-index: 10002 !important;

    background: #fff !important;

    border-color:
        rgba(17, 24, 39, 0.24)
        !important;

    box-shadow:
        0 4px 12px
        rgba(17, 24, 39, 0.18)
        !important;

    opacity: 1 !important;
    pointer-events: auto !important;
}


/* Fullscreen close control. */
#gallery > :is([role="dialog"], [aria-modal="true"])
[x-ref="galleryFullscreenCloseBtn"] {
    position: fixed !important;

    top: 16px !important;
    right: 16px !important;

    z-index: 10003 !important;

    display: block !important;

    padding: 12px !important;

    background: transparent !important;

    border: 0 !important;
    box-shadow: none !important;

    color: #6b7280 !important;
}


#gallery > :is([role="dialog"], [aria-modal="true"])
[x-ref="galleryFullscreenCloseBtn"]:hover,

#gallery > :is([role="dialog"], [aria-modal="true"])
[x-ref="galleryFullscreenCloseBtn"]:focus {
    color: #4b5563 !important;
}


/* Returns-style mobile dimensions. */
@media (max-width: 767px) {

    #gallery > :is([role="dialog"], [aria-modal="true"])
    > div.relative.self-center.w-full {
        top: 12px !important;
        right: 44px !important;

        bottom: calc(
            132px + var(--pd-gallery-bottom-nav-offset)
        ) !important;

        left: 44px !important;
    }


    #gallery > :is([role="dialog"], [aria-modal="true"])
    #gallery-main > img {
        max-height:
            calc(100vh - 156px)
            !important;

        max-height:
            calc(100dvh - 156px)
            !important;
    }


    #gallery > :is([role="dialog"], [aria-modal="true"])
    #thumbs {
        height: 88px !important;
        min-height: 88px !important;

        padding: 6px 48px !important;

        justify-content: flex-start !important;
    }


    #gallery > :is([role="dialog"], [aria-modal="true"])
    #thumbs .thumbs-wrapper {
        justify-content: flex-start !important;
    }


    #gallery > :is([role="dialog"], [aria-modal="true"])
    #thumbs .js_thumbs_slide img {
        width: 70px !important;
        height: 70px !important;
    }


    #gallery > :is([role="dialog"], [aria-modal="true"])
    .pd-gallery-counter {
        bottom: calc(
            92px + var(--pd-gallery-bottom-nav-offset)
        ) !important;
    }
}

