/* Styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden; /* Pas de scroll horizontal */
    font-family: Arial, sans-serif;
}

/* Disposition principale */
h1 {
    text-align: center;
    background: #003366;
    color: white;
    padding: 20px;
    margin-bottom: 0;
    font-size: 1.8rem;
}

/* Conteneur principal */
.container {
    display: flex;
    height: calc(100% - 60px); /* Hauteur restante après le H1 */
}

/* Section du labyrinthe */
.prim-section {
    width: 100%;
    background: #f4f4f9; /* Couleur de fond douce */
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto; /* Scroll si nécessaire */
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .prim-section {
        width: 100%; /* Prend toute la largeur en mobile */
        height: 50%; /* Divise l'espace en 2 */
    }
}

/* --- Cards grid --- */
.prim-section {
    gap: 20px;
}

.grid {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1100px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .grid { grid-template-columns: 1fr; }
}

.card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0,0,0,0.08);
    transition: transform .15s ease, box-shadow .15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.card-media {
    position: relative;
    background: linear-gradient(135deg, #e6eef8 0%, #f4f4f9 100%);
    /* Aspect ratio 16/9 */
    padding-top: 56.25%;
}

.card-media img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

.card-media.noimg {
    /* si pas d'image: motif doux */
    background-image:
            linear-gradient(135deg, rgba(0,51,102,0.08) 0%, rgba(0,0,0,0.03) 100%);
}

.card-body {
    padding: 14px 14px 16px;
}

.card-body h2 {
    font-size: 1.05rem;
    margin-bottom: 6px;
    color: #003366;
}

.card-body p {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.35;
}

/* Liste de liens d'origine: on la rend discrète sous la grille */
ul.links {
    list-style: none;
    margin-top: 10px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}
ul.links a {
    color: #003366;
    text-decoration: underline;
}
