/* === Counter Section === */

.counter-section {
    background-color: var(--black);
    padding-top: 0em;
    padding-bottom: 2em;
    color: var(--white);
}

.counter-grid {
    display: grid;
    grid-template-columns: 50% 1fr 1fr;
    align-items: flex-start;
}

.counter-item {
    display: flex;
    flex-direction: column;
    position: relative; /* Added for globe positioning */
}

/* Alignement spécifique et précis pour chaque colonne */
.counter-item:nth-child(1) {
    align-items: flex-start;
    text-align: left;
}
.counter-item:nth-child(2) {
    align-items: flex-start;
    text-align: left;
}
.counter-item:nth-child(3) {
    align-items: flex-start;
    text-align: left;
}


/* Wrapper pour les chiffres et les caractères statiques */
.counter-value-wrapper {
    font-family: 'Arc_Typ', 'RMNeue-Regular', sans-serif;
    font-size: clamp(4rem, 10vw, 11rem);
    line-height: 1.1;
    font-weight: 400;
    display: flex;
    /* justify-content est géré par l'alignement du parent .counter-item */
    align-items: flex-start;
    height: 1.1em;
    overflow: hidden;
    position: relative; /* Ensure it stays above globe */
    z-index: 2;
}

/* Style pour la police Gridular */
.gridular-font {
    font-family: 'Gridular', sans-serif;
}

/* Structure inspirée du code fourni */
.counter-value-fallback {
  display: block;
  white-space: nowrap;
}

/* Progressive enhancement: la valeur finale reste visible si le JS, GSAP,
   la police ou le déclencheur d'animation échoue. */
.counter-value-wrapper > .loading__numbers,
.counter-value-wrapper > .static-char {
  display: none;
}

.counter-item.is-counter-animating .counter-value-fallback {
  display: none;
}

.counter-item.is-counter-animating .loading__numbers {
  display: flex;
}

.counter-item.is-counter-animating .static-char {
  display: block;
}

.loading__number-group {
  height: 1em;
  display: flex;
  position: relative;
  overflow: hidden;
}

.loading__number-wrap {
  will-change: transform;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
}

.loading__number-wrap span, .static-char {
    display: block;
    line-height: 1.1;
}

/* --- Styles du bas de la section --- */

.counter-description {
    font-family: 'RMNeue-Regular', sans-serif;
    font-size: 1.8rem;
    color: var(--white);
    margin-top: 0.75rem;
    text-align: left;
    max-width: 18rem;
    font-weight: 600;
    position: relative; /* Ensure it stays above globe */
    z-index: 2;
}

.counter-footer {
    text-align: left; /* On aligne le footer à gauche */
}

.counter-divider {
    border: none;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.12);
    margin-bottom: 2rem;
}

.counter-footnote {
    font-family: 'RMNeue-Regular', sans-serif;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0.5rem 0;
}

.counter-footnote span {
    margin-right: 0.5rem;
}

/* Globe Icon Container */
.counter-globe-container {
    position: absolute;
    top: -5%;
    left: 33%;
    width: 150px;
    height: 150px;
    z-index: 1;
    pointer-events: none;
}

/* Digital Ball Globe */
.digital-ball {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Styles scopés sous .counter-globe-container pour éviter le conflit
   avec le nouveau globe Mapbox qui utilise aussi .globe-wrap */
.counter-globe-container .globe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8em;
    height: 8em;
    transform: translate(-50%, -50%);
    will-change: transform;
    border-radius: 50%;
    overflow: hidden;
}

.counter-globe-container .globe-wrap {
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    position: absolute;
    display: block;
    transform: translate(-50%, -50%) rotate(30deg);
    box-shadow: inset 0px 0px 0px 0.1em var(--orange-primary);
    border-radius: 50%;
    animation: globe 5.4s cubic-bezier(0.35, 0, 0.65, 1) infinite;
    overflow: hidden;
    opacity: 0.5;
}

/* Cercles verticaux animés */
.counter-globe-container .globe .circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0.08em 0px 0px 0.06em var(--orange-primary);
    font-size: 0.75em;
    border-radius: 50%;
    animation: circle1 2.7s linear infinite;
}

.counter-globe-container .globe .circle:nth-child(1) {
    animation-delay: -1.8s;
}

.counter-globe-container .globe .circle:nth-child(2) {
    animation-delay: -0.9s;
}

.counter-globe-container .globe .circle:nth-child(3) {
    animation-delay: 0s;
}

/* Cercle horizontal (ellipse) */
.counter-globe-container .globe .circle-hor {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 55%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0px 0px 0px 0.1em var(--orange-primary);
    font-size: 0.75em;
    border-radius: 50%;
}

/* Ligne horizontale du milieu */
.counter-globe-container .globe .circle-hor-middle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 0.1em;
    transform: translate(-50%, -50%);
    font-size: 0.75em;
    border-radius: 0%;
    background: var(--orange-primary);
}

/* Animation du globe (rotation douce) */
@keyframes globe {
    0% {
        transform: translate(-50%, -50%) rotate(15deg);
    }
    50% {
        transform: translate(-50%, -50%) rotate(-15deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(15deg);
    }
}

/* Animation des cercles verticaux */
@keyframes circle1 {
    0% {
        box-shadow: inset 0.08em 0px 0px 0.06em var(--orange-primary);
        width: 100%;
        border-radius: 50%;
    }
    49% {
        box-shadow: inset 0.08em 0px 0px 0.06em var(--orange-primary);
        border-radius: 50%;
        background: transparent;
    }
    50% {
        width: 0.12em;
        border-radius: 0%;
        background: var(--orange-primary);
    }
    51% {
        box-shadow: inset -0.08em 0px 0px 0.06em var(--orange-primary);
        border-radius: 50%;
        background: transparent;
    }
    100% {
        box-shadow: inset -0.08em 0px 0px 0.06em var(--orange-primary);
        width: 100%;
        border-radius: 50%;
    }
}

/* Override previous globe bg styles if any remain or conflict */
.counter-globe-bg {
    display: none;
}

/* PC portable uniquement (769px à 1366px) */
@media (min-width: 769px) and (max-width: 1366px) {
    .counter-section.section {
        border-top: none;
        border-bottom: none;
    }
}

/* =============================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================= */
@media (max-width: 768px) {
    .counter-section {
        padding-top: 3em;
        padding-bottom: 2em;
    }

    .counter-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .counter-value-wrapper {
        font-size: clamp(2.6rem, 14vw, 5rem);
    }

    .counter-description {
        font-size: 1rem;
        max-width: 100%;
    }

    /* Le globe se replace au-dessus du premier counter, pas en overlay */
    .counter-globe-container {
        position: relative;
        top: auto;
        left: auto;
        width: 110px;
        height: 110px;
        margin-bottom: 1rem;
    }
}

/* =============================================
   PAGES PILIERS SEO UNIQUEMENT (page-stand-seo)
   Pas la home, pas les pages villes.
   ============================================= */
@media (min-width: 769px) {
    .page-stand-seo .counter-section {
        padding-top: 9.6em;
    }
}
