/* =========================================================
   JUMISA — PRODUCTO ÚNICO
   Orden: variables · breadcrumb · galería · visor a pantalla
   completa · cabecera · características · colección · ficha ·
   ventajas · descripción · relacionados · formulario · móvil
   ========================================================= */

.jumisa-producto {
    --jumisa-header-height: 80px;
    --jp-borde: #e5e5e5;
    --jp-texto: #222;
    --jp-muted: #666;
    --jp-fondo-foto: #f1f0ee;
    --jp-rojo: var(--color-primary, #C61616);

    background-color: #F2F2F24D;
    color: var(--jp-texto);
}

/* =========================================================
   BREADCRUMB (igual que el archivo)
   ========================================================= */

.jumisa-producto .breadcrumb {
    align-items: center;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 300;
}

.jumisa-producto .breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.jumisa-producto .breadcrumb li {
    display: flex;
    align-items: center;
}

.jumisa-producto .breadcrumb li + li::before {
    content: "›";
    margin-right: 0.5rem;
    color: var(--jp-muted);
}

.jumisa-producto .breadcrumb a {
    color: var(--jp-muted);
    text-decoration: none;
}

.jumisa-producto .breadcrumb a:hover {
    text-decoration: underline;
}

.jumisa-producto .breadcrumb li[aria-current="page"] {
    color: var(--jp-texto);
    font-weight: 400;
}

/* =========================================================
   GALERÍA
   ========================================================= */

.jp-galeria {
    position: relative;
}

.jp-galeria-visor {
    position: relative;
    overflow: hidden;
    background: var(--jp-fondo-foto);
    border-radius: 2px;
}

/* Pista deslizable: en móvil se desliza con el dedo de forma nativa */
.jp-galeria-pista {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.jp-galeria-pista::-webkit-scrollbar {
    display: none;
}

.jp-galeria-diapositiva {
    flex: 0 0 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.jp-galeria-ampliar {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    background: none;
    overflow: hidden;
    cursor: zoom-in;
}

.jp-galeria-imagen,
.jp-galeria-ampliar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jp-galeria-sin-foto {
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

/* Lupa al pasar el ratón: capa en alta resolución */
.jp-zoom-capa {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(2.2);
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.jp-galeria-ampliar.is-zoom .jp-zoom-capa {
    opacity: 1;
}

.jp-galeria-lupa {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #111;
    font-size: 14px;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: opacity 0.25s ease;
}

.jp-galeria-visor:has(.is-zoom) .jp-galeria-lupa {
    opacity: 0;
}

/* Flechas (escritorio, aparecen al pasar el ratón) */
.jp-galeria-flecha {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #111;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.25s ease;
}

.jp-galeria-anterior { left: 12px; }
.jp-galeria-siguiente { right: 12px; }

.jp-galeria-flecha:disabled {
    visibility: hidden;
}

/* Puntos (móvil) */
.jp-galeria-puntos {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 2;
    display: flex;
    gap: 6px;
    transform: translateX(-50%);
}

.jp-galeria-punto {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.65);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.jp-galeria-punto[aria-current="true"] {
    background: #fff;
    transform: scale(1.35);
}

/* Miniaturas (escritorio) */
.jp-galeria-miniaturas {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.jp-galeria-miniatura {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    background: var(--jp-fondo-foto);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.jp-galeria-miniatura::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.jp-galeria-miniatura img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jp-galeria-miniatura:hover,
.jp-galeria-miniatura[aria-current="true"] {
    opacity: 1;
}

.jp-galeria-miniatura[aria-current="true"]::after {
    border-color: #111;
}

/* =========================================================
   VISOR A PANTALLA COMPLETA (<dialog> nativo)
   ========================================================= */

html.jp-visor-abierto {
    overflow: hidden;
}

.jp-visor {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(255, 255, 255, 0.98);
    color: #111;
    font-family: var(--font-main, sans-serif);
    overflow: hidden;
}

.jp-visor[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    animation: jp-visor-entrada 0.3s ease;
}

.jp-visor::backdrop {
    background: rgba(255, 255, 255, 0.9);
}

@keyframes jp-visor-entrada {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.jp-visor-barra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
}

.jp-visor-contador {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    color: var(--jp-muted, #666);
}

.jp-visor-acciones {
    display: flex;
    gap: 6px;
}

.jp-visor-boton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #111;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.jp-visor-boton:hover,
.jp-visor-boton:focus-visible {
    background: rgba(0, 0, 0, 0.06);
}

.jp-visor-cerrar {
    font-size: 24px;
}

.jp-visor-escenario {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.jp-visor-imagen {
    display: block;
    max-width: min(92vw, 1600px);
    max-height: calc(100vh - 190px);
    max-height: calc(100dvh - 190px);
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    cursor: zoom-in;
    -webkit-user-drag: none;
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.25s ease;
}

.jp-visor-imagen.is-arrastrando {
    transition: opacity 0.25s ease;
}

.jp-visor-imagen.is-cargando {
    opacity: 0.25;
}

.jp-visor.is-zoom .jp-visor-imagen {
    cursor: grab;
}

.jp-visor.is-zoom .jp-visor-imagen.is-arrastrando {
    cursor: grabbing;
}

.jp-visor-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    font-size: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: opacity 0.25s ease, transform 0.2s ease;
}

.jp-visor-nav:active {
    transform: scale(0.94);
}

.jp-visor-anterior { left: 16px; }
.jp-visor-siguiente { right: 16px; }

.jp-visor.is-zoom .jp-visor-nav {
    opacity: 0;
    pointer-events: none;
}

.jp-visor-miniaturas {
    display: flex;
    gap: 8px;
    justify-content: safe center;
    padding: 10px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.jp-visor-miniaturas::-webkit-scrollbar {
    display: none;
}

.jp-visor-miniatura {
    position: relative;
    flex: 0 0 64px;
    height: 64px;
    padding: 0;
    border: 0;
    background: var(--jp-fondo-foto, #f1f0ee);
    overflow: hidden;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.jp-visor-miniatura img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jp-visor-miniatura::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
}

.jp-visor-miniatura:hover,
.jp-visor-miniatura[aria-current="true"] {
    opacity: 1;
}

.jp-visor-miniatura[aria-current="true"]::after {
    border-color: #111;
}

.jp-visor-ayuda {
    margin: 0;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom));
    font-size: 11px;
    text-align: center;
    color: #888;
}

/* =========================================================
   CABECERA DEL PRODUCTO
   ========================================================= */

.jp-titulo {
    margin: 0;
    font-size: clamp(1.7rem, 2.2vw, 2.2rem);
    font-weight: 400;
    line-height: 1.15;
}

.jp-subtitulo {
    margin: 6px 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--jp-muted);
}

.jp-codigo {
    margin: 10px 0 0;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    color: var(--jp-muted);
}

.jp-codigo span {
    color: var(--jp-texto);
}

.jp-titulo-bloque {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.jp-titulo-bloque span {
    font-weight: 400;
    color: var(--jp-muted);
}

/* =========================================================
   CARACTERÍSTICAS
   (lista del atributo o descripción corta de WooCommerce)
   ========================================================= */

.jp-caracteristicas ul {
    margin: 0 !important;
    padding-left: 1.2rem;
    list-style: disc;
}

.jp-caracteristicas li {
    padding: 3px 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.jp-caracteristicas li::marker {
    color: #111;
}

/* Título que viene dentro de la descripción corta */
.jp-resumen h2,
.jp-resumen h3,
.jp-resumen h4,
.jp-resumen p > strong:only-child {
    display: block;
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.jp-resumen p {
    margin: 0 0 10px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.jp-resumen p:last-child {
    margin-bottom: 0;
}

/* =========================================================
   SELECTOR TIPO / COLECCIÓN
   ========================================================= */

.jp-selectores {
    margin-bottom: 14px;
}

.jp-selector {
    min-width: 0;
}

.jp-selector label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--jp-muted);
}

.jp-selector select {
    width: 100%;
    padding: 9px 36px 9px 14px;
    border: 1px solid var(--jp-borde);
    border-radius: 20px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23222' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    color: var(--jp-texto);
    font: inherit;
    font-size: 0.88rem;
    text-overflow: ellipsis;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.jp-selector select:hover {
    border-color: var(--jp-rojo);
}

.jp-selector select:focus-visible {
    outline: 2px solid var(--jp-rojo);
    outline-offset: 2px;
}

.jp-coleccion[aria-busy="true"] .jp-carrusel-pista {
    opacity: 0.45;
    pointer-events: none;
}

.jp-carrusel-vacio {
    flex: 1 1 100% !important;
    max-width: none !important;
    padding: 18px 0;
    font-size: 0.85rem;
    color: var(--jp-muted);
}

/* =========================================================
   COPIAR ENLACE (mismo estilo que el catálogo)
   ========================================================= */

.jp-cabecera-pie {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.jp-cabecera-pie .jp-codigo {
    margin: 0;
}

.jumisa-producto .catalogo-copiar-enlace {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--jp-borde);
    border-radius: 20px;
    background: #fff;
    color: var(--jp-texto);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.jumisa-producto .catalogo-copiar-enlace:hover {
    border-color: var(--jp-rojo);
    color: var(--jp-rojo);
}

/* =========================================================
   COLECCIÓN (carrusel)
   ========================================================= */

.jp-carrusel {
    position: relative;
}

.jp-carrusel-pista {
    position: relative;
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 2px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    transition: opacity 0.2s ease;
}

.jp-carrusel-pista::-webkit-scrollbar {
    display: none;
}

.jp-carrusel-pista li {
    flex: 0 0 calc((100% - 30px) / 4);
    max-width: 130px;
    scroll-snap-align: start;
}

.jp-coleccion-item {
    display: block;
    color: var(--jp-texto);
    text-align: center;
    text-decoration: none;
}

.jp-coleccion-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
    background: var(--jp-fondo-foto);
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: outline-color 0.2s ease, transform 0.3s ease;
}

.jp-coleccion-item span {
    display: block;
    padding-top: 6px;
    font-size: 0.78rem;
    line-height: 1.3;
}

.jp-coleccion-item:hover img {
    transform: translateY(-2px);
}

.jp-coleccion-item[aria-current="page"] img {
    outline-color: #111;
}

.jp-coleccion-item[aria-current="page"] span {
    font-weight: 600;
}

.jp-carrusel-flecha {
    position: absolute;
    top: 0;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-top: calc(min(130px, (100% - 30px) / 4) / 2 - 15px);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.jp-carrusel-anterior { left: -8px; }
.jp-carrusel-siguiente { right: -8px; }

.jp-carrusel.tiene-desborde .jp-carrusel-flecha {
    display: flex;
}

.jp-carrusel-flecha:disabled {
    visibility: hidden;
}

/* =========================================================
   FICHA TÉCNICA
   ========================================================= */

.jp-ficha {
    width: 100%;
    border: 1px solid var(--jp-borde);
    border-radius: 10px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    overflow: hidden;
    font-size: 0.9rem;
}

.jp-ficha th,
.jp-ficha td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--jp-borde);
    vertical-align: top;
}

.jp-ficha tr:last-child th,
.jp-ficha tr:last-child td {
    border-bottom: 0;
}

.jp-ficha th {
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.jp-ficha td {
    text-align: right;
    color: var(--jp-muted);
}

/* =========================================================
   VENTAJAS
   ========================================================= */

.jp-ventajas {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    margin: 16px 0 0 !important;
    padding: 16px 8px;
    list-style: none;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.jp-ventajas li {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: center;
}

.jp-ventajas i {
    font-size: 1.1rem;
    color: #111;
}

/* =========================================================
   DESCRIPCIÓN
   ========================================================= */

.jp-descripcion {
    max-width: 960px;
    padding-top: 48px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #444;
}

.jp-descripcion a {
    color: var(--jp-rojo);
}

.jp-descripcion img {
    max-width: 100%;
    height: auto;
}

/* =========================================================
   PRODUCTOS RELACIONADOS (tarjetas del catálogo)
   ========================================================= */

.jp-relacionados {
    padding-top: 40px;
}

.jumisa-producto .archivo-producto-foto {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.jumisa-producto .archivo-producto-imagen {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    transition: opacity 0.35s ease;
}

.jumisa-producto .archivo-producto-imagen-secundaria {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    pointer-events: none;
}

.jumisa-producto .archivo-producto-coleccion {
    font-size: 11px;
    font-weight: 400;
}

@media (hover: hover) and (pointer: fine) {
    .jumisa-producto
    .archivo-producto-enlace:hover
    .archivo-producto-foto:has(.archivo-producto-imagen-secundaria)
    .archivo-producto-imagen-principal {
        opacity: 0;
    }

    .jumisa-producto
    .archivo-producto-enlace:hover
    .archivo-producto-imagen-secundaria {
        opacity: 1;
    }
}

/* Valoraciones con el mismo fondo que el archivo */
.single-product #valoraciones {
    background: inherit !important;
}

/* =========================================================
   ESCRITORIO (≥992px)
   ========================================================= */

@media (min-width: 992px) {

    .jp-galeria-miniaturas {
        display: grid;
    }

    .jp-galeria-puntos {
        display: none;
    }

    .jp-galeria-flecha {
        display: flex;
    }

    .jp-galeria-visor:hover .jp-galeria-flecha,
    .jp-galeria-flecha:focus-visible {
        opacity: 1;
    }

    /* Formulario fijo al hacer scroll (igual que el archivo) */
    .jumisa-producto .contacto {
        position: sticky !important;
        top: calc(var(--jumisa-header-height) + 16px);
        align-self: flex-start;
        height: fit-content;
    }

    .jp-carrusel-pista li {
        flex-basis: calc((100% - 40px) / 5);
    }
}

/* =========================================================
   MÓVIL Y TABLET (≤991.98px)
   ========================================================= */

@media (max-width: 991.98px) {

    /* Galería a todo el ancho de la pantalla */
    .jp-galeria {
        width: 100vw;
        margin-left: calc(50% - 50vw);
    }

    .jp-galeria-visor {
        border-radius: 0;
    }

    .jp-galeria-lupa {
        top: 12px;
        bottom: auto;
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    /* Sin hueco blanco entre la cabecera y la foto */
    .jumisa-producto {
        padding-top: 0 !important;
    }

    .jumisa-producto > .row,
    .jumisa-producto > .row > .col-lg-9 > .row {
        --bs-gutter-y: 0;
    }

    .jp-info {
        padding-top: 24px;
    }

    .jp-cabecera {
        text-align: center;
    }

    .jp-cabecera-pie {
        flex-direction: column;
        justify-content: center;
    }

    .jp-visor-nav {
        display: none;
    }

    .jp-visor-miniatura {
        flex-basis: 52px;
        height: 52px;
    }

    .jp-visor-imagen {
        max-width: 100vw;
        max-height: calc(100vh - 170px);
        max-height: calc(100dvh - 170px);
    }

    .jp-descripcion {
        padding-top: 32px;
    }

    /* Que la barra fija "Solicita presupuesto" no tape el final del footer */
    .single-product .footer-custom {
        padding-bottom: calc(90px + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   REDUCIR ANIMACIONES
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .jp-visor[open] {
        animation: none;
    }

    .jp-galeria-ampliar img,
    .jp-zoom-capa,
    .jp-visor-imagen,
    .jp-coleccion-item img,
    .jumisa-producto .archivo-producto-imagen {
        transition: none !important;
    }
}