/*
 * UCB Brand Shortcode Styles
 * ---------------------------------------- */

/* --- Variables Globales --- */
.ucb-brand {
    --ucb-gap: 1rem;
    --ucb-title-font-size: clamp(1rem, 1.5vw + 0.5rem, 1.25rem);
    --ucb-anchor-font-size: 0.9rem;
    --ucb-media-max-width: 120px;
    --ucb-border-color: #e0e0e0;

    display: flex;
    flex-wrap: nowrap; /* Cambiado para mejor control */
    align-items: center;
    gap: var(--ucb-gap);
    padding: var(--ucb-gap);
    border: 1px solid var(--ucb-border-color);
    border-radius: 6px;
    background-color: #fff;
    margin: 1.5em 0;
}

/* --- Contenedor de la Imagen --- */
.ucb-brand__media {
    flex-shrink: 0;
    max-width: var(--ucb-media-max-width);
    display: block;
    line-height: 0;
    /* Por defecto, la imagen será el primer elemento visual */
    order: 1;
}

.ucb-brand__media img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}

.ucb-brand__media:hover img,
.ucb-brand__media:focus-visible img {
    opacity: 0.85;
}

/* --- Contenedor del Contenido (Título y Enlace) --- */
.ucb-brand__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* Por defecto, el contenido va después de la imagen */
    order: 2;
}

.ucb-brand__title {
    font-size: var(--ucb-title-font-size);
    margin: 0 0 0.25em;
    font-weight: 600;
    color: inherit;
    line-height: 1.3;
}

.ucb-brand__anchor {
    font-size: var(--ucb-anchor-font-size);
    text-decoration: none;
    transition: color 0.3s ease;
    outline: none;
}

.ucb-brand__anchor:hover,
.ucb-brand__anchor:focus-visible {
    text-decoration: underline;
    outline: 2px solid transparent; 
    outline-offset: 2px;
}

/* * --- Estilos Responsivos para Móviles ---
 * Por debajo de 768px, el diseño se apila y reordena.
 */
@media (max-width: 767px) {
    .ucb-brand {
        /* Cambiamos la dirección del flex a columna */
        flex-direction: column;
        text-align: center;
    }

    /* * Hacemos que el contenedor de contenido no exista visualmente
     * para que sus hijos (título y enlace) puedan ser reordenados 
     * como hermanos directos del contenedor de la imagen.
     */
    .ucb-brand__content {
        display: contents; 
    }

    /* * Reordenamos los elementos para la vista móvil:
     * 1. Título
     * 2. Imagen
     * 3. Enlace
     */
    .ucb-brand__title {
        order: 1; /* El título va primero */
        margin-bottom: 0.75rem; /* Añadimos espacio inferior */
    }

    .ucb-brand__media {
        order: 2; /* La imagen va en medio */
        margin: 0 auto; /* Centramos la imagen */
    }

    .ucb-brand__anchor {
        order: 3; /* El enlace va al final */
    }
}