/* =========================================================
   Portal SAJI - Sistema de Administración de Justicia Inteligente
   ========================================================= */

:root {
    /* SAJI (tomados del logotipo) */
    --saji-negro: #06192F;
    --negro: #010203;
    --negro-hover: #33363B;
    --turquesa: #2BB3B8;
    --ambar: #FFC107;
    /* Sistemas con conectividad (tomados de sus logotipos y temas) */
    --saga: #004360;
    --saga-claro: #A3BAC6;
    --saga-hero: #407288;
    --pel-azul: #252B49;
    --pel-verde: #4F9F45;
    --pel-verde-oscuro: #3B7F35;
    --pel-lima: #B0C633;
    --expediente: #FFC107;
    --expediente-oscuro: #9A6B00;
    --texto: #06192F;
    --texto-secundario: #4A5568;
    --fondo: #FFFFFF;
    --fondo-gris: #F3F6FA;
    --borde: #E6EAF0;
    --sombra: 0 2px 6px rgba(10, 25, 45, .06), 0 8px 24px rgba(10, 25, 45, .06);
    --sombra-hover: 0 4px 10px rgba(10, 25, 45, .08), 0 16px 36px rgba(10, 25, 45, .12);
    --radio: 12px;
    --ancho: 1200px;
    --fuente: 'Outfit', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--fuente);
    color: var(--texto);
    background: var(--fondo);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

h1, h2, h3, p {
    margin: 0;
}

a {
    color: inherit;
}

.sprite {
    display: none;
}

.contenedor {
    width: 100%;
    max-width: var(--ancho);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Header ---------- */

.header {
    background: var(--fondo);
    border-bottom: 1px solid var(--borde);
}

.header__contenido {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 104px;
}

.header__logo img {
    height: 52px;
    width: auto;
}

.header__pjecz {
    height: 68px;
    width: auto;
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 480px;
    overflow: hidden;
    color: #FFFFFF;
    background: var(--saji-negro);
}

/* Fotografía de la balanza, desvanecida hacia el texto */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(62%, 680px);
    background: url('../assets/img/hero-balanza.jpg') center top 12% / cover no-repeat;
    opacity: .9;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .6) 25%, #000 50%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .6) 25%, #000 50%);
}

.hero__contenido {
    position: relative;
    padding-top: 64px;
    padding-bottom: 64px;
}

.hero__titulo {
    max-width: 620px;
    font-size: clamp(2rem, 4.2vw, 3.25rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -.01em;
}

.hero__subtitulo {
    margin-top: 16px;
    font-size: clamp(1.05rem, 1.8vw, 1.4rem);
    font-weight: 400;
    color: rgba(255, 255, 255, .9);
}

.hero__franja {
    display: flex;
    gap: 6px;
    margin-top: 24px;
}

.hero__franja span {
    width: 44px;
    height: 5px;
    border-radius: 3px;
}

/* Una barrita por cada sistema con conectividad, en el orden de sus tarjetas */
.hero__franja span:nth-child(1) {
    background: linear-gradient(90deg, var(--pel-lima), var(--pel-verde));
}

.hero__franja span:nth-child(2) {
    background: var(--expediente);
}

.hero__franja span:nth-child(3) {
    background: var(--saga-hero);
}

/* ---------- Secciones ---------- */

.seccion {
    padding-top: 48px;
}

.seccion--ultima {
    padding-bottom: 56px;
}

.seccion__titulo {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    font-size: clamp(1.5rem, 2.4vw, 1.9rem);
    font-weight: 600;
}

.seccion__titulo::before {
    content: '';
    flex: none;
    width: 6px;
    height: 1.25em;
    border-radius: 3px;
    background: var(--negro);
}

.seccion__titulo--turquesa {
    margin-bottom: 8px;
}

.seccion__titulo--turquesa::before {
    background: var(--turquesa);
}

.seccion__intro {
    margin: 0 0 28px 22px;
    font-size: 1.1rem;
    color: var(--texto-secundario);
}

/* ---------- Rejilla y tarjetas ---------- */

.rejilla {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
}

.rejilla--cuatro {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rejilla--tres {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tarjeta {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 24px;
    text-align: center;
    background: var(--fondo);
    border: 1px solid var(--borde);
    border-top: 3px solid var(--negro);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    transition: box-shadow .2s ease;
}

.tarjeta:hover {
    box-shadow: var(--sombra-hover);
}

.tarjeta__icono {
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
    fill: none;
    stroke: var(--negro);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tarjeta__nombre {
    font-size: 1.15rem;
    font-weight: 600;
}

.tarjeta__descripcion {
    flex: 1;
    margin: 8px 0 20px;
    font-size: .92rem;
    color: var(--texto-secundario);
}

.tarjeta--conectividad {
    align-items: flex-start;
    padding: 28px 32px;
    text-align: left;
    border-top-width: 4px;
}

.tarjeta__favicon {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    object-fit: contain;
}

.tarjeta--conectividad .tarjeta__nombre {
    font-size: 1.3rem;
    color: var(--marca);
}

.tarjeta__subnombre {
    display: block;
    margin-top: 2px;
    font-size: .95rem;
    font-weight: 500;
    color: var(--texto-secundario);
}

/* Acceso a la app móvil de Poder en Línea, junto al botón */
.tarjeta__acciones {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.tarjeta__app {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tarjeta__app-icono {
    width: 30px;
    height: 30px;
    margin-right: 2px;
}

.tarjeta__app a {
    display: block;
    border-radius: 50%;
}

.tarjeta__app a img {
    width: 28px;
    height: 28px;
    transition: opacity .2s ease;
}

.tarjeta__app a:hover img {
    opacity: .75;
}

.tarjeta__app a:focus-visible {
    outline: 3px solid var(--ambar);
    outline-offset: 2px;
}

.tarjeta--conectividad .boton--contorno {
    color: var(--marca-boton);
    border-color: var(--marca-boton);
}

.tarjeta--conectividad .boton--contorno:hover {
    color: #FFFFFF;
    background: var(--marca-boton);
    border-color: var(--marca-boton);
}

.tarjeta--saga {
    --marca: var(--saga);
    --marca-boton: var(--saga);
    border-top-color: var(--saga);
}

.tarjeta--pel {
    --marca: var(--pel-azul);
    --marca-boton: var(--pel-verde-oscuro);
    border-top: 0;
    padding-top: 32px;
    background:
        linear-gradient(90deg, var(--pel-lima), var(--pel-verde)) top / 100% 4px no-repeat,
        var(--fondo);
}

.tarjeta--expediente {
    --marca: var(--saji-negro);
    --marca-boton: var(--expediente-oscuro);
    border-top-color: var(--expediente);
}

/* En amarillo el texto blanco no se lee: el hover usa texto negro */
.tarjeta--expediente .boton--contorno:hover {
    color: var(--saji-negro);
    background: var(--expediente);
    border-color: var(--expediente);
}

/* Sistemas que todavía no están en línea */
.tarjeta--inactiva {
    border-top-color: var(--borde);
    background: var(--fondo-gris);
    box-shadow: none;
}

.tarjeta--inactiva:hover {
    box-shadow: none;
}

.tarjeta--inactiva .tarjeta__icono {
    stroke: #A0A8B4;
}

.tarjeta--inactiva .tarjeta__nombre,
.tarjeta--inactiva .tarjeta__descripcion {
    color: #8A93A0;
}

/* ---------- Botones ---------- */

.boton {
    display: inline-block;
    min-width: 128px;
    padding: 9px 28px;
    font-size: .95rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    color: #FFFFFF;
    background: var(--negro);
    border: 1.5px solid var(--negro);
    border-radius: 999px;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.boton:hover {
    background: var(--negro-hover);
    border-color: var(--negro-hover);
}

.boton:focus-visible,
.header__logo:focus-visible {
    outline: 3px solid var(--ambar);
    outline-offset: 3px;
}

.boton--inactivo,
.boton--inactivo:hover {
    color: #6B7480;
    background: #E3E7ED;
    border-color: #E3E7ED;
    cursor: default;
}

.boton--contorno {
    min-width: 116px;
    padding: 7px 24px;
    font-size: .88rem;
    background: transparent;
}

/* ---------- Conectividad ---------- */

.conectividad {
    padding: 56px 0;
    background: var(--fondo-gris);
}

/* ---------- Footer ---------- */

.footer {
    color: #FFFFFF;
    background: var(--saji-negro);
}

.footer__contenido {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 32px;
    padding-bottom: 32px;
}

.footer__institucion {
    font-size: 1.05rem;
    font-weight: 500;
}

.footer__sistema {
    margin-top: 4px;
    font-size: .9rem;
    color: rgba(255, 255, 255, .75);
}

.footer__copy {
    font-size: .85rem;
    color: rgba(255, 255, 255, .6);
}

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {

    .rejilla {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rejilla--cuatro {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 760px) {

    .contenedor {
        padding-left: 16px;
        padding-right: 16px;
    }

    .header__contenido {
        min-height: 76px;
    }

    .header__logo img {
        height: 38px;
    }

    .header__pjecz {
        height: 48px;
    }

    .hero {
        min-height: 320px;
    }

    .hero::before {
        width: 100%;
        background-position: 70% 30%;
        background-size: cover;
        opacity: .3;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .rejilla,
    .rejilla--tres {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .tarjeta {
        padding: 22px 14px 18px;
    }

    .tarjeta--conectividad {
        padding: 22px 20px;
    }

    .tarjeta--pel {
        padding-top: 26px;
    }

    .seccion__intro {
        margin-left: 0;
    }

    .footer__contenido {
        flex-direction: column;
        align-items: flex-start;
    }

}

@media (max-width: 480px) {

    .header__pjecz {
        display: none;
    }

    .rejilla,
    .rejilla--tres {
        grid-template-columns: 1fr;
    }

}

@media (prefers-reduced-motion: reduce) {

    .tarjeta,
    .boton {
        transition: none;
    }

}
