/* Nota de Transparencia: Código generado/refactorizado con asistencia de IA Generativa (Claude Code) bajo la Política ODTI012 del CCS. Requiere supervisión y validación humana permanente. */

/* ==========================================================================
   Encabezado público CCS (layouts/header.php)
   Clases propias con prefijo `ccs-` para no chocar con assets/css/header.css,
   que sigue sirviendo a header_admin.php y header_publicacion.php.
   ========================================================================== */

:root {
    /* La barra de publicaciones.css se ancla a esta altura. */
    --ccs-header-h: 64px;

    --ccs-blue: #1e73be;
    --ccs-blue-dark: #185c98;
    --ccs-navy: #083155;
    --ccs-green: #61ce70;
}

@media (max-width: 767.98px) {
    :root {
        --ccs-header-h: 56px;
    }
}

/* --------------------------------------------------------------------------
   Enlace de salto: primera parada de tabulación de la página
   -------------------------------------------------------------------------- */
.ccs-skiplink {
    position: absolute;
    top: -100px;
    left: var(--ccs-space, 1rem);
    z-index: 1060;
    padding: .75rem 1.25rem;
    border-radius: 0 0 8px 8px;
    background: #fff;
    color: var(--ccs-navy);
    font-weight: 700;
    text-decoration: none;
    transition: top .16s ease;
}

.ccs-skiplink:focus {
    top: 0;
    outline: 3px solid var(--ccs-green);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Barra
   -------------------------------------------------------------------------- */
.ccs-header {
    position: sticky;
    top: 0;
    /* Por debajo del modal de Bootstrap (1055) para no taparlo; el valor
       anterior era 9999, que se montaba encima de cualquier diálogo. */
    z-index: 1030;
    background: var(--ccs-blue);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .12), 0 2px 12px rgba(8, 49, 85, .18);
}

.ccs-header__inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--ccs-header-h);
}

/* Logo */
.ccs-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin-right: auto;
    padding: .25rem;
    border-radius: 6px;
    line-height: 0;
}

.ccs-brand img {
    display: block;
    width: auto;
    height: 40px;
}

.ccs-brand:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 767.98px) {
    .ccs-brand img {
        height: 32px;
    }
}

/* --------------------------------------------------------------------------
   Navegación
   -------------------------------------------------------------------------- */
.ccs-nav {
    display: flex;
    align-items: center;
    gap: .125rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ccs-nav__item {
    position: relative;
}

/* Un solo aspecto para <a> y <button> del mismo nivel */
.ccs-header .ccs-nav__link {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    min-height: 40px;
    padding: 0 .75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .16s ease;
}

/* El teal #37C3B0 anterior daba 2.26:1 sobre el azul (falla AA). El texto se
   mantiene blanco y el estado se comunica con un velo OSCURO: aclarar el azul
   bajaria el contraste del texto a 3.7:1, mientras que este lo sube de 4.9:1
   a 6.4:1. */
.ccs-header .ccs-nav__link:hover,
.ccs-header .ccs-nav__link[aria-expanded="true"] {
    background: rgba(8, 49, 85, .28);
    color: #fff;
}

.ccs-header .ccs-nav__link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Página actual */
.ccs-header .ccs-nav__link[aria-current="page"] {
    background: rgba(8, 49, 85, .22);
}

.ccs-header .ccs-nav__link[aria-current="page"]::after {
    content: "";
    position: absolute;
    right: .75rem;
    bottom: 2px;
    left: .75rem;
    height: 3px;
    border-radius: 2px;
    background: var(--ccs-green);
}

.ccs-nav__chevron {
    font-size: .6875rem;
    opacity: .85;
    transition: transform .16s ease;
}

.ccs-nav__link[aria-expanded="true"] .ccs-nav__chevron {
    transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Submenús
   Se sube la especificidad e se repite !important porque header.css declara
   `.dropdown-item { color: #1e73be !important; padding-top: 0 !important }`.
   -------------------------------------------------------------------------- */
.ccs-header .ccs-dropdown {
    min-width: 260px;
    margin-top: .375rem !important;
    padding: .5rem !important;
    border: 1px solid rgba(8, 49, 85, .12) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 8px 28px rgba(8, 49, 85, .18) !important;
}

.ccs-header .ccs-dropdown .ccs-dropdown__item {
    padding: .5rem .75rem !important;
    border-radius: 8px !important;
    color: var(--ccs-navy) !important;
    font-size: .9375rem !important;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
}

.ccs-header .ccs-dropdown .ccs-dropdown__item:hover,
.ccs-header .ccs-dropdown .ccs-dropdown__item:focus {
    background: #eaf2fa !important;
    color: var(--ccs-blue-dark) !important;
}

.ccs-header .ccs-dropdown .ccs-dropdown__item:focus-visible {
    outline: 2px solid var(--ccs-blue);
    outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   Botón hamburguesa
   -------------------------------------------------------------------------- */
.ccs-burger {
    display: none;
    align-items: center;
    justify-content: center;
    /* 44x44: objetivo táctil mínimo recomendado */
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.ccs-burger:hover {
    background: rgba(8, 49, 85, .28);
}

.ccs-burger:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Panel móvil
   -------------------------------------------------------------------------- */
.ccs-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(8, 49, 85, .55);
    opacity: 0;
    visibility: hidden;
    transition: opacity .24s ease, visibility 0s linear .24s;
}

.ccs-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .24s ease, visibility 0s linear 0s;
}

@media (max-width: 991.98px) {
    .ccs-burger {
        display: inline-flex;
    }

    .ccs-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
        width: min(88vw, 360px);
        padding: 1rem;
        overflow-y: auto;
        background: var(--ccs-navy);
        /* translateX + visibility en lugar del `left: 100%` anterior: así el
           panel cerrado no suma al scrollWidth del documento (causaba scroll
           horizontal en móvil) ni deja paradas de tabulación fantasma. */
        transform: translateX(100%);
        visibility: hidden;
        /* visibility con duración 0 y retardo: al cerrar espera a que termine
           el desplazamiento; al abrir aparece de inmediato. Transicionarla
           normalmente la cambia a mitad de la animación, y entonces el
           focus() sobre el botón de cerrar falla en silencio. */
        transition: transform .26s ease, visibility 0s linear .26s;
    }

    .ccs-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        transition: transform .26s ease, visibility 0s linear 0s;
    }

    .ccs-nav__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: .5rem;
        padding-bottom: .75rem;
        border-bottom: 1px solid rgba(255, 255, 255, .18);
    }

    .ccs-nav__head-title {
        margin: 0;
        color: #bcd8ef;
        font-size: .75rem;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .ccs-header .ccs-nav__link {
        justify-content: space-between;
        width: 100%;
        min-height: 48px;
        padding: 0 .75rem;
        font-size: 1rem;
    }

    /* Dentro del panel el fondo es navy, no azul: aquí el velo claro sí aporta
       contraste (8.7:1) y el oscuro sería invisible. */
    .ccs-header .ccs-nav__link:hover,
    .ccs-header .ccs-nav__link[aria-expanded="true"] {
        background: rgba(255, 255, 255, .12);
    }

    .ccs-header .ccs-nav__link[aria-current="page"] {
        background: rgba(255, 255, 255, .12);
    }

    /* El botón de cerrar vive sobre el panel navy. */
    .ccs-nav__head .ccs-burger:hover {
        background: rgba(255, 255, 255, .14);
    }

    /* En columna, el subrayado inferior se cambia por una marca lateral. */
    .ccs-header .ccs-nav__link[aria-current="page"]::after {
        top: .5rem;
        right: auto;
        bottom: .5rem;
        left: 0;
        width: 3px;
        height: auto;
    }

    /* Submenús en flujo: sin posicionamiento flotante dentro del panel. */
    .ccs-header .ccs-dropdown {
        position: static !important;
        width: 100%;
        min-width: 0;
        margin: .25rem 0 .5rem !important;
        padding: .25rem !important;
        border: 0 !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, .07) !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .ccs-header .ccs-dropdown .ccs-dropdown__item {
        color: #dceaf6 !important;
    }

    .ccs-header .ccs-dropdown .ccs-dropdown__item:hover,
    .ccs-header .ccs-dropdown .ccs-dropdown__item:focus {
        background: rgba(255, 255, 255, .14) !important;
        color: #fff !important;
    }
}

@media (min-width: 992px) {
    .ccs-nav__head {
        display: none;
    }
}

/* Bloquea el scroll del fondo mientras el panel está abierto */
body.ccs-menu-open {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .ccs-nav,
    .ccs-backdrop,
    .ccs-skiplink,
    .ccs-nav__chevron,
    .ccs-header .ccs-nav__link {
        transition: none;
    }
}
