/* ═══════════════════════════════════════════════════
   HEY! Grid — Elementor Widget  |  heyworld.es
   ═══════════════════════════════════════════════════ */

/* ── Variables ── */
.hg-wrapper {
    --hg-gap:         24px;
    --hg-radius:      12px;
    --hg-arrow-size:  44px;
    --hg-dot-size:    8px;
    --hg-transition:  0.4s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    width: 100%;
    overflow: visible;
}

/* ── Track exterior (viewport del slider) ── */
.hg-track-outer {
    overflow: hidden;
    width: 100%;
}

/* ── Track (el "carro" que se mueve) ── */
.hg-track {
    display: flex;
    gap: var(--hg-gap);
    transition: transform var(--hg-transition);
    will-change: transform;
}

/* ── Slides ── */
/* Por defecto (sin slider): cada slide ocupa la mitad del ancho */
.hg-slide {
    flex: 0 0 calc(50% - var(--hg-gap) / 2);
    min-width: 0;
}

/* Cuando hay slider activo (>2 imágenes) */
.hg-has-slider .hg-slide {
    /* En desktop: dos slides por "página" */
    flex: 0 0 calc(50% - var(--hg-gap) / 2);
    min-width: 0;
}

/* ── Tarjeta ── */
.hg-card {
    background: #ffffff;
    border-radius: var(--hg-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.13);
}

/* ── Imagen ── */
.hg-card-image-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.hg-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.hg-card:hover .hg-card-image {
    transform: scale(1.04);
}

/* ── Contenido ── */
.hg-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hg-card-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

.hg-title-link {
    text-decoration: none;
    color: inherit;
}

.hg-title-link:hover .hg-card-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hg-card-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555577;
    flex: 1;
}

/* ── Flechas ── */
.hg-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(calc(-50% - 24px)); /* centrado en la imagen, no en toda la tarjeta */
    z-index: 10;

    width: var(--hg-arrow-size);
    height: var(--hg-arrow-size);
    border-radius: 50%;
    background: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    padding: 0;
}

.hg-arrow:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    background: #f5f5fa;
}

.hg-arrow svg {
    fill: #1a1a2e;
    pointer-events: none;
}

.hg-arrow-prev {
    left: -22px;
}

.hg-arrow-next {
    right: -22px;
}

/* Estado deshabilitado */
.hg-arrow[disabled] {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* ── Puntos ── */
.hg-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.hg-dot {
    width: var(--hg-dot-size);
    height: var(--hg-dot-size);
    border-radius: 50%;
    background: #ccccdd;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, width 0.25s;
}

.hg-dot.is-active {
    background: #1a1a2e;
    width: calc(var(--hg-dot-size) * 2.5);
    border-radius: 4px;
}

.hg-dot:hover:not(.is-active) {
    background: #9999bb;
    transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════
   MODO CUADRÍCULA — Todos los elementos visibles
   ═══════════════════════════════════════════════════ */

/* En modo cuadrícula el track-outer NO oculta nada */
.hg-layout-grid .hg-track-outer {
    overflow: visible;
}

/* El track se envuelve en múltiples filas */
.hg-layout-grid .hg-track {
    flex-wrap: wrap;
    gap: var(--hg-gap);
}

/* Columnas */
.hg-layout-grid.hg-cols-1 .hg-slide {
    flex: 0 0 100%;
}

.hg-layout-grid.hg-cols-2 .hg-slide {
    flex: 0 0 calc(50% - var(--hg-gap) / 2);
}

.hg-layout-grid.hg-cols-3 .hg-slide {
    flex: 0 0 calc(33.333% - var(--hg-gap) * 2 / 3);
}

.hg-layout-grid.hg-cols-4 .hg-slide {
    flex: 0 0 calc(25% - var(--hg-gap) * 3 / 4);
}

/* En móvil: siempre 1 columna en modo cuadrícula */
@media (max-width: 767px) {
    .hg-layout-grid .hg-slide {
        flex: 0 0 100% !important;
    }
    .hg-layout-grid .hg-track {
        gap: var(--hg-gap);
    }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — Tablet (768px y menos)
   ═══════════════════════════════════════════════════ */
@media (max-width: 767px) {

    /* En móvil: UN slide a la vez */
    .hg-slide,
    .hg-has-slider .hg-slide {
        flex: 0 0 100%;
        min-width: 0;
    }

    /* El gap en móvil se usa para la separación entre slides (fuera de vista) */
    .hg-track {
        gap: 0; /* separación gestionada por el JS con translate */
    }

    /* Flechas más pegadas en móvil */
    .hg-arrow-prev { left: -10px; }
    .hg-arrow-next { right: -10px; }
    .hg-arrow {
        --hg-arrow-size: 38px;
    }

    /* Los puntos en móvil representan cada slide individual */
    /* (el JS los recalcula para móvil) */
}

/* ═══════════════════════════════════════════════════
   ACCESIBILIDAD
   ═══════════════════════════════════════════════════ */
.hg-arrow:focus-visible,
.hg-dot:focus-visible {
    outline: 3px solid #4a90d9;
    outline-offset: 3px;
}

/* Reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    .hg-track           { transition: none; }
    .hg-card            { transition: none; }
    .hg-card:hover      { transform: none; }
    .hg-card-image      { transition: none; }
    .hg-card:hover .hg-card-image { transform: none; }
}

/* ═══════════════════════════════════════════════════
   EDITOR DE ELEMENTOR — correcciones de preview
   ═══════════════════════════════════════════════════ */
.elementor-editor-active .hg-track {
    transition: none;
}
