/* ==========================================================
   ESTILOS GENERALES
   ========================================================== */

/*
 * box-sizing: border-box hace que el padding y el borde
 * formen parte del tamaño total de los elementos.
 */

* { box-sizing: border-box; }

/*
 * Eliminamos los márgenes por defecto del navegador.
 *
 * height: 100% permite que la aplicación pueda ocupar
 * toda la altura disponible.
 */

html,
body {
    margin: 0;
    height: 100%;
    font-family: system-ui, sans-serif;
}

/* ==========================================================
   ESTRUCTURA PRINCIPAL
   ========================================================== */

/*
 * La aplicación utiliza CSS Grid.

 * Escritorio:

 * ┌──────────────────────────────┐
 * │           HEADER             │
 * ├──────────┬───────────────────┤
 * │ menuLat  │      MAIN         │
 * │          │                   │
 * └──────────┴───────────────────┘
 */

.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 60px 1fr;
    grid-template-areas: "header header" "menuLat main";
    height: 100vh;
}

/* ==========================================================
   CABECERA
   ========================================================== */

.header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
    background: #1f2937;
    color: white;
}

/*
 * Nombre / logotipo de la aplicación.
 */

.logo {
    font-size: 20px;
    font-weight: bold;
}

/*
 * Botón del menú móvil.

 * En escritorio permanece oculto.
 */

.menu-boton {
    display: none;
    border: 0;
    background: transparent;
    color: white;
    font-size: 26px;
    cursor: pointer;
}

/* ==========================================================
   MENÚ LATERAL
   ========================================================== */

.menuLat {
    grid-area: menuLat;
    background: #f3f4f6;
    border-right: 1px solid #ddd;
    padding: 20px;
}

/*
 * Enlaces del menú.
 */

.menuLat nav a {
    display: block;
    padding: 10px;
    margin-bottom: 5px;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
}

/*
 * Estado hover de los enlaces.
 */

.menuLat nav a:hover {
    background: #ddd;
}

/* ==========================================================
   CONTENIDO PRINCIPAL
   ========================================================== */

.main {
    grid-area: main;
    padding: 25px;
    overflow: auto;
    background: #fff;
}

/* ==========================================================
   MINIATURAS DE FOTOGRAFÍAS
   ========================================================== */

.miniatura {
    cursor: pointer;
    max-width: 300px;
}

/* ==========================================================
   CAPA PARA EL MENÚ MÓVIL
   ========================================================== */

.menu-capa {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 100;

}

/* ==========================================================
   AVISOS
   ========================================================== */

.notificacion-layer {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    z-index: 200;
}

/*
 * Ventana del aviso.
 */

.notificacion {
    width: min(90%, 450px);
    padding: 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

/* ==========================================================
   VISOR DE FOTOGRAFÍAS
   ========================================================== */

.foto-visor {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(0, 0, 0, .9);
    z-index: 300;
}

/*
 * Fotografía ampliada.
 */

.foto-visor img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
}

/*
 * Botón para cerrar el visor.
 */

.foto-cerrar {
    position: absolute;
    top: 15px;
    right: 20px;
    border: 0;
    background: transparent;
    color: white;
    font-size: 35px;
    cursor: pointer;
}

/* ==========================================================
   DISEÑO PARA DISPOSITIVOS MÓVILES
   ========================================================== */

/*
 * A partir de 768px o menos cambiamos la estructura.

 * En móvil:

 * ┌───────────────────────────┐
 * │          HEADER           │
 * ├───────────────────────────┤
 * │                           │
 * │           MAIN            │
 * │                           │
 * └───────────────────────────┘

 * El menú lateral pasa a ser una capa que se desplaza
 * desde la izquierda.
 */

@media (max-width: 768px) {
    /* ------------------------------------------------------
       ESTRUCTURA DE LA APLICACIÓN
       ------------------------------------------------------ */

    .app {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
        grid-template-areas: "header" "main";
    }

    /* ------------------------------------------------------
       BOTÓN DEL MENÚ
       ------------------------------------------------------ */

    .menu-boton { display: block; }

    /* ------------------------------------------------------
       MENÚ LATERAL MÓVIL
       ------------------------------------------------------ */

    .menuLat {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 101;
        box-shadow: 5px 0 20px rgba(0, 0, 0, .2);
    }

    /*
     * Cuando JavaScript añade la clase .open,
     * el menú vuelve a su posición original.
     */

    .menuLat.open { transform: translateX(0); }

    /* ------------------------------------------------------
       CAPA DEL MENÚ
       ------------------------------------------------------ */

    .menu-capa.open { display: block; }

}
