/* ============================================================
   WebinarsGallery.css — Estilos propios del widget WebinarsGallery
   Bticino Mx · Sitefinity Renderer
   ============================================================

   Galería desplegable de tarjetas de webinars. Nodos de Figma: 3944:58987 (PC), 3944:59549
   (tablet) y 3944:60352 (mobile). Tipografía: site.css.

   PC y tablet: 2 columnas con el botón arriba a la derecha. Mobile: 1 columna con el botón abajo y
   centrado. Se abre y se cierra con una animación suave: la fila de la grilla del panel anima de
   1fr a 0fr (mismo recurso de FaqCategoryCards), sin medir alturas con JS.

   Breakpoints del @media propio: mobile hasta 500px, tablet hasta 1024px, laptop hasta 1200px
   (hereda desktop), desktop de 1201px en adelante sin @media.
   ============================================================ */

/* --- Sección: fondo blanco. --- */
.WebinarsGallery {
    background-color: #ffffff;
}

/* Contenido centrado dentro del techo del sitio, con 30px arriba y abajo. Grilla de dos zonas:
   encabezado a la izquierda y botón a la derecha; el panel ocupa toda la fila de abajo. */
.WebinarsGallery-content {
    width: 100%;
    max-width: var(--container-max-width);
    margin-inline: auto;
    box-sizing: border-box;
    padding: 30px 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "head toggle"
        "panel panel";
    align-items: center;
}

/* --- Encabezado. --- */
.WebinarsGallery-header {
    grid-area: head;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.WebinarsGallery-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    line-height: normal;
    text-transform: uppercase;
    color: #1b2d3a;
}

.WebinarsGallery-eyebrow-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background-color: #1b2d3a;
}

.WebinarsGallery-title {
    margin: 0;
    font-size: 30px;
    font-weight: 900;
    line-height: normal;
    color: #0f0f12;
}

/* --- Botón de abrir y cerrar. --- */
.WebinarsGallery-toggle {
    grid-area: toggle;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    min-width: 0; /* Puede achicarse por debajo de su leyenda. */
    max-width: 100%; /* Nunca más ancho que la sección. */
    padding: 8px 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: normal;
    color: #243746;
    cursor: pointer;
}

.WebinarsGallery-toggle:focus-visible {
    outline: 2px solid #429cde;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Leyenda: dos renglones como máximo; lo que sobra se corta con puntos suspensivos. */
.WebinarsGallery-toggle-text {
    display: -webkit-box; /* Necesario para el recorte por renglones. */
    -webkit-box-orient: vertical; /* Ídem. */
    -webkit-line-clamp: 2; /* Tope de renglones. */
    line-clamp: 2; /* Ídem, versión estándar. */
    min-width: 0; /* Cede ancho al ícono. */
    overflow: hidden; /* Recorta lo que no entra. */
    overflow-wrap: anywhere; /* Una palabra larga parte en vez de desbordar. */
}

/* Abierta se ve el texto de cerrar; cerrada, el de abrir. */
.WebinarsGallery-toggle-text--closed {
    display: none;
}

.WebinarsGallery.is-closed .WebinarsGallery-toggle-text--open {
    display: none;
}

.WebinarsGallery.is-closed .WebinarsGallery-toggle-text--closed {
    display: -webkit-box; /* El mismo recorte por renglones. */
}

/* Flecha: apunta arriba con la galería abierta y gira hacia abajo al cerrar. */
.WebinarsGallery-toggle-icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.35s ease;
}

.WebinarsGallery.is-closed .WebinarsGallery-toggle-icon {
    transform: rotate(180deg);
}

/* --- Panel desplegable: la fila de la grilla anima de 1fr a 0fr. --- */
.WebinarsGallery-panel {
    grid-area: panel;
    display: grid;
    grid-template-rows: 1fr;
    visibility: visible;
    transition: grid-template-rows 0.35s ease, visibility 0s linear 0s;
}

.WebinarsGallery.is-closed .WebinarsGallery-panel {
    grid-template-rows: 0fr;
    visibility: hidden;
    /* El visibility espera a que termine el cierre para que las tarjetas salgan del orden de tabulación. */
    transition: grid-template-rows 0.35s ease, visibility 0s linear 0.35s;
}

.WebinarsGallery-panel-clip {
    min-height: 0;
    overflow: hidden;
}

/* --- Grilla de tarjetas: el espacio de arriba va dentro del panel para que se cierre con él. --- */
.WebinarsGallery-grid {
    list-style: none;
    margin: 0;
    padding: 28px 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 24px;
}

/* Tarjeta fuera de la página visible (BTCN-362): el atributo le gana al display de la grilla. */
.WebinarsGallery-card[hidden] {
    display: none;
}

/* --- Paginación de 8 en 8 (BTCN-362): "1–8 de 43 · ‹ Anterior | Siguiente ›", el mismo patrón de
   OfficeEventsCalendar y SplitPreviewShowcase. --- */
.WebinarsGallery-pager {
    display: flex; /* Conteo y leyendas en una sola fila. */
    flex-wrap: wrap; /* En un ancho muy chico las leyendas bajan en lugar de salirse. */
    align-items: center;
    justify-content: space-between; /* Conteo a la izquierda, leyendas a la derecha. */
    gap: 4px 16px;
    padding-top: 20px; /* Aire con la grilla. */
}

    .WebinarsGallery-pager[hidden] {
        display: none;
    }

.WebinarsGallery-pager-status {
    margin: 0;
    font-size: 12px;
    font-variant-numeric: tabular-nums; /* Los dígitos no bailan al cambiar de página. */
    letter-spacing: 0.2px;
    color: rgba(15, 15, 18, 0.5); /* Gris del diseño. */
}

.WebinarsGallery-pager-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto; /* A la derecha aunque la fila envuelva. */
}

/* Leyenda de texto, no botón: sin caja, sin contorno y sin fondo. */
.WebinarsGallery-pager-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 2px; /* Zona de toque cómoda sin caja visible. */
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: #429cde; /* Celeste de los enlaces de las tarjetas. */
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

    .WebinarsGallery-pager-button[hidden] {
        display: none;
    }

    /* Cuando se ven las dos, una raya fina las separa. */
    .WebinarsGallery-pager-button:not([hidden]) ~ .WebinarsGallery-pager-button:not([hidden]) {
        padding-left: 12px;
        border-left: 1px solid rgba(15, 15, 18, 0.2);
    }

    .WebinarsGallery-pager-button:hover,
    .WebinarsGallery-pager-button:active {
        opacity: 0.7;
    }

    .WebinarsGallery-pager-button:focus-visible {
        outline: 2px solid #429cde;
        outline-offset: 2px;
    }

.WebinarsGallery-pager-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Tarjeta: ícono, texto y enlace. --- */
.WebinarsGallery-card {
    position: relative;
    box-sizing: border-box;
    min-height: 100px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 16px 18px;
    background-color: #ffffff;
    border: 1px solid #e3e5e9;
    border-radius: 8px;
}

.WebinarsGallery-card-icon-box {
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #eaf3fb;
    color: #429cde;
}

.WebinarsGallery-card-icon {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* La separación va como margen izquierdo y no como gap: una tarjeta sin enlace no deja una columna vacía con su hueco. */
.WebinarsGallery-card-text {
    margin-left: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.WebinarsGallery-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: normal;
    color: #0f0f12;
}

.WebinarsGallery-card-meta {
    margin: 0;
    font-size: 12.5px;
    font-weight: 400;
    line-height: normal;
    color: #6b7280;
}

/* Enlace con la flecha estándar de LegalLinksSection: la flecha se separa al pasar el mouse. */
.WebinarsGallery-card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px; /* Separación estándar entre leyenda y flecha. */
    max-width: 280px; /* Tope estándar: ~30 caracteres por renglón. */
    min-width: 0; /* Puede achicarse por debajo de su leyenda. */
    font-size: 13px;
    font-weight: 600;
    line-height: normal;
    margin-left: 14px;
    margin-inline-end: 4px; /* Va contra la derecha: reserva los 4px que crece en hover. */
    transition: gap 0.2s ease-in-out, margin-inline-end 0.2s ease-in-out, max-width 0.2s ease-in-out; /* Flecha, reserva y tope al mismo ritmo. */
}

/* Los cinco estados le ganan al a:hover de Bootstrap: nunca subrayado. */
.WebinarsGallery-card-link,
.WebinarsGallery-card-link:link,
.WebinarsGallery-card-link:visited,
.WebinarsGallery-card-link:hover,
.WebinarsGallery-card-link:focus,
.WebinarsGallery-card-link:active {
    color: #429cde;
    text-decoration: none;
}

/* La flecha se corre al abrir la separación; reserva y tope ceden los 4px y el texto no se mueve. */
.WebinarsGallery-card-link:hover,
.WebinarsGallery-card-link:focus-visible {
    gap: 10px; /* Separación estándar en hover y foco. */
    margin-inline-end: 0; /* Cede la reserva. */
    max-width: 284px; /* El tope crece los 4px de la flecha. */
}

/* Leyenda: dos renglones como máximo; lo que sobra se corta con puntos suspensivos. */
.WebinarsGallery-link-text {
    display: -webkit-box; /* Necesario para el recorte por renglones. */
    -webkit-box-orient: vertical; /* Ídem. */
    -webkit-line-clamp: 2; /* Tope de renglones. */
    line-clamp: 2; /* Ídem, versión estándar. */
    min-width: 0; /* Cede ancho a la flecha. */
    overflow: hidden; /* Recorta lo que no entra. */
    overflow-wrap: anywhere; /* Una palabra larga parte en vez de desbordar. */
}

.WebinarsGallery-link-arrow {
    width: 14px;
    height: 14px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Sin animación para quien pidió menos movimiento. */
@media (prefers-reduced-motion: reduce) {
    .WebinarsGallery-pager-button {
        transition: none;
    }

    .WebinarsGallery-panel,
    .WebinarsGallery.is-closed .WebinarsGallery-panel,
    .WebinarsGallery-toggle-icon,
    .WebinarsGallery-card-link {
        transition: none;
    }

    .WebinarsGallery-card-link:hover,
    .WebinarsGallery-card-link:focus-visible {
        gap: 6px; /* La flecha no se corre. */
        margin-inline-end: 4px; /* La reserva se queda. */
        max-width: 280px; /* El tope no crece. */
    }
}

/* --- Tablet: 2 columnas; el enlace va en la esquina inferior derecha de cada tarjeta. --- */
@media (max-width: 1024px) {
    .WebinarsGallery-content {
        padding: 30px 32px;
    }

    .WebinarsGallery-grid {
        padding-top: 24px;
    }

    .WebinarsGallery-card {
        padding: 16px;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .WebinarsGallery-card-text {
        margin-left: 12px;
    }

    .WebinarsGallery-card-icon-box {
        width: 38px;
        height: 38px;
    }

    .WebinarsGallery-card-icon {
        width: 20px;
        height: 20px;
    }

    .WebinarsGallery-card-text {
        gap: 2px;
    }

    .WebinarsGallery-card-title {
        font-size: 14px;
    }

    .WebinarsGallery-card-meta {
        font-size: 12px;
    }

    /* El enlace sale del flujo y va en la esquina inferior derecha: el texto sigue centrado en la tarjeta, como en el nodo. */
    .WebinarsGallery-card-link {
        position: absolute;
        right: 16px;
        bottom: 9px;
        margin-left: 0; /* Solo el margen izquierdo: la reserva de la derecha se queda. */
        font-size: 12px;
    }
}

/* --- Mobile: una columna y el botón abajo, centrado. --- */
@media (max-width: 500px) {
    .WebinarsGallery-content {
        padding: 30px 20px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "head"
            "panel"
            "toggle";
    }

    .WebinarsGallery-grid {
        grid-template-columns: minmax(0, 1fr);
        padding: 20px 0 8px;
        gap: 12px;
    }

    .WebinarsGallery-card {
        padding: 14px;
    }

    .WebinarsGallery-card-link {
        right: 14px;
    }

    .WebinarsGallery-card-icon-box {
        width: 36px;
        height: 36px;
    }

    .WebinarsGallery-toggle {
        justify-self: center;
        padding: 12px 0;
    }
}
