/* ==========================================================================
   Header Custom - estilos base (estructura; colores/tipografía/tamaños
   los pone Elementor con los valores del panel, que tienen más
   especificidad que estas reglas y las sobrescriben sin problema).
   ========================================================================== */

.hc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

/* "Fijar arriba siempre": position: fixed real, no sticky. El spacer que
   se genera junto a esta clase (ver JS del widget) evita que el contenido
   de debajo salte al quitar el header del flujo normal del documento. */
.hc-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

.hc-header-spacer {
    width: 100%;
}

.hc-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.hc-logo img {
    display: block;
    height: 48px;
    width: auto;
}

.hc-menu-wrap {
    flex: 1 1 auto;
}

.hc-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.hc-item {
    position: relative;
}

.hc-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.hc-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hc-link-top {
    padding: 12px 16px;
}

/* Ítem raíz "no clicable" (renderizado como <span>, no navega) */
span.hc-link-top {
    cursor: default;
}

.hc-link-sub {
    padding: 10px 16px;
    white-space: nowrap;
}

/* Indicador de desplegable en escritorio: icono estático junto al texto.
   El tamaño/color reales los pone Elementor (controles del panel); aquí
   solo la maquetación y la rotación al desplegar. */
.hc-dropdown-static {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.hc-dropdown-icon {
    transition: transform 0.2s ease;
}

.hc-item-top:hover .hc-dropdown-static .hc-dropdown-icon,
.hc-item-top:focus-within .hc-dropdown-static .hc-dropdown-icon {
    transform: rotate(180deg);
}

/* Botón de despliegue (independiente del enlace). En escritorio se
   oculta: ahí ya está el indicador estático de arriba y el submenú se
   abre con :hover. En móvil es el que se ve y se toca (ver media query). */
.hc-toggle {
    display: none;
    background: transparent !important;
    border: none;
    border-radius: inherit;
    padding: 6px;
    margin-left: auto;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: inherit;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
}

.hc-toggle[aria-expanded="true"] .hc-dropdown-icon {
    transform: rotate(180deg);
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Botón de hamburguesa: oculto en escritorio, solo aparece en el media
   query de abajo. */
.hc-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hc-burger-box {
    width: 24px;
    height: 18px;
    position: relative;
    display: block;
}

.hc-burger-box span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease, top 0.25s ease;
}

.hc-burger-box span:nth-child(1) { top: 0; }
.hc-burger-box span:nth-child(2) { top: 8px; }
.hc-burger-box span:nth-child(3) { top: 16px; }

/* Icono de hamburguesa -> X cuando el menú está abierto */
.hc-header-open .hc-burger-box span:nth-child(1) {
    top: 8px;
    transform: rotate(45deg);
}
.hc-header-open .hc-burger-box span:nth-child(2) {
    opacity: 0;
}
.hc-header-open .hc-burger-box span:nth-child(3) {
    top: 8px;
    transform: rotate(-45deg);
}

/* Submenú: oculto por defecto; en escritorio aparece al pasar el ratón o,
   para navegación por teclado, al enfocar el ítem. */
.hc-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: max-content;
    min-width: 220px;
    margin: 0;
    padding: 0;
    list-style: none;
    z-index: 100;
}

.hc-item-top:hover > .hc-submenu,
.hc-item-top:focus-within > .hc-submenu {
    display: block;
}

.hc-item-sub {
    position: relative;
}

/* Submenús anidados (3er nivel en adelante): se abren hacia la derecha */
.hc-item-sub .hc-submenu {
    top: 0;
    left: 100%;
}

/* ==========================================================================
   Tablet / móvil: botón de hamburguesa + lista vertical desplegable
   (acordeón) dentro de la propia cabecera.
   ========================================================================== */
@media (max-width: 991px) {

    .hc-burger {
        display: inline-flex;
    }

    .hc-dropdown-static {
        display: none;
    }

    /* En móvil el botón de despliegue de cada ítem sí se ve: el submenú
       ya no depende de :hover (el tacto no lo tiene de forma fiable). */
    .hc-toggle {
        display: inline-flex;
    }

    /* El hover se mantiene también aquí (además del toggle táctil): en
       tablets o portátiles con ratón, pasar por encima del ítem despliega
       el submenú solo, sin necesidad de tocar la flecha. */
    .hc-item-top:hover .hc-toggle .hc-dropdown-icon,
    .hc-item-top:focus-within .hc-toggle .hc-dropdown-icon {
        transform: rotate(180deg);
    }

    /* El menú entero se oculta hasta que se toca la hamburguesa, y pasa
       a ocupar todo el ancho, debajo del logo. */
    .hc-menu-wrap {
        display: none;
        flex-basis: 100%;
        width: 100%;
    }

    .hc-header-open .hc-menu-wrap {
        display: block;
    }

    .hc-menu {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        width: 100%;
    }

    .hc-item-top,
    .hc-item-sub {
        width: 100%;
    }

    .hc-link-top,
    .hc-link-sub {
        width: 100%;
    }

    /* Cada submenú se abre/cierra con la clase que pone el JS al tocar
       la flecha, no con :hover. */
    .hc-submenu {
        display: none;
        position: static;
        min-width: 0;
        width: 100%;
        left: auto;
        top: auto;
    }

    .hc-item.hc-open > .hc-submenu {
        display: block;
    }

    /* Indentación visual de los submenús, como en un listado anidado */
    .hc-item-sub .hc-link-sub {
        padding-left: 32px;
    }

    .hc-item-sub .hc-item-sub .hc-link-sub {
        padding-left: 48px;
    }
}
