/************* STYLES DE LA PAGE RESSOURCES **************/

.hide-block {
    display: none;
}


h1 {
    font-size: clamp(1.3125rem, 0.4531rem + 4.2969vw, 2rem);
}


h2 {
    font-weight: normal;
    margin-top: 0px;
    font-size: clamp(0.9375rem, 0.5469rem + 1.9531vw, 1.25rem);
}


/********* HEADER *********/
header {
    display: flex;
    flex-direction: column;
    grid-area: header;
    color: var(--blue-grey-color);
    justify-content: space-between;
    padding: 20px var(--content-left-margin);
}

/********* FIN HEADER *********/

/********* MAIN *********/
body {
    display: grid;
    font-size: clamp(0.8125rem, 0.5781rem + 1.1719vw, 1rem);
}

a.logo-link {
    grid-area: logo;
    display: flex;
}

nav.top-nav {
    grid-area: nav;
    display: flex;
    justify-content: end;
    align-items: center;
    background-color: var(--dark-blue-grey-color);

    img {
        padding: 10px;
        height: 40px;
    }

    button {
        border: none;
        background-color: transparent;

        &:hover:not(.active) {
            background-color: transparent;
        }
    }

    .icon-contrib {
        transition: .3s all ease-in-out;
        cursor: pointer;
        height: 25px;
    }

    .icon-contrib:hover {
        filter: brightness(0.8);
    }
}

/* Barre latérale */
aside {
    grid-area: aside;
    background-color: var(--blue-grey-color);
    position: relative;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding-inline: 10px;

    >button {
        display: none;
    }

    button#closeFilters {
        width: min-content;
        margin-top: 10px;
        align-self: flex-end;
    }

    form {
        position: sticky;
        top: 0;
        padding-block: var(--right-margin);
        display: flex;
        flex-direction: column;
        gap: 20px;

        hr {
            width: 50%;
            margin: 0 auto;
        }

        fieldset {
            border: none;
            display: flex;
            flex-direction: column;
            gap: 5px;
            padding-top: 0;
            padding-bottom: 0;

            legend {
                margin-bottom: 10px;
            }
        }

        #keywordsBox {
            display: flex;
            flex-direction: column;
            gap: 5px;
            overflow-y: auto;
            scrollbar-width: auto;
            scrollbar-color: #f1f1f1 var(--dark-blue-grey-color);
            max-height: 200px;

            &::-webkit-scrollbar-thumb {
                background: #f1f1f1;
                border-radius: 6px;
            }

            &::-webkit-scrollbar-track {
                background: #f1f1f1;
                border-radius: 6px;
            }

            &::-webkit-scrollbar-thumb:hover {
                background: #555;
            }

            label {
                order: 1;

                &:has(:checked) {
                    order: 0;
                }
            }
        }

        #searchField {
            position: relative;
            display: flex;
            align-items: center;

            #searchKeyword {
                padding: 5px 10px;
                border-radius: 5px;
                width: 100%;
            }

            #deleteSearch {
                position: absolute;
                right: 10px;
                cursor: pointer;

                &:before {
                    content: "X";
                    color: var(--dark-blue-color);
                }
            }
        }

        #resetFilters {
            padding: 4px;
            border: 1px solid #ccc;
            background-color: #f9f9f9;
            border-radius: 5px;
            cursor: pointer;

            &:hover {
                background-color: #ddd;
            }
        }
    }
}

/* Contenu */
main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    padding: 0 var(--right-margin);

    #buttonFilters {
        display: none;
    }

    /* Contenu : intro */
    #introBlock {
        color: var(--dark-grey-color);
        font-size: clamp(0.75rem, 0.5rem + 1.25vw, 0.95rem);
        line-height: 1.5;
    }


    /* Contenu : contributeurs */
    #contribsBlock {
        color: var(--dark-grey-color);
        border: 2px solid var(--blue-grey-color);
        padding: 20px;

        ul {
            padding-left: 0;

            li {
                margin-left: 20px;
                margin-bottom: 10px;
            }
        }

        button {
            border: none;
            background-color: transparent;
            color: var(--dark-grey-color);
            font-weight: bold;
            float: right;
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 0;

            span {
                font-size: 1.3rem;

                &:hover {
                    text-decoration-line: underline;
                }
            }
        }
    }

    /* Contenu : ressources */
    #resourcesBlock {
        .theme-container {
            margin: 50px 0;
        }

        .theme-title {
            color: var(--orange-color);
            font-size: clamp(0.75rem, 0.5rem + 1.25vw, 0.95rem);
        }

        .resource-box {
            margin: 20px 0 40px 0;
            word-break: break-word;

            * {
                margin: 0;
            }

            span {
                font-weight: bold;
                font-size: .8rem;
            }

            .grid-block {
                display: grid;
                grid-template-columns: 1fr 3fr;
                gap: 30px;
                align-items: start;
                max-width: 100%;
                margin-bottom: 20px;

                div:last-child {
                    display: flex;
                    flex-direction: column;
                    gap: 20px;
                }
            }

            .resource-keywords {
                list-style: none;
                padding: 0;
                color: var(--dark-blue-color);
                margin-top: 10px;
            }

            .resource-description {
                color: var(--dark-grey-color);
            }

            .versions-title {
                color: var(--blue-grey-color);
            }

            .resource-versions {
                list-style: square;
                padding-left: 0;
                font-size: .8rem;

                li {
                    margin: 8px 0px 8px 20px;
                }
            }
        }

        .pagination-legend {
            text-align: center;
            color: var(--dark-grey-color);
            font-size: .8rem;
            margin-top: 30px;
        }

        /* Contenu : pagination */
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 30px;
            margin-bottom: 30px;
            gap: 5px;
        }
    }
}

/********* FIN MAIN *********/

footer {
    grid-area: footer;
    background-color: var(--dark-blue-grey-color);
    color: #fff;
    width: 100%;

    nav,
    p {
        padding: 10px;
    }

    p {
        margin: 0;
    }

    a {
        color: #fff;
        display: block;
        margin-bottom: 10px;
        width: max-content;

        &:hover {
            color: var(--orange-color);
        }
    }
}

@media screen and (min-width: 1200px) {
    body {
        grid-template-areas:
            "logo header"
            "nav main"
            "aside main"
            "footer main";
        grid-template-rows: 140px 60px 1fr;
    }
}

@media screen and (max-width: 1200px) and (min-width: 960px) {
    body {
        grid-template-areas:
            "logo header"
            "nav header"
            "aside main"
            "footer main";
        grid-template-rows: 120px 60px 1fr;
    }
}

@media screen and (max-width: 960px) and (min-width: 576px) {
    body {
        grid-template-areas:
            "logo nav"
            "header header"
            "main main"
            "footer footer";
        grid-template-columns: min-content 1fr;

        &:not(:has(#filtersToggle:checked)) aside {
            display: none;
        }
    }

    main {
        #buttonFilters {
            display: flex;
        }
    }

    aside {
        position: fixed;
        height: 100%;

        >button {
            display: block;
        }
    }
}

@media screen and (max-width: 576px) {
    body {
        display: flex;
        flex-direction: column;

        &:not(:has(#filtersToggle:checked)) aside {
            display: none;
        }
    }

    a.logo-link {
        position: relative;
        justify-content: end;
        background-color: var(--yellow-color);

        img {
            max-width: 100%;
        }
    }

    aside {
        position: fixed;
        height: 100%;

        >button {
            display: block;
        }

        form {
            padding-top: 10px;
        }
    }

    main {
        #buttonFilters {
            display: flex;
        }

        #resourcesBlock {
            .resource-box {
                .grid-block {
                    display: flex;
                    flex-direction: column;
                    gap: 20px;
                }

                .resource-keywords {
                    display: flex;
                    flex-wrap: wrap;
                    column-gap: 10px;
                }
            }
        }
    }
}