@import url("variables.css");

main {
    gap: 80px;
    padding: 80px 0 40px 0;
    max-width: var(--max-width-container);
    margin: auto;
}

section {
    padding: 30px 10px 10px;
}

section h2 {
    font-size: 36px;
    margin-bottom: 2px;
    color: var(--title-clr);
}

/* == GAP == */
ol {
    gap: 4px;
}

/* == COMPONENTS == */
/* card */
.card {
    border-radius: 6px;
    border: 1px solid var(--border-clr);
    background-color: var(--bg-clr-card);
    padding: 10px;
    height: fit-content;

    figure {
        height: 100%;
        border-radius: 6px;
        border: 1px solid var(--bg-clr-card);
        background-color: var(--bg-clr);
    }
}

/* Bannière */
.flash-banner {
    max-width: 700px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 10px;
    margin-bottom: 20px;
    background-color: var(--title-clr);
    color: var(--bg-clr);
    border-radius: 6px;
    border: 1px solid var(--border-clr);
    width: 100%;

    /* Text */
    hgroup {
        flex: 1;
        
        h2 {
            font-size: 16px;
            margin: 0;
            font-weight: 500;
            color: var(--border-clr);
        }

        mark {
            background-color: var(--title-clr);
            color: var(--bg-clr);
            font-weight: bold;
            text-transform: uppercase;
        }
    }

    /* Actions */
    .flash-banner__actions {
        display: flex;
        align-items: center;
        gap: 15px;
        position: relative;
    }
}

/* cookie */
.cookie-banner-container {
    position: fixed;
    bottom: 10px;
    right: 50%;
    transform: translateX(50%);
    background-color: var(--tag-bg);
    border: 1px solid var(--border-clr);
    padding: 10px;
    border-radius: 6px;
    z-index: 10;

    form {
        margin-top: 10px;
        width: fit-content;
        display: flex;
        gap: 10px;
    }
}

/* Sondage */
.polls-container {
    box-shadow: var(--shadow-md);
    width: calc(100% - 20px);
    margin: auto;
    border-radius: 6px;
    background-color: var(--border-clr);

    padding: 10px;

    a {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    strong {
        color: var(--title-clr);
        text-transform: uppercase;
    }

    footer, h3 {
        color: var(--text-clr);
    }
}

/* dropdown for admin */
.admin-context-menu {
    position: relative;

    /* icon */
    .menu-btn {
        color: var(--bg-clr);
        cursor: pointer;
    }

    .menu-dropdown {
        display: none;
        position: absolute;
        right: 0;
        top: 100%;
        background: var(--bg-clr);
        border: 1px solid var(--border-clr);
        border-radius: 6px;
        list-style: none;
        min-width: 150px;
        padding: 5px;
        z-index: 100;

        li {
            a, button {
                display: block;
                width: 100%;
                padding: 10px 15px;
                background: none;
                border: none;
                text-align: left;
                color: var(--title-clr);
                text-decoration: none;
                font-size: 0.9rem;
                cursor: pointer;
                
                &:hover {
                    border-radius: 6px;
                }
            }
            
            button {
                color: var(--danger-clr);
                &:hover {
                    background-color: var(--danger-bg);
                }
            }
            a:hover {
                background-color: var(--tag-bg);
            }
        }
    }

    /* Affichage du menu */
    &:hover, &:focus-within {
        .menu-dropdown {
            display: block;
        }
    }
}

/* Bouton de création */
.flashbanner-create-container {
    padding: 10px 5%;
    text-align: center;

    .btn-add {
        color: var(--title-clr);
        text-decoration: none;
        font-weight: bold;
        border: 2px dashed var(--border-clr);
        padding: 10px 20px;
        display: inline-block;
        border-radius: 8px;
        transition: border-color 0.2s;

        &:hover {
            border-color: var(--title-clr);
        }
    }
}

/* Hero */
#hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    
    /* Badge */
    .badge {
        border-radius: 28px;
        border: 1px solid var(--border-clr);
        width: fit-content;
        padding: 2px 6px;
        font-size: 12px;
        margin-bottom: 40px;
    }
    /* Open */
    .badge-open {
        color: var(--success-clr);
    }
    /* Close */
    .badge-close {
        color: var(--danger-clr);
    }

    /* Text */
    h1 {
        width: fit-content;
        text-align: center;
        font-size: 40px;
        color: var(--title-clr);
    }
    .sub-title {
        text-align: center;
        font-size: 16px;
        color: var(--text-clr);
        margin-bottom: 20px;
    }

    /* CTA */
    .cta {
        display: flex;
        flex-direction: row;
        gap: 4px;
        margin-bottom: 100px;
    }

    /* Next event */
    #next-event {
        max-width: 500px;
        width: 100%;
        background-color: var(--bg-clr-card);
        border: 1px solid var(--border-clr);
        border-radius: 6px;
        padding: 10px;
        position: relative;
        
        display: grid;
        grid-template-columns: 120px 1fr;
        grid-template-rows: repeat(4, auto);
        column-gap: 10px;
        
        /* Absolute */
        .tag {
            width: fit-content;
            position: absolute;
            top: 0;
            left: 50%;
            transform: translate(-50%, -50%);
            padding: 2px 6px;
            background-color: var(--tag-bg);
            border: 1px solid var(--border-clr);
            border-radius: 6px;
            text-wrap: nowrap;
        }
        
        /* Content */
        figure {
            grid-column: 1/2;
            grid-row: 1/5;
            height: 100%;
            aspect-ratio: 1/1;
            border-radius: 6px;
            background-color: var(--bg-clr);
            border: 1px solid var(--border-clr);
            
            img {
                border-radius: 6px;
                height: 100%;
                width: 100%;
                object-fit: cover;
                display: block;
            }
        }
        p:not(.tag), h2, a {
            grid-column: 2/3;
        }
        h2 {
            margin-top: 4px;
            font-size: 20px;
        }
    }

    &::before, &::after {
        content: "";
        position: absolute;
        width: 200px;
        aspect-ratio: 1/1;
        border-radius: 50%;
        filter: blur(500px);
        opacity: .7;
        background-color: var(--text-clr);
        z-index: -10;
    }
    &::before {
        top: 0;
        left: 0;
    }
    &::after {
        top: 60%;
        right: 0;
    }
}

#news {
    /* Container de la liste */
    ol {
        display: grid;
        /* Grille responsive : min 300px par carte */
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        /* On définit 4 lignes par rangée pour le subgrid */
        grid-auto-rows: auto auto 1fr auto; 
        gap: 24px;
        list-style: none;
        padding: 0;
        margin-bottom: 20px;

        li {
            /* Le li prend 4 lignes de la grille ol */
            grid-row: span 4;
            display: grid;
            grid-template-rows: subgrid;
        }
    }

    .card {
        /* L'article prend aussi les 4 lignes du li */
        grid-row: span 4;
        display: grid;
        grid-template-rows: subgrid;
        
        background-color: var(--bg-clr-card);
        border: 1px solid var(--border-clr);
        border-radius: 8px;
        padding: 15px;
        height: 100%;

        figure {
            grid-row: 1; /* Ligne 1 : Image */
            aspect-ratio: 16/9;
            border-radius: 6px;
            overflow: hidden;
            background-color: var(--bg-clr);
            margin: 0 0 10px 0;
            width: 100%;

            img {
                object-fit: cover;
                width: 100%;
                height: 100%;
                display: block;
            }
        }

        h3 {
            grid-row: 2; /* Ligne 2 : Titre */
            margin: 0;
            font-size: 1.2rem;
            color: var(--title-clr);
        }

        p {
            grid-row: 3; /* Ligne 3 : Texte (prend la place restante) */
            margin: 10px 0;
            font-size: 0.95rem;
            line-height: 1.5;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .btn {
            width: 100%;
            padding: 8px;
        }
    }
}

/* About */
#about {    
    address, ul {
        margin-bottom: 8px;
    }
    address, li {
        font-size: 16px;
    }
    
    li {
        list-style: circle;
        list-style-position: inside;

        &:first-child {
            list-style: none;
        }
    }
    
    
}

/* Events */
#events {

    /* container card */
    ol {
        margin-bottom: 8px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        list-style: none;
        padding: 0;
    }

    /* card */
    .card {
        display: grid;
        grid-template-columns: 100px 1fr;
        grid-template-rows: auto auto auto;
        column-gap: 10px;
        align-items: center;
        background-color: var(--bg-clr-card);
        border: 1px solid var(--border-clr);
        border-radius: 6px;
        padding: 10px;

        figure {
            border-radius: 6px;
            border: 1px solid var(--border-clr);
            background-color: var(--bg-clr);
            margin-right: 10px;
            grid-column: 1;
            grid-row: 1 / 5;
            width: 100%;
            aspect-ratio: 1/1;
            
            img {
                border-radius: 6px;
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
            }
        }

        .place, .seat {
            font-size: 14px;
        }
    }
}

/* Shop */
#shop {

    /* container card */
    ul {
        margin-bottom: 8px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        list-style: none;
        padding: 0;
    }

    /* card */
    .card {
        display: grid;
        grid-template-columns: 100px 1fr;
        grid-template-rows: auto auto auto;
        background-color: var(--bg-clr-card);
        border: 1px solid var(--border-clr);
        border-radius: 6px;
        padding: 10px;

        /* gauche */
        figure {
            border-radius: 6px;
            border: 1px solid var(--border-clr);
            background-color: var(--bg-clr);
            margin-right: 10px;
            grid-column: 1/2;
            grid-row: 1/5;
            height: 100%;
            aspect-ratio: 1/1;
            
            img {
                border-radius: 6px;
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
            }
        }

        /* droite */
        h3, p, a {
            grid-column: 2/3;
            width: fit-content;
        }
        /* bas */
        a, .stock {
            grid-row: 4/5;
        }
        a {
            place-self: end;
        }

        h3 {
            margin-bottom: 2px;
        }

        .category {
            font-size: 14px;
        }
        .price {
            font-weight: bold;
        }
        .stock {
            font-size: 14px;
            place-self: center start;
            font-family: 12px;
            color: var(--title-clr);
        }
    }
}

/* Contact */
#contact ol {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;

    li {
        width: 100%;
    }
}



/* background enchance */
#about {
    position: relative;
    background-color: var(--tag-bg);
    /* haut */
    &::before {
        position: absolute;
        content: "";
        top: -40px;
        left: 0;
        width: 100%;
        height: 40px;
        background-color: var(--tag-bg);
        clip-path: polygon(0% 0%, 50% 100%, 100% 0%, 100% 100%, 0% 100%);
    }
    /* bas */
    &::after {
        position: absolute;
        content: "";
        bottom: -40px;
        left: 0;
        width: 100%;
        height: 40px;
        background-color: var(--tag-bg);
        clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
    }
}
