﻿/* ==========================================================================
   1. RESET Y VARIABLES
   ========================================================================== */
:root {
    --fenix-bg: #0f0c29;
    --fenix-bg2: #0f0c2952;
    --fenix-panel: #1e1b36;
    --color-text: #e2e8f0;
    --color-muted: #94a3b8;
    --cyan: #00d2ff;
    --purple: #9d50bb;
    --purple2: #9d50bb58;
    --pink: #ff007f;
    --gold: #ffd700;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--fenix-bg);
    color: var(--color-text);
    font-family: 'Roboto', sans-serif;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-family: 'Orbitron', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

img {
    max-width: 100%;
    display: block;
}

.hidden {
    display: none !important;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==========================================================================
   2. HEADER RESTAURADO (Diseño Fijo)
   ========================================================================== */
.main-header {
    background: linear-gradient(
    90deg,
    rgba(15,12,41,0.78),
    rgba(30,27,54,0.78)
  );
  backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: 180px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-layout {
    display: flex;
    justify-content: space-between;
    /* Extremos separados */
    align-items: center;
    height: 100%;
    position: relative;
    /* Clave para el centrado absoluto del título */
}

/* IZQUIERDA: LOGO */
.header-left {
    z-index: 20;
}

.logo-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--purple);
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.6);
    padding: 12px 2px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* mejor que scale-down aquí */
    transform: translateY(6px) scale(0.98); /* prueba 2–6px */
  transform-origin: center;
}

.logo-circle i {
    color: var(--cyan);
    font-size: 1.5rem;
}

@media (max-width: 900px){
  .logo-circle{ padding: 4px; }
}
/* CENTRO: TÍTULO (Posición Absoluta) */
.header-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    pointer-events: none;
    /* Para no bloquear clics */
    z-index: 10;
}

.header-center .desktop-socials { pointer-events: auto; }

.site-title {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--cyan), #fff, var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 10px rgba(197, 121, 121, 0.5);
    margin-bottom: 0.2rem;
}

.site-subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #ccc;
    
    background:rgba(0,0,0,0.25);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    backdrop-filter: blur(4px);
}
.site-semititle {
    font-size: 1.1rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: light-dark();
/*    color:darkgrey;*/
    /*background: linear-gradient(90deg, var(--color-text), gray, var(--color-muted));*/
    /*background: linear-gradient(90deg, navy, gray, darkgrey);*/
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    backdrop-filter: blur(4px);
}

/* DERECHA: AUTOR Y SOCIALS */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 20;
}

.desktop-socials{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 10px;     /* separa del nombre */
}

/* Opcional: que no “griten” tanto */
.desktop-socials a{
  color: rgba(255,255,255,.65);
  font-size: 1.6rem;    /* ahora tienes 2rem */
}
.desktop-socials a:hover{
  color: #fff;
  transform: scale(1.08);
}

.author-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--purple);
    overflow: hidden;
    background: #1a1a1a;
    box-shadow: 0 0 15px rgba(157, 80, 187, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.author-circle img {
    width: 100%;
    height: 100%;
    object-fit: scale-down;
}

.author-circle i {
    color: var(--purple);
    font-size: 1.5rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* RESPONSIVE HEADER */
@media (max-width: 900px) {
    .main-header {
        height: 80px;
    }

    .logo-circle,
    .author-circle {
        width: 50px;
        height: 50px;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .site-subtitle {
        display: none;
    }

    .desktop-socials {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }
}

.footer-layout{
  display: grid;
  grid-template-columns: 120px 1fr 120px; /* ajusta ancho laterales */
  align-items: center;
  gap: 1rem;
}

.footer-center{
  text-align: center;
}

.footer-side{
  display: flex;
  align-items: center;
}

.footer-left{ justify-content: flex-start; }
.footer-right{ justify-content: flex-end; }

.footer-logo{
  width: 44px;   /* ajusta a gusto */
  height: 44px;
  opacity: .9;
  filter: drop-shadow(0 0 6px rgba(0, 210, 255, .25));
}

/* Responsive: en móvil, apila */
@media (max-width: 700px){
  .footer-layout{
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-side{
    justify-content: center;
  }
}


/* ==========================================================================
   3. NAVEGACIÓN (CARDS)
   ========================================================================== */
.main-nav {
    background: var(--fenix-panel);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.nav-card {
    position: relative;
    height: 110px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Fondos */
.bg-cronicas {
    background: url('../img/_CronicasBg2.png') center/cover;
}

.bg-pubs {
    background: url('../img/_LibrosBg.png') center/cover;
}

.bg-media {
    background: url('../img/_multimediaBg.png') center/cover;
}

.bg-personal {
    background: url('../img/_personalBg.jpg') center/cover;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    transition: 0.3s;
}

.nav-card:hover .card-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.card-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.nav-card h2 {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

/* Estados Activos */
.nav-card.active {
    transform: translateY(-5px);
    border-color: var(--active-color);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.5);
}

.nav-card.active .card-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: var(--active-color);
    transition: width 0.4s ease;
}

.nav-card.active .indicator {
    width: 100%;
}

@media (max-width: 900px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .nav-card {
        height: 70px;
    }
}

/* SUBMENÚ */
.submenu-container {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

@media (max-width: 900px) {
    .submenu-container {
        justify-content: center;
    }
}

.submenu-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    padding: 0.6rem 1.4rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.submenu-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    color: #fff;
}

.submenu-btn.active {
    background: var(--btn-color);
    color: #000;
    font-weight: 700;
    border-color: var(--btn-color);
    box-shadow: 0 0 15px var(--btn-color);
}


/* ==========================================================================
   4. LAYOUT CONTENIDO
   ========================================================================== */
.main-content {
    flex-grow: 1;
    padding: 2rem 0;
}

#content-viewer {
    position: relative;
    min-height: 400px;

}

/* Loader */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: var(--fenix-bg2);
    opacity: 0.95;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
}

.spinner-box {
    text-align: center;
    color: var(--cyan);
}

.spinner-box i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.spinner-box span {
    font-family: 'Orbitron';
    letter-spacing: 2px;
}


/* ==========================================================================
   5. ESTILOS DE COMPONENTES EXTERNOS (Replicando tu diseño solicitado)
   ========================================================================== */

/* CABECERA DE SECCIÓN */
.CabeceraSeccion {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 5px solid var(--active-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 3rem;
}

.CabeceraSeccion>img,
.CabeceraSeccion img[loading="lazy"] {
    width: 80px !important;
    height: 80px !important;
    object-fit: contain;
    flex-shrink: 0;
    filter: invert(1) drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.CabeceraSeccion>div {
    flex: 1;
}

.CabeceraSeccion>div>p:first-child {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #fff, var(--active-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.CabeceraSeccion>div>p:nth-child(2) {
    color: var(--color-muted);
}

/* ARTÍCULOS (.Noticia) */
.Noticia,
.post-item {
    display: block;
    background: rgba(30, 27, 54, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 3rem;
    overflow: hidden;
    /* Clearfix */
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s;
}

.Noticia:hover {
    transform: translateY(-5px);
    background: rgba(30, 27, 54, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}

.Noticia::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--active-color), transparent);
}

/* Icono */
.Noticia>img:first-child {
    float: left;
    width: 36px !important;
    height: 36px !important;
    margin-right: 15px;
    margin-top: 4px;
    margin-bottom: 1.5rem;
    filter: invert(1) drop-shadow(0 0 5px var(--active-color));
}

/* Título */
.Noticia>p:first-of-type {
    display: block;
    overflow: visible;
    /* evitar crear BFC que interfiera con floats posteriores */
    font-family: 'Orbitron';
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    margin-top: 0;
    line-height: 1.3;
    background: linear-gradient(90deg, #fff, var(--active-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Imágenes dentro de la noticia (excluyendo el icono first-child)
       Aplicar float/anchos sólo a imágenes que no sean el icono inicial. */
.Noticia>img:not(:first-child) {
    float: left;
    width: 30%;
    height: auto;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    margin-left: 0;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    shape-outside: margin-box;
    max-width: 100%;
}

/* Imágenes que se fuerzan a la derecha vía inline style
       (ej. style="float:right" o "float: right") — limitar su ancho */
.Noticia>img[style*="float:right"],
.Noticia>img[style*="float: right"] {
    float: right !important;
    width: 25% !important;
    margin-left: 1.5rem !important;
    margin-right: 0 !important;
}

/* Regla explícita para la imagen inmediatamente posterior al título */
.Noticia>p:first-of-type+img {
    float: left;
    width: 40%;
    margin-left: 0;
    margin-right: 1.5rem;
}

/* Texto */
.Noticia>p:not(:first-of-type) {
    color: var(--color-muted);
    line-height: 1.8;
    text-align: justify;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .Noticia>img:nth-of-type(2) {
        float: none;
        display: block;
        width: 100% !important;
        margin: 0 0 1.5rem 0;
    }
}


/* CERTIFICACIONES (.ms) */
/* CERTIFICACIONES (.ms) */
.ms {
    float: left;
    width: calc(50% - 1rem);
    margin-right: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* Un poco más de aire entre imagen y texto */
    height: 110px;
    /* Altura fija para que todas las cajas sean idénticas */
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1rem;
    transition: 0.3s;
    overflow: hidden;
    /* Evita que nada sobresalga */
}

/* Si es la última y es impar, ocupa el 100% */
.ms:last-child:nth-of-type(odd) {
    width: calc(100% - 1rem);
    margin-right: 0;
}

.ms:nth-of-type(2n) {
    margin-right: 0;
}

.ms:hover {
    transform: translateY(-3px);
    border-left-color: var(--active-color);
    background: rgba(255, 255, 255, 0.08);
}

/* Gráficos con medidas idénticas */
.ms img {
    width: 100px !important;
    /* Ancho fijo */
    height: 60px !important;
    /* Alto fijo */
    object-fit: fill;
    /* Fuerza a que llenen el espacio aunque se deformen un poco */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    transition: 0.3s;
    flex-shrink: 0;
    /* Evita que el texto aplaste la imagen */
}

.ms:hover img {
    transform: scale(1.05);
}

.ms h3 {
    font-size: 0.95rem;
    font-weight: 400;
    color: #eee;
    margin: 0;
    font-family: 'Roboto';
    line-height: 1.2;
}

.ms:hover h3 {
    color: #fff;
    font-weight: 500;
}

@media (max-width: 900px) {

    .ms,
    .ms:last-child:nth-of-type(odd) {
        width: 100%;
        float: none;
        margin-right: 0;
        height: auto;
        /* En móvil que crezca si el texto es largo */
    }
}

/* FOOTER */
.main-footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    margin-top: auto;
}

.copyright {
    color: #666;
    font-size: 0.85rem;
}

.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 14px;
    font-size: 20px;
    border: none;
    border-radius: 50%;
    background: #333;
    color: white;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.credits {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   MAQUETACIÓN AUTOMÁTICA DE IMÁGENES (CRÓNICAS)
   ========================================================================== */
/* ==========================================================================
   MAQUETACIÓN AUTOMÁTICA DE IMÁGENES (.Noticia) - VERSIÓN CORREGIDA
   ========================================================================== */

/* 1. ICONO: Solo afecta a la primera imagen si es hija directa */
.Noticia>img:first-of-type {
    float: left;
    width: 50px;
    height: 50px;
    margin: 0 1.2rem 0.5rem 0;
    object-fit: contain;
}

/* 2. PRINCIPAL: Segunda imagen hija directa (limitada al 30%) */
.Noticia>img:nth-of-type(2) {
    float: left;
    width: 30%;
    max-width: 280px;
    margin: 0.5rem 1.5rem 1rem 0;
    border-radius: 4px;
}

/* 3. GRUPOS DE 2 (Ocupan el 60% juntos) */
/* Solo si son hijas directas para no romper la galería */
.Noticia>img+img:not(.galeria-auto img),
.Noticia>img:has(+ img):not(.galeria-auto img) {
    float: left;
    width: 28%;
    margin: 1rem 1%;
}

/* 4. ALTERNANCIA: A partir de la 3ª imagen (HIJAS DIRECTAS SOLAMENTE) */
/* Usamos el selector de hijo directo (>) para que no entre en la galería */
.Noticia>img:nth-of-type(n+3) {
    width: 32%;
    max-width: 300px;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    clear: both;
}

/* Derecha (Impares) - Solo hijas directas */
.Noticia>img:nth-of-type(odd):not(:first-of-type) {
    float: right;
    margin-left: 1.5rem;
}

/* Izquierda (Pares) - Solo hijas directas */
.Noticia>img:nth-of-type(even):not(:nth-of-type(2)) {
    float: left;
    margin-right: 1.5rem;
}

/* 5. ESTILO DE LA GALERÍA (Protegido) */
.galeria-auto{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  width: 100%;
  margin: 2rem 0;
  padding: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--cyan);
  border-radius: 12px;
  clear: both;
}

/* Reset para las imágenes DENTRO de la galería */
.galeria-auto img{
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  object-fit: cover;
  margin: 0 !important;
  float: none !important;
  border-radius: 6px;
}

@media (max-width: 900px){
  .galeria-auto{ grid-template-columns: 1fr; }
}

.Noticia::after {
    content: "";
    display: table;
    clear: both;
}

/*memes*/
/* ===== Memes del mes: panel colapsable (siempre visible) ===== */
.memes-panel {
    margin: 0 0 1.6rem 0;
    border-radius: 14px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.08);
    border-left: 5px solid var(--active-color);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,.5);
    overflow: hidden;
}

/* Por defecto usamos el color de Crónicas (cian) */
.memes-panel {
    --active-color: var(--cyan);
}

.memes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    background: rgba(0,0,0,.16);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

    .memes-head:focus {
        outline: 2px solid rgba(255,255,255,.12);
        outline-offset: 2px;
    }

.memes-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.05rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff, var(--active-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.memes-subtitle {
    margin-top: 2px;
    color: rgba(233,238,247,.65);
    font-size: .9rem;
}

.memes-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(233,238,247,.72);
    font-size: .9rem;
    white-space: nowrap;
}

.memes-arrow {
    width: 34px;
    height: 30px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.04);
    display: grid;
    place-items: center;
    transition: transform .22s ease;
}

    .memes-arrow i {
        font-size: 14px;
        opacity: .9;
    }

.memes-body {
    max-height: 520px;
    transition: max-height .28s ease;
}

/* Estado plegado */
.memes-panel.is-collapsed .memes-body {
    max-height: 0;
}

.memes-panel.is-collapsed .memes-arrow {
    transform: rotate(-90deg);
}

.memes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 14px 16px 16px;
}

.meme-item {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(0,0,0,.18);
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease;
}

    .meme-item:hover {
        transform: translateY(-2px);
        border-color: rgba(255,255,255,.22);
    }

    .meme-item img {
        width: 100% !important;
        height: 150px !important;
        object-fit: contain; /* <- antes: cover */
        background: rgba(0,0,0,.22); /* para que no quede feo */
        display: block;
    }

@media (max-width: 980px) {
    .memes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .meme-item img {
        height: 170px !important;
    }
}

@media (max-width: 520px) {
    .memes-grid {
        grid-template-columns: 1fr;
    }

    .meme-item img {
        height: 220px !important;
    }
}
