/* =============================================
   CABECERA — Izquierda Española
   ============================================= */

@font-face {
    font-family: 'RedditSans';
    src: url('/wp-content/themes/astra-child/fonts/RedditSans-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}
@font-face {
    font-family: 'RedditSans';
    src: url('/wp-content/themes/astra-child/fonts/RedditSans-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
}

/* Ocultar cabecera nativa de Astra — display:none + colapso total para evitar huecos */
#masthead {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    position: static !important;
}

.cabecera {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #e52c21;
    width: 100%;
    font-family: 'RedditSans', sans-serif;
}

.cabecera-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5vw;
    height: 68px;
}

/* ── Logo ── */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    height: 68px;
}

.logo-escritorio {
    display: block;
    height: 52px;
    width: auto;
    mix-blend-mode: screen;
}

.logo-movil {
    display: none;
    height: 48px;
    width: auto;
    mix-blend-mode: screen;
}

/* ── Nav escritorio ── */
.nav-escritorio {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.nav-item {
    position: relative;
}

.nav-item::after {
    content: '';
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
}

.nav-link,
.nav-link:visited,
.nav-link:hover,
.nav-link:focus,
.nav-link:active {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.88) !important;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
    font-family: 'RedditSans', sans-serif;
}

.nav-link:hover,
.nav-link:focus {
    background: rgba(255,255,255,0.15) !important;
    color: white !important;
}

.nav-link .chevron {
    display: inline-block;
    width: 10px;
    height: 10px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 0.22s ease;
    flex-shrink: 0;
}

.nav-item:hover .nav-link .chevron {
    transform: rotate(180deg);
}

/* ── Submenú ── */
.submenu {
    display: block; /* visible por CSS; el inline del PHP lo oculta hasta que carga */
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: white;
    border-radius: 10px;
    border: 0.5px solid rgba(0,0,0,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 210px;
    padding: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 100;
}

.nav-item:hover .submenu {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.submenu-link {
    display: block;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    transition: background 0.15s;
    font-family: 'RedditSans', sans-serif;
}

.submenu-link:hover {
    background: #f5f2ef;
    color: #e52c21;
}

.submenu-sep {
    border: none;
    border-top: 0.5px solid #eee;
    margin: 4px 0;
}

.submenu-link.destacado {
    font-weight: 600;
    color: #e52c21;
}

/* ── Enlace Foro (texto, no botón) ── */
/* ── Grupo derecho: Foro + Únete pegados al margen ── */
.cabecera-derecha {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* ── Enlace Foro (texto, no botón) ── */
header.cabecera a.nav-link-foro,
header.cabecera a.nav-link-foro:visited,
header.cabecera a.nav-link-foro:hover,
header.cabecera a.nav-link-foro:focus,
header.cabecera a.nav-link-foro:active {
    color: #ffffff !important;
    text-decoration: none;
    font-family: 'RedditSans', sans-serif;
    font-weight: 800; /* más grueso que el resto del menú (500) y que Únete (700), sin ser un botón */
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

header.cabecera a.nav-link-foro:hover,
header.cabecera a.nav-link-foro:focus {
    color: rgba(255,255,255,0.78) !important;
}

/* ── Botón Únete ── */
.btn-unete {
    display: inline-flex;
    align-items: center;
    background: white;
    color: #e52c21 !important;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.45rem 1.1rem;
    border-radius: 6px;
    flex-shrink: 0;
    font-family: 'RedditSans', sans-serif;
}

.btn-unete:hover,
.btn-unete:focus {
    background: rgba(255,255,255,0.88) !important;
    color: #e52c21 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ── Hamburguesa ── */
.btn-hamburguesa {
    display: none;
    background: none !important;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.18s;
}

.btn-hamburguesa:hover {
    background: rgba(255,255,255,0.15) !important;
}

.ham-icon {
    width: 22px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ham-icon span {
    display: block;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform 0.28s ease, opacity 0.2s ease, width 0.2s ease;
    transform-origin: center;
}

.ham-icon span:last-child { width: 14px; }

.btn-hamburguesa.cab-abierto .ham-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.btn-hamburguesa.cab-abierto .ham-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.btn-hamburguesa.cab-abierto .ham-icon span:nth-child(3) {
    width: 22px;
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Overlay ── */
.overlay {
    display: none;
    position: fixed !important;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9998 !important;
    opacity: 0;
    transition: opacity 0.28s ease;
}
.overlay.visible { display: block; }
.overlay.cab-abierto { opacity: 1; }

/* ── Drawer ── */
.drawer {
    display: flex; /* visible por CSS; el inline del PHP lo oculta hasta que el JS lo libera */
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    bottom: 0;
    width: min(300px, 84vw);
    background: #e52c21;
    z-index: 9999 !important;
    display: flex;
    flex-direction: column;
    transform: translateX(100%) !important;
    transition: transform 0.32s cubic-bezier(0.22,1,0.36,1);
    overflow-y: auto;
    font-family: 'RedditSans', sans-serif;
}

.drawer.cab-abierto {
    transform: translateX(0) !important;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.drawer-logo {
    height: 28px;
    width: auto;
    mix-blend-mode: screen;
}

.btn-cerrar {
    background: none !important;
    border: none;
    cursor: pointer;
    color: white !important;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
}

.btn-cerrar:hover,
.btn-cerrar:focus {
    color: white !important;
    background: rgba(255,255,255,0.15) !important;
    outline: none !important;
    box-shadow: none !important;
}

.drawer-nav { padding: 0.75rem 0; flex: 1; }

.drawer-link {
    display: block;
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 500;
    padding: 0.75rem 1.4rem;
    transition: background 0.15s;
    letter-spacing: 0.01em;
    font-family: 'RedditSans', sans-serif;
}
.drawer-link:hover { background: rgba(255,255,255,0.12); color: white; }

.drawer-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.12);
    margin: 0.4rem 0;
}

.drawer-grupo-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255,255,255,0.92);
    font-size: 1.05rem;
    font-weight: 500;
    padding: 0.75rem 1.4rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    letter-spacing: 0.01em;
    font-family: 'RedditSans', sans-serif;
}
.drawer-grupo-titulo:hover { background: rgba(255,255,255,0.12); }
.drawer-grupo-titulo svg {
    opacity: 0.7;
    transition: transform 0.22s ease;
}
.drawer-grupo.desplegado .drawer-grupo-titulo svg {
    transform: rotate(180deg);
}

.drawer-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.drawer-grupo.desplegado .drawer-sub { max-height: 280px; }

.drawer-sub-link {
    display: block;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.55rem 1.4rem 0.55rem 2.2rem;
    transition: background 0.15s, color 0.15s;
    font-style: italic;
    font-family: 'RedditSans', sans-serif;
}
.drawer-sub-link:hover { background: rgba(255,255,255,0.1); color: white; }
.drawer-sub-link.destacado {
    font-style: normal;
    font-weight: 600;
    color: rgba(255,255,255,0.92);
}

.drawer-footer {
    padding: 1.25rem 1.4rem;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.drawer-link-foro {
    display: block;
    text-align: center;
    color: white !important;
    text-decoration: none;
    font-family: 'RedditSans', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    padding: 0.6rem 0;
    margin-bottom: 0.4rem;
}

.drawer-link-foro:hover,
.drawer-link-foro:focus {
    color: rgba(255,255,255,0.78) !important;
}

.btn-unete-drawer {
    display: block;
    text-align: center;
    background: white;
    color: #e52c21 !important;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    letter-spacing: 0.03em;
    transition: background 0.18s;
    font-family: 'RedditSans', sans-serif;
}
.btn-unete-drawer:hover { background: rgba(255,255,255,0.88); }

/* ── Responsive ── */
@media (max-width: 860px) {
    .nav-escritorio,
    .cabecera-derecha { display: none; }
    .logo-escritorio { display: none; }
    .logo-movil      { display: block; }
    .btn-hamburguesa { display: flex !important; align-items: center; justify-content: center; }
    .cabecera-inner  { padding: 0 4vw; }
}