/* ----------------------------------------------------------
   Product showcase modal — overlay
---------------------------------------------------------- */
/* hide siblings without 0×0 collapse, which breaks theme image sliders */
*:has(> .sun-product-showcase-overlay) > :not(.sun-product-showcase-overlay) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.sun-product-showcase-overlay {
    position: relative;
    background: #fff;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px;
}

/* ----------------------------------------------------------
   Product showcase modal — card layout
---------------------------------------------------------- */
.sun-product-showcase-card {
    background: #fff;
    width: 100%;
    max-width: 1200px;
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Grid items */
.sun-product-showcase-card > * {
    min-width: 0;
}

/* ----------------------------------------------------------
   Product showcase modal — info column
---------------------------------------------------------- */
.sun-product-showcase-info {
    display: flex;
    flex-direction: column;
}

.sun-product-showcase-title {
    font-size: 28px;
    margin: 0 0 8px;
}

.sun-product-showcase-price {
    font-size: 18px;
    font-weight: 500;
    color: #2c2c2c;
    margin: 0 0 16px;
}

.sun-product-showcase-price:empty {
    display: none;
}

.sun-product-showcase-description {
    flex: 1;
    color: #2c2c2c;
    font-size: 14px;
    line-height: 1.6;
    background: none;
    -webkit-text-fill-color: initial;

    /* contain author HTML from the_content on small viewports */
    max-width: 100%;
    overflow-x: auto;
}

.sun-product-showcase-description img,
.sun-product-showcase-description video,
.sun-product-showcase-description iframe {
    max-width: 100%;
    height: auto;
}

.sun-product-showcase-description p {
    margin: 0 0 1em;
    padding: 0;
    background: none;
    color: inherit;
    -webkit-text-fill-color: initial;
}

.sun-product-showcase-description p:last-child {
    margin-bottom: 0;
}

.sun-product-showcase-description strong,
.sun-product-showcase-description b {
    font-weight: bold;
    color: inherit;
}

.sun-product-showcase-description em,
.sun-product-showcase-description i {
    font-style: italic;
}

.sun-product-showcase-description ul,
.sun-product-showcase-description ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.sun-product-showcase-description a {
    color: inherit;
    text-decoration: underline;
}

/* ----------------------------------------------------------
   Product showcase modal — actions (back + CTA buttons)
---------------------------------------------------------- */
.sun-product-showcase-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    align-self: flex-start;
}

.sun-product-showcase-info .sun-product-showcase-cta,
.sun-product-showcase-info .sun-product-showcase-back {
    padding: 14px 32px;
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.sun-product-showcase-info .sun-product-showcase-cta {
    background: #2c2c2c;
    color: #fff;
    border: 1px solid #2c2c2c;
}

.sun-product-showcase-info .sun-product-showcase-cta:hover {
    background: #444;
    border-color: #444;
}

.sun-product-showcase-info .sun-product-showcase-cta:disabled,
.sun-product-showcase-info .sun-product-showcase-cta:disabled:hover {
    background: #2c2c2c;
    opacity: 0.4;
    cursor: not-allowed;
}

.sun-product-showcase-info .sun-product-showcase-back {
    background: transparent;
    color: #2c2c2c;
    border: 1px solid #2c2c2c;
}

.sun-product-showcase-info .sun-product-showcase-back:hover {
    background: #2c2c2c;
    color: #fff;
}

/* ----------------------------------------------------------
   Custom gallery — layout
---------------------------------------------------------- */
.sun-gallery {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 16px;
    align-items: start;
}

/* single-image mode: only show the main image, hide thumbs column and nav arrows */
.sun-gallery--single {
    grid-template-columns: 1fr;
}

.sun-gallery--single .sun-gallery-thumbs,
.sun-gallery--single .sun-gallery-nav {
    display: none;
}

/* empty mode (no images): hide the <img> (avoids broken-image icon when src is empty),
   the thumbs column and the nav arrows. The .sun-gallery-main gray box remains as a
   visual placeholder so the layout doesn't collapse. */
.sun-gallery--empty {
    grid-template-columns: 1fr;
}

.sun-gallery--empty .sun-gallery-thumbs,
.sun-gallery--empty .sun-gallery-nav,
.sun-gallery--empty .sun-gallery-main-img {
    display: none;
}

/* ----------------------------------------------------------
   Custom gallery — thumbnails column
---------------------------------------------------------- */
.sun-gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sun-gallery-thumbs::-webkit-scrollbar {
    display: none;
}

.sun-gallery-thumb {
    box-sizing: border-box;
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.sun-gallery-thumb.active,
.sun-gallery-thumb:hover {
    opacity: 1;
}

/* ----------------------------------------------------------
   Custom gallery — main image area
---------------------------------------------------------- */
.sun-gallery-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7f7;
    min-height: 400px;
}

.sun-gallery-main-img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    user-select: none;
}

/* ----------------------------------------------------------
   Custom gallery — prev/next navigation
---------------------------------------------------------- */
.sun-gallery-main button.sun-gallery-nav.sun-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff80;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid #524f4f80;
    width: 50px;
    height: 50px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c2c2c;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.sun-gallery-main button.sun-gallery-nav:hover {
    background-color: #ffffffbf;
    border-color: #2c2c2c;
    color: #000;
}

.sun-gallery-main button.sun-gallery-nav:focus {
    background-color: rgba(255, 255, 255, 0.75);
    border-color: #524f4f80;
    color: #000;
}

.sun-gallery-main button.sun-gallery-nav i {
    font-size: 20px;
    color: #524f4f80;
}

.sun-gallery-main button.sun-gallery-nav:hover i {
    color: #000;
}

.sun-gallery-prev {
    left: 16px;
}

.sun-gallery-next {
    right: 16px;
}

.sun-gallery-main button.sun-gallery-nav[disabled] {
    opacity: 0;
    pointer-events: none;
}

/* ----------------------------------------------------------
   Mobile layout (≤768px) — stack gallery > title > description > buttons.
   The DOM order inside .sun-product-showcase-card already matches that sequence,
   so a single-column grid is enough; no order:N juggling needed at this level.
---------------------------------------------------------- */
@media (max-width: 768px) {
    .sun-product-showcase-overlay {
        padding: 16px;
    }

    .sun-product-showcase-card {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .sun-product-showcase-title {
        font-size: 22px;
        margin: 0 0 8px;
    }

    .sun-product-showcase-actions {
        align-self: stretch;
        margin-top: 16px;
    }

    /* full-width buttons sharing the row evenly — Voltar | Encomendar */
    .sun-product-showcase-cta,
    .sun-product-showcase-back {
        flex: 1;
        padding: 12px 16px;
    }

    /* Gallery: main image on top, thumbs as a horizontal strip below.
       Both children are grid items, so `order` reorders without touching the DOM. */
    .sun-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sun-gallery-main {
        order: 1;
        min-height: 260px;
    }

    .sun-gallery-thumbs {
        order: 2;
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .sun-gallery-thumb {
        width: 56px;
        height: 56px;
    }

    .sun-gallery-main-img {
        max-height: 320px;
    }

    .sun-gallery-main button.sun-gallery-nav {
        width: 40px;
        height: 40px;
    }

    .sun-gallery-main button.sun-gallery-nav i {
        font-size: 16px;
    }

    .sun-gallery-prev {
        left: 8px;
    }

    .sun-gallery-next {
        right: 8px;
    }
}