/* ==========================================================
   Haine-Saint-Bière — feuille de style
   Ordre : base > composants > popups > responsive (en dernier)
   ========================================================== */

/* ---------- Base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    background: #f5f5f5;
    color: #333;
}

/* Empêche le défilement de la page quand un popup est ouvert */
body.bloque {
    overflow: hidden;
}

h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #b8860b;
}

section {
    padding: 70px 10%;
}

button {
    padding: 15px 35px;
    font-size: 18px;
    border: none;
    background: #d4a017;
    color: white;
    cursor: pointer;
    border-radius: 30px;
    transition: .3s;
}

button:hover {
    background: #b8860b;
}

/* ---------- En-tête ---------- */
header {
    height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, .6)),
                url("image/HSBtrio.jpg");
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

header h1 {
    font-size: 70px;
}

header p {
    font-size: 24px;
    margin: 20px;
}

/* ---------- Navigation ---------- */
nav {
    background: #222;
    position: sticky;
    top: 0;
    z-index: 10;
}

nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
}

nav li {
    padding: 20px;
}

nav a {
    color: white;
    text-decoration: none;
}

/* ---------- Cartes ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    align-items: start;
}

.cards1 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    align-items: start;
}

.card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .15);
    transition: .3s;
    width: 100%;
}

.card:hover {
    transform: translateY(-10px);
}

/* Cartes de bières : cliquables et utilisables au clavier */
.card[data-nom] {
    cursor: pointer;
}

.card:focus-visible,
.close:focus-visible,
.lien-discret:focus-visible,
button:focus-visible {
    outline: 3px solid #d4a017;
    outline-offset: 2px;
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    display: block;
}

.card h3 {
    padding: 15px;
    text-align: center;
}

.card p {
    padding: 0 15px 20px;
}

.card .adresse {
    text-align: center;
}

/* ---------- Recherche de partenaires par distance ---------- */
.proximite {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .15);
    max-width: 800px;
    margin: 0 auto 30px;
}

.proximite h3 {
    text-align: center;
    color: #b8860b;
    margin-bottom: 15px;
}

.proximite-champs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.proximite .champ {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 260px;
}

.proximite .champ.petit {
    flex: 0 1 140px;
}

.proximite label {
    font-weight: bold;
    font-size: 14px;
}

.proximite input,
.proximite select {
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: white;
    width: 100%;
}

.proximite .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

.proximite .actions button {
    margin: 0;
}

.proximite button:disabled,
.proximite input:disabled,
.proximite select:disabled {
    opacity: .6;
    cursor: wait;
}

.proximite .note {
    font-size: 13px;
    color: #666;
    margin-top: 12px;
    text-align: center;
}

button.secondaire {
    background: #555;
}

button.secondaire:hover {
    background: #333;
}

#resultat-proximite {
    scroll-margin-top: 80px; /* sous le menu collant */
    text-align: center;
    font-weight: bold;
    margin: 0 auto 20px;
    max-width: 800px;
}

#resultat-proximite.erreur {
    color: #b00020;
}

/* isolation : les calques de la carte ne passent pas par-dessus le menu */
#carte-partenaires {
    height: 420px;
    max-width: 1000px;
    margin: 0 auto 20px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .15);
    position: relative;
    z-index: 0;
    isolation: isolate;
}

#liste-proximite:empty {
    display: none;
}

#liste-proximite {
    max-width: 1100px;
    margin: 0 auto;
}

.pin {
    font-size: 28px;
    line-height: 32px;
    text-align: center;
    background: none;
    border: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}

/* Outil de calcul des coordonnées (index.html?coordonnees) */
.outil-coordonnees {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: white;
    padding: 20px;
    overflow: auto;
}

.outil-coordonnees h2 {
    margin-bottom: 15px;
}

.outil-coordonnees p {
    margin-bottom: 12px;
}

.outil-coordonnees textarea {
    width: 100%;
    font-family: monospace;
    font-size: 13px;
}

/* ---------- Sections ---------- */
#about {
    background: white;
    line-height: 1.8;
    text-align: center;
}

#about img {
    max-width: 100%;
}

#contact .infos {
    text-align: center;
    font-size: 20px;
}

#contact .infos a {
    color: inherit;
}

.reseau {
    width: 50px;
}

footer {
    background: #222;
    color: white;
    text-align: center;
    padding: 30px;
}

footer p + p {
    margin-top: 10px;
}

/* Bouton qui ressemble à un lien (mentions légales) */
.lien-discret {
    padding: 0;
    width: auto;
    max-width: none;
    background: none;
    color: white;
    font-size: inherit;
    text-decoration: underline;
    border-radius: 0;
}

.lien-discret:hover {
    background: none;
    color: #d4a017;
}

/* Message affiché si la personne refuse la vérification d'âge */
.acces-refuse {
    text-align: center;
    margin-top: 100px;
    color: #333;
}

/* ---------- Popup de vérification d'âge ---------- */
#age-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup {
    background: white;
    padding: 40px;
    text-align: center;
    border-radius: 10px;
    width: 350px;
    max-width: 90%;
}

.popup h2 {
    color: #333;
}

.popup button {
    margin: 10px;
}

/* ---------- Popups de détail (bières, mentions légales) ---------- */
.popup1 {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.popup1-content {
    background: white;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 12px;
    position: relative;
}

.popup1-content p + p {
    margin-top: 10px;
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 30px;
    cursor: pointer;
}

.popup1-content h2 {
    margin-bottom: 20px;
    color: #b8860b;
}

/* ==========================================================
   Responsive — doit rester EN DERNIER pour l'emporter sur la base
   (ordre : du plus grand au plus petit écran)
   ========================================================== */

@media screen and (max-width: 1024px) {

    header h1 {
        font-size: 55px;
    }

    section {
        padding: 60px 5%;
    }

    .cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .cards1 {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

}

@media screen and (max-width: 768px) {

    header {
        height: 80vh;
    }

    header h1 {
        font-size: 38px;
    }

    header p {
        font-size: 18px;
        padding: 0 20px;
    }

    button {
        width: 90%;
        max-width: 300px;
    }

    section {
        padding: 40px 20px;
    }

    .cards,
    .cards1 {
        grid-template-columns: 1fr;
    }

    .card {
        max-width: 400px;
        margin: auto;
    }

    .card img {
        height: 220px;
    }

    h2 {
        font-size: 30px;
    }

    p {
        font-size: 16px;
        line-height: 1.6;
    }

    .popup1-content {
        width: 95%;
        padding: 20px;
    }

    #carte-partenaires {
        height: 340px;
    }

    .proximite {
        padding: 18px;
    }

    #contact .infos {
        font-size: 16px;
    }

    #contact img,
    .reseau {
        width: 40px;
        margin: 5px;
    }

    footer {
        font-size: 14px;
        padding: 20px;
    }
}

@media screen and (max-width: 600px) {

    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0;
        margin: 0;
    }

    nav li {
        padding: 6px 8px;
    }

    nav a {
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {

    header h1 {
        font-size: 30px;
    }

    header p {
        font-size: 16px;
    }

    h2 {
        font-size: 26px;
    }

    .card img {
        height: 180px;
    }

    .popup1-content {
        width: 98%;
        padding: 15px;
    }
}

/* Respecte le réglage « réduire les animations » du système */
@media (prefers-reduced-motion: reduce) {

    .card,
    button {
        transition: none;
    }

    .card:hover {
        transform: none;
    }
}
