/* css/sitio.css
   Estilos del contenido del sitio web del portal del CCP (páginas Wagtail:
   inicio, proyectos, personal, historia, contacto...).
   Se carga sólo en las plantillas del sitio del portal, no en apps como
   repository. El cascarón global (encabezado, menú, pie) vive en css/base.css. */

/* ===============================
   CARRUSEL
   =============================== */
#myCarousel {
    max-height: 600px;
    overflow: hidden;
}

#myCarousel .carousel-item img {
    width: 100%;
    height: 60vh;   /* 60% de la pantalla */
    object-fit: cover;
}

/* ===============================
   SECCIONES
   =============================== */
.seccion {
    padding: 5rem 0; /* Espacio vertical para todas las secciones */
}

.titulo-seccion {
    max-width: 760px; /* Limita el ancho del bloque de título */
    margin: 0 auto 2.5rem auto; /* Centra el bloque y agrega espacio abajo */
}

/* ===============================
   TARJETAS DE NOVEDADES
   =============================== */
.card-noticia {
    border: 0; /* Quita borde normal de la card */
    border-radius: 1.5rem; /* Bordes redondeados */
    overflow: hidden; /* Respeta los bordes redondeados en la imagen */
    transition: transform .2s ease, box-shadow .2s ease; /* Suaviza el hover */
}

.card-noticia:hover {
    transform: translateY(-6px); /* Sube un poco la tarjeta al pasar el mouse */
    box-shadow: var(--sombra-suave); /* Agrega sombra al pasar el mouse */
}

.card-noticia img {
    height: 230px; /* Altura de las imágenes de servicios */
    object-fit: cover; /* Recorta sin deformar */
}

.card-noticia a:hover {
    background: var(--color-terciario);
}

/* ===============================
   SECCIÓN DE EVENTOS
   =============================== */
.eventos {
    background: var(--color-fondo);
    padding-left: 2rem;
    padding-right: 2rem;
}

.card-evento {
    border: 0;
    border-radius: 1rem;
    transition: all .25s ease;
}

.card-evento:hover {
    transform: translateY(-5px);
    box-shadow: var(--sombra-suave);
}

.card-evento .btn-outline-success:hover {
    color: white;
}

.fecha-evento {
    width: 100px;
    min-width: 100px;
    height: 85px;

    background: var(--color-principal);
    color: #fff;

    border-radius: 1rem;
    padding: 1rem;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.fecha-evento .dia {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.fecha-evento .mes {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.fecha-evento .anio {
    font-size: .8rem;
    opacity: .85;
}

@media (max-width: 768px) {
    .fecha-evento {
        width: 80px;
        min-width: 80px;
    }
}

/* ===============================
   RELOJ DE POBLACIÓN
   =============================== */
.reloj-poblacion {
    /*background: var(--color-fondo);*/
    padding: 3rem 0;
}

.reloj-card {
    border: 0;
    border-radius: 1.5rem;
    background: linear-gradient(
        135deg,
        var(--color-principal),
        var(--color-principal-oscuro)
    );
    color: white;
}

.poblacion-numero {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    color: var(--color-principal-claro);
    letter-spacing: 2px;
    transition: transform .3s ease;
}

.poblacion-numero.actualizado {
    transform: scale(1.03);
}

.reloj-card .label {
    display: block;
    font-size: .85rem;
    opacity: .8;
}

.reloj-card .dato-secundario strong {
    display: block;
    font-size: 1.1rem;
}

/* ===============================
   RECURSOS DE INFORMACIÓN
   =============================== */
.recursos {
    background: var(--color-fondo);
}

.card-recurso {
    border: 0;
    border-radius: 1.5rem;
    background: var(--color-principal);

    color: #fff;

    transition:
        transform .25s ease,
        box-shadow .25s ease;
}

.card-recurso:hover {
    transform: translateY(-6px);

    box-shadow: var(--sombra-suave);

    color: var(--color-terciario);

    background: #464545;
}

.card-recurso .card-body {
    padding: 2rem 1rem;
}

.card-recurso i {
    display: block;
}

.card-recurso h5 {
    font-weight: 600;
    font-size: 1rem;
}

/* ===============================
   PÁGINA DE PROYECTOS
   =============================== */
.card-proyecto {
    background: var(--color-fondo);
    border: 0;
    border-radius: 1.25rem;
    transition: all .25s ease;
}

.card-proyecto:hover {
    transform: translateY(-5px);
    box-shadow: var(--sombra-suave);
}

.card-proyecto a {
    text-decoration: none;
}

.card-proyecto a:hover {
    color: var(--color-terciario);
}

/* ===============================
   LISTA DE PERSONAL COLABORADOR
   =============================== */
.card-persona {
    background: var(--color-fondo);
    border: 0;
    border-radius: 1.25rem;
    transition: all .25s ease;
}

.card-persona:hover {
    transform: translateY(-5px);
    box-shadow: var(--sombra-suave);
}

.foto-persona {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--color-principal-claro);
}

.card-persona a {
    text-decoration: none;
}

.card-persona a:hover {
    color: var(--color-terciario);
}

/* Página colaborador */
.seccion-colaborador img {
    max-height: 280px;
    object-fit: cover;
}

.seccion-colaborador .card i {
    opacity: 0.9;
}

/* ===============================
   SECCIÓN DE CONTACTO
   =============================== */
.contacto li {
    margin-bottom: .5rem;
}

.contacto a {
    color: var(--color-principal-oscuro);
    text-decoration: none;
}

.contacto a:hover {
    color: var(--color-terciario);
    text-decoration: underline;
}

/* ===============================
   PÁGINA DE HISTORIA (LÍNEA DE TIEMPO)
   =============================== */
.timeline {
    position: relative;
    margin: 0 auto;
    padding: 20px 0;
    width: 100%;
}

/* Línea vertical */
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    width: 4px;
    height: 100%;
    background: #ffc107;
    transform: translateX(-50%);
}

/* Evento */
.timeline-item {
    position: relative;
    width: 50%;
    padding: 20px;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease;
}

/* Alternar lados */
.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

/* Caja */
.timeline-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Punto */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 30px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: #0d6efd;
    border-radius: 50%;
    z-index: 1;
}

.timeline-item:nth-child(even)::before {
    left: -8px;
}

/* Animación visible */
.timeline-item.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {

    .timeline::before {
        left: 10px;
    }

    .timeline-item {
        width: 100%;
        left: 0 !important;
        text-align: left;
        padding-left: 40px;
    }

    .timeline-item::before {
        left: 0;
    }
}

/* ===============================
   SUBPÁGINA DE PROYECTO
   =============================== */
#carruselProyecto img {
    height: 40vh;
    object-fit: cover;
}

.sidebar-proyecto {
    border-radius: 1.25rem;
    background: var(--color-fondo);
}

.sidebar-proyecto .nav-link {
    color: var(--color-texto);
    padding: .5rem .75rem;
    border-radius: .5rem;
    margin-bottom: .25rem;
    font-weight: 500;
    transition: all .2s ease;
}

.sidebar-proyecto .nav-link:hover {
    background: var(--color-suave);
    color: var(--color-terciario);
}

.sidebar-proyecto .nav-link.active {
    background: var(--color-principal);
    color: #fff;
}

/* Sidebar sticky */
@media (min-width: 992px) {
    .sidebar-proyecto {
        position: sticky;
        top: 100px;
    }
}

/* ===============================
   PÁGINA DE NOTICIA / EVENTO (panel lateral)
   =============================== */
@media (min-width: 992px) {
    .sidebar-detalle {
        position: sticky;
        top: 100px;
    }
}

/* ===============================
   CONTENIDO DE BLOG (tablas pegadas desde Word en entradas migradas)
   =============================== */
.contenido-blog table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.contenido-blog table td,
.contenido-blog table th {
    border: 1px solid var(--color-secundario);
    padding: .6rem .8rem;
    vertical-align: top;
}

.contenido-blog table tr:first-child td,
.contenido-blog table tr:first-child th {
    background: var(--color-suave);
}

.contenido-blog table ul {
    margin-bottom: 0;
}

/* ===============================
   ESTRUCTURA ORGANIZACIONAL
   =============================== */
.organigrama-caja {
    border: 0;
    border-left: 5px solid var(--color-principal);
    border-radius: .75rem;
    background: #fff;
    box-shadow: var(--sombra-suave);
}

.organigrama-caja.nivel-asesor {
    border-left-color: var(--color-secundario);
}

.organigrama-caja.nivel-staff {
    border-left-color: var(--color-terciario);
}

.organigrama-conector {
    width: 2px;
    height: 2rem;
    background: var(--color-secundario);
    margin: 0 auto;
}

.organigrama-conector::after {
    content: "";
    display: block;
}

.organigrama-unidad .list-group-item {
    border: 0;
    border-bottom: 1px solid var(--color-suave);
}

.organigrama-unidad .list-group-item:last-child {
    border-bottom: 0;
}
