/**
 * Integra Core — Slider de categorías por zona
 *
 * Encolado por: includes/extensions/zonas-categorias-slider.php
 * Markup esperado: .ic-zcs > .ic-zcs__track > .ic-zcs__item
 *
 * El número de elementos por pantalla llega del atributo `per_view` del
 * shortcode como variable inline `--ic-zcs-cols`. Las media queries
 * reducen el valor en tablet/móvil sin pisar la variable inline.
 *
 * La posición vertical de las flechas la fija el JS en
 * `--ic-zcs-arrow-top` (mitad de la altura real de .ic-zcs__media), de
 * modo que quedan centradas sobre la imagen y no sobre la tarjeta
 * completa (imagen + nombre).
 */

.ic-zcs {
    --ic-zcs-per-view: var(--ic-zcs-cols, 5);
    --ic-zcs-gap: 16px;
    --ic-zcs-img-ratio: 4 / 3;
    --ic-zcs-arrow-size: 40px;

    position: relative;
}

@media (max-width: 1024px) {
    .ic-zcs {
        --ic-zcs-per-view: min(var(--ic-zcs-cols, 5), 3);
    }
}

@media (max-width: 640px) {
    .ic-zcs {
        --ic-zcs-per-view: min(var(--ic-zcs-cols, 5), 2);
    }
}

/* ------------------------------------------------------------------ */
/* Track (scroll-snap)                                                 */
/* ------------------------------------------------------------------ */

.ic-zcs__track {
    display: flex;
    gap: var(--ic-zcs-gap);
    margin: 0;
    padding: 0;
    list-style: none;

    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
}

.ic-zcs__track::-webkit-scrollbar {
    display: none; /* Chrome / Safari / Edge */
}

.ic-zcs__item {
    flex: 0 0 calc((100% - (var(--ic-zcs-per-view) - 1) * var(--ic-zcs-gap)) / var(--ic-zcs-per-view));
    min-width: 0;
    scroll-snap-align: start;
}

/* ------------------------------------------------------------------ */
/* Tarjeta                                                             */
/* ------------------------------------------------------------------ */

.ic-zcs__link {
    display: block;
    color: inherit;
    text-decoration: none;
    text-align: center;
}

.ic-zcs__media {
    position: relative;
    display: block;
    aspect-ratio: var(--ic-zcs-img-ratio);
    overflow: hidden;
    /* border-radius: 8px; */
    background: #f2f2f2;
    transform: scale(1);
    transform-origin: center;
    transition:
        transform 700ms ease,
        box-shadow 300ms ease;
}

.ic-zcs__media:hover {
    transform: scale(1.02);
    box-shadow: 0 0 8px #888888;
}

/* La foto es un background-image con cover sobre un <span> interno:
   rellena siempre el contenedor y es inmune a reglas externas del tema
   (img { height: auto }) y a plugins de lazy-load que envuelven los
   <img>. cover recorta el excedente en lugar de deformar. */
.ic-zcs__img {
    position: absolute;
    inset: 0;
    display: block;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

/* .ic-zcs__link:hover .ic-zcs__img,
.ic-zcs__link:focus-visible .ic-zcs__img {
    transform: scale(1.05);
} */

.ic-zcs__name {
    display: block;
    margin-top: 8px;
    font-weight: 600;
    line-height: 1.3;
}

/* ------------------------------------------------------------------ */
/* Flechas                                                             */
/*                                                                     */
/* Siempre visibles, incluso deshabilitadas (en ese caso atenuadas).   */
/* --ic-zcs-arrow-top la escribe el JS = altura de .ic-zcs__media / 2. */
/* ------------------------------------------------------------------ */

/* .ic-zcs__arrow {
    position: absolute;
    top: calc(var(--ic-zcs-arrow-top, 50%) - var(--ic-zcs-arrow-size) / 2);
    z-index: 2;

    width: var(--ic-zcs-arrow-size);
    height: var(--ic-zcs-arrow-size);
    padding: 0;
    border: 0;
    border-radius: 50%;

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

    font-size: 22px;
    line-height: 1;
    cursor: pointer;

    background: #fff;
    color: #222;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);

    transition: opacity 0.2s ease;
}

.ic-zcs__arrow--prev {
    left: 8px;
}

.ic-zcs__arrow--next {
    right: 8px;
}

.ic-zcs__arrow:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
} */
.ic-zcs .ic-zcs__arrow {
    position: absolute;
    top: calc(var(--ic-zcs-arrow-top, 50%) - 16px);
    z-index: 2;

    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;

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

    /* Ocultar el carácter original del botón */
    font-size: 0 !important;
    line-height: 0 !important;

    background: rgba(255, 255, 255, 0.75) !important;
    color: #666 !important;
    box-shadow: none !important;
    cursor: pointer;

    transition: background-color 250ms ease, color 250ms ease;
}

.ic-zcs .ic-zcs__arrow > *,
.ic-zcs .ic-zcs__arrow::before {
    display: none !important;
}

/* Dibujar una única flecha */
.ic-zcs .ic-zcs__arrow::after {
    content: "" !important;
    display: block !important;
    width: 10px;
    height: 10px;
    background: none !important;
    border: none !important;
    border-top: 1.5px solid currentColor !important;
    border-right: 1.5px solid currentColor !important;
}

.ic-zcs .ic-zcs__arrow--prev {
    left: 8px;
}

.ic-zcs .ic-zcs__arrow--prev::after {
    transform: rotate(-135deg) !important;
    margin: 0 0 0 4px !important;
}

.ic-zcs .ic-zcs__arrow--next {
    right: 8px;
}

.ic-zcs .ic-zcs__arrow--next::after {
    transform: rotate(45deg) !important;
    margin: 0 4px 0 0 !important;
}

/* Fondo blanco completo en hover */
.ic-zcs .ic-zcs__arrow:hover {
    background: #fff !important;
    color: #666 !important;
}

.ic-zcs .ic-zcs__arrow:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}