:root {
    --indent-alinea: 2em;
    --marge-paragraphe: 1.2em;
    --marge-titre-avant: 2.4em;
    --marge-titre-avant-large: 3.6em;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #333;
    line-height: 1.6;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 20px 10px;
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.tagline {
    color: #666;
    font-size: 0.95em;
    font-style: italic;
    margin-bottom: 20px;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    max-width: min(1200px, 96%);
    margin: 0 auto;
    gap: 1vw;
}

nav ul li {
    flex: 1 1 auto;
    min-width: 0;
}

nav ul li a {
    display: block;
    text-align: center;
    text-decoration: none;
    color: #333;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.55rem, 1.4vw, 0.85rem);
    letter-spacing: 0.5px;
    padding-bottom: 5px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

nav ul li a:hover {
    border-bottom: 1px solid #333;
}

nav ul li a.actif {
    border-bottom: 1px solid #333;
    font-weight: bold;
}

main {
    max-width: min(900px, 92%);
    margin: 40px auto;
    padding: 0 20px;
}

main > h2 {
    margin-bottom: 1.5em;
}

/* Styles communs à toutes les sections de contenu des modules */
.section-contenu p {
    text-align: justify;
    text-indent: var(--indent-alinea);
    margin-bottom: var(--marge-paragraphe);
}

.section-contenu p.sans-espace {
    margin-bottom: 0;
}

.section-contenu p.sans-alinea {
    text-indent: 0;
}

.section-contenu h3 {
    margin-top: var(--marge-titre-avant);
    margin-bottom: var(--marge-paragraphe);
}

/* Titres h4 avec un espacement plus large avant (terrain, tournois) */
#terrain h4,
#formats h4,
#categories h4,
#deroulement-match h4,
#arbitrage h4 {
    margin-top: 2em;
    margin-bottom: 0;
    font-size: 1.05em;
}

/* Titres h4 avec un espacement plus resserré (comptage, échange) */
#comptage h4,
#echange h4 {
    margin-top: var(--marge-titre-avant);
    margin-bottom: 0;
}

/* Exceptions ponctuelles qui dérogent à la règle commune .section-contenu h3 */
#comptage h3 {
    margin-top: 0;
    margin-bottom: var(--marge-paragraphe);
}

#accessoires h3 {
    margin-top: 0;
    margin-bottom: var(--marge-paragraphe);
}

#echange h3 {
    margin-top: var(--marge-titre-avant);
}

#arbitrage h3 {
    margin-top: var(--marge-titre-avant-large);
}

#histoire h2 {
    margin-bottom: var(--marge-paragraphe);
}

#intro {
    max-width: 600px;
    margin: 0 auto 3em;
    color: #555;
}

#intro .accroche {
    font-size: 1.25em;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin-bottom: 0.8em;
}

#intro p:not(.accroche) {
    text-align: justify;
    text-align-last: center;
    font-size: 1.05em;
}

/* Encarts anecdote */
.anecdote {
    background-color: #f7f5ef;
    border-left: 3px solid #999;
    padding: 15px 20px;
    margin: 1.5em 0 2.7em;
    font-size: 0.95em;
    color: #444;
}

.anecdote p {
    text-align: left;
    text-indent: 0;
    margin-bottom: 0;
}

.anecdote-titre {
    font-weight: bold;
    margin-bottom: 0.5em;
}

/* Page d'accueil : cartes de modules */
#modules {
    margin-top: 3em;
}

#modules h2 {
    margin-bottom: var(--marge-paragraphe);
}

.cartes-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.carte {
    position: relative;
    display: block;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    text-decoration: none;
    color: #333;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.carte:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border-color: #bbb;
}

.carte h3 {
    font-size: 1.05em;
    margin-bottom: 6px;
}

.carte p {
    font-size: 0.85em;
    color: #666;
}

.carte-recommandee {
    border-color: #999;
}

.badge {
    position: absolute;
    top: -10px;
    left: 12px;
    background-color: #333;
    color: #fff;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Bouton retour en haut */
#bouton-haut {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #333;
    color: #fff;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, background-color 0.2s;
    z-index: 200;
}

#bouton-haut.visible {
    opacity: 1;
    visibility: visible;
}

#bouton-haut:hover {
    background-color: #555;
}

#bouton-haut .bulle-info {
    position: absolute;
    bottom: 55px;
    right: 0;
    background-color: #d3c9c9;
    color: #fff;
    font-size: 0.75em;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

#bouton-haut:hover .bulle-info {
    opacity: 1;
    visibility: visible;
}

.nom-surface {
    font-style: italic;
    color: #1a1a1a;
}

/* Schémas SVG : propriétés communes, puis largeur propre à chacun */
.schema-terrain,
.schema-comptage,
.schema-tableau,
.schema-echelle,
.schema-pyramide,
.schema-trajectoires {
    display: block;
    height: auto;
    margin: 1.5em auto;
}

.schema-terrain,
.schema-tableau,
.schema-echelle,
.schema-trajectoires {
    width: 100%;
    max-width: 600px;
}

.schema-comptage {
    width: 480px;
    max-width: 100%;
}

.schema-pyramide {
    width: 420px;
    max-width: 100%;
}

/* Accordéons de description (modules frappes et tenue) */
.liste-coups {
    margin-bottom: 1.5em;
}

.coup {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.coup summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: bold;
    background-color: #f7f5ef;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.coup summary::-webkit-details-marker {
    display: none;
}

.coup summary::after {
    content: "+";
    font-weight: normal;
    font-size: 1.2em;
    color: #666;
}

.coup[open] summary::after {
    content: "−";
}

.coup summary:hover {
    background-color: #efece2;
}

.coup p {
    padding: 12px 16px;
    margin-bottom: 0 !important;
    color: #444;
}

/* Sous-accordéon imbriqué : plusieurs items distincts au sein d'une même bulle
   (ex : chaque accessoire du joueur, chaque surface pour les chaussures) */
.coup .sous-coup {
    margin: 8px 16px 10px;
    font-size: 0.95em;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 3em;
    border-top: 1px solid #ddd;
    color: #777;
    font-size: 0.85em;
}

.footer-liens a {
    color: #777;
    text-decoration: none;
}

.footer-liens a:hover {
    text-decoration: underline;
}

/* Bouton hamburger (menu mobile) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    position: absolute;
    top: 22px;
    right: 20px;
    padding: 0;
    z-index: 110;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #333;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.ouvert span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.ouvert span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.ouvert span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* En dessous de 700px, la nav devient un menu déroulant */
@media (max-width: 700px) {
    .menu-toggle {
        display: flex;
    }

    nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
    }

    nav ul li {
        flex: none;
    }

    nav ul.ouvert {
        max-height: 400px;
    }

    nav ul li a {
        font-size: 0.95rem;
        text-transform: none;
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }
}