/**
 * Estilos del bloque: CTC - Cabecera
 * Este archivo se usa tanto en el editor como en el frontend.
 * Metodología: Desktop First.
 *
 * Consume los tokens de marca de css/ctc-css-base/ctc-css-base.css
 * (la hoja base se encola sola al detectar bloques onlines/ctc-*).
 */

/* ============================================
   Contenedor principal - Desktop
   ============================================ */
.ctc-header {
    margin-top: 0 !important;
    width: 100%;
    max-width: none !important;
    box-sizing: border-box;
}

.ctc-header,
.ctc-header::before,
.ctc-header::after,
.ctc-header *,
.ctc-header *::before,
.ctc-header *::after {
    box-sizing: border-box;
}

/* ============================================
   Barra
   El lateral del diseño (120px a 1440px) se hace
   fluido para no forzar un ancho fijo.
   ============================================ */
.ctc-header__barra {
    background: var(--ctc-color-fondo);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 20px clamp(24px, 8.33vw, 120px);
    border-bottom: 1px solid var(--ctc-color-borde);
    font-family: var(--ctc-font-base);
    color: var(--ctc-color-oscuro);
}

/* ============================================
   Logo (h1 clickeable)
   ============================================ */
.ctc-header__logo {
    margin: 0;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.ctc-header__logo-enlace {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

/* Wordmark del programa (contiene el nombre completo con el degradé) */
.ctc-header__logo-marca {
    height: 52px;
    width: auto;
    flex: none;
    display: block;
}

/* El nombre ya está en el logo: el span queda solo para lectores de
   pantalla (el h1 necesita texto real). */
.ctc-header__logo-texto {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Menú (nav + redes) - fila inline en desktop
   ============================================ */
.ctc-header__menu {
    display: flex;
    align-items: center;
}

.ctc-header__nav {
    display: flex;
    align-items: center;
    gap: 34px;
    font-size: 15px;
}

.ctc-header__enlace {
    color: var(--ctc-color-texto-sec);
    font-weight: 500;
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: color var(--ctc-transition), border-color var(--ctc-transition);
}

.ctc-header__enlace:hover {
    color: var(--ctc-color-oscuro);
}

.ctc-header__enlace--activo {
    color: var(--ctc-color-oscuro);
    font-weight: 700;
    border-bottom-color: var(--ctc-color-acento);
}

/* ============================================
   Redes sociales
   ============================================ */
.ctc-header__social {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 28px;
    padding-left: 28px;
    border-left: 1px solid var(--ctc-color-borde);
}

.ctc-header__social-enlace {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--ctc-color-borde);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--ctc-color-texto-sec);
    transition: transform var(--ctc-transition), border-color var(--ctc-transition);
}

.ctc-header__social-enlace:hover {
    transform: scale(1.08);
    border-color: var(--ctc-color-acento);
    color: var(--ctc-color-acento);
}

/* ============================================
   Botón hamburguesa (oculto en desktop)
   ============================================ */
.ctc-header__burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.ctc-header__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ctc-color-oscuro);
    border-radius: 2px;
    transition: all 0.25s ease;
}

.ctc-header__burger span:nth-child(2) {
    width: 16px;
}

.ctc-header__burger--abierto span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.ctc-header__burger--abierto span:nth-child(2) {
    opacity: 0;
}

.ctc-header__burger--abierto span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Responsive - Tablet/Móvil (max-width: 1023px)
   La barra pasa a logo + hamburguesa; el menú
   se convierte en desplegable de ancho completo.
   ============================================ */
@media (max-width: 63.9375rem) {
    .ctc-header__barra {
        padding: 16px 24px;
    }

    .ctc-header__logo-marca {
        height: 42px;
    }

    .ctc-header__logo-enlace {
        gap: 10px;
    }

    .ctc-header__burger {
        display: flex;
    }

    /* Menú desplegable */
    .ctc-header__menu {
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.32s ease;
    }

    .ctc-header__menu--abierto {
        max-height: 400px;
    }

    .ctc-header__nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-top: 24px;
    }

    .ctc-header__enlace {
        font-family: var(--ctc-font-base);
        font-weight: 700;
        font-size: 26px;
        color: var(--ctc-color-texto-sec);
        padding: 14px 0;
        border-bottom: 1px solid var(--ctc-color-borde);
    }

    .ctc-header__enlace--activo {
        color: var(--ctc-color-oscuro);
        border-bottom-color: var(--ctc-color-borde);
    }

    .ctc-header__social {
        margin-left: 0;
        padding: 16px 0 8px;
        border-left: none;
        gap: 12px;
    }

    .ctc-header__social-enlace {
        width: 38px;
        height: 38px;
    }
}

/* ============================================
   Estilos específicos del editor
   ============================================ */
.editor-styles-wrapper .ctc-header {
    margin-left: 0;
    margin-right: 0;
}

.editor-styles-wrapper .ctc-header__logo-enlace,
.editor-styles-wrapper .ctc-header__enlace,
.editor-styles-wrapper .ctc-header__social-enlace {
    cursor: default;
}

/* En el editor el logo es un <span>: se pinta como background-image
   (url relativa a este CSS). Ratio del wordmark 1600:789. */
.editor-styles-wrapper .ctc-header__logo-marca {
    background: url('ctc-header-images/ctc-header-logo.svg') no-repeat left center / contain;
    height: 52px;
    width: 106px;
}

@media (max-width: 63.9375rem) {
    .editor-styles-wrapper .ctc-header__logo-marca {
        height: 42px;
        width: 85px;
    }
}
