/* ═══════════════════════════════════════════════════════════════════════════
   Page d'accueil : trois blocs ajoutés sous le hero.

   1. Les chiffres du serveur, tirés de l'API : une promesse chiffrée vaut
      mieux qu'un paragraphe qui dit « communauté active ».
   2. Ce qui se passe maintenant : la dernière une, le concours en cours, les
      anniversaires du jour. C'est ce qui donne envie de revenir.
   3. Les premiers pas, numérotés : un visiteur sait quoi faire en arrivant.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Padding bas indispensable : sans lui, la dernière carte d'une section
   touchait le titre de la suivante : « Tes premiers pas » collait à
   « Notre Communauté ». */
.ac-section {
    padding: 4rem 5% 4.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.ac-section.large { max-width: 1400px; }

.ac-tete { text-align: center; margin-bottom: 2.25rem; }

.ac-tete h2 {
    /* Titres de section volontairement plus present : c'est ce qui decoupe la
       page quand on la parcourt de haut en bas. */
    font-size: clamp(1.9rem, 3.8vw, 2.8rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ac-tete h2 .material-symbols-outlined { color: var(--primary-color); font-size: 2.3rem; }
.ac-tete p { color: var(--text-secondary); margin-top: 0.8rem; max-width: 58ch;
             margin-inline: auto; line-height: 1.65; font-size: 1.02rem; }
/* Une tete sans sous-titre ne doit pas laisser un blanc sous le titre. */
.ac-tete p:empty { display: none; }

/* ── 1. Chiffres ── */
.ac-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }

.ac-chiffre {
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.5rem 1.2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Un liseré coloré en haut : les cartes se distinguent sans multiplier les
   fonds teintés, qui alourdiraient la page. */
.ac-chiffre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

.ac-chiffre-ic {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    margin: 0 auto 0.7rem;
    background: rgba(99, 102, 241, 0.14);
    color: var(--primary-color);
}

.ac-chiffre-ic.or   { background: rgba(241, 196, 15, 0.14); color: #f1c40f; }
.ac-chiffre-ic.vert { background: rgba(34, 197, 94, 0.14); color: #22c55e; }
.ac-chiffre-ic.bleu { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }

.ac-chiffre-val {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 900;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.ac-chiffre-lbl {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.ac-chiffre-sous { font-size: 0.72rem; color: var(--text-secondary); opacity: 0.7; margin-top: 0.2rem; }

/* ── 2. En ce moment ── */
.ac-actu { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.1rem; align-items: start; }

.ac-carte {
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ac-carte:hover { transform: translateY(-4px); border-color: var(--primary-color); }

.ac-carte-tete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.2rem 0;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.ac-carte-tete .material-symbols-outlined { font-size: 1.05rem; color: var(--primary-color); }

/* La une du journal a droit à sa photo : c'est elle qui donne envie de lire. */
.ac-une-photo {
    height: 168px;
    margin: 0.9rem 0 0;
    background-size: cover;
    background-position: center;
    background-color: var(--background-card);
}

.ac-carte-corps { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.ac-carte-titre { font-size: 1.05rem; font-weight: 800; line-height: 1.35; }

.ac-carte-texte {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ac-carte-pied {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.8rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.ac-avatars { display: flex; }
.ac-avatars img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--background-secondary);
    background: var(--background-card);
}
.ac-avatars img + img { margin-left: -10px; }

.ac-etat-vide {
    padding: 2rem 1.2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.6;
}

.ac-etat-vide .material-symbols-outlined { font-size: 2rem; opacity: 0.45; display: block; margin-bottom: 0.5rem; }

.ac-puce-vive {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    margin-left: auto;
}

/* ── 3. Premiers pas ── */
.ac-etapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; counter-reset: etape; }

.ac-etape {
    position: relative;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.5rem 1.3rem 1.3rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.ac-etape:hover { transform: translateY(-4px); border-color: var(--primary-color); }

.ac-etape-num {
    position: absolute;
    top: -14px;
    left: 1.3rem;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 0.92rem;
    color: #fff;
    background: var(--gradient-primary);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.ac-etape h3 { font-size: 1rem; font-weight: 800; margin-top: 0.5rem; }
.ac-etape p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; flex: 1; }

.ac-etape-lien {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.4rem;
}

.ac-etape-lien .material-symbols-outlined { font-size: 1rem; }

.ac-sk {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%,
                rgba(255, 255, 255, 0.10) 37%, rgba(255, 255, 255, 0.04) 63%);
    background-size: 400% 100%;
    animation: acShim 1.4s ease infinite;
    border-radius: 8px;
}

@keyframes acShim { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── Avis des membres ──
   Deux rubans qui défilent en sens inverse : on lit sans cliquer, et la page
   respire au lieu d'aligner trente cartes. */
.ac-avis-tete { text-align: center; margin-bottom: 2rem; }

.ac-note-moyenne {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ac-etoiles { font-size: 1.35rem; color: #f1c40f; letter-spacing: 2px; }
.ac-note-txt { font-size: 0.9rem; color: var(--text-secondary); }
.ac-note-txt strong { color: var(--text-primary); font-weight: 800; }

.ac-rubans { position: relative; overflow: hidden; padding: 0.5rem 0; }

/* Les bords s'estompent : les cartes entrent et sortent sans coupure nette. */
.ac-rubans::before,
.ac-rubans::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: clamp(60px, 12vw, 180px);
    z-index: 2;
    pointer-events: none;
}

.ac-rubans::before { left: 0;  background: linear-gradient(to right, var(--background-primary), transparent); }
.ac-rubans::after  { right: 0; background: linear-gradient(to left,  var(--background-primary), transparent); }

.ac-ruban { display: flex; gap: 1rem; width: max-content; padding: 0.4rem 0; }
/* Durée par défaut si le script n'a pas encore calculé la vraie vitesse
   (nombre de cartes réelles) ; JS la réécrit toujours ensuite. */
.ac-ruban.gauche { animation: acDefileG 26s linear infinite; }
.ac-ruban.droite { animation: acDefileD 30s linear infinite; margin-top: 1rem; }

/* Survoler n'importe où dans le carrousel arrête LES DEUX rubans : on ne peut
   pas lire un avis qui fuit, et arrêter seulement celui qu'on touche laissait
   l'autre filer sous les yeux. */
.ac-rubans:hover .ac-ruban { animation-play-state: paused; }

@keyframes acDefileG { from { transform: translateX(0); }    to { transform: translateX(-50%); } }
@keyframes acDefileD { from { transform: translateX(-50%); } to { transform: translateX(0); } }

/* Peu d'avis réels (< SEUIL_DEFILEMENT côté script) : une grille fixe plutôt
   qu'un ruban qui devrait répéter les deux ou trois avis qu'on a vraiment
   pour donner l'illusion d'un flux. Pas de fondu sur les bords : rien ne
   défile, il n'y a rien à masquer. */
.ac-rubans.statique { overflow: visible; }
.ac-rubans.statique::before,
.ac-rubans.statique::after { display: none; }
.ac-rubans.statique .ac-ruban {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.ac-avis {
    width: 300px;
    flex-shrink: 0;
    padding: 1.1rem 1.2rem;
    border-radius: 16px;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    text-align: left;
    transition: border-color 0.25s ease;
}

.ac-avis:hover { border-color: var(--primary-color); }
.ac-avis-etoiles { font-size: 0.9rem; color: #f1c40f; letter-spacing: 2px; margin-bottom: 0.6rem; }

.ac-avis-texte {
    font-size: 0.87rem;
    color: var(--text-primary);
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ac-avis-pied { display: flex; align-items: center; gap: 0.55rem; margin-top: 0.9rem; }

.ac-avis-pied img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--background-card);
}

.ac-avis-nom {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Apparition au défilement ──
   Les blocs montent en fondu quand ils entrent dans l'écran. Le repli est
   l'état VISIBLE : sans JavaScript, ou si l'observateur ne se déclenche pas,
   la page reste lisible : l'inverse cacherait tout le contenu. */
.reveal {
    opacity: 0;
    transform: translateY(38px);
    transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal.gauche { transform: translateX(-60px); }
.reveal.droite { transform: translateX(60px); }
.reveal.visible { opacity: 1; transform: none; }

/* Décalage en cascade des enfants d'une grille : les cartes arrivent l'une
   après l'autre au lieu de surgir d'un bloc. */
.reveal-suite > * {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal-suite.visible > * { opacity: 1; transform: none; }
.reveal-suite.visible > :nth-child(1) { transition-delay: 0.05s; }
.reveal-suite.visible > :nth-child(2) { transition-delay: 0.13s; }
.reveal-suite.visible > :nth-child(3) { transition-delay: 0.21s; }
.reveal-suite.visible > :nth-child(4) { transition-delay: 0.29s; }
.reveal-suite.visible > :nth-child(5) { transition-delay: 0.37s; }
.reveal-suite.visible > :nth-child(n+6) { transition-delay: 0.45s; }

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-suite > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .ac-ruban { animation: none !important; }
}

@media (max-width: 900px) {
    .ac-etapes { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
    .ac-section { padding-top: 3rem; }
    .ac-avis { width: 260px; }
    .ac-etapes { grid-template-columns: 1fr; }
}

/* ── Nous rejoindre ── */
.join-points {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem 1.4rem;
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
}

.join-points li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.join-points .material-symbols-outlined { font-size: 1.15rem; color: var(--primary-color); }

.join-note {
    margin-top: 1.1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.85;
}

.ac-avis-grade {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.16);
    color: #c4b5fd;
    white-space: nowrap;
}

.ac-avis-appel {
    text-align: center;
    margin-top: 1.6rem;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.ac-avis-appel:empty { display: none; }
.ac-avis-appel strong { color: var(--primary-color); font-weight: 800; }

.ac-avis-vide {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
