/*  Base y accesibilidad */
.contenido-proyectos,
.contenido-ficha {
    --proy-verde: #006e38;
    --proy-azul: var(--azul);
    --proy-borde: #dbe4de;
    box-sizing: border-box;
}

.contenido-proyectos [hidden],
.contenido-ficha [hidden] {
    display: none !important;
}

.contenido-proyectos :focus-visible,
.contenido-ficha :focus-visible {
    outline: 3px solid #2359b8;
    outline-offset: 4px;
}

.contenido-proyectos .solo-lectores {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.salto-proyectos {
    position: fixed;
    top: .5rem;
    left: 1rem;
    z-index: 200;
    padding: .75rem 1rem;
    color: white;
    background: var(--azul);
    transform: translateY(-180%);
    border-radius: 7px;
}

.salto-proyectos:focus {
    transform: none;
}

.contenido-proyectos .intro-proyectos,
.contenido-proyectos .filtros-proyectos,
.contenido-proyectos .cabecera-resultados,
.contenido-proyectos .sin-resultados {
    line-height: 1.6;
    color: var(--proy-azul);
}

.contenido-proyectos .filtros-proyectos,
.contenido-proyectos .filtros-proyectos * {
    box-sizing: border-box;
}

.contenido-proyectos .filtros-proyectos button,
.contenido-proyectos .filtros-proyectos input {
    font: inherit;
}

.contenido-proyectos .filtros-proyectos button {
    cursor: pointer;
}

.contenido-proyectos .filtros-proyectos .material-symbols-outlined {
    flex-shrink: 0;
    font-size: 1.35rem;
}


/* Listado de proyectos: filtros y busqueda */
/* Título, buscador y filtros aprobados. */
.contenido-proyectos {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}


.contenido-proyectos .intro-proyectos {
    margin-bottom: 1.8rem;
    max-width: 760px;
}

.contenido-proyectos .intro-proyectos .etiqueta-seccion {
    color: var(--proy-verde);
    font-size: .875rem;
}

.contenido-proyectos h1 {
    margin: 0 0 .6rem;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    line-height: 1.15;
}

.contenido-proyectos .intro-proyectos > p {
    margin: .65rem 0;
}


/* BUSCADOR COMPACTO DE PROYECTOS */

.contenido-proyectos .filtros-proyectos {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

/* Barra principal */

.contenido-proyectos .barra-filtros {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 70px;
    padding: 8px;
    border: 1px solid #e5eae7;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(27, 42, 74, .055);
}

/* Campo de búsqueda */

.contenido-proyectos .campo-busqueda {
    position: relative;
    flex: 1 1 230px;
    min-width: 0;
    max-width: none;
}

.contenido-proyectos .campo-busqueda .icono-buscar {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    color: #718078;
    pointer-events: none;
}

.contenido-proyectos .campo-busqueda input {
    display: block;
    width: 100%;
    height: 52px;
    min-height: 0;
    padding: 0 12px 0 45px;
    border: 0;
    border-radius: 999px;
    outline: none;
    background: transparent;
    color: var(--proy-azul);
    font-size: 15px;
}

.contenido-proyectos .campo-busqueda:focus-within {
    border-radius: 999px;
    box-shadow: inset 0 0 0 2px var(--verde);
}

.contenido-proyectos .campo-busqueda input::placeholder {
    color: #75817b;
    opacity: 1;
}

/* Contenedores de los desplegables */

.contenido-proyectos .filtro-menu {
    position: relative;
    width: 224px;
    flex: 0 0 224px;
    min-width: 0;
}

.contenido-proyectos .filtro-menu[data-tipo="territorio"] {
    width: 160px;
    flex-basis: 160px;
}

/* fieldeset en actividades.html */


/* Adaptación de los filtros existentes de Actividades */

.contenido-proyectos .filtro-menu fieldset {
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
}

.contenido-proyectos .filtro-menu legend {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.contenido-proyectos .filtro-menu .opciones-filtro {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
}

.contenido-proyectos .filtro-menu .chip-filtro.opcion-filtro {
    width: 100%;
    max-width: none;
    min-height: 42px;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--azul);
    box-shadow: none;
    font-size: 14px;
    font-weight: 400;
}

.contenido-proyectos .filtro-menu .chip-filtro.opcion-filtro:hover {
    background: #edf6f0;
}

.contenido-proyectos .filtro-menu .chip-filtro.opcion-filtro[aria-pressed="true"] {
    background: #eaf5ee;
    color: var(--verde-oscuro);
    box-shadow: none;
}

.contenido-proyectos .filtro-menu[data-tipo="periodo"] {
    width: 170px;
    flex: 0 0 170px;
}

/* Botones de área y territorio */

.contenido-proyectos .filtros-proyectos .boton-filtro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #f5f8f6;
    color: var(--proy-azul);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background-color .2s, color .2s;
}

.contenido-proyectos .boton-filtro .texto-filtro {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.contenido-proyectos .boton-filtro .icono-desplegable {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    transition: transform .2s;
}

.contenido-proyectos .filtros-proyectos .boton-filtro:hover {
    background: #eaf3ed;
}

/* Cuando tiene un filtro elegido */

.contenido-proyectos .filtros-proyectos .boton-filtro[data-elegido="true"] {
    background: var(--verde);
    border-color: var(--verde);
    color: white;
}

.contenido-proyectos .filtros-proyectos .boton-filtro[aria-expanded="true"] {
    border-color: var(--verde);
}

.contenido-proyectos .boton-filtro[aria-expanded="true"] .icono-desplegable {
    transform: rotate(180deg);
}

/* Paneles desplegables */

.contenido-proyectos .lista-opciones-filtro {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    width: max-content;
    min-width: 100%;
    max-width: min(310px, calc(100vw - 32px));
    max-height: 345px;
    overflow-y: auto;
    padding: 7px;
    border: 1px solid #e0e8e3;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(27, 42, 74, .14);
}

.contenido-proyectos .filtro-menu.abierto .lista-opciones-filtro {
    display: grid;
    gap: 2px;
}

/* Opciones interiores */

.contenido-proyectos .filtros-proyectos .opcion-filtro {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--proy-azul);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
}

.contenido-proyectos .opcion-filtro .nombre-opcion {
    flex: 1;
}

.contenido-proyectos .filtros-proyectos .opcion-filtro:hover,
.contenido-proyectos .filtros-proyectos .opcion-filtro:focus-visible {
    background: #edf6f0;
}

.contenido-proyectos .filtros-proyectos .opcion-filtro[aria-pressed="true"] {
    background: #eaf5ee;
    color: var(--verde-oscuro);
    font-weight: 600;
}

/* Botón Limpiar */

.contenido-proyectos .filtros-proyectos .limpiar-filtros {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #68736d;
    font-size: 14px;
    font-weight: 500;
}

.contenido-proyectos .limpiar-filtros:hover {
    background: #f1f6f3;
    color: var(--verde);
}

/* Filtros activos debajo de la barra */

.contenido-proyectos .filtros-activos:empty {
    display: none;
}

.contenido-proyectos .filtros-activos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.contenido-proyectos .filtros-proyectos .chip-activo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid #cde2d3;
    border-radius: 999px;
    background: #eff7f1;
    color: var(--verde-oscuro);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.contenido-proyectos .chip-activo:hover {
    border-color: var(--verde);
    background: #e1f0e6;
}

.contenido-proyectos .chip-activo > span {
    font-size: 18px;
    line-height: 1;
}

.contenido-proyectos .chip-filtro[aria-pressed="true"] {
    background: var(--proy-verde);
    border-color: var(--proy-verde);
    color: #fff;
    box-shadow: inset 0 0 0 1px currentColor;
}

.contenido-proyectos .chip-filtro[aria-pressed="true"] .material-symbols-outlined {
    color: inherit;
}

.contenido-proyectos .limpiar-filtros {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 44px;
    padding: .5rem .8rem;
    border: 1px solid #9eafa4;
    border-radius: 7px;
    background: #fff;
    color: var(--proy-verde);
    font-weight: 700;
}

.contenido-proyectos .limpiar-filtros:hover {
    background: #e9f3ed;
}

.contenido-proyectos .aviso-sin-js {
    padding: 1rem;
    background: #fff6d5;
    border-radius: 8px;
}


/* Listado de proyectos: resultados y tarjetas */
/* Misma tarjeta del inicio: sin marcos, rellenos ni colores nuevos. */
.contenido-proyectos .resultados-proyectos {
    margin-top: 2rem;
}

.contenido-proyectos .cabecera-resultados {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: 1.25rem;
}

.contenido-proyectos .cabecera-resultados h2 {
    margin: 0;
    font-size: 1.35rem;
}

.contenido-proyectos #contador-proyectos {
    margin: 0;
    color: #7b8580;
    font-size: 13px;
    font-weight: 400;
}

.contenido-proyectos .rejilla-proyectos {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.contenido-proyectos .img-tarjeta-proyecto > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.contenido-proyectos .sin-resultados {
    padding: 2rem 1rem;
    border: 1px dashed #9eafa4;
    border-radius: 12px;
    text-align: center;
}

.contenido-proyectos .sin-resultados > span {
    color: var(--proy-verde);
    font-size: 2.5rem;
}

.contenido-proyectos .sin-resultados h3 {
    margin: .5rem 0;
    font-size: 1.2rem;
}

.contenido-proyectos .sin-resultados p {
    max-width: 55ch;
    margin: .5rem auto;
    color: #526158;
}


/* Ficha de proyecto: contenido y datos */
/* Ficha interna: los componentes del inicio conservan sus clases. */
.contenido-ficha {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;

    min-height: calc(100svh - var(--alto-header, 110px));
}


.contenido-ficha .aviso-ficha {
    font-size: .875rem;
    line-height: 1.5;
    color: #59655f;
}

.contenido-ficha .foto-proyecto {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

.contenido-ficha .etiquetas-proyecto a {
    text-decoration: none;
}

.contenido-ficha h1 {
    color: var(--azul);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.2;
    margin: 0 0 1rem;
}

.contenido-ficha .resumen-proyecto {
    max-width: 75ch;
    color: #555;
    font-size: 1.05rem;
    line-height: 1.6;
}

.contenido-ficha .descripcion-proyecto {
    margin: 30px 0;
    font-size: 18px;
    line-height: 1.7;
    white-space: pre-line;
}


/* 
   FICHA DE PROYECTO | DATOS GENERALES
    */

.contenido-ficha .datos-proyecto {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    grid-template-areas:
        "lugar ano estado financiacion"
        "beneficiarios beneficiarios colaboraciones colaboraciones";

    column-gap: 20px;
    row-gap: 24px;

    margin: 24px 0;
    padding: 24px;

    background: #f6f9f7;
    border-radius: 14px;
}

/* DISTRIBUCION DE LOS CAMPOS */

.contenido-ficha .datos-proyecto > div {
    min-width: 0;
}

.contenido-ficha .datos-proyecto > div:nth-child(1) {
    grid-area: lugar;
}

.contenido-ficha .datos-proyecto > div:nth-child(2) {
    grid-area: ano;
}

.contenido-ficha .datos-proyecto > div:nth-child(3) {
    grid-area: estado;
}

.contenido-ficha .datos-proyecto > div:nth-child(4) {
    grid-area: beneficiarios;
}

.contenido-ficha .datos-proyecto > div:nth-child(5) {
    grid-area: financiacion;
}

.contenido-ficha .datos-proyecto > div:nth-child(6) {
    grid-area: colaboraciones;
}

/* PRIMERA FILA: DATOS COMPACTOS */

.contenido-ficha .datos-proyecto > div:nth-child(1),
.contenido-ficha .datos-proyecto > div:nth-child(2),
.contenido-ficha .datos-proyecto > div:nth-child(3),
.contenido-ficha .datos-proyecto > div:nth-child(5) {
    padding: 16px;
    background: #fcfffd;
    border: 1px solid #e3ece6;
    border-radius: 10px;
}

/* SEGUNDA FILA: DATOS DESCRIPTIVOS */

.contenido-ficha .datos-proyecto > div:nth-child(4),
.contenido-ficha .datos-proyecto > div:nth-child(6) {
    padding-top: 20px;
    border-top: 1px solid #dbe6df;
}

/* TITULOS */

.contenido-ficha .datos-proyecto dt {
    margin-bottom: 8px;

    color: var(--azul);
    font-weight: 700;
    line-height: 1.35;
}

/* CONTENIDO */

.contenido-ficha .datos-proyecto dd {
    margin: 0;

    color: #555;
    line-height: 1.6;

    text-align: left;
    overflow-wrap: break-word;
}

.contenido-ficha .bloques-detalle {
    display: grid;
    gap: 24px;
}

.contenido-ficha .bloques-detalle h2 {
    color: var(--azul);
    font-size: 1.25rem;
    margin: 0 0 10px;
}

.contenido-ficha .bloques-detalle p,
.contenido-ficha .bloques-detalle ul {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

.contenido-ficha .bloques-detalle ul {
    padding-left: 20px;
}

.contenido-ficha .bloque-ficha {
    margin-top: 40px;
}

.contenido-ficha .bloque-ficha .cabecera-seccion {
    width: auto;
    margin-bottom: 15px;
}

.contenido-ficha .actividades-proyecto .tarjeta-explora {
    display: block;
    width: 100%;
    scroll-snap-align: start;
}

.contenido-ficha .img-noticia img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.contenido-ficha .seguir-explorando {
    margin-top: 32px;
}


/* Ficha de proyecto: carrusel de actividades */
/* The original .tarjeta-explora styling (height 180px, etc.) stays in estilos.css. */
.contenido-ficha .carrusel-actividades {
    position: relative;
}

.contenido-ficha .actividades-proyecto {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 30%;
    gap: 20px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.contenido-ficha .actividades-proyecto::-webkit-scrollbar {
    display: none;
}

/* The arrows are outside the cards, in the white side margins. */
.contenido-ficha .flecha-carrusel {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--azul);
    box-shadow: 0 2px 8px #0003;
    cursor: pointer;
    transform: translateY(-50%);
}

.contenido-ficha .flecha-anterior {
    left: -50px;
}

.contenido-ficha .flecha-siguiente {
    right: -50px;
}

.contenido-ficha .flecha-carrusel:disabled {
    opacity: .35;
    cursor: default;
}
