/* ==========================================================================
   Horizonrando — CSS Custom consolidé
   Fichier : css/hr-custom.css (thème enfant)
   Chargé via wp_enqueue_style
   
   Regroupe les ~11 snippets CSS de Code Snippets externalisés.
   ========================================================================== */


/* ==========================================================================
   1. LAYOUT GLOBAL & TYPOGRAPHIE
   ========================================================================== */

/* Largeur des lignes sur le site */
.et_pb_section .et_pb_row {
    width: 92%;
}

@media (min-width: 981px) {
    .et_pb_section .et_pb_row {
        width: 92%;
    }
}

/* Hauteur de l'interligne pour les titres */
h1, h2, h3, h4 {
    line-height: 1.3em;
}

h2 {
    margin-top: 0px;
    margin-bottom: 0px;
}

h3 {
    margin-top: 0px;
    margin-bottom: 0px;
}

.titre-section {
    margin-top: 0.5em;
    margin-bottom: 0.2em;
}

/* Titres spécifiques aux fiches de randonnée */
.titre-rando-h3 {
    font-size: 22px;
}

.titre-rando-h2 {
    font-size: 26px;
}

.liste-fiche-rando li {
    line-height: 1.5em;
}

/* Listes utilitaires */
ul.ul-hr {
    line-height: 1.5em !important;
    margin-top: 7px;
}

ul.ul-mt {
    margin-top: 7px;
}

ul.ul-pb0 {
    line-height: 1.5em !important;
    padding-bottom: 0px;
}

.liste-compact {
    margin-top: -0.2em !important;
    padding-left: 1.8em !important;
    line-height: 1.5em !important;
}

.liste-compact li {
    margin-bottom: 0.4em !important;
}

/* Compensation marge Divi sur dernier <p> */
p:not(.has-background):last-of-type + * {
    margin-top: 0.7em !important;
}

/* FAQ */
.h3-faq {
    margin-top: 15px;
}


/* ==========================================================================
   2. FOND GRIS CLAIR & Z-INDEX
   ========================================================================== */

.et_pb_row.fond-gris-clair {
    position: relative;
    overflow: visible;
}

.et_pb_row.fond-gris-clair::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background-color: #f2f2f2;
    z-index: 0;
}

.et_pb_row.fond-gris-clair > * {
    position: relative;
    z-index: 1;
}

/* Ligne avec z élevé pour l'affichage des tooltip */
.ligne-au-dessus {
    position: relative;
    z-index: 9999;
}


/* ==========================================================================
   3. EFFETS HOVER IMAGES
   ========================================================================== */

.image-hover-transition-douce {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-hover-transition-douce:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.image-hover-opacite {
    transition: opacity 0.3s ease;
}

.image-hover-opacite:hover {
    opacity: 0.8;
}


/* ==========================================================================
   4. INVERSION COLONNES MOBILE
   ========================================================================== */

@media screen and (max-width: 980px) {
    .reverse2 {
        display: flex;
        flex-direction: column-reverse;
    }
}


/* ==========================================================================
   5. FOO GALLERY
   ========================================================================== */

.fg-caption-title {
    display: none !important;
}

.fg-caption:hover .fg-caption-title {
    display: block !important;
}

.fg-preset.fg-preset-small .fg-caption-title {
    font-size: 17px !important;
}

.fg-preset.fg-preset-small .fg-caption-desc {
    font-size: 12px !important;
}

@media screen and (max-width: 480px) {
    .fg-item-inner {
        border-width: 7px !important;
    }
}

@media screen and (min-width: 481px) and (max-width: 920px) {
    .fg-item-inner {
        border-width: 7px !important;
    }
}

@media screen and (min-width: 921px) {
    .fg-item-inner {
        border-width: 14px !important;
    }
}

@media screen and (max-width: 920px) {
    .fg-caption:hover * {
        display: none;
    }

    .foogallery.fg-preset.fg-oscar .fg-caption::before {
        display: none;
    }
}

.fg-media-caption-title,
.fg-media-caption-description {
    text-align: center !important;
}

.fg-media-caption-description a {
    text-decoration: underline !important;
}


/* Force 3 colonnes sur desktop avec gutter 14px horizontale ET verticale */
@media (min-width: 769px) {
    .fg-gutter-width {
        --fg-gutter: 14px;
        width: 14px;
        row-gap: 14px;
    }
    
    /* Force la largeur des colonnes pour avoir 3 colonnes */
    .fg-column-width {
        width: calc((100% - 28px) / 3) !important;
    }
    
   .fg-item {
        width: calc((100% - 28px) / 3) !important;
        margin-bottom: 14px !important;     }
}


/* ==========================================================================
   6. TOOLTIPS
   ========================================================================== */

/* Contenu du tooltip — masqué par défaut */
.tooltip-content {
    display: none;
    position: absolute;
    background-color: #CEF5F7;
    color: #333;
    font-weight: normal;
    text-align: center;
    font-size: 15px;
    padding: 5px;
    border-radius: 8px;
    width: 310px;
    top: 160%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.tooltip-content strong {
    color: #333;
    font-weight: 700;
}

/* Flèche du tooltip */
.tooltip-content::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    top: -16px;
    border-style: solid;
    border-color: transparent transparent #CEF5F7 transparent;
}

/* Déclencheur (cercle ?) */
.tooltip-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    margin-left: 5px;
    width: 17px;
    height: 17px;
    background-color: #69A3BA;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transform: translateY(-2px);
    z-index: 99990;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus,
.tooltip-trigger:active {
    z-index: 99995;
}

/* Affichage au survol/focus */
.tooltip-trigger:hover .tooltip-content,
.tooltip-trigger:focus .tooltip-content,
.tooltip-trigger:active .tooltip-content {
    display: block;
}

/* Variante grand */
.tooltip-trigger--grand {
    margin-left: 5px;
    width: 19px;
    height: 19px;
    font-weight: bold;
    font-size: 15px;
    transform: translateY(-2px);
}

.tooltip-content--grand {
    font-size: 15px;
    padding: 10px;
    width: 450px;
    line-height: 1.4em;
}

/* Variante très grand */
.tooltip-content--tres-grand {
    font-size: 15px;
    padding: 10px;
    width: 600px;
    line-height: 1.4em;
    color: #333;
    font-weight: normal;
}

/* Responsive tooltips */
@media (max-width: 768px) {
    .tooltip-content {
        width: 290px;
        top: 160%;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 480px) {
    .tooltip-content {
        width: 250px;
        top: 160%;
        left: 50%;
        transform: translateX(-50%);
    }

    .tooltip-content--grand {
        width: 300px;
        padding: 5px;
    }

    .tooltip-content--tres-grand {
        width: 300px;
        padding: 5px;
    }

    .tooltip-content--gauche {
        transform: translateX(-50%) translateX(-70px);
    }

    .tooltip-content--gauche::after {
        left: calc(50% + 70px);
    }
}


/* ==========================================================================
   7. LIENS SOULIGNÉS
   ========================================================================== */

.lien-souligne {
    text-decoration: underline;
    word-wrap: break-word;
    text-underline-offset: 2px;
    transition: text-decoration 0.2s ease;
}

.lien-souligne:hover {
    text-decoration: none !important;
}


/* ==========================================================================
   8. ICÔNES
   ========================================================================== */

.icon-HR {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
    margin-right: 4px;
    position: relative;
    top: -0.05em;
}

.icon-titre {
    font-size: 22px;
}

.icon-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 0.8em;
}

.icon-line-titre {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 0.1em;
}

.icon-line .icon {
    flex-shrink: 0;
    width: 1.1em;
    text-align: center;
    font-size: 1.1em;
}

.icon-line-titre .icon {
    flex-shrink: 0;
    width: 1.4em;
    text-align: center;
    font-size: 1.5em;
    transform: translateY(-0.05em);
}

.icon-line-titre .icon-large {
    flex-shrink: 0;
    width: 1.4em;
    text-align: center;
    font-size: 1.7em;
    transform: translateY(-0.05em);
}


/* ==========================================================================
   9. MODULES RANDONNÉE (proximité, aléatoire, récentes)
   ========================================================================== */

/* Conteneur global */
.randos-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    padding: 0px;
}

/* Module individuel (lien <a>) */
.rando-module {
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    background-color: #f5f5f5;
    border: 15px solid white;
    box-shadow: 0 0 0 1px #cccccc;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: calc((100% - (3 * 35px)) / 4);
    min-width: 120px;
    box-sizing: border-box;
}

.rando-module:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

/* Conteneur interne */
.rando-module-container {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Image */
.rando-module-image {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
}

/* Titre */
.rando-module-titre {
    font-size: 1.4em;
    margin-top: 14px;
    margin-bottom: 0px;
    padding-left: 8px;
    padding-right: 8px;
    color: #05668d;
    text-decoration: underline;
    text-underline-offset: 2px;
    line-height: 1.3;
    text-align: center;
    width: 100%;
}

/* Détails (liste UL) */
.rando-module-details {
    list-style-type: none !important;
    padding-top: 0px;
    padding-bottom: 10px !important;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 1.1em;
    box-sizing: border-box;
    transform: translateX(-5px);
    max-width: 100%;
}

.rando-module-details li {
    margin-bottom: 2px;
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rando-module-details li strong {
    font-weight: bold;
    color: #444;
}

/* Tablettes et mobiles (2 par ligne, max 4 visibles) */
@media (max-width: 1023px) and (min-width: 300px) {
    .randos-wrapper {
        gap: 7px;
    }

    .rando-module {
        flex-basis: calc((100% - 20px) / 2);
        border: 8px solid white;
    }

    .rando-module-titre {
        font-size: 1.3em;
    }

    .rando-module-details {
        font-size: 0.9em;
    }

    .rando-module-details li {
        margin-bottom: 4px;
        line-height: 1.4;
    }

    .homepage-randos-aleatoires-wrapper .rando-module:nth-child(n+5),
    .randos-country-aleatoire-wrapper .rando-module:nth-child(n+5) {
        display: none;
    }

    .randos-aleatoires-wrapper .module-rando-aleatoire-link:nth-child(n+5) {
        display: none;
    }
}

/* Petits mobiles (1 par ligne) */
@media (max-width: 299px) {
    .randos-wrapper {
        gap: 6px;
    }

    .rando-module {
        flex-basis: 100%;
        border: 6px solid white;
    }

    .rando-module-titre {
        font-size: 1.3em;
    }

    .rando-module-details {
        width: auto;
        padding-left: 10px;
        padding-right: 10px;
        text-align: left;
        transform: translateX(0);
        font-size: 0.9em;
    }

    .rando-module-details li {
        text-align: left;
        white-space: normal;
        overflow-wrap: break-word;
    }

    .homepage-randos-aleatoires-wrapper .rando-module:nth-child(n+5),
    .randos-country-aleatoire-wrapper .rando-module:nth-child(n+5) {
        display: none;
    }

    .randos-aleatoires-wrapper .module-rando-aleatoire-link:nth-child(n+5) {
        display: none;
    }
}

/* Bureau — layouts spécifiques par section */
@media (min-width: 1024px) {

    /* 1 ligne de 3 — Proximité */
    .randos-proximite-wrapper .module-rando-proximite-link {
        flex-basis: calc((100% - (2 * 35px)) / 3);
    }

    .randos-proximite-wrapper .module-rando-proximite-link:nth-child(n+4) {
        display: none;
    }

    /* 1 ligne de 3 — Aléatoire (pages rando) */
    .randos-aleatoires-wrapper .module-rando-aleatoire-link {
        flex-basis: calc((100% - (2 * 35px)) / 3);
    }

    /* 1 ligne de 3 — Récentes configurées (homepage) */
    .homepage-randos-recentes-wrapper .rando-module {
        flex-basis: calc((100% - (2 * 35px)) / 3);
    }

    .homepage-randos-recentes-wrapper .rando-module:nth-child(n+4) {
        display: none;
    }

    /* 2 lignes de 3 — Aléatoire tous pays (homepage + pages pays) */
    .homepage-randos-aleatoires-wrapper .rando-module,
    .randos-country-aleatoire-wrapper .rando-module {
        flex-basis: calc((100% - (2 * 35px)) / 3);
    }

    .homepage-randos-aleatoires-wrapper .rando-module:nth-child(n+7),
    .randos-country-aleatoire-wrapper .rando-module:nth-child(n+7) {
        display: none;
    }
}


/* ==========================================================================
   11. FIX DÉBORDEMENT HORIZONTAL MOBILE
   ========================================================================== */

html, body {
    overflow-x: hidden;
}

.hr-mobile-menu-overlay {
    max-width: 100vw;
    overflow: hidden;
}

.leaflet-container {
    max-width: 100% !important;
    box-sizing: border-box;
}