.product-page {
    padding: 3rem 5% 7rem;
}

.back-link {
    display: inline-block;

    margin-bottom: 3rem;

    color: #969696;

    transition: color 0.2s ease;
}

.back-link:hover {
    color: #ffffff;
}


/* CONTENEDOR PRINCIPAL */

.product-detail {
    display: grid;

    grid-template-columns:
        minmax(0, 600px)
        minmax(200px, 1fr);

    gap: 4rem;

    align-items: start;
    justify-content: center;
}


/* GALERÍA */

.product-gallery {
    position: sticky;
    top: 2rem;

    display: grid;

    grid-template-columns:
        80px minmax(0, 1fr);

    grid-template-areas:
        "thumbnails main";

    gap: 1rem;

    align-items: start;
}


/* IMAGEN PRINCIPAL */

.product-main-image {
    grid-area: main;

    width: 350px;
    height: 550px;

    overflow: hidden;

    justify-self: center;
}

.product-main-image img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    background-color: #ffffff;
}


/* MINIATURAS */

.product-thumbnails {
    grid-area: thumbnails;
    
    display: flex;
    flex-direction: column;

    gap: 0.8rem;

    margin: 0;
}

.thumbnail-button {
    width: 80px;
    aspect-ratio: 3 / 4;

    padding: 0;

    border: 1px solid transparent;

    background-color: #ffffff;

    cursor: pointer;

    overflow: hidden;

    transition: border-color 0.2s ease;
}

.thumbnail-button img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    background-color: #ffffff;
}

.thumbnail-button:hover {
    border-color: #777777;
}

.thumbnail-button.active {
    border-color: #ffffff;
}

/* INFORMACIÓN */

.product-data {
    padding-top: 1rem;
}

.product-brand-detail {
    margin-bottom: 0.75rem;

    color: #8f8f8f;

    font-size: 0.75rem;
    letter-spacing: 0.18rem;

    text-transform: uppercase;
}

.product-data h1 {
    margin-bottom: 1rem;

    font-size: clamp(
        2.5rem,
        5vw,
        4.5rem
    );

    line-height: 1;
}

.product-price-detail {
    margin-bottom: 3rem;

    font-size: 1.25rem;
}


/* DETALLES */

.product-options {
    display: flex;
    flex-direction: column;

    gap: 2rem;

    margin-bottom: 3rem;
}

.product-option {
    padding-bottom: 1.5rem;

    border-bottom: 1px solid #272727;
}

.product-option-label {
    margin-bottom: 0.6rem;

    color: #8f8f8f;

    font-size: 0.75rem;

    letter-spacing: 0.15rem;

    text-transform: uppercase;
}

.product-option-value {
    font-size: 1rem;
}


/* TALLAS */

.size-list {
    display: flex;
    flex-wrap: wrap;

    gap: 0.7rem;
}

.size-button {
    min-width: 48px;

    padding: 0.7rem;

    border: 1px solid #3a3a3a;

    background: transparent;
    color: #ffffff;

    cursor: pointer;
}

.size-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
}

.size-button:disabled:hover {
    border-color: #3a3a3a;
}

.size-button:hover {
    border-color: #ffffff;
}

.size-button.selected {
    background-color: #f5f5f5;
    color: #111111;

    border-color: #f5f5f5;
}

/*STOCK*/

.stock-status {
    margin-top: 0.9rem;

    color: #999999;

    font-size: 0.85rem;
}

/* ACCIÓN */

.product-action {
    width: 100%;

    padding: 1rem 1.5rem;

    border: none;

    background-color: #f5f5f5;
    color: #111111;

    font-weight: 600;

    cursor: pointer;
}

.product-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* DESCRIPCIÓN */

.product-description {
    margin-top: 4rem;

    padding-top: 2rem;

    border-top: 1px solid #272727;
}

.product-description h2 {
    margin-bottom: 1rem;

    font-size: 1.2rem;
}

.product-description p {
    max-width: 600px;

    color: #aaa;

    line-height: 1.7;
}


/* ERROR */

.product-error {
    min-height: 60vh;

    display: flex;
    flex-direction: column;

    align-items: flex-start;
    justify-content: center;

    gap: 1.5rem;
}


/* RELATED PRODUCTS*/

.related-section {
    margin-top: 8rem;

    padding-top: 5rem;

    border-top: 1px solid #262626;
}

.related-header {
    margin-bottom: 3rem;
}

.related-header p {
    margin-bottom: 0.5rem;

    color: #888888;

    font-size: 0.75rem;
    letter-spacing: 0.18rem;
}

.related-header h2 {
    font-size: clamp(
        2rem,
        4vw,
        3.5rem
    );
}

/* RESPONSIVE */

@media (max-width: 850px) {

    .product-detail {
        grid-template-columns: 1fr;

        gap: 3rem;
    }

    .product-gallery {
        position: static;
    }

}


@media (max-width: 650px) {

    .product-page {
        padding-left: 4%;
        padding-right: 4%;
        padding-top: 1.5rem;
    }

    .product-data h1 {
        font-size: 2.5rem;
        padding-top: 0;
    }

    .product-detail {
        gap: 1.8rem;
    }

    .product-description {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .product-gallery {
        display: flex;
        flex-direction: column;
    }

    .product-main-image {
        width: 100%;
        max-width: none;
        max-height: 65vh;

        justify-self: auto;
        object-fit: contain;
    }

    .product-option {
        padding-bottom: 1rem;
    }

    .product-options {
        gap: 1.2rem;
        margin-bottom: 1.8rem;
    }

    .product-thumbnails {
        order: 2;

        width: 100%;

        display: flex;
        flex-direction: row;

        gap: 0.7rem;

        overflow-x: auto;
    }

    .thumbnail-button {
        flex: 0 0 70px;

        width: 70px;
    }

    .related-section {
        margin-top: 3rem;
        padding-top: 2rem;
    }

    .related-header h2 {
        font-size: 1.5rem;
    }

    .related-section .product-grid {
        display: flex;

        gap: 1rem;

        overflow-x: auto;

        scroll-snap-type: x mandatory;

        padding-bottom: 1rem;
    }

    .related-section .product-card {
        flex: 0 0 70%;

        scroll-snap-align: start;
    }

    .back-link {
        margin-bottom: 1.5rem;
    }
}
/* Acordeón nativo: funciona con teclado y sin eventos adicionales. */
.product-description summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; min-height: 48px; list-style: none; }
.product-description summary::-webkit-details-marker { display: none; }
.product-description summary h2 { margin: 0; }
.product-description[open] summary { margin-bottom: 1rem; }
.accordion-icon::before { content: "+"; font-size: 1.5rem; }
.product-description[open] .accordion-icon::before { content: "−"; }
.product-main-image { max-width: 100%; }
.product-data, .product-gallery { min-width: 0; }
.product-data h1 { overflow-wrap: anywhere; }
@media (max-width: 650px) { .product-data { padding-top: 0; } }


/* Selección libre de prendas de una colección. */
.outfit { margin: 1.5rem 0; min-width: 0; }
.outfit h2 { font-size: 1.25rem; line-height: 1.35; }
.outfit-hint { color: #adadad; font-size: .85rem; margin: .5rem 0 1rem; }
.outfit-list { display: grid; gap: .75rem; }
.outfit-card { display: flex; gap: .75rem; padding: .75rem; border: 1px solid #333; min-width: 0; }
.outfit-card > img { width: 72px; height: 110px; object-fit: contain; background: #fff; flex-shrink: 0; }
.outfit-info { min-width: 0; flex: 1; }
.outfit-info label { display: flex; align-items: start; gap: .5rem; cursor: pointer; font-size: .9rem; }
.outfit-info input { margin-top: .2rem; accent-color: #fff; flex-shrink: 0; }
.outfit-info > p { margin: .4rem 0; font-size: .85rem; }
.outfit-info fieldset { border: 0; min-width: 0; padding: 0; margin-top: .5rem; }
.outfit-info legend { font-size: .75rem; color: #adadad; margin-bottom: .4rem; }
.outfit-info .size-list { gap: .3rem; flex-wrap: wrap; }
.outfit-info .size-button { min-width: 40px; min-height: 44px; padding: .35rem; }
.outfit-summary { margin-top: 1rem; padding: 1rem 0; border-top: 1px solid #333; font-size: .95rem; }
.order-error { color: #ffb9b9; font-size: .9rem; margin: .75rem 0; }
.order-error:empty { display: none; }
@media (max-width: 650px) {
    .outfit-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .5rem; }
    .outfit-card { flex: 0 0 94%; scroll-snap-align: start; }
    .outfit-card > img { width: 56px; height: 96px; }
    .outfit-info legend { font-size: .7rem; }
}
.quantity-control { display: flex; align-items: center; gap: .75rem; margin: .75rem 0; font-size: .9rem; }
.quantity-control input { width: 80px; min-height: 44px; padding: .5rem; color: #f5f5f5; background: #111; border: 1px solid #444; font: inherit; color-scheme: dark; }
.outfit-info .quantity-control { align-items: center; font-size: .8rem; }
.size-quantity-row { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.size-quantity-row > .size-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.quantity-control { display: inline-flex; flex-shrink: 0; align-items: center; gap: .2rem; margin: 0; padding: .3rem; border-radius: 999px; background: #0754df; color: white; }
.quantity-control button { width: 32px; height: 36px; border: 0; border-radius: 50%; color: white; background: #003bab; font-size: 1.5rem; cursor: pointer; }
.quantity-control button:disabled { opacity: .45; cursor: default; }
.quantity-control .quantity-value { display: flex; align-items: center; gap: .1rem; color: white; font-size: .75rem; }
.quantity-control input { width: 30px; min-height: 36px; padding: 0; border: 0; background: transparent; color: white; text-align: center; font-weight: 700; appearance: textfield; -moz-appearance: textfield; }
.quantity-control input::-webkit-inner-spin-button, .quantity-control input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.quantity-control :focus-visible { outline: 2px solid white; outline-offset: 2px; }
.selected-extras { display: grid; gap: .75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #333; }
.selected-extras .outfit-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); }
.selected-extras .outfit-card > img { grid-row: 1 / 3; width: 56px; height: 85px; }
.selected-extras .outfit-info { display: contents; }
.selected-extras .outfit-info > label, .selected-extras .outfit-info > p { grid-column: 2; }
.selected-extras fieldset { grid-column: 1 / -1; }
@media (max-width: 650px) {
    .size-quantity-row { gap: .5rem; }
    .size-quantity-row .size-button { min-width: 36px; padding: .3rem; }
}
/* Ficha adaptable con resumen de pedido lateral. */
.quantity-control { background: #242424; border: 1px solid #4a4a4a; color: #f5f5f5; }
.quantity-control button { background: #3c3c3c; color: #fff; }
.product-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
.product-gallery { grid-template-columns: 60px minmax(0, 1fr); gap: .75rem; }
.product-thumbnails .thumbnail-button { width: 60px; }
.product-main-image { width: 100%; max-width: 350px; }
.product-data h1 { font-size: clamp(2rem, 3vw, 3.8rem); }
.product-options { margin-bottom: 0; gap: 1rem; }
.product-option { padding-bottom: 1rem; }
.product-option:last-child { border-bottom: 0; padding-bottom: 0; }
.selected-extras { margin-top: 1rem; padding-top: 0; border-top: 0; }
.outfit { margin: 1.25rem 0 0; }
.product-description { margin-top: 1.5rem; padding-top: 1rem; }
.order-panel { grid-column: 2; padding: 1.25rem; border: 1px solid #333; background: #111; align-self: start; min-width: 0; }
.order-panel h2 { font-size: 1.1rem; }
.order-panel .outfit-summary { margin: .75rem 0 1rem; padding: 0; border: 0; line-height: 1.7; }
.order-panel .product-action { margin: 0; }
@media (min-width: 1200px) {
    .product-detail { grid-template-columns: minmax(260px, 1fr) minmax(350px, 1.2fr) minmax(230px, .65fr); }
    .order-panel { grid-column: 3; position: sticky; top: 2rem; }
}
@media (max-width: 850px) {
    .product-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }
    .product-gallery { display: flex; flex-direction: column; position: static; }
    .product-thumbnails { flex-direction: row; order: 2; }
    .product-main-image { height: 420px; }
}
@media (max-width: 650px) {
    .product-detail { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .product-main-image { height: min(42svh, 350px); max-height: 350px; width: 100%; }
    .product-thumbnails .thumbnail-button { width: 44px; flex-basis: 44px; }
    .order-panel { grid-column: 1; padding: 1rem; }
    .product-data h1 { font-size: 2rem; }
}
#main-product-image { cursor: zoom-in; }
.viewer-open { overflow: hidden; }
.image-viewer { width: calc(100vw - 2rem); max-width: 1500px; height: calc(100dvh - 2rem); max-height: none; margin: auto; padding: 0; background: #111; color: #f5f5f5; border: 1px solid #444; }
.image-viewer::backdrop { background: rgb(0 0 0 / .85); }
.viewer-toolbar { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 1rem; font-size: .85rem; }
.viewer-close { flex-shrink: 0; width: 44px; height: 44px; background: #222; color: white; border: 1px solid #555; font-size: 1.8rem; cursor: pointer; }
.viewer-close { margin-left: auto; }
@media (min-width: 651px) { .viewer-toolbar p { display: none; } }
.viewer-stage { height: calc(100% - 60px); overflow: auto; display: flex; align-items: center; justify-content: center; padding: 12px; }
.viewer-image { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; flex-shrink: 0; }
.viewer-stage.zoomed { display: block; }
.viewer-stage.zoomed .viewer-image { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
@media (max-width: 650px) { .image-viewer { width: 100vw; height: 100dvh; border: 0; } .viewer-toolbar { font-size: .75rem; } }
.outfit-card:has(input:checked) { display: grid; grid-template-columns: 56px minmax(0, 1fr); }
.outfit-card:has(input:checked) > img { grid-row: 1 / 3; width: 56px; height: 85px; }
.outfit-card:has(input:checked) .outfit-info { display: contents; }
.outfit-card:has(input:checked) .outfit-info > label, .outfit-card:has(input:checked) .outfit-info > p { grid-column: 2; }
.outfit-card:has(input:checked) fieldset { grid-column: 1 / -1; }
.order-panel #order-summary { white-space: pre-line; }
.image-viewer { background: rgb(17 17 17 / .42); }
.image-viewer::backdrop { background: rgb(0 0 0 / .4); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.viewer-arrow { position: absolute; top: 50%; z-index: 2; width: 44px; height: 52px; border: 1px solid #777; border-radius: 6px; background: rgb(20 20 20 / .85); color: #fff; font-size: 2.3rem; cursor: pointer; }
.viewer-prev { left: 12px; }
.viewer-next { right: 12px; }
.viewer-counter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: .25rem .65rem; background: #111c; border-radius: 12px; color: #fff; font-size: .8rem; pointer-events: none; }

.quantity-control.quantity-inactive{opacity:.5}.quantity-control.quantity-inactive :is(input,button){cursor:not-allowed}
.low-stock-note{color:var(--color-gold-hover,#d3b780);font-size:.875rem;line-height:1.5;margin:6px 0 0}.low-stock-note:empty{margin:0}

/* Product-only composition; package galleries retain their own layout. */
.producto-page .product-page{padding-inline:clamp(12px,2vw,32px)}
.producto-page #product-detail{max-width:none;gap:clamp(16px,1.5vw,28px);align-items:start}
.producto-page #product-detail>.order-panel{padding:clamp(16px,1.4vw,24px);align-self:start}
.producto-page #product-detail>.order-panel .product-action{width:100%;white-space:normal;overflow-wrap:anywhere}
.producto-page #product-detail>.order-panel #add-cart{margin-top:12px}
@media(min-width:1200px){
 .producto-page #product-detail{grid-template-columns:minmax(0,38fr) minmax(0,39fr) minmax(0,23fr)}
 .producto-page #product-detail>.product-gallery{grid-column:1;grid-row:1}
 .producto-page #product-detail>.product-data{grid-column:2;grid-row:1}
 .producto-page #product-detail>.order-panel{grid-column:3;grid-row:1}
}
@media(min-width:851px){
 .producto-page #product-detail .product-main-image{width:100%;max-width:none;height:auto;aspect-ratio:3/4;max-height:min(75svh,720px)}
 .producto-page #product-detail .product-main-image img{display:block;width:100%;height:100%;object-fit:contain;object-position:center}
}
@media(min-width:851px) and (max-width:1199px){
 .producto-page #product-detail{grid-template-columns:minmax(0,48fr) minmax(0,52fr)}
 .producto-page #product-detail>.product-gallery{grid-column:1;grid-row:1 / 3}
 .producto-page #product-detail>.product-data{grid-column:2;grid-row:1}
 .producto-page #product-detail>.order-panel{grid-column:2;grid-row:2;position:static}
}
/* Navigation controls exist only in the shared dialog, never over this gallery. */
.producto-page .image-viewer .viewer-arrow{top:calc(50% + 30px);transform:translateY(-50%);width:44px;height:48px;background:rgb(8 18 29 / .78)}
