/* Galería de las fichas de catálogo. */

.reinpe-cat-gallery {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.reinpe-cat-gallery-principal {
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
}

.reinpe-cat-gallery-principal img {
	display: block;
	width: 100%;
	height: auto;
}

.reinpe-cat-gallery-thumbs {
	display: grid;
	grid-template-columns: repeat(var(--reinpe-cat-gallery-cols, 5), 1fr);
	gap: 10px;
}

.reinpe-cat-gallery-thumb {
	display: block;
	padding: 0;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.reinpe-cat-gallery-thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.reinpe-cat-gallery-thumb:hover,
.reinpe-cat-gallery-thumb:focus-visible {
	border-color: #999;
}

.reinpe-cat-gallery-thumb.is-activa {
	border-color: #333;
}

/* ---------------------------------------------------------------------------
   Las miniaturas son <button>, así que el tema y Elementor les aplican su
   estilo de botón: fondo del color de marca, relleno y sombra. Hace falta más
   especificidad que la de esas reglas para devolverlas a su aspecto neutro.
   --------------------------------------------------------------------------- */

.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb,
.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb:hover,
.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb:focus,
.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb:active {
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    background: #fff;
    background-color: #fff;
    background-image: none;
    box-shadow: none;
    text-decoration: none;
    outline: none;
    line-height: 0;
    min-height: 0;
    min-width: 0;
}

.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb {
    border: 1px solid #e5e5e5;
}

.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb:hover,
.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb:focus-visible {
    border-color: #999;
}

.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb.is-activa {
    border-color: #333;
}

/* El contenedor de la imagen principal no es un botón, pero el tema puede
   darle fondo si hereda estilos de tarjeta. */
.reinpe-cat-gallery .reinpe-cat-gallery-principal {
    background: #fff;
}

/* ------------------------------------------------- Flechas e imagen ampliable */

.reinpe-cat-gallery-principal {
    position: relative;
}

.reinpe-cat-gallery.tiene-zoom .reinpe-cat-gallery-principal img {
    cursor: zoom-in;
}

.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha,
.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-zoom {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.9);
    background-image: none;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s ease, background-color 0.18s ease;
    min-height: 0;
    min-width: 0;
    line-height: 0;
}

.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha {
    top: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border-radius: 50%;
}

.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha.es-anterior {
    left: 10px;
}

.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha.es-siguiente {
    right: 10px;
}

.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-zoom {
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 4px;
}

/* Aparecen al pasar por encima; en táctil no hay hover, así que se dejan
   siempre visibles para que la galería sea usable con el dedo. */
.reinpe-cat-gallery .reinpe-cat-gallery-principal:hover button.reinpe-cat-gallery-flecha,
.reinpe-cat-gallery .reinpe-cat-gallery-principal:hover button.reinpe-cat-gallery-zoom,
.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha:focus-visible,
.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-zoom:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha,
    .reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-zoom {
        opacity: 1;
    }
}

.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-flecha:hover,
.reinpe-cat-gallery .reinpe-cat-gallery-principal button.reinpe-cat-gallery-zoom:hover {
    background: #fff;
}

/* Miniatura en uso: además del borde, se atenúan las demás. */
.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb img {
    opacity: 0.62;
    transition: opacity 0.18s ease;
}

.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb:hover img,
.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb.is-activa img {
    opacity: 1;
}

.reinpe-cat-gallery .reinpe-cat-gallery-thumbs button.reinpe-cat-gallery-thumb.is-activa {
    border-width: 2px;
    border-color: #1e293b;
}

/* ------------------------------------------------------------------ Ampliada */

body.reinpe-cat-lightbox-abierto {
    overflow: hidden;
}

.reinpe-cat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 64px;
    background: rgba(15, 23, 42, 0.92);
}

.reinpe-cat-lightbox[hidden] {
    display: none !important;
}

.reinpe-cat-lightbox__figura {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reinpe-cat-lightbox__figura img {
    max-width: 100%;
    max-height: calc(100vh - 96px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
}

.reinpe-cat-lightbox button {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    background-image: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.18s ease;
    min-height: 0;
    min-width: 0;
    line-height: 0;
}

.reinpe-cat-lightbox button:hover,
.reinpe-cat-lightbox button:focus-visible {
    background: rgba(255, 255, 255, 0.26);
}

.reinpe-cat-lightbox__cerrar {
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
}

.reinpe-cat-lightbox__flecha {
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
}

.reinpe-cat-lightbox__flecha.es-anterior {
    left: 14px;
}

.reinpe-cat-lightbox__flecha.es-siguiente {
    right: 14px;
}

.reinpe-cat-lightbox__flecha[hidden] {
    display: none !important;
}

.reinpe-cat-lightbox__contador {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    font-size: 13px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.reinpe-cat-lightbox__contador[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .reinpe-cat-lightbox {
        padding: 16px;
    }

    .reinpe-cat-lightbox__flecha {
        width: 42px;
        height: 42px;
        margin-top: -21px;
    }

    .reinpe-cat-lightbox__flecha.es-anterior {
        left: 6px;
    }

    .reinpe-cat-lightbox__flecha.es-siguiente {
        right: 6px;
    }
}

/* ---------------------------------------------------------------------------
   La ventana ampliada se inserta en <body>, fuera del widget, así que no le
   llegan los selectores acotados a .reinpe-cat-gallery y el tema le aplica su
   estilo de botón: fondo azul de marca y color de texto propio, que dejaba los
   iconos invisibles sobre ese mismo fondo. Aquí se fuerza su aspecto.
   --------------------------------------------------------------------------- */

.reinpe-cat-lightbox button.reinpe-cat-lightbox__cerrar,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__flecha,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__cerrar:hover,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__flecha:hover,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__cerrar:focus,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__flecha:focus,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__cerrar:active,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__flecha:active {
    -webkit-appearance: none !important;
    appearance: none !important;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.14) !important;
    background-color: rgba(255, 255, 255, 0.14) !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    line-height: 0 !important;
}

.reinpe-cat-lightbox button.reinpe-cat-lightbox__cerrar:hover,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__flecha:hover,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__cerrar:focus-visible,
.reinpe-cat-lightbox button.reinpe-cat-lightbox__flecha:focus-visible {
    background: rgba(255, 255, 255, 0.3) !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
}

/* Los iconos son trazos, no rellenos: si el tema les impone un fill sólido o
   hereda su color, desaparecen sobre el fondo del botón. */
.reinpe-cat-lightbox button svg {
    display: block;
    width: auto;
    height: auto;
    overflow: visible;
}

.reinpe-cat-lightbox button svg line,
.reinpe-cat-lightbox button svg polyline,
.reinpe-cat-lightbox button svg path {
    stroke: #fff !important;
    fill: none !important;
}

/* Mismo cuidado con los controles del visor, que sí están dentro del widget
   pero pueden heredar un fill del tema. */
.reinpe-cat-gallery button.reinpe-cat-gallery-flecha svg line,
.reinpe-cat-gallery button.reinpe-cat-gallery-flecha svg polyline,
.reinpe-cat-gallery button.reinpe-cat-gallery-zoom svg line,
.reinpe-cat-gallery button.reinpe-cat-gallery-zoom svg circle {
    stroke: currentColor;
    fill: none;
}
