/* public/css/portal.css */

/* =========================================
   Encabezado de sección unificado
   ========================================= */
.portal-header, .inv-header {
    background: #284a74;
    padding: 2.5rem 1.5rem 2rem;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.portal-header-inner, .inv-header-inner {
    max-width: 960px;
    margin: 0 auto;
}

/* =========================================
   Migas de pan (Breadcrumb)
   ========================================= */
.portal-breadcrumb, .inv-breadcrumb {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.portal-breadcrumb a, .inv-breadcrumb a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
}

.portal-breadcrumb a:hover, .inv-breadcrumb a:hover {
    color: rgba(255,255,255,0.85);
}

.portal-breadcrumb-sep, .inv-breadcrumb-sep {
    color: rgba(255,255,255,0.25);
}

/* =========================================
   Títulos y subtítulos
   ========================================= */
.portal-page-title, .inv-page-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.portal-page-sub, .inv-page-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.58);
    max-width: 720px;
    line-height: 1.7;
}

/* =========================================
   Buscador de sección unificado (píldora blanca)
   ========================================= */
.portal-search, .inv-search {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 40px;
    padding: 6px 6px 6px 16px;
    gap: 8px;
    max-width: 460px;
}

.portal-search svg, .inv-search svg {
    width: 16px;
    height: 16px;
    color: #888;
    flex-shrink: 0;
}

.portal-search input, .inv-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #1a3a5c;
    background: transparent;
    font-family: inherit;
    min-width: 0;
}

/* Botón Buscar dentro de la píldora (mismo en Proyectos, Investigadorxs y Qué se investiga) */
.portal-search button[type="submit"], .inv-search button[type="submit"] {
    flex-shrink: 0;
    background: #284a74;
    color: #ffffff;
    border: none;
    cursor: pointer;
    font: 600 12px/1 inherit;
    letter-spacing: 0.02em;
    padding: 8px 16px;
    border-radius: 999px;
    transition: background 0.15s ease;
}

.portal-search button[type="submit"]:hover, .inv-search button[type="submit"]:hover {
    background: #1a3a5c;
}

/* Link para limpiar la búsqueda (✕) dentro de la píldora */
.portal-search .search-clear, .inv-search .search-clear {
    flex-shrink: 0;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    padding: 0 4px;
}

.portal-search .search-clear:hover, .inv-search .search-clear:hover {
    color: #4b5563;
}

/* =========================================
   Botones de filtro del encabezado (píldoras sobre el azul)
   Usados en Proyectos, Investigadorxs y donde sume filtros.
   ========================================= */
.filter-btn {
    background: rgba(40, 74, 116, 0.25);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.filter-btn.active {
    background: #ffffff !important;
    color: #284a74 !important;
    border-color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

/* =========================================
   Tarjetas y Utilidades
   ========================================= */
.portal-card, .stat-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.portal-card:hover, .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================
   Navegación editorial del portal
   ========================================= */
.portal-main-nav {
    flex: 0 1 auto;
    min-width: 0;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(31, 41, 55, 0.10);
    box-shadow: 0 1px 16px rgba(31, 41, 55, 0.05);
    backdrop-filter: blur(14px);
}

.portal-main-nav__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.portal-main-nav__links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.portal-main-nav__links::-webkit-scrollbar {
    display: none;
}

.portal-main-nav__item {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 48px;
    padding: 0.75rem 1.125rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font: 600 0.8125rem/1.25rem inherit;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color 0.2s ease;
}

.portal-main-nav__item:hover,
.portal-main-nav__item.active {
    color: #1f2937;
}

.portal-main-nav__item::after {
    position: absolute;
    right: 1.125rem;
    bottom: 0;
    left: 1.125rem;
    height: 2px;
    border-radius: 999px;
    background: #e30518;
    content: "";
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.portal-main-nav__item:hover::after,
.portal-main-nav__item.active::after {
    transform: scaleX(1);
}

@media (max-width: 640px) {
    .portal-main-nav__inner {
        padding: 0 1rem;
    }

        .portal-main-nav__links {
            justify-content: flex-start;
        }
    }

    @media (max-width: 1100px) {
        .ffyh-topbar-inner {
            flex-wrap: wrap;
        }

        .portal-main-nav {
            order: 3;
            width: 100%;
    }
}

/* =========================================
   Galería "Nuestras revistas" (/portal/produccion)
   ========================================= */
.revistas-carrusel {
    overflow: hidden;
    padding: 0.5rem 0 0.25rem;
    /* Desvanece los bordes para que las portadas entren y salgan suavemente */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
            mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}

.revistas-pista {
    display: flex;
    width: max-content;
    margin: 0;
    padding: 0;
    list-style: none;
    animation: revistas-desplazamiento 110s linear infinite;
}

/* Se detiene mientras se mira o se navega con teclado */
.revistas-carrusel:hover .revistas-pista,
.revistas-carrusel:focus-within .revistas-pista {
    animation-play-state: paused;
}

@keyframes revistas-desplazamiento {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* El espacio va como padding (no gap) para que el -50% caiga justo al inicio de la copia */
.revistas-item {
    flex: none;
    padding-right: 1.25rem;
}

.revistas-portada {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 9rem;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.revistas-portada__marco {
    display: block;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.revistas-portada__marco img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.revistas-portada:hover .revistas-portada__marco,
.revistas-portada:focus-visible .revistas-portada__marco {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(40, 74, 116, 0.22);
}

.revistas-portada:focus-visible {
    outline: none;
}

.revistas-portada:focus-visible .revistas-portada__marco {
    outline: 2px solid #284a74;
    outline-offset: 3px;
}

.revistas-portada__nombre {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    color: #374151;
}

.revistas-portada:hover .revistas-portada__nombre {
    color: #284a74;
}

/* Sin animación: la galería queda quieta y se recorre con scroll horizontal */
@media (prefers-reduced-motion: reduce) {
    .revistas-carrusel {
        overflow-x: auto;
        -webkit-mask-image: none;
                mask-image: none;
    }
    .revistas-pista {
        animation: none;
    }
    .revistas-item[aria-hidden="true"] {
        display: none;
    }
    .revistas-portada__marco {
        transition: none;
    }
}

/* Ficha de revista (diálogo) */
.revista-ficha {
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
    color: #374151;
}

.revista-ficha::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.revista-ficha[open] {
    animation: revista-ficha-entrada 0.2s ease-out;
}

@keyframes revista-ficha-entrada {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .revista-ficha[open] { animation: none; }
}

.revista-ficha__cuerpo {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 1.5rem;
    padding: 1.75rem;
}

.revista-ficha__portada {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.revista-ficha__info {
    min-width: 0;
}

.revista-ficha__estado {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border-radius: 999px;
}

.revista-ficha__nombre {
    padding-right: 1.5rem;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.25;
    color: #1f2937;
}

.revista-ficha__dependencia {
    margin-top: 0.35rem;
    font-size: 12px;
    font-weight: 500;
    color: #284a74;
}

.revista-ficha__descripcion {
    margin-top: 0.85rem;
    font-size: 14px;
    line-height: 1.65;
}

.revista-ficha__issn {
    margin-top: 0.75rem;
    font-size: 12px;
    color: #6b7280;
}

.revista-ficha__acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.revista-ficha__boton {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1rem;
    font-size: 13px;
    font-weight: 500;
    color: #284a74;
    border: 1px solid #284a74;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.revista-ficha__boton:hover {
    background: #eff6ff;
}

.revista-ficha__boton--primario {
    color: #fff;
    background: #284a74;
}

.revista-ficha__boton--primario:hover {
    background: #1e3a5f;
}

.revista-ficha__cerrar {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    padding: 0.25rem 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
    color: #9ca3af;
    background: none;
    border: 0;
    cursor: pointer;
}

.revista-ficha__cerrar:hover {
    color: #4b5563;
}

@media (max-width: 520px) {
    .revista-ficha__cuerpo {
        grid-template-columns: 1fr;
        padding: 1.5rem 1.25rem;
    }
    .revista-ficha__portada {
        width: 7.5rem;
    }
}

/* =========================================
   Líneas editoriales: Colecciones del CIFFyH (/portal/produccion)
   ========================================= */
.lineas-destacado {
    padding: 1.75rem;
    background: #f5f8fc;
    border: 1px solid #dbe5f1;
    border-radius: 14px;
}

.lineas-destacado__logo {
    display: block;
    width: auto;
    height: 4.25rem;
    margin-bottom: 0.9rem;
}

.lineas-destacado__titulo {
    margin-top: 0.2rem;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    color: #1f2937;
}

.libro-ciffyh {
    display: flex;
    gap: 1rem;
    height: 100%;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.libro-ciffyh:hover,
.libro-ciffyh:focus-visible {
    border-color: #b9cbe2;
    box-shadow: 0 8px 20px rgba(40, 74, 116, 0.12);
    transform: translateY(-2px);
}

.libro-ciffyh:focus-visible {
    outline: 2px solid #284a74;
    outline-offset: 2px;
}

.libro-ciffyh__portada {
    flex: none;
    /* align-self evita que el flex estire la portada al alto de la tarjeta */
    align-self: flex-start;
    width: 6.5rem;
    /* Proporción de las portadas de OMP (900×1385), la de un libro estándar */
    aspect-ratio: 900 / 1385;
    overflow: hidden;
    background: #eef2f7;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

.libro-ciffyh__portada img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.libro-ciffyh__info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.libro-ciffyh__fecha {
    font-size: 11px;
    color: #6b7280;
}

.libro-ciffyh__titulo,
.libro-ciffyh__autores,
.libro-ciffyh__resumen {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.libro-ciffyh__titulo {
    -webkit-line-clamp: 3;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #1f2937;
}

.libro-ciffyh:hover .libro-ciffyh__titulo {
    color: #284a74;
}

.libro-ciffyh__autores {
    -webkit-line-clamp: 2;
    font-size: 12px;
    line-height: 1.4;
    color: #284a74;
}

.libro-ciffyh__resumen {
    -webkit-line-clamp: 3;
    margin-top: 0.15rem;
    font-size: 12px;
    line-height: 1.5;
    color: #4b5563;
}

.lineas-coleccion {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    font-size: 13px;
    color: #284a74;
    background: #fff;
    border: 1px solid #c8d6e8;
    border-radius: 999px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lineas-coleccion:hover {
    background: #eff6ff;
    border-color: #284a74;
}

@media (prefers-reduced-motion: reduce) {
    .libro-ciffyh { transition: none; }
    .libro-ciffyh:hover, .libro-ciffyh:focus-visible { transform: none; }
}

@media (max-width: 520px) {
    .lineas-destacado { padding: 1.25rem; }
}

/* =========================================
   Últimas cargas en los repositorios (/portal/produccion)
   ========================================= */
.repo-columna {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #284a74;
    border-radius: 12px;
    overflow: hidden;
}

.repo-columna__encabezado {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid #eef0f3;
}

.repo-columna__logo {
    display: flex;
    align-items: center;
    height: 3rem;
    margin-bottom: 0.9rem;
}

.repo-columna__logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.repo-columna__subtitulo {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #284a74;
}

.repo-columna__descripcion {
    margin-top: 0.5rem;
    font-size: 13px;
    line-height: 1.55;
    color: #4b5563;
}

.repo-columna__total {
    margin-top: 0.75rem;
    font-size: 12px;
    color: #6b7280;
}

.repo-columna__total strong {
    font-size: 15px;
    font-weight: 700;
    color: #284a74;
}

.repo-columna__lista {
    flex-grow: 1;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
}

.repo-columna__lista li + li {
    border-top: 1px solid #f1f3f6;
}

.repo-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.8rem 1.25rem;
    transition: background-color 0.15s ease;
}

.repo-item:hover,
.repo-item:focus-visible {
    background: #f5f8fc;
}

.repo-item:focus-visible {
    outline: 2px solid #284a74;
    outline-offset: -2px;
}

.repo-item__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 11px;
    color: #6b7280;
}

.repo-item__tipo {
    padding: 1px 8px;
    font-weight: 600;
    color: #284a74;
    background: #e8eff8;
    border-radius: 999px;
}

.repo-item__titulo,
.repo-item__autorxs {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.repo-item__titulo {
    -webkit-line-clamp: 3;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1f2937;
}

.repo-item:hover .repo-item__titulo {
    color: #284a74;
}

.repo-item__autorxs {
    -webkit-line-clamp: 1;
    font-size: 12px;
    color: #4b5563;
}

.repo-columna__vacio {
    flex-grow: 1;
    padding: 1rem 1.25rem;
    font-size: 13px;
    color: #6b7280;
}

.repo-columna__pie {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 1rem;
    padding: 0.85rem 1.25rem;
    background: #f9fafb;
    border-top: 1px solid #eef0f3;
}

.repo-columna__explorar {
    font-size: 13px;
    font-weight: 500;
    color: #284a74;
}

.repo-columna__enlace {
    font-size: 12px;
    color: #6b7280;
}

.repo-columna__explorar:hover,
.repo-columna__enlace:hover {
    color: #1e3a5f;
    text-decoration: underline;
}
