/*
Theme Name: UVa Informática
Theme URI: https://www.infor.uva.es
Author: Departamento de Informática – Universidad de Valladolid
Description: Layout fiel a infor.uva.es con la paleta de colores oficial de uva.es (azul #003366, dorado #c8a84b).
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: uva-infor
*/

/* ================================================
   VARIABLES — paleta UVa
   ================================================ */
:root {
    /* Colores corporativos UVa */
    --uva-blue:       #003366;
    --uva-blue-dark:  #002244;
    --uva-blue-mid:   #004488;
    --uva-blue-light: #0055aa;
    --uva-blue-pale:  #e8f0f8;
    --uva-gold:       #c8a84b;
    --uva-gold-light: #dfc06b;

    /* Neutros */
    --gray-dark:  #333333;
    --gray-mid:   #555555;
    --gray-light: #888888;
    --gray-pale:  #f4f4f4;
    --border:     #d4d4d4;
    --white:      #ffffff;
    --text:       #222222;

    /* Tipografías */
    --font-body:  Arial, Helvetica, sans-serif;
    --font-title: Georgia, 'Times New Roman', serif;

    /* Layout — igual que infor.uva.es */
    --max-w:      960px;   /* ancho del contenedor */
    --header-pad: 20px;
    --tr:         .15s ease;
}

/* ================================================
   RESET BÁSICO
   ================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    font-size: .875rem;   /* ~14px, igual que el original */
    color: var(--text);
    background: var(--white);
    line-height: 1.6;
}
a { color: var(--uva-blue); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--uva-blue-light); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
.screen-reader-text {
    clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
    height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px;
}
:focus-visible { outline: 2px solid var(--uva-gold); outline-offset: 2px; }

/* ================================================
   CONTENEDOR
   ================================================ */
.wrap {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
}

/* ================================================
   HEADER
   Estructura original: logo izquierda + título dpto.
   ================================================ */
#masthead {
    background: var(--white);
    border-bottom: 3px solid var(--uva-gold);    /* acento dorado UVa */
    padding: 12px 0 0;
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
    display: flex;
    align-items: center;
    gap: 18px;
    padding-bottom: 12px;
}

/* Logo — igual que el original: imagen a la izquierda */
.site-logo a {
    display: block;
    text-decoration: none;
}
.site-logo img {
    height: 70px;
    width: auto;
}
/* Fallback cuando no hay imagen: badge UVa */
.site-logo-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--uva-blue);
    color: var(--uva-gold);
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: bold;
    width: 70px;
    height: 70px;
    border-bottom: 4px solid var(--uva-gold);
    text-decoration: none;
    flex-shrink: 0;
}

/* Títulos del departamento — al lado del logo */
.site-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.site-name {
    font-family: var(--font-title);
    font-size: 1.45rem;
    font-weight: bold;
    color: var(--uva-blue);
    line-height: 1.2;
    text-decoration: none;
}
.site-name:hover { text-decoration: none; color: var(--uva-blue-light); }
.site-description {
    font-size: .78rem;
    color: var(--gray-mid);
    font-style: normal;
}

/* ================================================
   BARRA DE NAVEGACIÓN PRINCIPAL
   Layout original: menú horizontal, fondo azul UVa
   ================================================ */
#site-navigation {
    background: var(--uva-blue);
    border-top: 1px solid var(--uva-blue-mid);
}

.nav-wrap {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
    display: flex;
    align-items: stretch;
}

/* Menú principal */
.main-menu {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
}

.main-menu li {
    position: relative;
}

.main-menu > li > a {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 14px;
    color: var(--white);
    font-size: .8rem;
    font-weight: normal;
    border-right: 1px solid rgba(255,255,255,.12);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--tr);
}

.main-menu > li:first-child > a {
    border-left: 1px solid rgba(255,255,255,.12);
}

.main-menu > li > a:hover,
.main-menu > li.current-menu-item > a,
.main-menu > li.current-menu-ancestor > a {
    background: var(--uva-gold);
    color: var(--uva-blue-dark);
    text-decoration: none;
}

/* Submenú desplegable — estilo UVa */
.main-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 270px;
    background: var(--white);
    border-top: 3px solid var(--uva-gold);
    border: 1px solid var(--border);
    border-top: 3px solid var(--uva-gold);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--tr), transform var(--tr), visibility var(--tr);
}

.main-menu > li:hover > .sub-menu,
.main-menu > li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-menu .sub-menu a {
    display: block;
    padding: 7px 14px;
    color: var(--uva-blue);
    font-size: .8rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    transition: background var(--tr), padding-left var(--tr);
}

.main-menu .sub-menu li:last-child a { border-bottom: none; }

.main-menu .sub-menu a:hover {
    background: var(--uva-blue-pale);
    padding-left: 20px;
    text-decoration: none;
}

/* Toggle móvil */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    padding: 10px 14px;
    cursor: pointer;
    font-size: .82rem;
    align-items: center;
    gap: 7px;
}

/* ================================================
   BANNER BIENVENIDA — bajo la barra de navegación
   Fondo azul oscuro UVa, franja compacta
   ================================================ */
#site-hero {
    background: var(--uva-blue-dark);
    border-bottom: 3px solid var(--uva-gold);
    padding: 14px 0;
}

.hero-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-title {
    font-family: var(--font-title);
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--white);
}

.hero-desc {
    font-size: .82rem;
    color: var(--uva-gold-light);
    letter-spacing: .02em;
}

/* Portada sin sidebar — ancho completo */
.site-content-full {
    max-width: var(--max-w);
}

/* ================================================
   CONTENIDO PRINCIPAL
   infor.uva.es: sin sidebar, full-width, muy limpio
   ================================================ */
#content {
    padding: 24px 0 40px;
}

.site-content-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
}

/* Entry: página / post */
.entry-title {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--uva-blue);
    border-bottom: 2px solid var(--uva-gold);
    padding-bottom: 10px;
    margin-bottom: 18px;
    line-height: 1.3;
}

.entry-content {
    font-size: .875rem;
    line-height: 1.65;
    color: var(--text);
}

/* Listas con estilo punto azul — igual que infor.uva.es */
.entry-content ul {
    list-style: disc;
    padding-left: 22px;
    margin: 10px 0 14px;
}

.entry-content ul li::marker {
    color: var(--uva-blue);
}

.entry-content ol {
    list-style: decimal;
    padding-left: 22px;
    margin: 10px 0 14px;
}

.entry-content p { margin-bottom: 12px; }

.entry-content h2 {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--uva-blue);
    margin: 20px 0 10px;
    padding-left: 10px;
    border-left: 4px solid var(--uva-gold);
}

.entry-content h3 {
    font-size: 1rem;
    font-weight: bold;
    color: var(--uva-blue-dark);
    margin: 16px 0 8px;
}

.entry-content a {
    color: var(--uva-blue-light);
    text-decoration: underline;
}
.entry-content a:hover { color: var(--uva-blue); }

.entry-content blockquote {
    border-left: 4px solid var(--uva-blue);
    background: var(--uva-blue-pale);
    padding: 10px 16px;
    margin: 14px 0;
    font-style: italic;
    color: var(--uva-blue-dark);
}

.entry-content code {
    background: var(--uva-blue-pale);
    padding: 1px 5px;
    font-size: .82em;
    border: 1px solid var(--border);
}

.entry-content pre {
    background: var(--gray-pale);
    border: 1px solid var(--border);
    padding: 12px;
    overflow-x: auto;
    font-size: .82rem;
    margin-bottom: 14px;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
    margin-bottom: 14px;
}

.entry-content table th {
    background: var(--uva-blue);
    color: var(--white);
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
}

.entry-content table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.entry-content table tr:nth-child(even) td {
    background: var(--uva-blue-pale);
}

/* Entry meta */
.entry-meta {
    font-size: .76rem;
    color: var(--gray-light);
    margin-bottom: 14px;
}

/* ================================================
   PORTADA — igual que infor.uva.es:
   título h1 + texto + listas simples, sin hero
   ================================================ */
.home-welcome {
    margin-bottom: 30px;
}

.home-welcome h1 {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--uva-blue);
    margin-bottom: 16px;
    border-bottom: 2px solid var(--uva-gold);
    padding-bottom: 8px;
}

.home-welcome h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--uva-blue);
    margin: 20px 0 10px;
}

.home-welcome p { margin-bottom: 10px; font-size: .875rem; }

.home-welcome ul {
    list-style: disc;
    padding-left: 22px;
    margin-bottom: 14px;
    font-size: .875rem;
}

.home-welcome ul li { margin-bottom: 4px; }
.home-welcome ul li::marker { color: var(--uva-blue); }

/* Divider azul entre secciones */
.home-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* Posts recientes en portada (opcional) */
.home-posts { margin-top: 28px; }
.home-posts h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--uva-blue);
    border-bottom: 2px solid var(--uva-gold);
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.home-post-list { margin: 0; }
.home-post-item {
    padding: 9px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: .85rem;
}
.home-post-item:last-child { border-bottom: none; }
.home-post-date {
    color: var(--gray-light);
    font-size: .75rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.home-post-item a {
    color: var(--uva-blue);
    text-decoration: none;
}
.home-post-item a:hover {
    color: var(--uva-blue-light);
    text-decoration: underline;
}

/* ================================================
   LISTA DE POSTS (index, archivo, búsqueda)
   ================================================ */
.posts-list { margin: 0; }

.post-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }

.post-item-title {
    font-family: var(--font-title);
    font-size: 1.05rem;
    margin-bottom: 5px;
}
.post-item-title a { color: var(--uva-blue); text-decoration: none; }
.post-item-title a:hover { color: var(--uva-blue-light); text-decoration: underline; }

.post-item-meta { font-size: .75rem; color: var(--gray-light); margin-bottom: 6px; }

.post-item-excerpt {
    font-size: .84rem;
    color: var(--gray-mid);
    line-height: 1.55;
}

/* ================================================
   MENÚ INFERIOR (infor.uva.es duplica el menú abajo)
   ================================================ */
.footer-nav-area {
    border-top: 3px solid var(--uva-gold);
    background: var(--uva-blue-pale);
    padding: 14px 0;
}

.footer-nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
}

.footer-nav-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.footer-nav-menu li a {
    display: inline-block;
    padding: 4px 12px 4px 0;
    font-size: .8rem;
    color: var(--uva-blue);
    text-decoration: none;
    border-right: 1px solid var(--border);
    margin-right: 12px;
    line-height: 1.4;
}

.footer-nav-menu li:last-child a { border-right: none; margin-right: 0; }

.footer-nav-menu li a:hover { color: var(--uva-blue-light); text-decoration: underline; }

/* sub-items del footer-nav en una nueva línea */
.footer-nav-sub {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding-left: 12px;
    border-left: 3px solid var(--uva-gold);
}

.footer-nav-sub a {
    font-size: .76rem;
    color: var(--gray-mid);
    text-decoration: none;
    padding: 2px 10px 2px 0;
    border-right: 1px solid var(--border);
    margin-right: 10px;
}

.footer-nav-sub a:last-child { border-right: none; }
.footer-nav-sub a:hover { color: var(--uva-blue-light); text-decoration: underline; }

/* ================================================
   PIE DE PÁGINA
   infor.uva.es: simple, una sola línea de texto
   ================================================ */
#colophon {
    background: var(--uva-blue);
    border-top: 3px solid var(--uva-gold);
    padding: 14px 0;
    color: rgba(255,255,255,.75);
    font-size: .76rem;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--header-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-inner a {
    color: var(--uva-gold-light);
    text-decoration: none;
}

.footer-inner a:hover { text-decoration: underline; }

/* ================================================
   PAGINACIÓN
   ================================================ */
.nav-links {
    display: flex;
    gap: 4px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--border);
    color: var(--uva-blue);
    font-size: .8rem;
    text-decoration: none;
    transition: background var(--tr), color var(--tr);
}

.page-numbers.current,
.page-numbers:hover {
    background: var(--uva-blue);
    color: var(--white);
    border-color: var(--uva-blue);
    text-decoration: none;
}

/* ================================================
   BÚSQUEDA
   ================================================ */
.search-form {
    display: flex;
    border: 1px solid var(--border);
    overflow: hidden;
    max-width: 380px;
}

.search-form input[type="search"] {
    flex: 1;
    border: none;
    outline: none;
    padding: 7px 10px;
    font-size: .83rem;
    font-family: var(--font-body);
    background: var(--gray-pale);
}

.search-form button {
    background: var(--uva-blue);
    border: none;
    color: var(--white);
    padding: 7px 12px;
    cursor: pointer;
    font-size: .8rem;
    transition: background var(--tr);
}

.search-form button:hover { background: var(--uva-blue-light); }

/* ================================================
   SKIP LINK / ACCESIBILIDAD
   ================================================ */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--uva-blue);
    color: var(--white);
    padding: 8px 16px;
    z-index: 9999;
    font-size: .84rem;
}
.skip-link:focus { top: 0; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 720px) {
    :root { --max-w: 100%; }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-bottom: 10px;
    }

    .site-name { font-size: 1.15rem; }

    .menu-toggle { display: flex; }

    .main-menu {
        display: none;
        flex-direction: column;
        width: 100%;
    }

    .main-menu.is-open { display: flex; }

    .main-menu > li > a {
        height: auto;
        padding: 10px 14px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,.12);
    }

    .main-menu > li:first-child > a { border-left: none; }

    .main-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-top: none;
        border: none;
        background: rgba(0,0,0,.15);
        display: none;
    }

    .main-menu .sub-menu.is-open { display: block; }

    .main-menu .sub-menu a { color: rgba(255,255,255,.85); border-bottom-color: rgba(255,255,255,.1); }

    .footer-nav-menu { flex-direction: column; }
    .footer-nav-menu li a { border-right: none; }

    .footer-inner { flex-direction: column; gap: 6px; }
}

@media print {
    #site-navigation, .footer-nav-area { display: none; }
    a[href]::after { content: " (" attr(href) ")"; font-size: .7em; color: #666; }
}
