/*
 * Pages publiques : accessibilité sur tous les formats (téléphone, paysage, tablette, ordinateur).
 * Chargée en dernier par base_public.html.twig, elle corrige les feuilles plus anciennes.
 */

/* main_27_01.css fixe html/body à height: 100% : sur mobile, le défilement se fait alors dans body et non
   dans la page, la barre d'adresse ne se replie plus correctement et peut recouvrir le haut de la page. */
html,
body {
    height: auto;
    min-height: 100%;
}

body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Bandeau ------------------------------------------------------------------------------------ */

.entete-public {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1030; /* au-dessus du carrousel et de tout contenu de page */
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    padding-top: env(safe-area-inset-top);
}

.entete-public__nav {
    flex-wrap: wrap;
    padding: .5rem max(1rem, env(safe-area-inset-right)) .5rem max(1rem, env(safe-area-inset-left));
}

.entete-public__logo {
    margin-right: .5rem;
    padding: 0;
}

.entete-public__logo img {
    display: block;
    width: auto;
    height: 40px;
}

.entete-public__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

.btn-entete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 1rem;
    border: 2px solid var(--main, #50aa99);
    border-radius: 6px;
    background: #ffffff;
    color: var(--main, #50aa99);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.btn-entete--plein {
    background: var(--main, #50aa99);
    color: #ffffff;
}

.btn-entete--plein:hover,
.btn-entete--plein:focus {
    background: #3f8a7c;
    border-color: #3f8a7c;
    color: #ffffff;
    text-decoration: none;
}

.btn-entete--danger {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-entete--danger:hover,
.btn-entete--danger:focus {
    background: #dc3545;
    color: #ffffff;
    text-decoration: none;
}

.entete-public__menu {
    min-width: 44px;
    min-height: 44px;
    padding: .25rem .5rem;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 6px;
}

.entete-public__lien {
    display: block;
    padding: .75rem 1rem !important;
    color: var(--main, #50aa99) !important;
    font-size: 1.125rem;
    font-family: "Nunito Sans", Arial, sans-serif;
}

.entete-public__lien.active {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.entete-public__lien--danger {
    color: #dc3545 !important;
}

.entete-public a:focus-visible,
.entete-public button:focus-visible {
    outline: 3px solid #1e5f53;
    outline-offset: 2px;
}

/* Menu déplié sur mobile : liste pleine largeur, séparée du bandeau */
@media (max-width: 991.98px) {
    #menu-public {
        flex-basis: 100%;
    }

    #menu-public .navbar-nav {
        margin-top: .5rem;
        border-top: 1px solid rgba(0, 0, 0, .08);
    }
}

/* Très petits écrans (iPhone SE, anciens Android) : logo et bouton resserrés pour tenir sur une ligne */
@media (max-width: 359.98px) {
    .entete-public__logo img {
        height: 34px;
    }

    .btn-entete {
        padding: 0 .75rem;
    }
}

@media (min-width: 992px) {
    .entete-public__logo img {
        height: 52px;
    }
}

/* --- Contenu ------------------------------------------------------------------------------------ */

/* Les sections « row » sans conteneur gardaient les marges négatives de Bootstrap (-15 px) : la page
   défilait horizontalement sur mobile. */
section.row,
.padding-public.row {
    margin-left: 0;
    margin-right: 0;
}

.padding-public {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
}

@media (min-width: 576px) {
    .padding-public {
        padding-left: 40px;
        padding-right: 40px;
    }
}

@media (min-width: 992px) {
    .padding-public {
        padding-left: 100px;
        padding-right: 100px;
    }
}

@media (min-width: 1400px) {
    .padding-public {
        padding-left: 170px;
        padding-right: 170px;
    }
}

/* Titres longs : retour à la ligne plutôt que débordement */
h1, h2, h3, h4, h5 {
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    h2 {
        font-size: 1.6rem;
        padding: 32px 0 16px;
    }
}

/* Carrousel : sur téléphone, la légende passe sous l'image au lieu de déborder sur le bandeau */
.carousel-caption {
    z-index: 1;
}

@media (max-width: 767.98px) {
    .carousel-caption {
        position: static;
        padding: .75rem 1rem;
    }

    .carousel-caption h5 {
        font-size: 1.1rem;
    }

    .carousel-control-prev,
    .carousel-control-next {
        display: none;
    }
}

/* Pied de page : liens sur plusieurs lignes, zones tactiles confortables */
footer .lien-footer {
    display: inline-block;
    padding: .5rem 0;
}

footer .sub-footer {
    padding-left: 16px;
    padding-right: 16px;
}

