/**
 * Integra Core — Municipios → grid de categorías por zona
 *
 * Encolado por: includes/extensions/zonas-municipios-categorias.php
 * Markup esperado:
 *   .ic-zmc > .ic-zmc__controls > .ic-zmc__select
 *           > .ic-zmc__grid    > .ic-zmc__item
 *
 * Grid de 3 columnas en escritorio (2 en tablet ≤1024px, 1 en móvil
 * ≤640px) con tarjetas imagen (background cover) + nombre +
 * "Más información".
 */

.ic-zmc {
    --ic-zmg-cols: 3;
    --ic-zmg-gap: 48px;
    --ic-zmg-max-width: 1100px;
    --ic-zmg-img-ratio: 4 / 3;
}

@media (max-width: 1024px) {
    .ic-zmc {
        --ic-zmg-cols: 2;
    }
}

@media (max-width: 640px) {
    .ic-zmc {
        --ic-zmg-cols: 1;
    }
}

/* ------------------------------------------------------------------ */
/* Select de municipios                                                */
/* ------------------------------------------------------------------ */

.ic-zmc__controls {
    display: flex;
    justify-content: center;
    margin-bottom: var(--ic-zmg-gap);
}

/* Compacto (nunca a todo el ancho aunque el tema ponga select{100%}),
   centrado y con padding generoso alrededor del texto. */
.ic-zmc__select {
    width: auto;
    min-width: 240px;
    max-width: 100%;
    padding: 10px 44px 10px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    font-size: 1em;
    line-height: 1.4;
}

/* ------------------------------------------------------------------ */
/* Grid                                                                */
/* ------------------------------------------------------------------ */

/* Flexbox en lugar de grid: con justify-content:center las filas
   incompletas (1-2 items) quedan centradas en lugar de alinearse a la
   izquierda. Ancho máximo + gap amplio: tarjetas compactas y con aire. */
.ic-zmc__grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ic-zmg-gap);
    max-width: var(--ic-zmg-max-width);
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.ic-zmc__item {
    flex: 0 0 calc((100% - (var(--ic-zmg-cols) - 1) * var(--ic-zmg-gap)) / var(--ic-zmg-cols));
    min-width: 0;
}

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

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

/* Foto como background-image con cover (igual que el slider): rellena
   siempre el contenedor y es inmune a reglas externas del tema y a
   plugins de lazy-load que envuelven los <img>. */
.ic-zmc__img {
    position: absolute;
    inset: 0;
    display: block;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease;
}

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

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

.ic-zmc__more {
    display: inline-block;
    margin-top: 2px;
    font-size: 0.9em;
    text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Estados                                                             */
/* ------------------------------------------------------------------ */

/* Item de "sin resultados": ocupa toda la fila. */
.ic-zmc__empty {
    flex-basis: 100%;
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 0;
    padding: 0;
}

/* Durante la petición AJAX se atenúa el grid y se bloquea el select
   (el JS lo deshabilita). */
.ic-zmc--loading .ic-zmc__grid {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
